PopPlNotifyDeviceFState

NTSTATUS __stdcall PopPlNotifyDeviceFState(INT64 a1, UINT64 a2, UINT64 a3, UINT64 a4, CHAR a5){
  int v6; 
  __int64 v7; 
  bool v8; 
  __int64 v9; 
  __int64 v10; 
  int v11; 
  int v12; 
  INT64 v13; 
  unsigned int v14; 
  const CHAR *v15; 
  __int64 v16; 
  int v17; 
  INT64 v18; 
  int v19; 
  __int64 v20; 
  ULONG v21; 
  unsigned __int64 v22; 
  int v24; 
  int v25; 
  __int16 v26; 
  int v27; 
  unsigned int v28; 
  int v29; 
  unsigned int v30; 
  int v31; 
  unsigned int v32; 
  __int64 v33; 
  __int64 v34[8]; 
  INT64 v35[15]; 
  int v36[2]; 

  v27 = a2;
  v6 = a4;
  v28 = a4;
  v7 = *(_QWORD *)(*(_QWORD *)(a1 + 832) + 8i64 * (unsigned int)a2);
  v33 = v7;
  if( *(_QWORD *)(v7 + 432) )
  {
    v8 = (unsigned int)a4 < (unsigned int)a3;
    if( (unsigned int)a4 > (unsigned int)a3 )
    {
      if( !a5 )
        return v7;
      v8 = (unsigned int)a4 < (unsigned int)a3;
    }
    if( !v8 || !a5 )
    {
      v9 = *(_QWORD *)(a1 + 1184);
      v10 = *(_QWORD *)(v9 + 16);
      *(_BYTE *)(v10 + 24) = KeAcquireSpinLockRaiseToDpc((UINT64 *)(v10 + 16));
      v11 = *(_DWORD *)(v9 + 32);
      v12 = PopPlCalculateDevicePowerDraw(a1, 0i64, &v28, &v27);
      *(_DWORD *)(v9 + 32) = v12;
      v14 = v12 - v11;
      if( *(&stru_140C00F40 + 1194) > 5u )
      {
        v26 = 1;
        v34[4] = (__int64)&v26;
        v15 = "Beginning";
        v34[6] = v33;
        v34[5] = 2i64;
        if( a5 )
          v15 = "Completed";
        v34[7] = 16i64;
        tlgCreate1Sz_char((INT64)v35, v15);
        v29 = v6;
        v35[2] = (INT64)&v29;
        v35[3] = 4i64;
        v35[4] = (INT64)&v30;
        v31 = *(_DWORD *)(v9 + 32);
        v35[6] = (INT64)&v31;
        v35[8] = (INT64)&v32;
        v16 = *(_QWORD *)(v9 + 16);
        v30 = v14;
        v35[5] = 4i64;
        v35[7] = 4i64;
        v32 = v14;
        v35[9] = 4i64;
        v17 = *(_DWORD *)(v16 + 28);
        v35[10] = (INT64)&v33;
        v18 = *(_QWORD *)(a1 + 224);
        LODWORD(v33) = v14 + v17;
        v19 = *(unsigned __int16 *)(a1 + 216);
        v35[14] = v18;
        v35[12] = (INT64)v36;
        v36[0] = v19;
        v35[11] = 4i64;
        v35[13] = 2i64;
        v36[1] = v20;
        tlgWriteEx_EtwWriteEx(
          (__int64)&stru_140C00F40 + 4776,
          (unsigned __int8 *)&dword_1400294EC,
          v20,
          v21,
          v24,
          v25,
          0xCu,
          (__int64)v34);
      }
      PopPlPublishSystemPowerChange((UINT16 *)v10, v14, v13);
      v22 = *(unsigned __int8 *)(v10 + 24);
      KxReleaseSpinLock((UINT64 *)(v10 + 16));
      LODWORD(v7) = KiIrqlFlags;
      __writecr8(v22);
    }
  }
  return v7;
}

Referenced by:

PopPepCompleteComponentIdleState
PopPepNotifyIdleState
PopPepStartComponentIdleStateChangeActivity