PopDeepSleepResiliencyPhaseAccountingUpdate

NTSTATUS __stdcall PopDeepSleepResiliencyPhaseAccountingUpdate(PVOID Src){
  char v1; 
  __int64 v2; 
  unsigned int v3; 
  char v4; 
  unsigned int v5; 
  int v6; 
  unsigned __int8 v7; 
  __int16 v8; 
  unsigned __int64 v9; 
  NTSTATUS result; 
  UINT64 PerformanceCounter; 
  _TOKEN *v12; 
  char *v13; 

  v2 = (int)Src;
  v3 = 0;
  v4 = v1;
  v5 = 0;
  v6 = 1 << (char)Src;
  v7 = KeAcquireSpinLockRaiseToDpc((UINT64 *)&stru_140C23628 + 115);
  v8 = dword_140C22FDC;
  v9 = v7;
  if( (v6 & dword_140C22FDC) != 0 )
  {
    PerformanceCounter = KeQueryPerformanceCounter(0i64);
    v13 = &PopCsResiliencyStats[8 * v2];
    if( !v4 )
    {
      *(_QWORD *)&PopCsResiliencyStats[8 * v2 + 240] += PerformanceCounter - *((_QWORD *)v13 + 20);
      PerformanceCounter = 0i64;
    }
    *((_QWORD *)v13 + 20) = PerformanceCounter;
    if( v4 )
    {
      if( (v6 & 3) != 0 )
      {
        if( (v8 & 0x40) != 0 )
          v5 = 64;
        if( (v8 & 0x3BC) != 0 )
          v5 |= 0x3BCu;
      }
      else if( (v6 & 0x40) != 0 && (v8 & 0x3BC) != 0 )
      {
        v5 = 956;
      }
      PopDeepSleepResiliencyPhaseAccountingEnd(v5, 1);
    }
    else
    {
      if( (v6 & 3) != 0 )
      {
        if( (*(&PopIrpWorkerControlEvent + 208) & 3) == 0 )
        {
          v3 = 64;
          if( (*(&PopIrpWorkerControlEvent + 208) & 0x40) == 0 )
            v3 = 1020;
        }
      }
      else if( (v6 & 0x40) != 0 && (*(&PopIrpWorkerControlEvent + 208) & 0x40) == 0 )
      {
        v3 = 956;
      }
      LOBYTE(v12) = 1;
      PopDeepSleepResiliencyPhaseAccountingBegin((_TOKEN *)v3, v12);
    }
  }
  KxReleaseSpinLock((UINT64 *)&stru_140C23628 + 115);
  result = KiIrqlFlags;
  __writecr8(v9);
  return result;
}

Referenced by:

PopDeepSleepClearDisengageReason
PopDeepSleepSetDisengageReason