// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq/timerbase.h
// Function: dasynq::timer_base<dasynq::v2::child_proc_events<dasynq::v2::dprivate::event_dispatch<dasynq::v2::epoll_traits, dasynq::v2::default_traits<dasynq::null_mutex>>>>::process_timer_queue(dasynq::dary_heap<dasynq::timer_data, dasynq::time_val, dasynq::compare_timespec, 4>&, timespec const&)
void process_timer_queue(timer_queue_t &queue, const struct timespec &curtime) noexcept
    {
        if (queue.empty()) return;

        // Peek timer queue; calculate difference between current time and timeout
        const time_val * timeout = &queue.get_root_priority();
        time_val curtime_tv = curtime;
        while (*timeout <= curtime_tv) {
            auto & thandle = queue.get_root();
            timer_data &data = queue.node_data(thandle);
            time_val &interval = data.interval_time;
            data.expiry_count++;
            queue.pull_root();
            if (interval.seconds() == 0 && interval.nseconds() == 0) {
                // Non periodic timer
                if (data.enabled) {
                    data.enabled = false;
                    int expiry_count = data.expiry_count;
                    data.expiry_count = 0;
                    Base::receive_timer_expiry(thandle, data.userdata, expiry_count);
                }
                if (queue.empty()) {
                    break;
                }
            }
            else {
                // First calculate the overrun in time:
                time_val overrun = time_val(curtime) - time_val(*timeout);

                // Now we have to divide the time overrun by the period to find the
                // interval overrun. This requires a division of a value not representable
                // as a long...
                struct timespec rem;
                data.expiry_count += divide_timespec(overrun, interval, rem);

                // new time is current time + interval - remainder:
                time_val newtime = curtime + interval - rem;

                queue.insert(thandle, newtime);
                if (data.enabled) {
                    data.enabled = false;
                    int expiry_count = data.expiry_count;
                    data.expiry_count = 0;
                    Base::receive_timer_expiry(thandle, data.userdata, expiry_count);
                }
            }

            // repeat until all expired timeouts processed
            timeout = &queue.get_root_priority();
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, 0x18(%rsp)
cmpq $0x0, 0x8(%rsi)
je 0x7a16
movq %rdx, %rbp
movq %rsi, %r14
movq (%rdx), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%rdx), %rax
movq %rax, 0x30(%rsp)
leaq 0x20(%rsp), %r12
movq %rdx, 0x10(%rsp)
movq (%r14), %rbx
movq 0x38(%rsp), %rax
cmpq %rax, (%rbx)
jl 0x7813
jne 0x7a16
movq 0x30(%rsp), %rax
cmpq %rax, 0x8(%rbx)
jg 0x7a16
movq 0x10(%rbx), %r15
incl 0x10(%r15)
movq %r14, %rdi
callq 0x7a26
cmpq $0x0, (%r15)
jne 0x7834
cmpq $0x0, 0x8(%r15)
je 0x7957
movups (%rbp), %xmm0
movaps %xmm0, (%rsp)
movups (%rbx), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rsp, %rdi
movq %r12, %rsi
callq 0x7a2d
movq %rax, %r12
movq (%r15), %rax
xorl %ebx, %ebx
movq %r12, %rbp
subq %rax, %rbp
jge 0x7864
movq %rdx, %r13
jmp 0x78cc
movq 0x8(%r15), %rcx
jne 0x788a
movq %rdx, %r13
subq %rcx, %r13
jl 0x785f
testq %r12, %r12
movq 0x10(%rsp), %rbp
je 0x7a00
xorl %r12d, %r12d
pushq $0x1
popq %rax
movl %eax, %ebx
jmp 0x78d1
movq %rax, (%rsp)
movq %rcx, 0x8(%rsp)
leaq 0x3b9aca00(%rdx), %r13
xorl %esi, %esi
cmpq %rcx, %rdx
cmovgeq %rdx, %r13
setl %sil
subq %rsi, %rbp
subq %rcx, %r13
cmpq %rax, %rbp
jl 0x78c4
jne 0x798d
cmpq %rcx, %r13
jge 0x798d
movq %rax, %rbp
pushq $0x1
popq %rax
movl %eax, %ebx
movq %rbp, %r12
movq 0x10(%rsp), %rbp
addl %ebx, 0x10(%r15)
movups (%rbp), %xmm0
movaps %xmm0, 0x50(%rsp)
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0x7a56
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movq %r12, 0x40(%rsp)
movq %r13, 0x48(%rsp)
leaq 0x20(%rsp), %r12
movq %r12, %rdi
leaq 0x40(%rsp), %rsi
callq 0x7a2d
movq %rax, (%rsp)
movq %rdx, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
movq %rsp, %rdx
callq 0x7194
cmpb $0x1, 0x14(%r15)
jne 0x77f1
movb $0x0, 0x14(%r15)
movl 0x10(%r15), %ecx
andl $0x0, 0x10(%r15)
movq 0x18(%r15), %rdx
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x6b94
jmp 0x77f1
cmpb $0x1, 0x14(%r15)
jne 0x797d
movb $0x0, 0x14(%r15)
movl 0x10(%r15), %ecx
andl $0x0, 0x10(%r15)
movq 0x18(%r15), %rdx
movq 0x18(%rsp), %rdi
movq %r15, %rsi
callq 0x6b94
cmpq $0x0, 0x8(%r14)
jne 0x77f1
jmp 0x7a16
pushq $0x1
popq %r12
cmpq %rbp, %rax
jge 0x79aa
movq %rsp, %rdi
pushq $0x1
popq %rsi
callq 0x7a84
addl %r12d, %r12d
movq (%rsp), %rax
jmp 0x7991
pushq $0x1
popq %rax
movl %eax, %ebx
testl %r12d, %r12d
je 0x78c9
movq 0x8(%rsp), %rcx
movq %rbp, %rax
subq (%rsp), %rax
jg 0x79cd
jne 0x79f0
cmpq %r13, %rcx
jg 0x79f0
leaq 0x3b9aca00(%r13), %rdx
xorl %esi, %esi
cmpq %rcx, %r13
setl %sil
cmovgeq %r13, %rdx
subq %rsi, %rax
subq %rcx, %rdx
addl %r12d, %ebx
movq %rdx, %r13
movq %rax, %rbp
movq %rsp, %rdi
pushq $0x1
popq %rsi
callq 0x7ac9
shrl %r12d
jmp 0x79af
movq %rdx, %rax
cqto
idivq %rcx
movq %rax, %rbx
movq %rdx, %r13
xorl %r12d, %r12d
jmp 0x78d1
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop