HalpTscAdvSynchCalculateRemoteDeltas

CHAR __fastcall HalpTscAdvSynchCalculateRemoteDeltas(INT64 *a1, INT64 *a2, UINT64 *a3, INT64 a4, INT64 a5, UINT64 a6){
  INT64 *v6; 
  __int64 v8; 
  UINT64 *v10; 
  unsigned int v11; 
  struct _KPRCB *CurrentPrcb; 
  int *v13; 
  INT64 v14; 
  EVENT_DESCRIPTOR *v15; 
  INT64 v16; 
  int v17; 
  UINT64 v18; 
  UINT64 UserDataCount; 
  int v21; 
  unsigned int v22; 
  int v23; 
  __int64 v24; 
  UINT64 *v25; 
  INT64 v26; 
  EVENT_DATA_DESCRIPTOR UserData; 
  int *v28; 
  __int64 v29; 
  __int64 *v30; 
  __int64 v31; 
  int *v32; 
  __int64 v33; 
  v6 = (INT64 *)HalpTscDeltas;
  v8 = HalpTscNopCycles;
  v25 = a3;
  v10 = a3;
  v24 = HalpTscNopCycles;
  v11 = 0;
  *a1 = 0i64;
  *a2 = 0i64;
  CurrentPrcb = KeGetCurrentPrcb();
  *(_DWORD *)a3 = *((_DWORD *)CurrentPrcb + 9);
  if( (_DWORD)a6 )
  {
    v13 = (int *)v8;
    do
    {
      CurrentPrcb = KeGetCurrentPrcb();
      if( v11 == *((_DWORD *)CurrentPrcb + 9) )
      {
        *v6 = 0i64;
        *v13 = 0;
      }
      else
      {
        v14 = HalpTscAdvSynchCalculateRemoteDelta(
                v11,
                (unsigned int)HalpTscRequestedIterations,
                (_DWORD *)(v8 + 4i64 * v11));
        *v6 = v14;
        if( v14 < *a1 )
          *a1 = v14;
        v16 = *v6;
        if( *v6 > *a2 )
        {
          *a2 = v16;
          *(_DWORD *)v10 = v11;
          v16 = *v6;
        }
        v17 = *v13;
        v26 = v16;
        v23 = v17;
        LODWORD(CurrentPrcb) = *((_DWORD *)KeGetCurrentPrcb() + 9);
        v21 = (int)CurrentPrcb;
        v22 = v11;
        if( HalpDiagnosticEventsRegistered )
        {
          v18 = HalpDiagnosticEventHandle;
          LOBYTE(CurrentPrcb) = EtwEventEnabled(
                                  HalpDiagnosticEventHandle,
                                  (EVENT_DESCRIPTOR *)&HAL_ETW_EVENT_TIMER_PROC_DELTA_REPORT,
                                  v15);
          if( (_BYTE)CurrentPrcb )
          {
            v31 = 8i64;
            *(_QWORD *)&UserData.Size = 4i64;
            UserData.Ptr = (unsigned __int64)&v21;
            v29 = 4i64;
            v28 = (int *)&v22;
            v33 = 4i64;
            v30 = &v26;
            v32 = &v23;
            LODWORD(UserDataCount) = 4;
            LOBYTE(CurrentPrcb) = EtwWriteEx(
                                    v18,
                                    (EVENT_DESCRIPTOR *)&HAL_ETW_EVENT_TIMER_PROC_DELTA_REPORT,
                                    0i64,
                                    0i64,
                                    0i64,
                                    0i64,
                                    UserDataCount,
                                    &UserData);
          }
          v10 = v25;
        }
        v8 = v24;
      }
      ++v11;
      ++v13;
      ++v6;
    }
    while( v11 < (unsigned int)a6 );
  }
  return(char)CurrentPrcb;
}

Referenced by:

HalpTscAdvSynchLeader