HalpAcquireCmosSpinLockAndWait

unsigned __int8 __fastcall HalpAcquireCmosSpinLockAndWait(INT64 a1, INT64 a2, INT64 a3){
  INT64 v3; 
  INT64 v4; 
  int v5; 
  unsigned __int8 result; 
  HalpAcquireCmosSpinLock(a1, a2, a3);
  v5 = 0;
  __outbyte(0x70u, 0xAu);
  while( 1 )
  {
    result = __inbyte(0x71u);
    if( (result & 0x80u) == 0 )
      break;
    if( ++v5 == 100 )
    {
      LOBYTE(v3) = HalpSystemHardwareLockInterruptsEnabled;
      _InterlockedExchange(&HalpSystemHardwareLock, -1);
      v5 = 0;
      if( (_BYTE)HalpSystemHardwareLockInterruptsEnabled )
        _enable();
      HalpAcquireCmosSpinLock(v3, 113i64, v4);
    }
    __outbyte(0x70u, 0xAu);
  }
  return result;
}

Referenced by:

HalpReadCmosTime
HalpSetWakeAlarm
HalpWriteCmosTime