LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: davmac314[P]dinit/src/includes/dinit-client.h
// Function: check_protocol_version(int, int, cpbuffer<1024u>&, int)
inline uint16_t check_protocol_version(int minversion, int version, cpbuffer_t &rbuffer, int fd)
{
    using namespace dinit_cptypes;
    constexpr int bufsize = 1;
    char buf[bufsize] = { (char)cp_cmd::QUERYVERSION };
    write_all_x(fd, buf, bufsize);

    wait_for_reply(rbuffer, fd);
    if (rbuffer[0] != (char)cp_rply::CPVERSION) {
        throw cp_read_exception{0};
    }

    // cp_rply::CVERSION, (2 byte) minimum compatible version, (2 byte) actual version
    constexpr int rbufsize = 1 + 2 * sizeof(uint16_t);
    fill_buffer_to(rbuffer, fd, rbufsize);
    uint16_t rminversion;
    uint16_t cpversion;

    rbuffer.extract(reinterpret_cast<char *>(&rminversion), 1, sizeof(uint16_t));
    rbuffer.extract(reinterpret_cast<char *>(&cpversion), 1 + sizeof(uint16_t), sizeof(uint16_t));
    rbuffer.consume(rbufsize);

    if (rminversion > version) {
        // We are too old
        throw cp_old_client_exception();
    }
    if (cpversion < minversion) {
        // Server is too old
        throw cp_old_server_exception();
    }

    return cpversion;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
leaq -0x19(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x3120
movl -0x14(%rbp), %edi
leaq -0x19(%rbp), %rsi
movl $0x1, %edx
callq 0x5150
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x51e0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x5270
movsbl %al, %eax
cmpl $0x3a, %eax
je 0x5097
movl $0x4, %edi
callq 0x3110
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
xorl %esi, %esi
callq 0x55b0
jmp 0x5069
movq -0x40(%rbp), %rdi
leaq 0x147ac(%rip), %rsi     # 0x19820
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x3190
jmp 0x5141
movl $0x5, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl $0x5, %edx
callq 0x55d0
movq -0x10(%rbp), %rdi
leaq -0x32(%rbp), %rsi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x56d0
movq -0x10(%rbp), %rdi
leaq -0x34(%rbp), %rsi
movl $0x3, %edx
movl $0x2, %ecx
callq 0x56d0
movq -0x10(%rbp), %rdi
movl $0x5, %esi
callq 0x5780
movzwl -0x32(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x5111
movl $0x1, %edi
callq 0x3110
movq %rax, %rdi
leaq 0x146e8(%rip), %rsi     # 0x197f0
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movzwl -0x34(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x5137
movl $0x1, %edi
callq 0x3110
movq %rax, %rdi
leaq 0x146da(%rip), %rsi     # 0x19808
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movw -0x34(%rbp), %ax
addq $0x40, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3410
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/includes/dinit-client.h
// Function: wait_for_reply(cpbuffer<1024u>&, int)
inline void wait_for_reply(cpbuffer_t &rbuffer, int fd)
{
    fill_buffer_to(rbuffer, fd, 1);

    while (rbuffer[0] >= 100) {
        // Information packet; discard.
        fill_buffer_to(rbuffer, fd, 2);
        int pktlen = (unsigned char) rbuffer[1];

        rbuffer.consume(1);  // Consume one byte so we'll read one byte of the next packet
        fill_buffer_to(rbuffer, fd, pktlen);
        rbuffer.consume(pktlen - 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl $0x1, %edx
callq 0x55d0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x5270
movsbl %al, %eax
cmpl $0x64, %eax
jl 0x5266
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl $0x2, %edx
callq 0x55d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x5270
movzbl %al, %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x5780
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x55d0
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
subl $0x1, %esi
callq 0x5780
jmp 0x5200
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/shutdown.cc
// Function: subproc_buffer::subproc_buffer(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)
subproc_buffer(dasynq::event_loop_n &loop_p, int out_fd) : loop(loop_p)
    {
        using loop_t = dasynq::event_loop_n;
        using rearm = dasynq::rearm;

        out_watch = loop_t::fd_watcher::add_watch(loop, out_fd, dasynq::OUT_EVENTS,
                [&](loop_t &eloop, int fd, int flags) -> rearm {

            auto fstatus = flush(STDOUT_FILENO);
            if (fstatus == subproc_buffer::fill_status::ENDFILE) {
                return rearm::DISARM;
            }

            return rearm::REARM;
        });
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x5a10
movq -0x28(%rbp), %rax
movl $0xffffffff, 0x1008(%rax) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x100c(%rax) # imm = 0xFFFFFFFF
movq $0x0, 0x1010(%rax)
movq -0x10(%rbp), %rcx
movq %rcx, 0x1018(%rax)
movq 0x1018(%rax), %rdi
movl -0x14(%rbp), %esi
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movl $0x2, %edx
callq 0x5a40
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x1020(%rax)
addq $0x30, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/shutdown.cc
// Function: subproc_buffer::append(char const*)
void append(const char *msg)
    {
        out_watch->set_enabled(loop, true);
        unsigned len = strlen(msg);
        if (subproc_bufsize - get_length() >= len) {
            base::append(msg, len);
        }
        else {
            mark_overflow();
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq 0x1020(%rax), %rdi
movq 0x1018(%rax), %rsi
movl $0x1, %edx
callq 0x7910
movq -0x10(%rbp), %rdi
callq 0x30e0
movq -0x20(%rbp), %rdi
movl %eax, -0x14(%rbp)
callq 0x6520
movl %eax, %ecx
movl $0x1000, %eax           # imm = 0x1000
subl %ecx, %eax
cmpl -0x14(%rbp), %eax
jb 0x53d5
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x79f0
jmp 0x53de
movq -0x20(%rbp), %rdi
callq 0x7ac0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::run(int)
void run(int limit = -1) noexcept
    {
        // Poll the mechanism first, in case high-priority events are pending:
        waitqueue_node<T_Mutex> qnode;
        get_pollwait_lock(qnode);
        loop_mech.pull_events(false);
        release_lock(qnode);

        while (! process_events(limit)) {
            // Pull events from the AEN mechanism and insert them in our internal queue:
            get_pollwait_lock(qnode);
            loop_mech.pull_events(true);
            release_lock(qnode);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
leaq -0xd(%rbp), %rsi
callq 0xe870
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0xe930
jmp 0x545d
movq -0x18(%rbp), %rdi
leaq -0xd(%rbp), %rsi
callq 0x83f0
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xe9f0
xorb $-0x1, %al
testb $0x1, %al
jne 0x547e
jmp 0x54aa
movq -0x18(%rbp), %rdi
leaq -0xd(%rbp), %rsi
callq 0xe870
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xe930
jmp 0x549b
movq -0x18(%rbp), %rdi
leaq -0xd(%rbp), %rsi
callq 0x83f0
jmp 0x546a
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::poll(int)
void poll(int limit = -1) noexcept
    {
        waitqueue_node<T_Mutex> qnode;
        if (poll_attn_lock(qnode)) {
            loop_mech.pull_events(false);
            release_lock(qnode);
        }

        process_events(limit);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
leaq -0xd(%rbp), %rsi
callq 0x106a0
testb $0x1, %al
jne 0x5526
jmp 0x5540
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0xe930
jmp 0x5533
movq -0x18(%rbp), %rdi
leaq -0xd(%rbp), %rsi
callq 0x83f0
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xe9f0
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/includes/dinit-client.h
// Function: fill_buffer_to(cpbuffer<1024u>&, int, int)
inline void fill_buffer_to(cpbuffer_t &buf, int fd, int rlength)
{
    do {
        int r = buf.fill_to(fd, rlength);
        if (r == -1) {
            if (errno != EINTR) {
                throw cp_read_exception(errno);
            }
        }
        else if (r == 0) {
            throw cp_read_exception(0);
        }
        else {
            return;
        }
    }
    while (true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x57e0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x5655
callq 0x3030
cmpl $0x4, (%rax)
je 0x5653
movl $0x4, %edi
callq 0x3110
movq %rax, -0x30(%rbp)
movq %rax, -0x38(%rbp)
callq 0x3030
movq -0x30(%rbp), %rdi
movl (%rax), %esi
callq 0x55b0
jmp 0x5628
movq -0x38(%rbp), %rdi
leaq 0x141ed(%rip), %rsi     # 0x19820
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3190
jmp 0x56b9
jmp 0x56a5
cmpl $0x0, -0x14(%rbp)
jne 0x56a3
movl $0x4, %edi
callq 0x3110
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
xorl %esi, %esi
callq 0x55b0
jmp 0x5678
movq -0x40(%rbp), %rdi
leaq 0x1419d(%rip), %rsi     # 0x19820
xorl %eax, %eax
movl %eax, %edx
callq 0x3400
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3190
jmp 0x56b9
jmp 0x56b3
jmp 0x56a7
movb $0x1, %al
testb $0x1, %al
jne 0x55e2
jmp 0x56b3
addq $0x40, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x3410
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: davmac314[P]dinit/src/includes/cpbuffer.h
// Function: cpbuffer<1024u>::extract(void*, unsigned int, unsigned int)
void extract(void *dest, unsigned index, unsigned length) noexcept
    {
        index += cur_idx;
        if (index >= SIZE) index -= SIZE;
        if (index + length > SIZE) {
            // wrap-around copy
            unsigned half = SIZE - index;
            std::memcpy(dest, buf + index, half);
            std::memcpy(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(dest) + half),
                    buf, length - half);
        }
        else {
            std::memcpy(dest, buf + index, length);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl 0x400(%rax), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
jb 0x570e
movl -0x14(%rbp), %eax
subl $0x400, %eax            # imm = 0x400
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl -0x18(%rbp), %eax
cmpl $0x400, %eax            # imm = 0x400
jbe 0x575d
movq -0x28(%rbp), %rsi
movl $0x400, %eax            # imm = 0x400
subl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rsi
movl -0x1c(%rbp), %eax
movl %eax, %edx
callq 0x31d0
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %eax
addq %rax, %rdi
movl -0x18(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x31d0
jmp 0x5775
movq -0x28(%rbp), %rsi
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rsi
movl -0x18(%rbp), %eax
movl %eax, %edx
callq 0x31d0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/includes/cpbuffer.h
// Function: cpbuffer<1024u>::fill_to(int, unsigned int)
int fill_to(int fd, unsigned rlength) noexcept
    {
        while (length < rlength) {
            int r = fill(fd);
            if (r <= 0) return r;
        }
        return 1;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x404(%rax), %eax
cmpl -0x18(%rbp), %eax
jae 0x5828
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x5840
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jg 0x5826
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x582f
jmp 0x57fa
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/includes/cpbuffer.h
// Function: cpbuffer<1024u>::fill(int)
int fill(int fd) noexcept
    {
        unsigned pos = cur_idx + length;
        if (pos >= SIZE) pos -= SIZE;
        unsigned max_count = std::min(SIZE - pos, SIZE - length);
        ssize_t r = bp_sys::read(fd, buf + pos, max_count);
        if (r >= 0) {
            length += r;
        }
        return r;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movl 0x400(%rcx), %eax
addl 0x404(%rcx), %eax
movl %eax, -0x10(%rbp)
cmpl $0x400, -0x10(%rbp)     # imm = 0x400
jb 0x587a
movl -0x10(%rbp), %eax
subl $0x400, %eax            # imm = 0x400
movl %eax, -0x10(%rbp)
movq -0x30(%rbp), %rcx
movl -0x10(%rbp), %esi
movl $0x400, %eax            # imm = 0x400
movl %eax, %edx
subl %esi, %edx
movl %edx, -0x18(%rbp)
movl 0x404(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x5910
movq %rax, -0x38(%rbp)
jmp 0x58ab
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %eax
addq %rax, %rsi
movl -0x14(%rbp), %eax
movl %eax, %edx
callq 0x3380
movq %rax, -0x40(%rbp)
jmp 0x58d1
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jl 0x58f7
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rdx
movl 0x404(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x404(%rax)
movq -0x28(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopl (%rax)
// File: davmac314[P]dinit/src/includes/dinit-client.h
// Function: write_all(int, void const*, int)
inline int write_all(int fd, const void *buf, int count)
{
    const char *cbuf = static_cast<const char *>(buf);
    int w = 0;
    while (count > 0) {
        int r = write(fd, cbuf, count);
        if (r == -1) {
            if (errno == EINTR) continue;
            return (w > 0) ? w : r;
        }
        w += r;
        cbuf += r;
        count -= r;
    }
    return w;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x59df
movl -0x8(%rbp), %edi
movq -0x20(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0x30b0
movl %eax, -0x28(%rbp)
cmpl $-0x1, -0x28(%rbp)
jne 0x59b8
callq 0x3030
cmpl $0x4, (%rax)
jne 0x599c
jmp 0x5971
cmpl $0x0, -0x24(%rbp)
jle 0x59aa
movl -0x24(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x59b0
movl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x59e5
movl -0x28(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x28(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x5971
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>* dasynq::v2::dprivate::fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_watch<subproc_buffer::subproc_buffer(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)::'lambda'(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)>(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int, subproc_buffer::subproc_buffer(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)::'lambda'(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int))
static fd_watcher<EventLoop> *add_watch(event_loop_t &eloop, int fd, int flags, T watchHndlr)
    {
        class lambda_fd_watcher : public fd_watcher_impl<event_loop_t, lambda_fd_watcher>
        {
            private:
            T watchHndlr;

            public:
            lambda_fd_watcher(T watchHandlr_a) : watchHndlr(watchHandlr_a)
            {
                //
            }

            rearm fd_event(event_loop_t &eloop, int fd, int flags)
            {
                return watchHndlr(eloop, fd, flags);
            }

            void watch_removed() noexcept override
            {
                delete this;
            }
        };
        
        lambda_fd_watcher * lfd = new lambda_fd_watcher(watchHndlr);
        lfd->add_watch(eloop, fd, flags);
        return lfd;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rcx, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl $0x30, %edi
callq 0x3280
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
callq 0x5ae0
jmp 0x5a7d
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x1, %r8d
movl $0x32, %r9d
callq 0x5b20
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x30, %esi
callq 0x3290
movq -0x30(%rbp), %rdi
callq 0x3410
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_watch(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int, bool, int)
void add_watch(event_loop_t &eloop, int fd, int flags, bool enabled = true, int prio = DEFAULT_PRIORITY)
    {
        base_watcher::init();
        this->priority = prio;
        this->watch_fd = fd;
        this->watch_flags = flags;
        eloop.register_fd(this, fd, flags, enabled, true);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x7190
movq -0x28(%rbp), %rsi
movl -0x20(%rbp), %eax
movl %eax, 0x18(%rsi)
movl -0x14(%rbp), %eax
movl %eax, 0x1c(%rsi)
movl -0x18(%rbp), %eax
movl %eax, 0x20(%rsi)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movb -0x19(%rbp), %al
movl $0x1, %r9d
andb $0x1, %al
movzbl %al, %r8d
callq 0x71f0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::fd_watcher_impl<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>, dasynq::v2::dprivate::fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>* dasynq::v2::dprivate::fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_watch<subproc_buffer::subproc_buffer(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)::'lambda'(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)>(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int, subproc_buffer::subproc_buffer(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)::'lambda'(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int))::lambda_fd_watcher>::dispatch(void*)
void dispatch(void *loop_ptr) noexcept override
    {
        EventLoop &loop = *static_cast<EventLoop *>(loop_ptr);

        // In case emulating, clear enabled here; REARM or explicit set_enabled will re-enable.
        this->emulate_enabled = false;

        loop_access::get_base_lock(loop).unlock();

        auto rearm_type = static_cast<Derived *>(this)->fd_event(loop, this->watch_fd, this->event_flags);

        loop_access::get_base_lock(loop).lock();

        if (rearm_type != rearm::REMOVED) {
            this->event_flags = 0;
            this->active = false;
            if (this->deleteme) {
                // We don't want a watch that is marked "deleteme" to re-arm itself.
                rearm_type = rearm::REMOVE;
            }

            rearm_type = loop_access::process_fd_rearm(loop, this, rearm_type);

            post_dispatch(loop, this, rearm_type);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movb 0xc(%rax), %cl
andb $-0x9, %cl
movb %cl, 0xc(%rax)
movq -0x18(%rbp), %rdi
callq 0x5fc0
movq %rax, %rdi
callq 0x5fe0
jmp 0x5c0c
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl 0x1c(%rdi), %edx
movl 0x24(%rdi), %ecx
callq 0x5ff0
movl %eax, -0x2c(%rbp)
jmp 0x5c24
movl -0x2c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5fc0
movq %rax, %rdi
callq 0x6030
jmp 0x5c3d
cmpl $0x4, -0x1c(%rbp)
je 0x5c97
movq -0x28(%rbp), %rax
movl $0x0, 0x24(%rax)
movb 0xc(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0xc(%rax)
movb 0xc(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5c70
movl $0x3, -0x1c(%rbp)
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
callq 0x6040
movq -0x28(%rbp), %rsi
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %edx
callq 0x6070
jmp 0x5c95
jmp 0x5c97
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: void dasynq::v2::dprivate::post_dispatch<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, dasynq::v2::dprivate::base_watcher*, dasynq::rearm)
void post_dispatch(Loop &loop, base_watcher *watcher, rearm rearm_type)
    {
        if (rearm_type == rearm::REMOVE) {
            loop_access::get_base_lock(loop).unlock();
            loop_access::release_watcher(loop, watcher);
            watcher->watch_removed();
            loop_access::get_base_lock(loop).lock();
        }
        else if (rearm_type == rearm::REQUEUE) {
            loop_access::requeue_watcher(loop, watcher);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jne 0x60c4
movq -0x8(%rbp), %rdi
callq 0x5fc0
movq %rax, %rdi
callq 0x5fe0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x68b0
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x8(%rbp), %rdi
callq 0x5fc0
movq %rax, %rdi
callq 0x6030
jmp 0x60d9
cmpl $0x5, -0x14(%rbp)
jne 0x60d7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x68e0
jmp 0x60d9
addq $0x20, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/includes/cpbuffer.h
// Function: cpbuffer<4096u>::get_contiguous_length(char*)
unsigned get_contiguous_length(char *ptr)
    {
        if (length == 0) return 0;

        unsigned eidx = cur_idx + length;
        if (eidx >= SIZE) eidx -= SIZE;
        
        if (buf + eidx > ptr) {
            return (buf + eidx) - ptr;
        }
        else {
            return (buf + SIZE) - ptr;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, 0x1004(%rax)
jne 0x6366
movl $0x0, -0x4(%rbp)
jmp 0x63c7
movq -0x28(%rbp), %rcx
movl 0x1000(%rcx), %eax
addl 0x1004(%rcx), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1000, -0x1c(%rbp)    # imm = 0x1000
jb 0x638d
movl -0x1c(%rbp), %eax
subl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addq %rcx, %rax
cmpq -0x18(%rbp), %rax
jbe 0x63b3
movq -0x28(%rbp), %rax
movl -0x1c(%rbp), %ecx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
jmp 0x63c7
movq -0x28(%rbp), %rax
addq $0x1000, %rax           # imm = 0x1000
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::process_fd_rearm(dasynq::v2::dprivate::base_fd_watcher*, dasynq::rearm)
rearm process_fd_rearm(base_fd_watcher * bfw, rearm rearm_type) noexcept
    {
        bool emulatedfd = static_cast<base_watcher *>(bfw)->emulatefd;

        if (emulatedfd) {
            if (rearm_type == rearm::REARM) {
                bfw->emulate_enabled = true;
                rearm_type = rearm::REQUEUE;
            }
            else if (rearm_type == rearm::DISARM) {
                bfw->emulate_enabled = false;
            }
            else if (rearm_type == rearm::NOOP) {
                if (bfw->emulate_enabled) {
                    rearm_type = rearm::REQUEUE;
                }
            }
        }
        else  if (rearm_type == rearm::REARM) {
            set_fd_enabled_nolock(bfw, bfw->watch_fd,
                    bfw->watch_flags & (IN_EVENTS | OUT_EVENTS), true);
        }
        else if (rearm_type == rearm::DISARM) {
            loop_mech.disable_fd_watch_nolock(bfw->watch_fd, bfw->watch_flags);
        }
        else if (rearm_type == rearm::REMOVE) {
            loop_mech.remove_fd_watch_nolock(bfw->watch_fd, bfw->watch_flags);
        }
        return rearm_type;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movb 0xc(%rax), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x15(%rbp)
testb $0x1, -0x15(%rbp)
je 0x661b
cmpl $0x0, -0x14(%rbp)
jne 0x65da
movq -0x10(%rbp), %rax
movb 0xc(%rax), %cl
andb $-0x9, %cl
orb $0x8, %cl
movb %cl, 0xc(%rax)
movl $0x5, -0x14(%rbp)
jmp 0x6619
cmpl $0x1, -0x14(%rbp)
jne 0x65f2
movq -0x10(%rbp), %rax
movb 0xc(%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, 0xc(%rax)
jmp 0x6617
cmpl $0x2, -0x14(%rbp)
jne 0x6615
movq -0x10(%rbp), %rax
movb 0xc(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x6613
movl $0x5, -0x14(%rbp)
jmp 0x6615
jmp 0x6617
jmp 0x6619
jmp 0x6689
cmpl $0x0, -0x14(%rbp)
jne 0x6647
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x20(%rax), %ecx
andl $0x3, %ecx
movl $0x1, %r8d
callq 0x66a0
jmp 0x6687
cmpl $0x1, -0x14(%rbp)
jne 0x6666
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
callq 0x6700
jmp 0x6685
cmpl $0x3, -0x14(%rbp)
jne 0x6683
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %esi
movq -0x10(%rbp), %rax
movl 0x20(%rax), %edx
callq 0x6730
jmp 0x6685
jmp 0x6687
jmp 0x6689
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/epoll.h
// Function: dasynq::v2::epoll_loop<dasynq::interrupt_channel<dasynq::timer_fd_events<dasynq::v2::child_proc_events<dasynq::v2::dprivate::event_dispatch<dasynq::v2::epoll_traits, dasynq::v2::default_traits<dasynq::null_mutex>>>>, dasynq::null_mutex>>::enable_fd_watch(int, void*, int)
void enable_fd_watch(int fd, void *userdata, int flags) noexcept
    {
        struct epoll_event epevent;
        // epevent.data.fd = fd;
        epevent.data.ptr = userdata;
        epevent.events = 0;
        
        if (flags & ONE_SHOT) {
            epevent.events = EPOLLONESHOT;
        }
        if (flags & IN_EVENTS) {
            epevent.events |= EPOLLIN;
        }
        if (flags & OUT_EVENTS) {
            epevent.events |= EPOLLOUT;
        }
        
        if (epoll_ctl(epfd, EPOLL_CTL_MOD, fd, &epevent) == -1) {
            // Shouldn't be able to fail
            // throw std::system_error(errno, std::system_category());
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x1c(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x67cf
movl $0x40000000, -0x28(%rbp) # imm = 0x40000000
movl -0x1c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x67e3
movl -0x28(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x67f7
movl -0x28(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movl 0xa0(%rax), %edi
movl -0xc(%rbp), %edx
movl $0x3, %esi
leaq -0x28(%rbp), %rcx
callq 0x3340
cmpl $-0x1, %eax
jne 0x6819
jmp 0x6819
addq $0x30, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/daryheap.h
// Function: dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::deallocate(dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::handle_t&)
void deallocate(handle_t & index) noexcept
    {
        num_nodes--;
        index.hd_u.hd.~T();

        // shrink the capacity of hvec if num_nodes is sufficiently less than
        // its current capacity:
        if (num_nodes < hvec.capacity() / 4) {
            hvec.shrink_to(num_nodes * 2);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
movq 0x18(%rdi), %rax
addq $-0x1, %rax
movq %rax, 0x18(%rdi)
movq 0x18(%rdi), %rax
movq %rax, -0x18(%rbp)
callq 0x6a10
movq %rax, %rcx
movq -0x18(%rbp), %rax
shrq $0x2, %rcx
cmpq %rcx, %rax
jae 0x69f5
movq -0x20(%rbp), %rdi
movq 0x18(%rdi), %rsi
addq %rsi, %rsi
callq 0x6a30
jmp 0x69f3
jmp 0x69f5
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/svec.h
// Function: dasynq::svector<dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::heap_node>::change_capacity(unsigned long)
bool change_capacity(size_type c)
            noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
    {
        _Pragma ("GCC diagnostic push")
        _Pragma ("GCC diagnostic ignored \"-Walloc-size-larger-than=\"")

        T *new_storage = (T *)(new (std::nothrow) char[c * sizeof(T)]);
        if (new_storage == nullptr) return false;

        _Pragma ("GCC diagnostic pop")

        // To transfer, we prefer move unless it is throwing and copy exists
        svec_helper::move_helper<T>::move(array, new_storage, size_v);

        delete[] (char *)array;
        array = new_storage;
        capacity_v = c;

        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
imulq $0x18, -0x18(%rbp), %rdi
movq 0x134dc(%rip), %rsi     # 0x19f70
callq 0x33f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6aaa
movb $0x0, -0x1(%rbp)
jmp 0x6aef
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
movq 0x8(%rax), %rdx
callq 0x6b00
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0x6ad8
movq -0x30(%rbp), %rdi
callq 0x3310
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>::interrupt_if_necessary()
void interrupt_if_necessary()
    {
        wait_lock.lock();
        bool attn_q_empty = attn_waitqueue.is_empty(); // (always true for single-threaded loops)
        wait_lock.unlock();

        if (! attn_q_empty) {
            loop_mech.interrupt_wait();
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x160, %rdi            # imm = 0x160
callq 0x6030
movq -0x18(%rbp), %rdi
addq $0x161, %rdi            # imm = 0x161
callq 0x7170
movq -0x18(%rbp), %rdi
andb $0x1, %al
movb %al, -0x9(%rbp)
addq $0x160, %rdi            # imm = 0x160
callq 0x5fe0
testb $0x1, -0x9(%rbp)
jne 0x6c34
movq -0x18(%rbp), %rdi
callq 0x7180
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/daryheap.h
// Function: dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::insert(dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::handle_t&, dasynq::stable_prio<int> const&)
bool insert(handle_t & hnd, const P &pval) noexcept
    {
        hnd.heap_index = hvec.size();
        // emplace an empty node; data/prio will be stored via bubble_down.
        hvec.emplace_back();
        return bubble_down(hvec.size() - 1, &hnd, pval);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x6d30
movq -0x20(%rbp), %rdi
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
callq 0x6d50
jmp 0x6cf6
movq -0x20(%rbp), %rdi
callq 0x6d30
movq -0x20(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x6dd0
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/svec.h
// Function: void dasynq::svector<dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::heap_node>::emplace_back<>()
void emplace_back(U... args)
    {
        if (!ensure_capacity(size_v + 1)) {
            throw std::bad_alloc();
        }
        new (&array[size_v]) T(args...);
        size_v++;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movq 0x8(%rdi), %rsi
addq $0x1, %rsi
xorl %edx, %edx
callq 0x6f10
testb $0x1, %al
jne 0x6da4
movl $0x8, %edi
callq 0x3110
movq %rax, %rdi
movq %rdi, -0x18(%rbp)
callq 0x6fe0
movq -0x18(%rbp), %rdi
movq 0x13228(%rip), %rsi     # 0x19fc0
movq 0x131f1(%rip), %rdx     # 0x19f90
callq 0x3400
movq -0x10(%rbp), %rax
movq (%rax), %rdi
imulq $0x18, 0x8(%rax), %rax
addq %rax, %rdi
callq 0x7020
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
addq $0x20, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/daryheap.h
// Function: dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::bubble_down(unsigned long, dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::handle_t*, dasynq::stable_prio<int> const&)
bool bubble_down(hindex_t pos, handle_t * ohndl, const P &op) noexcept
    {
        Compare lt;
        while (pos > 0) {
            hindex_t parent = (pos - 1) / N;
            if (! lt(op, hvec[parent].prio)) {
                break;
            }

            hvec[pos] = std::move(hvec[parent]);
            hvec[pos].hnd->heap_index = pos;
            pos = parent;
        }

        hvec[pos].hnd = ohndl;
        hvec[pos].prio = std::move(op);
        ohndl->heap_index = pos;

        return pos == 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0x6ea4
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
decq %rax
shrq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rsi
callq 0x7120
movq -0x48(%rbp), %rsi
movq %rax, %rdx
leaq -0x21(%rbp), %rdi
callq 0x70a0
movb %al, -0x39(%rbp)
jmp 0x6e34
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x6e3f
jmp 0x6e3d
jmp 0x6ea4
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x7120
movq -0x38(%rbp), %rdi
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rsi
callq 0x7120
movq -0x58(%rbp), %rcx
movq -0x38(%rbp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rsi
callq 0x7120
movq -0x50(%rbp), %rcx
movq 0x10(%rax), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x6df0
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rsi
callq 0x7120
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rdi
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rsi
callq 0x7120
movq -0x60(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x10(%rbp)
sete %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0x52b0
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/svec.h
// Function: dasynq::svector<dasynq::dary_heap<dasynq::v2::dprivate::empty_node, dasynq::stable_prio<int>, dasynq::compare_stable_prio<int, std::less<int>>, 4>::heap_node>::ensure_capacity(unsigned long, bool)
bool ensure_capacity(size_type c, bool exact = false)
            noexcept(std::is_nothrow_move_constructible<T>::value || std::is_nothrow_copy_constructible<T>::value)
    {
        if (capacity_v >= c) return true;

        if (c > max_size()) return false;

        size_type new_capacity = c;
        if (!exact) {
            if (max_size() / 2 <= capacity_v) {
                new_capacity = max_size();
            }
            else {
                if (capacity_v == 0) {
                    // 4 elements seems a reasonable minimum capacity to begin with
                    new_capacity = 4;
                }
                else {
                    new_capacity = capacity_v * 2;
                }
            }
        }

        return change_capacity(new_capacity);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0x10(%rax), %rax
cmpq -0x18(%rbp), %rax
jb 0x6f42
movb $0x1, -0x1(%rbp)
jmp 0x6fc6
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x7040
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jbe 0x6f61
movb $0x0, -0x1(%rbp)
jmp 0x6fc6
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x6fb4
callq 0x7040
movq -0x30(%rbp), %rcx
shrq %rax
cmpq 0x10(%rcx), %rax
ja 0x6f8c
callq 0x7040
movq %rax, -0x28(%rbp)
jmp 0x6fb2
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x6fa1
movq $0x4, -0x28(%rbp)
jmp 0x6fb0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x28(%rbp)
jmp 0x6fb2
jmp 0x6fb4
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6a70
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/stableheap.h
// Function: dasynq::compare_stable_prio<int, std::less<int>>::operator()(dasynq::stable_prio<int> const&, dasynq::stable_prio<int> const&)
bool operator()(const stable_prio<P> &a, const stable_prio<P> &b)
            noexcept(noexcept(C()) && noexcept(std::declval<C>()(std::declval<P>(),std::declval<P>())))
    {
        C lt;
        if (lt(a.p, b.p)) {
            return true;
        }
        if (lt(b.p, a.p)) {
            return false;
        }
        
        return a.order < b.order;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x21(%rbp), %rdi
callq 0x7140
testb $0x1, %al
jne 0x70cb
jmp 0x70d1
movb $0x1, -0x1(%rbp)
jmp 0x7106
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x21(%rbp), %rdi
callq 0x7140
testb $0x1, %al
jne 0x70e8
jmp 0x70ee
movb $0x0, -0x1(%rbp)
jmp 0x7106
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
setb %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/basewatchers.h
// Function: dasynq::v2::dprivate::base_watcher::init()
void init()
        {
            active = false;
            deleteme = false;
            emulatefd = false;
            emulate_enabled = false;
            child_termd = false;
            prio_queue::init_handle(heap_handle);
            priority = DEFAULT_PRIORITY;
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movb 0xc(%rdi), %al
andb $-0x2, %al
orb $0x0, %al
movb %al, 0xc(%rdi)
movb 0xc(%rdi), %al
andb $-0x3, %al
orb $0x0, %al
movb %al, 0xc(%rdi)
movb 0xc(%rdi), %al
andb $-0x5, %al
orb $0x0, %al
movb %al, 0xc(%rdi)
movb 0xc(%rdi), %al
andb $-0x9, %al
orb $0x0, %al
movb %al, 0xc(%rdi)
movb 0xc(%rdi), %al
andb $-0x11, %al
orb $0x0, %al
movb %al, 0xc(%rdi)
addq $0x10, %rdi
callq 0x7390
movq -0x10(%rbp), %rax
movl $0x32, 0x18(%rax)
addq $0x10, %rsp
popq %rbp
retq
// File: davmac314[P]dinit/src/../dasynq/include/dasynq/epoll.h
// Function: dasynq::v2::epoll_loop<dasynq::interrupt_channel<dasynq::timer_fd_events<dasynq::v2::child_proc_events<dasynq::v2::dprivate::event_dispatch<dasynq::v2::epoll_traits, dasynq::v2::default_traits<dasynq::null_mutex>>>>, dasynq::null_mutex>>::add_fd_watch(int, void*, int, bool, bool)
bool add_fd_watch(int fd, void *userdata, int flags, bool enabled = true, bool soft_fail = false)
    {
        struct epoll_event epevent;
        // epevent.data.fd = fd;
        epevent.data.ptr = userdata;
        epevent.events = 0;
        
        if (flags & ONE_SHOT) {
            epevent.events = EPOLLONESHOT;
        }
        if ((flags & IN_EVENTS) && enabled) {
            epevent.events |= EPOLLIN;
        }
        if ((flags & OUT_EVENTS) && enabled) {
            epevent.events |= EPOLLOUT;
        }

        if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &epevent) == -1) {
            if (soft_fail && errno == EPERM) {
                return false;
            }
            throw std::system_error(errno, std::system_category());
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl %r8d, -0x68(%rbp)
movl %ecx, %eax
movl -0x68(%rbp), %ecx
movl %eax, -0x64(%rbp)
movq %rdx, %rax
movl -0x64(%rbp), %edx
movq %rax, -0x60(%rbp)
movl %esi, %eax
movq -0x60(%rbp), %rsi
movl %eax, -0x54(%rbp)
movq %rdi, %r8
movl -0x54(%rbp), %edi
movb %r9b, %al
movq %r8, -0x10(%rbp)
movl %edi, -0x14(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
andb $0x1, %cl
movb %cl, -0x25(%rbp)
andb $0x1, %al
movb %al, -0x26(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x2e(%rbp)
movl $0x0, -0x32(%rbp)
movl -0x24(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x7495
movl $0x40000000, -0x32(%rbp) # imm = 0x40000000
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x74af
testb $0x1, -0x25(%rbp)
je 0x74af
movl -0x32(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x32(%rbp)
movl -0x24(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x74c9
testb $0x1, -0x25(%rbp)
je 0x74c9
movl -0x32(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x32(%rbp)
movq -0x50(%rbp), %rax
movl 0xa0(%rax), %edi
movl -0x14(%rbp), %edx
movl $0x1, %esi
leaq -0x32(%rbp), %rcx
callq 0x3340
cmpl $-0x1, %eax
jne 0x755f
testb $0x1, -0x26(%rbp)
je 0x74ff
callq 0x3030
cmpl $0x1, (%rax)
jne 0x74ff
movb $0x0, -0x1(%rbp)
jmp 0x7563
movl $0x20, %edi
callq 0x3110
movq %rax, -0x78(%rbp)
movq %rax, -0x80(%rbp)
callq 0x3030
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
callq 0x3140
movq -0x78(%rbp), %rdi
movl -0x6c(%rbp), %esi
movq %rax, %rdx
callq 0x77c0
jmp 0x7531
movq -0x80(%rbp), %rdi
movq 0x12a3c(%rip), %rsi     # 0x19f78
movq 0x12a65(%rip), %rdx     # 0x19fa8
callq 0x3400
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
callq 0x3190
jmp 0x7571
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3410
nopw (%rax,%rax)