PopFxIdleComponent

VOID __stdcall PopFxIdleComponent(POHANDLE *Handle, UINT64 Component, UINT64 Flags, PEP_WORK_INFORMATION *WorkInfo){
  UINT64 v4; 
  unsigned int v5; 
  char v8; 
  __int64 v9; 
  UINT64 v10; 
  __int64 v11; 
  UINT64 v12; 
  INT64 CurrentQpc[2]; 
  UINT64 PreviousTime; 

  v4 = 0i64;
  v5 = Component;
  PreviousTime = 0i64;
  v8 = Flags;
  if( (Flags & 3) == 3 )
    PopFxBugCheck(0x614u, (ULONG_PTR)Handle, Component, 1u);
  if( (unsigned int)Component >= *((_DWORD *)Handle + 207) )
    PopFxBugCheck(0x614u, (ULONG_PTR)Handle, Component, 2u);
  _mm_lfence();
  v9 = *((_QWORD *)Handle[104] + (unsigned int)Component);
  if( PopFxActiveIdleLevel == 2 )
  {
    LODWORD(v12) = RtlGetInterruptTimePrecise(CurrentQpc);
    PpmInterlockedUpdateTimeNoFence((UINT64 *)(v9 + 144), v12, &PreviousTime);
  }
  else
  {
    PreviousTime = *(_QWORD *)(v9 + 144);
  }
  if( (*(_DWORD *)(v9 + 88) & 0x3FFFFFFF) == 0 )
    PopFxBugCheck(0x608u, v9, *(_DWORD *)(v9 + 88), 0);
  if( _InterlockedDecrement((volatile signed __int32 *)(v9 + 88)) == 0x80000000 )
  {
    if( !v4 )
    {
      LODWORD(v10) = RtlGetInterruptTimePrecise(CurrentQpc);
      v4 = v10;
    }
    v11 = *(unsigned int *)(v9 + 92);
    if( (v11 & 2) == 0 && !PopFxLowPowerEpoch )
    {
      v11 = (unsigned int)PopFxActiveIdleThreshold;
      if( v4 - PreviousTime < (unsigned int)PopFxActiveIdleThreshold )
      {
        v11 = 2147483649i64;
        if( _InterlockedCompareExchange((volatile signed __int32 *)(v9 + 88), -2147483647, 0x80000000) != 0x80000000 )
          return;
        if( _InterlockedIncrement((volatile signed __int32 *)(v9 + 96)) == 1 )
        {
          if( _InterlockedIncrement((_DWORD *)&stru_140C23628 + 990) == 1 )
            PopFxArmResidentTimer(0);
          return;
        }
        _InterlockedDecrement((volatile signed __int32 *)(v9 + 96));
        _InterlockedDecrement((volatile signed __int32 *)(v9 + 88));
      }
    }
    if( PopFxActiveIdleLevel == 1 )
      PpmInterlockedUpdateTimeNoFence((UINT64 *)(v9 + 144), v4, 0i64);
    if( (v8 & 2) != 0 )
      PopFxQueueWorkOrder((_KQUEUE *)v11, (_POP_FX_WORK_ORDER *)(v9 + 24), (_POP_FX_DEVICE *)Handle, (UINT8)WorkInfo);
    else
      PopFxIdleWorker((POP_FX_DEVICE *)Handle, v5, WorkInfo);
  }
}

Referenced by:

PoFxIdleComponent
PopFxCompleteComponentActivation
PopFxResidentTimeoutRoutine