PpmResetPerfEngineForProcessorEx

NTSTATUS __stdcall PpmResetPerfEngineForProcessorEx(INT64 a1, INT64 a2){
  void **v2; 
  char v3; 
  INT64 i; 
  unsigned int j; 
  __int64 v7; 
  _KPRCB *v8; 
  __int64 v9; 
  __int64 v10; 
  unsigned int k; 
  __int64 v12; 
  void *retaddr; 

  v2 = &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 )
        {
          LODWORD(v2) = j;
          v7 = *(_QWORD *)(i + 216) + 136i64 * j;
          if( v3 )
          {
            if( *(_DWORD *)(v7 + 16) == 1 )
              PpmResetPerfTimes(*(_KPRCB **)v7);
          }
          else
          {
            v2 = *(void ***)(i + 272);
            if( v2 )
              LODWORD(v2) = ((__int64(__fastcall *)(_QWORD))v2)(*(_QWORD *)(v7 + 8));
          }
        }
      }
    }
  }
  v8 = (_KPRCB *)(a1 + 33128);
  v9 = *(_QWORD *)(a1 + 33128);
  if( v9 )
  {
    v10 = *(_QWORD *)(a1 + 33136);
    if( v10 )
    {
      if( !v3 )
      {
        v2 = *(void ***)(v9 + 272);
        if( v2 )
          LODWORD(v2) = ((__int64(__fastcall *)(_QWORD))v2)(*(_QWORD *)(v10 + 8));
      }
      if( v8 == *(_KPRCB **)(v9 + 16) )
      {
        for( k = 0; k < *(_DWORD *)(v9 + 200); ++k )
        {
          v12 = *(_QWORD *)(v9 + 216) + 136i64 * k;
          LODWORD(v2) = *(_DWORD *)(v12 + 16);
          if( (_DWORD)v2 )
          {
            if( v3 )
            {
              if( (_DWORD)v2 == 1 )
                PpmResetPerfTimes(*(_KPRCB **)v12);
            }
            else
            {
              v2 = *(void ***)(v9 + 272);
              if( v2 )
                LODWORD(v2) = ((__int64(__fastcall *)(_QWORD))v2)(*(_QWORD *)(v12 + 8));
            }
          }
        }
      }
    }
  }
  if( v3 )
    PpmResetPerfTimes(v8);
  return(int)v2;
}

Referenced by:

PopHandleNextState