EtwpGetMicroarchitecturalPmcAffinity

INT64 *__stdcall EtwpGetMicroarchitecturalPmcAffinity(INT64 a1, UINT16 *a2){
  INT64 *result; 
  unsigned int v5; 
  unsigned int v6; 
  INT64 v7; 
  _KPRCB **v8; 
  _KPRCB *v9; 
  int CpuStepping; 
  unsigned int v11; 
  int v12; 
  int v13[4]; 

  LODWORD(result) = KeQueryActiveProcessorAffinity((INT64)a2);
  v5 = 0;
  v6 = (unsigned int)result;
  if( (_DWORD)result )
  {
    v7 = a1 - (_QWORD)v13;
    v8 = &KiProcessorBlock;
    do
    {
      v9 = *v8;
      v13[0] = (*v8)->CpuType;
      v13[1] = v9->CpuModel;
      CpuStepping = v9->CpuStepping;
      v11 = 0;
      v13[2] = CpuStepping;
      result = (INT64 *)v13;
      do
      {
        v12 = *(_DWORD *)((char *)result + v7);
        if( v12 == -1 )
          break;
        if( v12 != *(_DWORD *)result )
        {
          LODWORD(result) = KeRemoveProcessorAffinityEx(a2, v5);
          break;
        }
        ++v11;
        result = (INT64 *)((char *)result + 4);
      }
      while( v11 < 3 );
      ++v5;
      ++v8;
    }
    while( v5 < v6 );
  }
  return result;
}

Referenced by:

EtwSetPerformanceTraceInformation
EtwpLoadMicroarchitecturalProfileGroup