MiSplitPfnBitMaps

INT64 __fastcall MiSplitPfnBitMaps(UINT64 *a1, UINT64 a2, INT64 a3){
  __int64 *v4; 
  unsigned int i; 
  unsigned __int64 v8; 
  UINT64 *v9; 
  UINT64 v10; 
  UINT64 v11; 
  UINT64 v12; 
  v4 = MiLargePageSizes;
  for( i = 0; i < 3; ++i )
  {
    if( i >= 2 )
    {
      if( a1 != &MiSystemPartition )
        goto LABEL_7;
      v9 = a1 + 768;
      v8 = 512i64;
    }
    else
    {
      v8 = *v4;
      v9 = &a1[2 * i + 633];
    }
    v10 = ((v8 + a2 + a3 - 1) & ~(v8 - 1)) / v8;
    if( !(unsigned int)MiSplitBitmapPages(
                          9i64,
                          (VOID *)(v9[1] + ((a2 / v8) >> 3)),
                          8 * (((v10 + 7) >> 3) - ((a2 / v8) >> 3))) )
      return 0i64;
    if( v10 > *v9 )
      *v9 = v10;
LABEL_7:
    ++v4;
  }
  if( (unsigned int)MiSplitBitmapPages(9i64, (VOID *)(a1[638] + (a2 >> 9)), 8 * (((a2 + a3 + 511) >> 9) - (a2 >> 9))) )
  {
    v11 = (a2 + a3 + 0x3FFFF) >> 18;
    v12 = a2 >> 18;
    if( (unsigned int)MiSplitBitmapPages(9i64, (VOID *)(a1[640] + (v12 >> 3)), 8 * (((v11 + 7) >> 3) - (v12 >> 3))) )
    {
      if( v11 > a1[639] )
        a1[639] = v11;
      if( (unsigned int)MiSplitBitmapPages(9i64, (VOID *)(a1[641] + 2 * v12), 8 * (2 * v11 - 2 * v12)) )
        return 1i64;
    }
  }
  return 0i64;
}

Referenced by:

MiActOnPartitionNodePages
MiAddPhysicalMemory
MiCreatePfnBitMaps