MiReleaseControlAreaCharges

VOID __stdcall MiReleaseControlAreaCharges(_CONTROL_AREA *ControlArea, UINT64 LockHeld){
  _CONTROL_AREA *v3; 
  __int64 v4; 
  int v5; 
  __int64 v6; 
  KIRQL v7; 
  char v8; 
  int v9; 
  int v10; 
  char *v11; 
  int v12; 
  if( !MiAweControlArea((INT64)ControlArea) && (unsigned int)MiIncludeSharedCommit(v3) )
  {
    v6 = 0i64;
    if( v5 == 1 )
      v7 = 17;
    else
      v7 = ExAcquireSpinLockExclusive((PEX_SPIN_LOCK)(v4 + 72));
    v8 = *((_BYTE *)ControlArea + 62);
    if( (v8 & 2) == 0
      || ((v9 = *((_DWORD *)ControlArea + 14), *((_BYTE *)ControlArea + 62) = v8 & 0xFD, (v9 & 0x20) != 0)
       || !*((_QWORD *)ControlArea + 8) ? (v10 = 1) : (v10 = 0),
          v11 = (char *)ControlArea + 128,
          ControlArea == (_CONTROL_AREA *)-128i64) )
    {
LABEL_7:
      if( v7 != 17 )
      {
        ExReleaseSpinLockExclusiveFromDpcLevel((INT64 *)ControlArea + 9);
        __writecr8(v7);
      }
      return;
    }
    v12 = 0x3FFFFFFF;
    while( 1 )
    {
      if( (v11[34] & 1) != 0 )
        goto LABEL_21;
      if( (v12 & *((_DWORD *)v11 + 12)) == v12 || v10 )
        break;
LABEL_22:
      v11 = (char *)*((_QWORD *)v11 + 2);
      if( !v11 )
        goto LABEL_7;
    }
    v6 += MiComputeCrossPartitionSectionCharges((INT64 *)v11);
LABEL_21:
    if( v10 )
      goto LABEL_7;
    goto LABEL_22;
  }
}

Referenced by:

MiInsertUnusedSegment
MiSegmentDelete