// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movq %rdx, (%rsp)
cmpq $0x0, 0x8(%rsi)
je 0x7de7
movq %rsi, %r14
movq %rdi, %r15
movq (%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
movq (%r14), %r12
movq 0x20(%rsp), %rax
cmpq %rax, (%r12)
jl 0x7b6a
jne 0x7de7
movq 0x18(%rsp), %rax
cmpq %rax, 0x8(%r12)
jg 0x7de7
movq 0x10(%r12), %rbp
incl 0x10(%rbp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x6dd8
movq (%rbp), %rdi
movq 0x8(%rbp), %r13
movq %rdi, %rax
orq %r13, %rax
jne 0x7be0
cmpb $0x1, 0x14(%rbp)
jne 0x7bd0
movb $0x0, 0x14(%rbp)
movl 0x10(%rbp), %eax
movl $0x0, 0x10(%rbp)
movq 0x18(%rbp), %rsi
addl %eax, 0x48(%rsi)
movl 0x18(%rsi), %eax
addq $0x10, %rsi
movq 0x20(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%r15)
movl %eax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x4ed0
cmpq $0x0, 0x8(%r14)
jne 0x7b46
jmp 0x7de7
movq (%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %r9
movq %rsi, %rdx
subq (%r12), %rdx
movq 0x8(%r12), %rax
leaq 0x3b9aca00(%r9), %rcx
xorl %r8d, %r8d
cmpq %rax, %r9
setl %r8b
cmovgeq %r9, %rcx
subq %rax, %rcx
subq %r8, %rdx
xorl %eax, %eax
movq %rdx, %r10
subq %rdi, %r10
jge 0x7ccf
movq %rdx, %r10
movq %rcx, %rdx
addl %eax, 0x10(%rbp)
leaq (%r9,%r13), %rax
xorl %ecx, %ecx
movl $0x3b9aca00, %r11d      # imm = 0x3B9ACA00
cmpq %r11, %rax
setge %cl
leaq -0x3b9aca00(%r13,%r9), %r8
cmovlq %rax, %r8
leaq (%r8,%r11), %rax
xorl %r9d, %r9d
cmpq %rdx, %r8
cmovgeq %r8, %rax
setl %r9b
subq %rdx, %rax
subq %r10, %rsi
addq %rdi, %rsi
addq %rcx, %rsi
subq %r9, %rsi
movq %rsi, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
leaq 0x28(%rsp), %rdx
callq 0x7362
cmpb $0x1, 0x14(%rbp)
jne 0x7b46
movb $0x0, 0x14(%rbp)
movl 0x10(%rbp), %eax
movl $0x0, 0x10(%rbp)
movq 0x18(%rbp), %rsi
addl %eax, 0x48(%rsi)
movl 0x18(%rsi), %eax
addq $0x10, %rsi
movq 0x20(%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%r15)
movl %eax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x4ed0
jmp 0x7b46
jne 0x7ce1
movq %rcx, %rdx
subq %r13, %rdx
jge 0x7d17
movq %rdi, %r10
jmp 0x7c23
leaq 0x3b9aca00(%rcx), %rdx
xorl %eax, %eax
cmpq %r13, %rcx
setl %al
cmovgeq %rcx, %rdx
subq %rax, %r10
subq %r13, %rdx
movl $0x1, %eax
cmpq %rdi, %r10
jl 0x7c26
jne 0x7d2a
cmpq %r13, %rdx
jge 0x7d2a
movq %rdi, %r10
jmp 0x7c26
testq %rdi, %rdi
je 0x7dd7
movl $0x1, %eax
jmp 0x7ddf
movl $0x1, %eax
movl $0x1, %ecx
movq %rdi, %r11
movq %r13, %r8
cmpq %r10, %rdi
jge 0x7d66
leaq (%r8,%r8), %r12
xorl %ebx, %ebx
cmpq $0x1dcd6500, %r8        # imm = 0x1DCD6500
leaq -0x3b9aca00(%r8,%r8), %r8
cmovlq %r12, %r8
setge %bl
leaq (%rbx,%r11,2), %r11
addl %ecx, %ecx
cmpq %r10, %r11
jl 0x7d3f
movq %r10, %r12
subq %r11, %r12
jg 0x7d75
jne 0x7d96
cmpq %rdx, %r8
jg 0x7d96
leaq 0x3b9aca00(%rdx), %r10
xorl %ebx, %ebx
cmpq %r8, %rdx
setl %bl
cmovgeq %rdx, %r10
subq %rbx, %r12
subq %r8, %r10
addl %ecx, %eax
movq %r10, %rdx
movq %r12, %r10
movq %r8, %rbx
shrq $0x3f, %rbx
addq %r8, %rbx
movq %r11, %r12
shrq $0x3f, %r12
addq %r11, %r12
movl %r11d, %r8d
andl $0x1, %r8d
negl %r8d
sarq %rbx
andl $0x1dcd6500, %r8d       # imm = 0x1DCD6500
addq %rbx, %r8
sarq %r12
movl %ecx, %ebx
shrl %ebx
movq %r12, %r11
cmpl $0x1, %ecx
movl %ebx, %ecx
ja 0x7d66
jmp 0x7c26
movq %rcx, %rax
cqto
idivq %r13
xorl %r10d, %r10d
jmp 0x7c26
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq