PpmResetPerfEngineForProcessorEx

INT64 __fastcall PpmResetPerfEngineForProcessorEx(INT64 a1, INT64 a2){
  INT64 result; 
  char v3; 
  INT64 i; 
  unsigned int j; 
  __int64 v7; 
  __int64 v8; 
  __int64 v9; 
  __int64 v10; 
  unsigned int k; 
  __int64 v12; 
  void *retaddr; 
  result = (INT64)&retaddr;
  v3 = a2;
  if( !*(_DWORD *)(a1 + 36) )
  {
    for( i = PpmPerfDomainHead; (INT64 *)i != &PpmPerfDomainHead; i = *(_QWORD *)i )
    {
      if( *(_DWORD *)(i + 208) )
      {
        for( j = 0; j < *(_DWORD *)(i + 200); ++j )
        {
          result = j;
          v7 = *(_QWORD *)(i + 216) + 136i64 * j;
          if( v3 )
          {
            if( *(_DWORD *)(v7 + 16) == 1 )
              result = PpmResetPerfTimes(*(_QWORD *)v7, a2);
          }
          else
          {
            result = *(_QWORD *)(i + 272);
            if( result )
              result = ((__int64(__fastcall *)(_QWORD))result)(*(_QWORD *)(v7 + 8));
          }
        }
      }
    }
  }
  v8 = a1 + 33128;
  v9 = *(_QWORD *)(a1 + 33128);
  if( v9 )
  {
    v10 = *(_QWORD *)(a1 + 33136);
    if( v10 )
    {
      if( !v3 )
      {
        result = *(_QWORD *)(v9 + 272);
        if( result )
          result = ((__int64(__fastcall *)(_QWORD))result)(*(_QWORD *)(v10 + 8));
      }
      if( v8 == *(_QWORD *)(v9 + 16) )
      {
        for( k = 0; k < *(_DWORD *)(v9 + 200); ++k )
        {
          v12 = *(_QWORD *)(v9 + 216) + 136i64 * k;
          result = *(unsigned int *)(v12 + 16);
          if( (_DWORD)result )
          {
            if( v3 )
            {
              if( (_DWORD)result == 1 )
                result = PpmResetPerfTimes(*(_QWORD *)v12, a2);
            }
            else
            {
              result = *(_QWORD *)(v9 + 272);
              if( result )
                result = ((__int64(__fastcall *)(_QWORD))result)(*(_QWORD *)(v12 + 8));
            }
          }
        }
      }
    }
  }
  if( v3 )
    return PpmResetPerfTimes(v8, a2);
  return result;
}

Referenced by:

PopHandleNextState