MiGetFreeOrZeroPageAnyColor

INT64 __stdcall MiGetFreeOrZeroPageAnyColor(_MI_PARTITION *Partition, UINT64 Color, UINT64 a3){
  unsigned __int64 v3; 
  unsigned int v4; 
  unsigned int v5; 
  UINT64 v7; 
  INT64 result; 
  unsigned int v9; 
  v3 = *((int *)Partition + 1575);
  v4 = a3;
  v5 = Color;
  if( v3 >= 0x10 )
    v3 = 16i64;
  v7 = (unsigned int)dword_140C4DC38 * v3;
  if( (a3 & 0x10001) != 0 || (result = MiDemoteLocalLargePage((INT64)Partition, Color, a3, v7)) == 0 )
  {
    result = MiRemovePageAnyColor((INT64)Partition, v5, v4);
    if( result != 1 )
    {
      if( result )
        return result;
      result = MiGetPageSlist((INT64)Partition, v5, v4);
      if( result || (v4 & 0x4000) == 0 )
        return result;
      v9 = v4 & 0xFFFFBFFF;
      result = MiRemovePageAnyColor((INT64)Partition, v5, v9);
      if( result != 1 )
      {
        if( !result )
          return MiGetPageSlist((INT64)Partition, v5, v9);
        return result;
      }
    }
    return 1i64;
  }
  return result;
}

Referenced by:

MiGetPage