MiMirrorAddPagesToBrownList

VOID __fastcall MiMirrorAddPagesToBrownList(UINT64 a1, UINT64 a2){
  UINT64 v4; 
  UINT64 v5; 
  volatile signed __int32 *v6; 
  UINT64 v7; 
  int v8; 
  UINT64 v9; 
  v4 = a1 >> 5;
  v5 = a2;
  v6 = (volatile signed __int32 *)(qword_140C4E468 + 4 * v4);
  v7 = a1 & 0x1F;
  if( v7 + a2 <= 0x20 )
  {
    if( a2 == 32 )
    {
      *v6 = 0;
      goto LABEL_5;
    }
    v8 = ~(((1 << a2) - 1) << v7);
    goto LABEL_4;
  }
  if( (a1 & 0x1F) != 0 )
  {
    _InterlockedAnd(v6, ~(((1 << (32 - (a1 & 0x1F))) - 1) << v7));
    v5 = a2 - (32 - (unsigned int)(a1 & 0x1F));
    ++v6;
  }
  if( v5 >= 0x20 )
  {
    v9 = v5 >> 5;
    v5 += -32i64 * (v5 >> 5);
    do
    {
      *v6++ = 0;
      --v9;
    }
    while( v9 );
  }
  if( v5 )
  {
    v8 = -1 << v5;
LABEL_4:
    _InterlockedAnd(v6, v8);
  }
LABEL_5:
  RtlSetBitsEx((INT64)qword_140C4E450, a1, a2);
}

Referenced by:

MiMirrorGatherBrownPages
MiMirrorNodeLargePages