HalpTimerDetermineValidTimerPairReadLatency

NTSTATUS __fastcall HalpTimerDetermineValidTimerPairReadLatency(_KDPC *Dpc, _KDPC *a2){
  unsigned int v4; 
  __int64 v5; 
  unsigned __int64 v6; 
  void *v7; 
  void *v8; 
  void *v9; 
  __int64 v10; 
  void *v11; 
  void *v12; 
  void *v13; 
  __int64 v14; 
  unsigned __int64 v15; 
  unsigned __int64 v16; 

  v4 = -1;
  v5 = 25i64;
  do
  {
    HalpProcessorFence();
    v6 = __rdtsc();
    HalpProcessorFence();
    if( Dpc == (_KDPC *)HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData(Dpc, v7, v8, v9);
      ((void(__fastcall *)(__int64))Dpc[1].SystemArgument2)(v10);
    }
    HalpProcessorFence();
    if( a2 == (_KDPC *)HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData(a2, v11, v12, v13);
      ((void(__fastcall *)(__int64))a2[1].SystemArgument2)(v14);
    }
    HalpProcessorFence();
    v15 = __rdtsc();
    HalpProcessorFence();
    v16 = v15 - v6;
    if( v16 >= v4 )
      LODWORD(v16) = v4;
    v4 = v16;
    --v5;
  }
  while( v5 );
  return 4 * v16;
}

Referenced by:

HalpTimerMeasureFrequencies
HalpTimerMeasureProcessorsWorker