KdPowerTransitionEx

INT64 __fastcall KdPowerTransitionEx(INT64 a1, CHAR a2){
  unsigned int v3; 
  int v4; 
  unsigned __int8 CurrentIrql; 
  unsigned int v6; 
  unsigned int v7; 
  __int64 v8; 
  UINT8 v9; 
  v3 = 0;
  if( !KdPitchDebugger )
  {
    v4 = a1 & 0x40000000 ^ a1;
    if( (_BYTE)KdDebuggerEnabled || (a1 & 0x40000000) != 0 )
    {
      CurrentIrql = -1;
      v6 = v4 & 0x80000000;
      v7 = v4 & 0x80000000 ^ v4;
      if( KdTransportMaxPacketSize != 1152 )
        v6 = 0;
      if( a2 )
      {
        if( ObGetCurrentIrql() < 2u )
        {
          CurrentIrql = KeGetCurrentIrql();
          __writecr8(2ui64);
        }
        KxAcquireSpinLock(&KdDebuggerLock);
      }
      if( v7 == 1 )
      {
        PpmCancelExitLatencyTrace((__int64)KeGetCurrentPrcb());
        v9 = ObGetCurrentIrql();
        if( v9 >= 2u )
        {
          LOBYTE(v8) = 1;
          ((void(__fastcall *)(__int64, _QWORD))off_140C00738[0])(v8, 0i64);
        }
        v3 = KdPower(v6 | 1, &KdpContext);
        if( v9 >= 2u )
          ((void(__fastcall *)(_QWORD, _QWORD))off_140C00738[0])(0i64, 0i64);
      }
      else if( v7 - 2 > 2 )
      {
        v3 = -1073741811;
      }
      else
      {
        v3 = KdPower(v6 | 4, &KdpContext);
      }
      if( a2 )
      {
        KxReleaseSpinLock(&KdDebuggerLock);
        if( CurrentIrql != 0xFF )
          __writecr8(CurrentIrql);
      }
    }
  }
  return v3;
}

Referenced by:

HalReturnToFirmware
KdDisableDebuggerWithLock
KdEnableDebuggerWithLock
KdPowerTransition
PopFxDebuggerPowerCriticalTransitionCallback
PpmExitCoordinatedIdle
PpmIdleExecuteTransition