// File: /workspace/github_cpp_makefile_star2_O1/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:
testl %esi, %esi
je 0x7805
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r14
movq 0x8(%rdi), %rax
movl %eax, %ecx
cmpq %r14, %rcx
cmovbq %rcx, %r14
testq %rax, %rax
je 0x7808
movq (%rbx), %rax
movq 0x10(%rax), %r15
addq $-0x10, %r15
movq %rbx, %rdi
xorl %esi, %esi
callq 0x56d8
jmp 0x780b
xorl %eax, %eax
retq
xorl %r15d, %r15d
testq %r15, %r15
je 0x787c
orb $0x1, 0xc(%r15)
cmpl $0x3, 0x8(%r15)
jne 0x782a
leaq -0x28(%r15), %rdi
movq -0x28(%r15), %rax
addq $0x8, %rax
jmp 0x7830
movq (%r15), %rax
movq %r15, %rdi
movq %rbx, %rsi
callq *(%rax)
testl %r14d, %r14d
jle 0x783f
decl %r14d
je 0x7868
cmpq $0x0, 0x8(%rbx)
je 0x7860
movq (%rbx), %rax
movq 0x10(%rax), %r15
addq $-0x10, %r15
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x56d8
jmp 0x786e
xorl %r15d, %r15d
xorl %r12d, %r12d
jmp 0x786e
xorl %r14d, %r14d
movb $0x1, %r12b
movb $0x1, %al
testb %r12b, %r12b
jne 0x787e
testq %r15, %r15
jne 0x7810
jmp 0x787e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq