// File: 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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe700
testb $0x1, %al
jne 0xf811
jmp 0xf816
jmp 0xfa56
movq -0x10(%rbp), %rdi
callq 0xe720
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0xdde0
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xfa60
testb $0x1, %al
jne 0xf846
jmp 0xfa56
movq -0x10(%rbp), %rdi
callq 0xfb00
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xd280
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
callq 0xfb30
movq -0x48(%rbp), %rdi
callq 0xe0f0
cmpq $0x0, (%rax)
jne 0xf8fb
movq -0x48(%rbp), %rdi
callq 0xe0b0
cmpq $0x0, (%rax)
jne 0xf8fb
movq -0x40(%rbp), %rax
testb $0x1, 0x14(%rax)
je 0xf8e2
movq -0x100(%rbp), %rdi
movq -0x40(%rbp), %rax
movb $0x0, 0x14(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdx
movl -0x4c(%rbp), %ecx
callq 0xd2a0
movq -0x10(%rbp), %rdi
callq 0xe700
testb $0x1, %al
jne 0xf8f1
jmp 0xf8f6
jmp 0xfa56
jmp 0xfa44
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0xdde0
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xfb50
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0xd780
movq %rax, -0xa0(%rbp)
movq %rdx, -0x98(%rbp)
movq -0x48(%rbp), %rdi
callq 0xd780
movq %rax, -0xb0(%rbp)
movq %rdx, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x4c10
movl %eax, %ecx
movq -0x40(%rbp), %rax
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0xdde0
movq -0x48(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0xfc60
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xdde0
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xfb50
movq %rax, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0xe470
movq -0x40(%rbp), %rax
testb $0x1, 0x14(%rax)
je 0xfa42
movq -0x100(%rbp), %rdi
movq -0x40(%rbp), %rax
movb $0x0, 0x14(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xf4(%rbp)
movq -0x40(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdx
movl -0xf4(%rbp), %ecx
callq 0xd2a0
jmp 0xfa44
movq -0x10(%rbp), %rdi
callq 0xe720
movq %rax, -0x20(%rbp)
jmp 0xf830
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nop