PopFxIssueDirectedPowerTransition

NTSTATUS __stdcall PopFxIssueDirectedPowerTransition(ULONG_PTR BugCheckParameter2){
  char v1; 
  __int64 v2; 
  __int64 v3; 
  char v4; 
  __int64 v5; 
  UINT64 *v6; 
  unsigned __int64 v7; 
  _KQUEUE *v8; 
  UINT8 v9; 
  NTSTATUS result; 

  v3 = v2;
  v4 = v1;
  v5 = *(_QWORD *)&BugCheckParameter2;
  if( (_InterlockedCompareExchange((volatile signed __int32 *)(*(_QWORD *)&BugCheckParameter2 + 824i64), 0, 0) & 0x20) == 0 )
    PopFxBugCheck(0x910u, 1u, BugCheckParameter2, 0);
  v6 = (UINT64 *)(*(_QWORD *)&BugCheckParameter2 + 1152i64);
  v7 = (unsigned __int8)KeAcquireSpinLockRaiseToDpc((UINT64 *)(*(_QWORD *)&BugCheckParameter2 + 1152i64));
  if( *(_DWORD *)(v5 + 1160) || (*(_DWORD *)(v5 + 32) & 0x2000) != 0 )
    PopFxBugCheck(0x910u, 3u, v5, 0);
  if( ((*(_DWORD *)(v5 + 32) & 0x1000) != 0) == v4 )
    PopFxBugCheck(0x910u, (v4 != 0) + 4, v5, 0);
  *(_DWORD *)(v5 + 1160) = 2;
  _InterlockedOr((volatile signed __int32 *)(v5 + 32), 0x2000u);
  if( v4 )
    _InterlockedOr((volatile signed __int32 *)(v5 + 32), 0x1000u);
  else
    _InterlockedAnd((volatile signed __int32 *)(v5 + 32), 0xFFFFEFFF);
  PopFxAddRefDevice((POP_FX_DEVICE *)v5);
  *(_DWORD *)(v5 + 1180) &= 0xFFFFFFFC;
  *(_QWORD *)(v5 + 1168) = v3;
  *(_DWORD *)(v5 + 1176) = -1073741436;
  PopFxQueueWorkOrder(v8, (_POP_FX_WORK_ORDER *)(v5 + 920), (_POP_FX_DEVICE *)v5, v9);
  KxReleaseSpinLock(v6);
  result = KiIrqlFlags;
  __writecr8(v7);
  return result;
}

Referenced by:

PopIssueDirectedPowerTransition