// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::register_fd(dasynq::v2::dprivate::base_fd_watcher*, int, int, bool, bool)
void register_fd(base_fd_watcher *callback, int fd, int eventmask, bool enabled, bool emulate = false)
    {
        std::lock_guard<mutex_t> guard(loop_mech.lock);

        loop_mech.prepare_watcher(callback);

        try {
            if (! loop_mech.add_fd_watch(fd, callback, eventmask | ONE_SHOT, enabled, emulate)) {
                callback->emulatefd = true;
                callback->emulate_enabled = enabled;
                if (enabled) {
                    callback->event_flags = eventmask & IO_EVENTS;
                    if (eventmask & IO_EVENTS) {
                        requeue_watcher(callback);
                    }
                }
            }
            else if (enabled && backend_traits_t::interrupt_after_fd_add) {
                interrupt_if_necessary();
            }
        }
        catch (...) {
            loop_mech.release_watcher(callback);
            throw;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %r8d, -0x54(%rbp)
movl %ecx, %eax
movl -0x54(%rbp), %ecx
movl %eax, -0x50(%rbp)
movl %edx, %eax
movl -0x50(%rbp), %edx
movl %eax, -0x4c(%rbp)
movq %rsi, %rax
movl -0x4c(%rbp), %esi
movq %rax, -0x48(%rbp)
movq %rdi, %r8
movq -0x48(%rbp), %rdi
movb %r9b, %al
movq %r8, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
andb $0x1, %cl
movb %cl, -0x19(%rbp)
andb $0x1, %al
movb %al, -0x1a(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x40(%rbp)
addq $0x28, %rsi
leaq -0x28(%rbp), %rdi
callq 0x73c0
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x73f0
jmp 0x725d
movq -0x40(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0x18(%rbp), %ecx
orl $0x8, %ecx
movzbl -0x1a(%rbp), %r9d
movzbl -0x19(%rbp), %r8d
andl $0x1, %r8d
andl $0x1, %r9d
callq 0x7420
movb %al, -0x55(%rbp)
jmp 0x728a
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x732e
jmp 0x7297
movq -0x10(%rbp), %rax
movb 0xc(%rax), %cl
andb $-0x5, %cl
orb $0x4, %cl
movb %cl, 0xc(%rax)
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movb %cl, %dl
movb 0xc(%rax), %cl
andb $0x1, %dl
shlb $0x3, %dl
andb $-0x9, %cl
orb %dl, %cl
movb %cl, 0xc(%rax)
testb $0x1, -0x19(%rbp)
je 0x732c
movl -0x18(%rbp), %ecx
andl $0x3, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x24(%rax)
movl -0x18(%rbp), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x732a
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6b60
jmp 0x732a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x7371
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdi
callq 0x30d0
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x6940
callq 0x3390
jmp 0x738b
jmp 0x732c
jmp 0x734b
testb $0x1, -0x19(%rbp)
je 0x7349
xorl %eax, %eax
testb $0x1, %al
jne 0x733c
jmp 0x7349
movq -0x40(%rbp), %rdi
callq 0x6be0
jmp 0x7347
jmp 0x7349
jmp 0x734b
jmp 0x7362
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
callq 0x33e0
jmp 0x7360
jmp 0x7371
leaq -0x28(%rbp), %rdi
callq 0x7580
addq $0x60, %rsp
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x7580
movq -0x30(%rbp), %rdi
callq 0x3410
movq %rax, %rdi
callq 0x52b0
nopl (%rax,%rax)