HalpTimerSchedulePeriodicQueries

NTSTATUS __stdcall HalpTimerSchedulePeriodicQueries(){
  _DWORD *v0; 
  INT64 v1; 
  __int64 v2; 
  UINT64 v3; 
  NTSTATUS result; 
  UINT64 v5; 
  UINT64 pullResult; 
  UINT64 v7; 

  pullResult = 0i64;
  v0 = HalpAlwaysOnCounter;
  v1 = HalpPerformanceCounter;
  if( HalpAlwaysOnCounter )
    v0 = (_DWORD *)(-(__int64)(*((_DWORD *)HalpAlwaysOnCounter + 55) < 0x40u) & (unsigned __int64)HalpAlwaysOnCounter);
  KeQueryPerformanceCounter(0i64);
  qword_140C4A498 = *(_QWORD *)&KUSER_SHARED_DATA.SystemTime.LowPart;
  if( RtlULongLongMult(1i64 << *(_DWORD *)(v1 + 220), 0xFAui64, &pullResult) < 0 )
    v3 = 120000i64;
  else
    v3 = pullResult / *(_QWORD *)(v1 + 192);
  v7 = v3;
  if( v0 )
  {
    v5 = RtlULongLongMult(v2 << v0[55], 0xFAui64, &v7) < 0 ? 120000i64 : v7 / *((_QWORD *)v0 + 24);
    if( v5 < v3 )
      v3 = v5;
  }
  if( v3 - 1 > 0x1D4BF )
    LODWORD(v3) = 120000;
  KiSetTimerEx(&HalpTimerPeriodicTimer, (_LARGE_INTEGER)(-10000i64 * (int)v3), (unsigned int)v3, 0, &HalpTimerDpc);
  return result;
}

Referenced by:

HalpTscFallbackToPlatformSource