MiDecrementLargeSubsections

__int64 __fastcall MiDecrementLargeSubsections(__int64 *a1, __int64 a2){
  __int64 *v2; 
  volatile LONG *v3; 
  unsigned __int64 v4; 
  __int64 v5; 
  unsigned int v6; 
  unsigned int v7; 
  _MMPTE *v8; 
  _MMPFN *v9; 
  _QWORD *v10; 
  __int64 result; 
  _CONTROL_AREA *ControlArea; 
  __int64 *v13; 
  volatile LONG *v15; 
  v13 = a1;
  v2 = a1;
  ControlArea = (_CONTROL_AREA *)*a1;
  v3 = (volatile LONG *)(*a1 + 72);
  v15 = v3;
  v4 = ExAcquireSpinLockExclusive(v3);
  v5 = a2;
  while( 1 )
  {
    if( --*((_DWORD *)v2 + 27) == 1 )
    {
      ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v3);
      __writecr8(2ui64);
      v6 = *((_DWORD *)v2 + 11);
      v7 = 0;
      v8 = (_MMPTE *)v2[1];
      if( v6 )
      {
        do
        {
          v9 = MiLockLeafPage(v8, 0i64);
          MiDecrementShareCount((UINT64)v9);
          _InterlockedAnd64((volatile signed __int64 *)v9 + 3, 0x7FFFFFFFFFFFFFFFui64);
          if( (++v7 & 0xF) == 0 && v7 != v6 && KeShouldYieldProcessor() )
          {
            __writecr8(v4);
            KeGetCurrentIrql();
            __writecr8(2ui64);
          }
          v8 = (_MMPTE *)((char *)v8 + 8);
        }
        while( v7 < v6 );
        v2 = v13;
        v3 = v15;
      }
      MiChargeLargeProtoSubsection((INT64)v2, 0i64);
      ExAcquireSpinLockExclusive(v3);
      --*((_DWORD *)v2 + 27);
      MiBuildWakeList(ControlArea, 0x200ui64);
      MiReleaseControlAreaWaiters(v10);
      v5 = a2;
    }
    if( v2 == (__int64 *)v5 )
      break;
    v2 = (__int64 *)v2[2];
    v13 = v2;
  }
  ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)v3);
  result = (unsigned int)KiIrqlFlags;
  __writecr8(v4);
  return result;
}

Referenced by:

MiCloneLargeFileOnlyVad
MiDeletePartialCloneVads
MiDeleteVad
MiDereferenceDataSubsections
MiIncrementLargeSubsections
MiMapViewOfDataSection
MiReferenceDataSubsections
MiRemoveMappedPtes