PopPowerAggregatorScreenOffEnterStateHandler

VOID __fastcall PopPowerAggregatorScreenOffEnterStateHandler(INT64 a1, PROFILE_STATUS a2){
  bool v2; 
  int v4; 
  INT64 v5; 
  __int64 v6; 
  unsigned __int8 v7; 
  int v8; 
  int v9; 
  unsigned int v10; 
  unsigned int v11; 
  INT64 v12; 
  ERESOURCE *v13; 
  INT64 v14; 
  INT64 v15; 
  INT64 v16; 
  int v17; 
  INT64 v18[4]; 
  INT64 v19; 
  v2 = *(_DWORD *)(a1 + 72) == 3;
  memset(v18, 0, sizeof(v18));
  if( v2 )
  {
    v4 = *(_DWORD *)(a1 + 48);
    v18[3] = 0i64;
    HIDWORD(v18[2]) = v4;
    *(_OWORD *)((char *)v18 + 4) = 0i64;
    LODWORD(v18[0]) = 4;
    PopPowerAggregatorSetCurrentState(a1, (INT64)v18);
    return;
  }
  if( *(_QWORD *)(a1 + 40) != *(_QWORD *)(a1 + 80) )
  {
    HIDWORD(v18[2]) = *(_DWORD *)(a1 + 48);
    LOBYTE(v18[3]) = *(_BYTE *)(a1 + 96);
    HIDWORD(v18[3]) = *(_DWORD *)(a1 + 100);
    LODWORD(v18[0]) = 4;
    PopPowerAggregatorSetCurrentState(a1, (INT64)v18);
    PopPowerAggregatorStartNextSession(1, *(_DWORD *)(a1 + 32));
    return;
  }
  v5 = *(_QWORD *)(a1 + 52);
  v6 = *(int *)(a1 + 92);
  v7 = *(_BYTE *)(a1 + 65);
  v17 = *(_DWORD *)(a1 + 60);
  v8 = *(_DWORD *)(a1 + 88);
  v16 = v5;
  if( v8 < 0 )
    return;
  if( v8 > 1 )
  {
    if( v8 == 2 )
      goto LABEL_13;
    v9 = v6;
    if( v8 == 3 )
    {
LABEL_16:
      v11 = *(_DWORD *)(a1 + 100);
      v18[3] = 0i64;
      HIDWORD(v18[2]) = v9;
      *(_OWORD *)((char *)v18 + 4) = 0i64;
      LODWORD(v18[0]) = 1;
      PopPowerAggregatorSetCurrentState(a1, (INT64)v18);
      PopPowerAggregatorStartNextSession(2, *(_DWORD *)(a1 + 76));
      PopPowerAggregatorLockRelease(v12);
      LOBYTE(v13) = v7;
      PopDripsWatchdogNotifySessionStart(v13);
      v19 = v7;
      PopDirectedDripsNotify(6i64, &v19, v14, v15);
      PopPowerAggregatorEngageAggressiveStandbyActions((unsigned int)v6, (INT64)&v16);
      ((void(__fastcall *)(_QWORD))qword_140C54188)(v11);
      PopPowerAggregatorLockAcquire();
      return;
    }
    if( v8 != 4 )
      return;
  }
  v10 = *((_DWORD *)PopPowerAggregatorModernStandbyResourceMasks + v6);
  PopPowerAggregatorLockRelease((INT64)PopPowerAggregatorModernStandbyResourceMasks);
  if( qword_140C54158 )
    qword_140C54158(v10);
  PopPowerAggregatorLockAcquire();
  *(_DWORD *)(a1 + 88) = 2;
LABEL_13:
  if( !*(_BYTE *)(a1 + 104) && *(_BYTE *)(a1 + 96) )
  {
    v9 = *(_DWORD *)(a1 + 92);
    *(_DWORD *)(a1 + 88) = 3;
    goto LABEL_16;
  }
}

Referenced by:

No references.