PopFxPepPerfInfoQuery

__int64 __fastcall PopFxPepPerfInfoQuery(ULONG_PTR BugCheckParameter3, ULONG_PTR BugCheckParameter4, unsigned int **a3){
  UINT64 v3; 
  NTSTATUS v4; 
  unsigned int *v5; 
  unsigned int v7; 
  unsigned int *PoolWithTag; 
  unsigned int v9; 
  __int64 v10; 
  unsigned int v11; 
  VOID *v12; 
  unsigned int *v13; 
  __int16 v14; 
  UINT64 v15; 
  VOID *v16; 
  __int64 pullResult[9]; 
  unsigned int v20; 
  v3 = (unsigned int)BugCheckParameter4;
  v20 = 0;
  pullResult[0] = 0i64;
  v4 = 0;
  v5 = 0i64;
  if( !PopPluginQueryComponentPerfCapabilities(BugCheckParameter3, BugCheckParameter4, &v20) )
  {
    v4 = -1073741822;
    goto LABEL_19;
  }
  v7 = v20;
  PoolWithTag = (unsigned int *)ExAllocatePoolWithTag(PagedPool, (int)(48 * v20 + 8), 0x4D584650ui64);
  v5 = PoolWithTag;
  if( !PoolWithTag )
  {
LABEL_4:
    v4 = -1073741670;
    goto LABEL_19;
  }
  memset((INT64)PoolWithTag, 0i64);
  *v5 = v7;
  v9 = 0;
  if( !v7 )
    goto LABEL_20;
  while( 1 )
  {
    v10 = 12i64 * v9;
    PopPluginQueryComponentPerfSet(
      BugCheckParameter3,
      v3,
      v9,
      &v5[v10 + 8],
      &v5[v10 + 9],
      &v5[v10 + 10],
      &v5[v10 + 10],
      &v5[v10 + 12]);
    if( !v5[v10 + 9] )
    {
      v11 = v5[v10 + 10];
      if( !v11 )
        PopFxBugCheck(0x61Aui64, *(_QWORD *)(BugCheckParameter3 + 64), BugCheckParameter3, v3);
      v4 = RtlULongLongMult(v11, 0x10ui64, (UINT64 *)pullResult);
      v12 = ExAllocatePoolWithTag(PagedPool, pullResult[0], 0x4D584650ui64);
      *(_QWORD *)&v5[v10 + 12] = v12;
      if( !v12 )
        goto LABEL_4;
      PopPluginQueryComponentPerfStates(BugCheckParameter3, (unsigned int)v3, v9, (INT64)v12);
    }
    v13 = &v5[v10];
    PopPluginQueryComponentPerfSetName(BugCheckParameter3, v3, v9, (unsigned __int16 *)&v5[v10 + 2] + 1, 0i64);
    v14 = HIWORD(v5[v10 + 2]);
    if( v14 )
      break;
    LOWORD(v5[v10 + 2]) = 0;
    *(_QWORD *)&v5[v10 + 4] = 0i64;
LABEL_14:
    if( ++v9 >= v7 )
      goto LABEL_18;
  }
  v15 = *((unsigned __int16 *)v13 + 5);
  LOWORD(v5[v10 + 2]) = v14 - 2;
  v16 = ExAllocatePoolWithTag(PagedPool, v15, 0x4D584650ui64);
  *(_QWORD *)&v5[v10 + 4] = v16;
  if( v16 )
  {
    PopPluginQueryComponentPerfSetName(BugCheckParameter3, v3, v9, (unsigned __int16 *)v13 + 5, (__int64)v16);
    goto LABEL_14;
  }
  v4 = -1073741670;
LABEL_18:
  if( v4 >= 0 )
  {
LABEL_20:
    *a3 = v5;
    return(unsigned int)v4;
  }
LABEL_19:
  PopFxPepPerfInfoFree((PPO_FX_COMPONENT_PERF_INFO)v5);
  return(unsigned int)v4;
}

Referenced by:

PopFxRegisterComponentPerfStates