// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::process_events(int)
bool process_events(int limit) noexcept
    {
        loop_mech.lock.lock();
        
        if (limit == 0) {
            return false;
        }
        
        // limit processing to the number of events currently queued, to avoid prolonged processing
        // of watchers which requeueu themselves immediately (including file watchers which are using
        // emulation for watching regular files)
        //
        // If limit is -1 (no limit) we rely on this being always larger than/equal to the number of
        // queued events when cast to size_t (which is unsigned).
        limit = std::min(size_t(limit), loop_mech.num_queued_events());

        base_watcher * pqueue = loop_mech.pull_queued_event();
        bool active = false;
        
        while (pqueue != nullptr) {
        
            pqueue->active = true;
            active = true;
            
            base_bidi_fd_watcher *bbfw = nullptr;
            
            // (Above variables are initialised only to silence compiler warnings).
            
            if (pqueue->watchType == watch_type_t::SECONDARYFD) {
                // construct a pointer to the main watcher, using integer arithmetic to avoid undefined
                // pointer arithmetic:
                uintptr_t rp = (uintptr_t)pqueue;

                // Here we take the offset of a member from a non-standard-layout class, which is
                // specified to have undefined result by the C++ language standard, but which
                // in practice works fine:
                _Pragma ("GCC diagnostic push")
                _Pragma ("GCC diagnostic ignored \"-Winvalid-offsetof\"")
                rp -= offsetof(base_bidi_fd_watcher, out_watcher);
                _Pragma ("GCC diagnostic pop")
                bbfw = (base_bidi_fd_watcher *)rp;

                // issue a secondary dispatch:
                bbfw->dispatch_second(this);
            }
            else {
                pqueue->dispatch(this);
            }

            if (limit > 0) {
                limit--;
                if (limit == 0) break;
            }
            pqueue = loop_mech.pull_queued_event();
        }
        
        loop_mech.lock.unlock();
        return active;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %esi, %esi
je 0x75dd
movq %rdi, %rbx
movq 0x8(%rdi), %r12
testq %r12, %r12
je 0x75dd
movl %esi, %ebp
movq (%rbx), %rax
movq 0x10(%rax), %r14
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5578
addq $-0x10, %r14
je 0x75e0
movl %r12d, %eax
movslq %ebp, %r12
cmpq %r12, %rax
cmovbq %rax, %r12
orb $0x1, 0xc(%r14)
cmpl $0x3, 0x8(%r14)
jne 0x75a5
movq -0x28(%r14), %rax
addq $-0x28, %r14
addq $0x8, %rax
jmp 0x75a8
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *(%rax)
testl %r12d, %r12d
jle 0x75ba
decl %r12d
je 0x75ec
movb $0x1, %r15b
cmpq $0x0, 0x8(%rbx)
je 0x75e0
movq (%rbx), %rax
movq 0x10(%rax), %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5578
addq $-0x10, %r14
jne 0x758b
jmp 0x75e0
xorl %r15d, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %r15b
jmp 0x75e0
nop