KiSetClockInterval

INT64 __fastcall KiSetClockInterval(UINT64 DesiredTime, CHAR a2, UINT64 a3){
  unsigned int v5; 
  __int64 v6; 
  bool v7; 
  __int64 v8; 
  unsigned int v9; 
  UINT64 v10; 
  v5 = DesiredTime;
  if( *(_BYTE *)(a3 + 24) )
    RtlRbRemoveNode((unsigned __int64 *)&KiClockIntervalRequests, a3);
  *(_DWORD *)(a3 + 28) = v5;
  v6 = KiClockIntervalRequests;
  if( (qword_140CEBF08 & 1) != 0 && KiClockIntervalRequests )
    v6 = (unsigned __int64)&KiClockIntervalRequests ^ KiClockIntervalRequests;
  v7 = 0;
  if( v6 )
  {
    while( 1 )
    {
      if( v5 < *(_DWORD *)(v6 + 28) )
      {
        v8 = *(_QWORD *)v6;
        if( (qword_140CEBF08 & 1) != 0 )
        {
          if( !v8 )
            break;
          v8 ^= v6;
        }
        if( !v8 )
          break;
      }
      else
      {
        v8 = *(_QWORD *)(v6 + 8);
        if( (qword_140CEBF08 & 1) != 0 )
        {
          if( !v8 )
            goto LABEL_18;
          v8 ^= v6;
        }
        if( !v8 )
        {
LABEL_18:
          v7 = 1;
          break;
        }
      }
      v6 = v8;
    }
  }
  RtlRbInsertNodeEx((unsigned __int64 *)&KiClockIntervalRequests, v6, v7, a3);
  *(_BYTE *)(a3 + 24) = 1;
  v9 = KiSetClockIntervalToMinimumRequested();
  if( a2 )
    KePseudoHrTimeIncrement = v5;
  v10 = *(unsigned int *)(a3 + 32);
  if( (_DWORD)v10 )
    PoTraceSystemTimerResolutionKernel(v5, v10);
  return v9;
}

Referenced by:

ExpUpdateTimerConfigurationWorker
KiSetVirtualHeteroClockIntervalRequest