HalpTimerDetermineValidTimerPairReadLatency

__int64 __fastcall HalpTimerDetermineValidTimerPairReadLatency(__int64 a1, __int64 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( a1 == HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData((KDPC *)a1, v7, v8, v9);
      (*(void(__fastcall **)(__int64))(a1 + 112))(v10);
    }
    HalpProcessorFence();
    if( a2 == HalpPerformanceCounter && HalpTimerFrequenciesMeasured )
    {
      KeQueryPerformanceCounter(0i64);
    }
    else
    {
      HalpTimerGetInternalData((KDPC *)a2, v11, v12, v13);
      (*(void(__fastcall **)(__int64))(a2 + 112))(v14);
    }
    HalpProcessorFence();
    v15 = __rdtsc();
    HalpProcessorFence();
    v16 = v15 - v6;
    if( v16 >= v4 )
      LODWORD(v16) = v4;
    v4 = v16;
    --v5;
  }
  while( v5 );
  return(unsigned int)(4 * v16);
}

Referenced by:

HalpTimerMeasureFrequencies
HalpTimerMeasureProcessorsWorker