PopFxIdleWorkerTail

void __fastcall PopFxIdleWorkerTail(ULONG_PTR BugCheckParameter2, UINT64 a2, int *a3){
  unsigned int v4; 
  __int64 v6; 
  UINT64 v7; 
  int v8; 
  unsigned __int8 v9; 
  unsigned __int64 v10; 
  char v11; 
  char v12; 
  signed __int32 v13; 
  signed __int32 v14; 
  EVENT_DESCRIPTOR *v15; 
  unsigned int i; 
  UINT64 v17; 
  unsigned __int8 v18; 
  unsigned __int64 v19; 
  int v20; 
  void(__fastcall *v21)(_QWORD, _QWORD); 
  v4 = a2;
  v6 = *(_QWORD *)(*(_QWORD *)(BugCheckParameter2 + 832) + 8i64 * (unsigned int)a2);
  v7 = *(_QWORD *)&KUSER_SHARED_DATA.InterruptTime.LowPart;
  KeAcquireSpinLockRaiseToDpc((UINT64 *)(v6 + 200), a2);
  v8 = *(_DWORD *)(v6 + 216);
  v10 = v9;
  if( v8 && v8 >= 0 )
  {
    PopFxUpdateAccountingActiveTime(v6 + 200, v7, 0i64);
    *(_BYTE *)(v6 + 208) = v11;
  }
  KxReleaseSpinLock((UINT64 *)(v6 + 200));
  __writecr8(v10);
  PopDiagTraceFxComponentLogicalCondition(*(PVOID *)(BugCheckParameter2 + 48), v4, 0);
  PpmInterlockedUpdateTimeNoFence((UINT64 *)(BugCheckParameter2 + 504), v7, 0i64);
  _m_prefetchw((const void *)(v6 + 88));
  v13 = *(_DWORD *)(v6 + 88);
  do
  {
    v14 = v13;
    v13 = _InterlockedCompareExchange((volatile signed __int32 *)(v6 + 88), v13, v13);
  }
  while( v14 != v13 );
  if( v13 == 0x40000000 )
  {
    if( PopPluginComponentActive(BugCheckParameter2, v4, v12, a3) == 1 )
      PopFxProcessWork(0i64, a3, v15);
    for( i = 0; i < *(_DWORD *)(v6 + 172); ++i )
      PoFxIdleComponent((POHANDLE *)BugCheckParameter2, *(unsigned int *)(*(_QWORD *)(v6 + 176) + 8i64 * i), 2ui64);
    if( _InterlockedCompareExchange((volatile signed __int32 *)(v6 + 88), 0, 0x40000000) != 0x40000000 )
    {
      _InterlockedIncrement((volatile signed __int32 *)(v6 + 88));
      _InterlockedAnd((volatile signed __int32 *)(v6 + 88), 0xBFFFFFFF);
      PopFxActivateComponentWorker(BugCheckParameter2, v6, 0, 0i64);
    }
  }
  else
  {
    PopFxAddRefDevice(BugCheckParameter2);
    _InterlockedIncrement((volatile signed __int32 *)(v6 + 88));
    _InterlockedAnd((volatile signed __int32 *)(v6 + 88), 0xBFFFFFFF);
    KeAcquireSpinLockRaiseToDpc((UINT64 *)(v6 + 200), v17);
    v19 = v18;
    v20 = *(_DWORD *)(v6 + 216);
    if( v20 && v20 >= 0 )
    {
      *(_QWORD *)(v6 + 224) = v7;
      *(_BYTE *)(v6 + 208) = 1;
    }
    KxReleaseSpinLock((UINT64 *)(v6 + 200));
    __writecr8(v19);
    PopDiagTraceFxComponentLogicalCondition(*(PVOID *)(BugCheckParameter2 + 48), v4, 1u);
    v21 = *(void(__fastcall **)(_QWORD, _QWORD))(BugCheckParameter2 + 112);
    if( v21 )
      v21(*(_QWORD *)(BugCheckParameter2 + 192), v4);
    PopFxCompleteComponentActivation(BugCheckParameter2, v6, 1);
  }
}

Referenced by:

PoFxCompleteIdleCondition
PopFxIdleWorker