PopPlCalculateDevicePowerDraw

INT64 __fastcall PopPlCalculateDevicePowerDraw(INT64 a1, INT64 *a2, UINT64 *a3, _DWORD *a4){
  __int64 v4; 
  unsigned int v8; 
  __int64 v9; 
  unsigned __int64 i; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  v4 = *(_QWORD *)(a1 + 1184);
  if( v4 )
  {
    if( !a2 )
      a2 = (INT64 *)(*(_QWORD *)(a1 + 48) + 156i64);
    v9 = *(int *)a2;
    v8 = *(_DWORD *)(v4 + 8 * v9 + 32);
    if( (int)v9 <= 1 )
    {
      for( i = 0i64; i < *(unsigned int *)(a1 + 828); ++i )
      {
        v11 = *(_QWORD *)(*(_QWORD *)(a1 + 832) + 8 * i);
        v12 = *(_QWORD *)(v11 + 432);
        if( v12 && *(_QWORD *)(v12 + 24) )
        {
          if( a3 && (!a4 || *a4 == i) )
            v13 = *(unsigned int *)a3;
          else
            v13 = *(unsigned int *)(v11 + 152);
          if( (unsigned __int64)(unsigned int)v13 >= *(_QWORD *)(v12 + 24) )
            v13 = (unsigned int)(*(_DWORD *)(v12 + 24) - 1);
          v8 -= *(_DWORD *)(v12 + 8 * v13 + 36);
        }
      }
    }
  }
  else
  {
    return 0;
  }
  return v8;
}

Referenced by:

PopFxUnregisterDevice
PopPlNotifyDeviceDState
PopPlNotifyDeviceFState
PopPlRegisterDeviceIterator