HalpTscAdvSynchComputeMinimumDeltaAlternate

NTSTATUS __stdcall HalpTscAdvSynchComputeMinimumDeltaAlternate(UINT64 a1, INT64 a2){
  __int64 v2; 
  int v3; 
  __int64 v4; 
  int v5; 
  unsigned __int64 *v6; 
  __int64 *v7; 
  __int64 v8; 
  unsigned __int64 v9; 
  __int64 v10; 

  v2 = 0i64;
  v3 = a2;
  v4 = 0x7FFFFFFFFFFFFFFFi64;
  v5 = 2;
  v6 = *(unsigned __int64 **)(((unsigned __int64)KeGetCurrentPrcb()->Number << 7) + qword_140C4A418 + 16);
  v7 = *(__int64 **)(((unsigned __int64)(unsigned int)a1 << 7) + qword_140C4A418 + 16);
  while( v3 )
  {
    --v3;
    do
    {
      _mm_pause();
      v8 = *v7;
    }
    while( *v7 == v2 );
    v2 = *v7;
    HalpProcessorFence();
    v9 = __rdtsc();
    *v6 = v9;
    if( v5 )
    {
      --v5;
    }
    else
    {
      v10 = v9 - v8;
      if( v10 < v4 )
        v4 = v10;
    }
  }
  return v4;
}

Referenced by:

HalpTscAdvSynchCalculateRemoteDelta
HalpTscAdvSynchTarget