ExpSaBinaryArrayInsert

__int64 __fastcall ExpSaBinaryArrayInsert(_QWORD **a1, __int64 a2, unsigned __int16 a3){
  unsigned int v3; 
  unsigned int v6; 
  _QWORD *v7; 
  unsigned int v8; 
  UINT64 v9; 
  _QWORD *PoolWithTagFromNode; 
  __int64 v11; 
  __int64 i; 
  unsigned int v13; 
  INT64 v15; 
  v3 = a3;
  v6 = 0;
  while( 1 )
  {
    v7 = *a1;
    v8 = 1 << (v6 + 2);
    if( !*a1 )
    {
      LODWORD(v15) = 0;
      v9 = v3;
      LODWORD(v9) = v3 | 0x80000000;
      PoolWithTagFromNode = ExpAllocatePoolWithTagFromNode(0x200ui64, 8 * v8 + 8, 0x61537845ui64, v9, v15);
      v7 = PoolWithTagFromNode;
      if( PoolWithTagFromNode )
        memset((INT64)PoolWithTagFromNode, 0i64);
      if( !v7 )
        return(unsigned int)-1;
      *a1 = v7;
    }
    v11 = *v7;
    if( *v7 < (unsigned __int64)v8 )
      break;
    ++v6;
    ++a1;
    if( v6 >= 0x10 )
      return(unsigned int)-1;
  }
  for( i = (unsigned int)v11; v7[i + 1]; i = (v8 - 1) & ((_DWORD)i + 1) )
    ;
  v13 = i | v8;
  *v7 = v11 + 1;
  v7[i + 1] = a2;
  return v13;
}

Referenced by:

ExpSaPageGroupDescriptorAllocate