PopPowerAggregatorHandleIntentUnsafe

INT64 __fastcall PopPowerAggregatorHandleIntentUnsafe(_QWORD *a1, INT64 a2, UINT64 a3){
  unsigned int v3; 
  unsigned int v4; 
  __int64 v5; 
  __int64(__fastcall *v6)(INT64 *, _DWORD *, _QWORD); 
  int v7; 
  INT64 a7; 
  _DWORD a2a[4]; 
  __m256i v11; 
  INT64 a5[2]; 
  __int128 v13; 
  __int128 v14; 
  v3 = a3;
  a2a[3] = 0;
  v4 = a2;
  *(_OWORD *)a5 = *(_OWORD *)&Version;
  v5 = (int)a1;
  v11.m256i_i64[0] = ++PopPowerAggregatorContext;
  v14 = *(&ymmword_140C215C8 + 1);
  a2a[0] = 4;
  a2a[2] = a3;
  a2a[1] = (_DWORD)a1;
  memset(&v11.m256i_u64[1], 0, 24);
  v13 = ymmword_140C215C8;
  if( (unsigned int)((_DWORD)a1 - 1) <= 7
    && (unsigned int)a2 <= 2
    && (PopPowerAggregatorCachePoPolicy((INT64)a1, a2, a3),
        a1 = PopPowerAggregatorIntentHandlers,
        (v6 = (__int64(__fastcall *)(INT64 *, _DWORD *, _QWORD))PopPowerAggregatorIntentHandlers[v5]) != 0i64) )
  {
    v7 = v6(&PopPowerAggregatorContext, a2a, (unsigned int)v5);
    if( v7 >= 0 )
    {
      *(_OWORD *)&Version = *(_OWORD *)a2a;
      ymmword_140C215C8 = v11;
      if( PopPowerAggregatorIsAtTargetState() )
      {
        v7 = 0;
      }
      else
      {
        v7 = 259;
        PopPowerAggregatorScheduleWorker((INT64)&PopPowerAggregatorContext);
      }
    }
  }
  else
  {
    v7 = -1073741811;
  }
  LODWORD(a7) = v7;
  PopPowerAggregatorRecordIntent((INT64)a1, (unsigned int)v5, v4, v3, (INT64)a5, a2a, a7);
  return(unsigned int)v7;
}

Referenced by:

PopPowerAggregatorForceSessionSwitch
PopPowerAggregatorHandleIntent
PopPowerAggregatorNotifySuspendResume