PpmApplyProfile

VOID __stdcall PpmApplyProfile(PVOID Context){
  __int64 v1; 
  __int64 v3; 
  __int64 *v4; 
  __int64 *v5; 
  __int64 *v6; 
  __int64 *v7; 
  __int64 v8; 
  __int64 v9; 
  __int64 v10; 
  INT64 v11; 
  v1 = dword_140C23D0C;
  v3 = 0i64;
  PpmAcquireLock(&PpmPerfPolicyLock);
  PopAcquireRwLockExclusive((_POP_RW_LOCK *)&PpmIdlePolicyLock);
  v4 = (__int64 *)PpmCurrentProfile;
  v5 = PpmDefaultProfile;
  if( Context )
    v5 = (__int64 *)Context;
  if( v5 == (__int64 *)PpmLowPowerProfile )
  {
    v6 = v5;
    v5 = PpmDefaultProfile;
    if( !PpmPerfMultimediaQosSupported )
      v5 = v6;
  }
  if( PpmCurrentProfile == v5 )
  {
    PopReleaseRwLock((UINT64)&PpmIdlePolicyLock);
    PpmReleaseLock(&PpmPerfPolicyLock);
  }
  else
  {
    PpmEndProfileAccumulation(PpmCurrentProfile, *(INT64 *)&KUSER_SHARED_DATA.InterruptTime.LowPart);
    v8 = 2i64;
    *((_DWORD *)v5 + 7) |= 2u;
    *((_DWORD *)v4 + 7) &= ~2u;
    PpmCurrentProfile = v5;
    v9 = 0i64;
    v5[689] = v10;
    do
    {
      if( v5 != v7 )
        v3 |= v5[342 * v1 + 5 + v9];
      if( v4 != v7 )
        v3 |= v4[342 * v1 + 5 + v9];
      ++v9;
      --v8;
    }
    while( v8 );
    v11 = v3 & 0x1CFFFFD8030FC0i64;
    PpmCompareAndApplyPolicySettings(&v11, (INT64)&v4[342 * v1 + 5], (INT64)&v5[342 * v1 + 5]);
    PpmEventTraceProfileChange(v4, (UINT64)v5);
    if( PpmLowPowerProfile )
    {
      if( v4 == (__int64 *)PpmLowPowerProfile )
      {
        PpmAcquireLock(&PpmPerfPolicyLock);
        PpmPostProcessMediaBuffering();
      }
    }
  }
}

Referenced by:

PdcPoPpmApplyProfile