PopPepGetMinimumComponentIdleState

CHAR __fastcall PopPepGetMinimumComponentIdleState(INT64 a1, UINT64 a2, CHAR a3, UINT64 *a4){
  __int64 v5; 
  CHAR v6; 
  int v8; 
  KIRQL v9; 
  int v10; 
  unsigned __int64 v11; 
  unsigned int v12; 
  unsigned int v13; 
  v5 = (unsigned int)a2;
  v6 = 0;
  v8 = 1 << a3;
  v9 = ExAcquireSpinLockShared((PEX_SPIN_LOCK)(a1 + 64));
  v10 = *(_DWORD *)(a1 + 172);
  v11 = v9;
  ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)(a1 + 64));
  __writecr8(v11);
  if( v10 == 2 )
  {
    v12 = 0;
    v13 = *(_DWORD *)(200 * v5 + a1 + 372);
    if( v13 )
    {
      do
      {
        if( (v8 & *(_DWORD *)(*(_QWORD *)(200 * v5 + a1 + 376) + 24i64 * v12 + 16)) == 0 )
          break;
        ++v12;
      }
      while( v12 < v13 );
    }
    if( v12 < v13 )
    {
      *(_DWORD *)a4 = v12;
      return 1;
    }
  }
  return v6;
}

Referenced by:

PopFxSetDeviceAccountingCsPlatformState