IopLiveDumpProcessCorralStateChange

VOID __fastcall IopLiveDumpProcessCorralStateChange(INT64 a1, INT64 a2){
  int v4; 
  int v5; 
  int v6; 
  int v7; 
  int v8; 
  int v9; 
  int v10; 
  __int16 v11; 
  UINT64 SpinCount; 
  LODWORD(SpinCount) = 0;
  while( *(_DWORD *)(a1 + 12) == *(_DWORD *)(a2 + 4) )
    KeYieldProcessorEx(&SpinCount);
  v4 = *(_DWORD *)(a1 + 12);
  *(_DWORD *)(a2 + 4) = v4;
  v5 = v4 - 2;
  if( v5 )
  {
    v6 = v5 - 1;
    if( v6 )
    {
      v7 = v6 - 1;
      if( v7 )
      {
        v8 = v7 - 1;
        if( v8 )
        {
          v9 = v8 - 1;
          if( v9 )
          {
            v10 = v9 - 1;
            if( v10 )
            {
              if( v10 == 1 && *(_BYTE *)(a2 + 9) )
              {
                KeRestoreSupervisorState(
                  *((_QWORD *)KeGetCurrentPrcb() + 216),
                  KUSER_SHARED_DATA.XState.EnabledSupervisorFeatures | 0x100);
                *(_BYTE *)(a2 + 9) = 0;
              }
            }
            else if( SaveSupervisorState )
            {
              KeSaveSupervisorState(
                *((_QWORD *)KeGetCurrentPrcb() + 216),
                KUSER_SHARED_DATA.XState.EnabledSupervisorFeatures | 0x100);
              *(_BYTE *)(a2 + 9) = 1;
            }
          }
          else if( *(_BYTE *)(a2 + 8) )
          {
            _enable();
          }
        }
        else
        {
          KeResumeClockTimerSafe();
        }
      }
      else
      {
        IopLiveDumpBufferDumpData((__int64 *)a1, (unsigned int *)a2);
      }
    }
    else
    {
      KeSuspendClockTimerSafe();
    }
  }
  else
  {
    _disable();
    *(_BYTE *)(a2 + 8) = (v11 & 0x200) != 0;
  }
  _InterlockedIncrement((volatile signed __int32 *)(a1 + 16));
}

Referenced by:

IopLiveDumpCorralDpc
IopLiveDumpInitiateCorralStateChange