VmpAllocateMemoryRanges

CHAR *__stdcall VmpAllocateMemoryRanges(UINT64 a1){
  CHAR *v2; 
  VOID **PoolWithTag; 
  VOID **v4; 
  VOID **v5; 
  UINT64 v6; 
  VOID **v7; 
  VOID **v8; 
  VOID ***v9; 

  v2 = 0i64;
  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x38ui64, 1918266710i64);
  v4 = PoolWithTag;
  if( PoolWithTag )
  {
    v5 = PoolWithTag + 5;
    *(_OWORD *)PoolWithTag = 0i64;
    v6 = 0i64;
    *((_OWORD *)PoolWithTag + 1) = 0i64;
    *((_OWORD *)PoolWithTag + 2) = 0i64;
    PoolWithTag[6] = 0i64;
    PoolWithTag[2] = (VOID *)-1i64;
    PoolWithTag[6] = PoolWithTag + 5;
    PoolWithTag[5] = PoolWithTag + 5;
    if( a1 )
    {
      while( 1 )
      {
        v7 = ExAllocatePoolWithTag(0x200ui64, 0x40ui64, 1917283670i64);
        v8 = v7;
        if( !v7 )
          break;
        memset(v7, 0i64, 0x40u);
        v8[5] = (VOID *)-1i64;
        v8[2] = v4;
        v9 = (VOID ***)v4[6];
        if( *v9 != v5 )
          __fastfail(3u);
        *v8 = v5;
        ++v6;
        v8[1] = v9;
        *v9 = v8;
        v4[6] = v8;
        if( v6 >= a1 )
          goto LABEL_6;
      }
    }
    else
    {
LABEL_6:
      v2 = (CHAR *)v4;
      v4 = 0i64;
    }
    if( v4 )
      VmpFreeMemoryRanges(v4);
  }
  return v2;
}

Referenced by:

VmCreateMemoryRange
VmPreallocateForRangeCreate
VmpSplitMemoryRange