LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::all_deps_started()
void service_record::all_deps_started() noexcept
{
    if (onstart_flags.starts_on_console && !have_console) {
        queue_for_console();
        return;
    }

    waiting_for_deps = false;

    if (!bring_up()) {
        service_state = service_state_t::STOPPING;
        failed_to_start();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movw 0x2e(%rax), %ax
shrw $0x3, %ax
andw $0x1, %ax
testw $0x1, %ax
je 0x4d398
movq -0x10(%rbp), %rax
movl 0x10c(%rax), %eax
shrl $0x6, %eax
andl $0x1, %eax
testl $0x1, %eax
jne 0x4d398
movq -0x10(%rbp), %rdi
callq 0x4d4b0
jmp 0x4d3cb
movq -0x10(%rbp), %rdi
movl 0x10c(%rdi), %eax
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x10c(%rdi)
movq (%rdi), %rax
callq *(%rax)
testb $0x1, %al
jne 0x4d3cb
movq -0x10(%rbp), %rdi
movb $0x3, 0x2c(%rdi)
xorl %esi, %esi
movl $0x1, %edx
callq 0x4cf90
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::stop_check_dependents()
bool service_record::stop_check_dependents() noexcept
{
    bool all_deps_stopped = true;
    for (auto dept : dependents) {
        // Note if the dependent is waiting on us, it must be restarting (since the
        // waiting_on flag gets cleared when we stop, and would only be set if the
        // service tries to restart). We can treat that as "stopped" for purposes of
        // checking whether we can transition to stopped state.
        if (dept->is_hard() && dept->holding_acq && !dept->waiting_on) {
            all_deps_stopped = false;
            break;
        }
    }

    return all_deps_stopped;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movb $0x1, -0x9(%rbp)
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x304d0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x30530
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x30500
testb $0x1, %al
jne 0x4d42b
jmp 0x4d479
leaq -0x20(%rbp), %rdi
callq 0x30590
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4e1f0
movb %al, -0x31(%rbp)
jmp 0x4d449
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x4d452
jmp 0x4d46c
movq -0x30(%rbp), %rax
testb $0x1, 0x11(%rax)
je 0x4d46c
movq -0x30(%rbp), %rax
testb $0x1, 0x10(%rax)
jne 0x4d46c
movb $0x0, -0x9(%rbp)
jmp 0x4d479
jmp 0x4d46e
leaq -0x20(%rbp), %rdi
callq 0x306a0
jmp 0x4d418
movb -0x9(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopl (%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::acquired_console()
void service_record::acquired_console() noexcept
{
    waiting_for_console = false;
    have_console = true;

    if (service_state != service_state_t::STARTING) {
        // We got the console but no longer want it.
        release_console();
    }
    else if (check_deps_started()) {
        all_deps_started();
    }
    else {
        // We got the console but can't use it yet.
        release_console();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0x10c(%rax), %ecx
andl $-0x21, %ecx
orl $0x0, %ecx
movl %ecx, 0x10c(%rax)
movl 0x10c(%rax), %ecx
andl $-0x41, %ecx
orl $0x40, %ecx
movl %ecx, 0x10c(%rax)
cmpb $0x1, 0x2c(%rax)
je 0x4d539
movq -0x10(%rbp), %rdi
callq 0x4bfd0
jmp 0x4d55e
movq -0x10(%rbp), %rdi
callq 0x4d2d0
testb $0x1, %al
jne 0x4d548
jmp 0x4d553
movq -0x10(%rbp), %rdi
callq 0x4d350
jmp 0x4d55c
movq -0x10(%rbp), %rdi
callq 0x4bfd0
jmp 0x4d55e
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::started()
void service_record::started() noexcept
{
    // If we start on console but don't keep it, release it now:
    if (have_console && !onstart_flags.runs_on_console) {
        bp_sys::tcsetpgrp(0, bp_sys::getpgrp());
        release_console();
    }

    log_service_started(get_name());
    service_state = service_state_t::STARTED;
    notify_listeners(service_event_t::STARTED);

    if (onstart_flags.rw_ready) {
        rootfs_is_rw();
    }
    if (onstart_flags.log_ready) {
        setup_external_log();
    }

    if (force_stop || desired_state == service_state_t::STOPPED) {
        // We must now stop.
        do_stop();
        return;
    }

    // Notify any dependents whose desired state is STARTED:
    for (auto dept : dependents) {
        if (dept->waiting_on) {
            dept->get_from()->dependency_started();
            dept->waiting_on = false;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x10c(%rax), %eax
shrl $0x6, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x4d5c4
movq -0x30(%rbp), %rax
movw 0x2e(%rax), %ax
shrw $0x2, %ax
andw $0x1, %ax
testw $0x1, %ax
jne 0x4d5c4
callq 0xa1b0
movl %eax, %esi
xorl %edi, %edi
callq 0xaa80
movq -0x30(%rbp), %rdi
callq 0x4bfd0
movq -0x30(%rbp), %rdi
callq 0x2d420
movq %rax, %rdi
callq 0x4d6c0
movq -0x30(%rbp), %rdi
movb $0x2, 0x2c(%rdi)
xorl %esi, %esi
callq 0x4e2a0
movq -0x30(%rbp), %rax
movw 0x2e(%rax), %ax
andw $0x1, %ax
testw $0x1, %ax
je 0x4d5fb
callq 0xdf20
movq -0x30(%rbp), %rax
movw 0x2e(%rax), %ax
shrw %ax
andw $0x1, %ax
testw $0x1, %ax
je 0x4d615
callq 0xd740
movq -0x30(%rbp), %rax
testb $0x1, 0x190(%rax)
jne 0x4d62c
movq -0x30(%rbp), %rax
cmpb $0x0, 0x2d(%rax)
jne 0x4d639
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x4c440
jmp 0x4d6b4
movq -0x30(%rbp), %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x304d0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30530
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x30500
testb $0x1, %al
jne 0x4d674
jmp 0x4d6b4
leaq -0x18(%rbp), %rdi
callq 0x30590
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
testb $0x1, 0x10(%rax)
je 0x4d6a7
movq -0x28(%rbp), %rdi
callq 0x30420
movq %rax, %rdi
callq 0x4c010
movq -0x28(%rbp), %rax
movb $0x0, 0x10(%rax)
jmp 0x4d6a9
leaq -0x18(%rbp), %rdi
callq 0x306a0
jmp 0x4d661
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::forced_stop()
void service_record::forced_stop() noexcept
{
    if (service_state != service_state_t::STOPPED) {
        force_stop = true;
        if (!is_start_pinned()) {
            prop_stop = true;
            services->add_prop_queue(this);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
cmpb $0x0, 0x2c(%rax)
je 0x4d7a6
movq -0x10(%rbp), %rdi
movb $0x1, 0x190(%rdi)
callq 0x4e360
testb $0x1, %al
jne 0x4d7a4
movq -0x10(%rbp), %rsi
movl 0x10c(%rsi), %eax
andl $0xffffdfff, %eax       # imm = 0xFFFFDFFF
orl $0x2000, %eax           # imm = 0x2000
movl %eax, 0x10c(%rsi)
movq 0x148(%rsi), %rdi
callq 0x4e320
jmp 0x4d7a6
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::stop(bool)
void service_record::stop(bool bring_down) noexcept
{
    // Stop; remove activation, and don't self-restart.

    if (start_explicit) {
        start_explicit = false;
        required_by--;
    }

    if (bring_down || required_by == 0) {
        // Set desired state to STOPPED, this will inhibit automatic restart (and will be
        // propagated to dependents)
        desired_state = service_state_t::STOPPED;
    }

    if (is_start_pinned()) {
        return;
    }

    // If our required_by count is 0, we should treat this as a full manual stop regardless
    if (required_by == 0) {
        bring_down = true;
        prop_release = !prop_require;
        if (prop_release) {
            services->add_prop_queue(this);
        }
    }

    if (bring_down && service_state != service_state_t::STOPPED) {
        // Note even if we are already STOPPING we should call do_stop for the case where we need
        // to interrupt any currently ongoing restart of dependents.
        stop_reason = stopped_reason_t::NORMAL;
        do_stop();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl 0x10c(%rax), %eax
shrl $0x8, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x4d827
movq -0x18(%rbp), %rax
movl 0x10c(%rax), %ecx
andl $0xfffffeff, %ecx       # imm = 0xFFFFFEFF
orl $0x0, %ecx
movl %ecx, 0x10c(%rax)
movl 0x110(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x110(%rax)
testb $0x1, -0x9(%rbp)
jne 0x4d83a
movq -0x18(%rbp), %rax
cmpl $0x0, 0x110(%rax)
jne 0x4d842
movq -0x18(%rbp), %rax
movb $0x0, 0x2d(%rax)
movq -0x18(%rbp), %rdi
callq 0x4e360
testb $0x1, %al
jne 0x4d851
jmp 0x4d856
jmp 0x4d8e1
movq -0x18(%rbp), %rax
cmpl $0x0, 0x110(%rax)
jne 0x4d8bc
movq -0x18(%rbp), %rax
movb $0x1, -0x9(%rbp)
movl 0x10c(%rax), %ecx
shrl $0x9, %ecx
andl $0x1, %ecx
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %edx
movl 0x10c(%rax), %ecx
shll $0xa, %edx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
orl %edx, %ecx
movl %ecx, 0x10c(%rax)
movl 0x10c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x4d8ba
movq -0x18(%rbp), %rsi
movq 0x148(%rsi), %rdi
callq 0x4e320
jmp 0x4d8bc
testb $0x1, -0x9(%rbp)
je 0x4d8e1
movq -0x18(%rbp), %rax
cmpb $0x0, 0x2c(%rax)
je 0x4d8e1
movq -0x18(%rbp), %rdi
movl $0x0, 0x1c4(%rdi)
xorl %esi, %esi
callq 0x4c440
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::restart()
bool service_record::restart() noexcept
{
    // Re-start without affecting dependency links/activation. Hard dependents will be similarly
    // restarted.

    if (service_state == service_state_t::STARTED) {
        stop_reason = stopped_reason_t::NORMAL;
        force_stop = true;
        do_stop(true);
        return true;
    }

    // Wrong state
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpb $0x2, 0x2c(%rax)
jne 0x4d92f
movq -0x18(%rbp), %rdi
movl $0x0, 0x1c4(%rdi)
movb $0x1, 0x190(%rdi)
movl $0x1, %esi
callq 0x4c440
movb $0x1, -0x1(%rbp)
jmp 0x4d933
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/service.cc
// Function: service_record::pin_start()
void service_record::pin_start() noexcept
{
    if (!pinned_started) {
        if (!dept_pinned_started) {
            for (auto &dep : depends_on) {
                if (dep.is_hard() && !dep.get_to()->dept_pinned_started) {
                    dep.get_to()->prop_pin_dpt = true;
                    services->add_prop_queue(dep.get_to());
                }
            }
        }
        pinned_started = true;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x10c(%rax), %eax
shrl $0x2, %eax
andl $0x1, %eax
testl $0x1, %eax
jne 0x4dd04
movq -0x30(%rbp), %rax
movl 0x10c(%rax), %eax
shrl $0x3, %eax
andl $0x1, %eax
testl $0x1, %eax
jne 0x4dcee
movq -0x30(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30240
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x30270
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x302a0
testb $0x1, %al
jne 0x4dc54
jmp 0x4dcec
leaq -0x18(%rbp), %rdi
callq 0x302d0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x4e1f0
movb %al, -0x31(%rbp)
jmp 0x4dc6f
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x4dc78
jmp 0x4dcdc
movq -0x28(%rbp), %rdi
callq 0x3cda0
movl 0x10c(%rax), %eax
shrl $0x3, %eax
andl $0x1, %eax
testl $0x1, %eax
jne 0x4dcdc
movq -0x28(%rbp), %rdi
callq 0x3cda0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movl 0x10c(%rcx), %edx
andl $0xffffbfff, %edx       # imm = 0xFFFFBFFF
orl $0x4000, %edx           # imm = 0x4000
movl %edx, 0x10c(%rcx)
movq 0x148(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3cda0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x4e320
jmp 0x4dcde
leaq -0x18(%rbp), %rdi
callq 0x30330
jmp 0x4dc3e
jmp 0x4dcee
movq -0x30(%rbp), %rax
movl 0x10c(%rax), %ecx
andl $-0x5, %ecx
orl $0x4, %ecx
movl %ecx, 0x10c(%rax)
addq $0x40, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/includes/service.h
// Function: service_set::append_console_queue(service_record*)
void append_console_queue(service_record * newTail) noexcept
    {
        bool was_empty = console_queue.is_empty();
        console_queue.append(newTail);
        if (was_empty) {
            enable_console_log(false);
        }
    }

// 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)
addq $0x30, %rdi
callq 0x4ed90
movq -0x20(%rbp), %rdi
andb $0x1, %al
movb %al, -0x11(%rbp)
addq $0x30, %rdi
movq -0x10(%rbp), %rsi
callq 0x4edb0
testb $0x1, -0x11(%rbp)
je 0x4e644
xorl %edi, %edi
callq 0x6b1e0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/includes/service.h
// Function: service_set::pull_console_queue()
void pull_console_queue() noexcept
    {
        if (console_queue.is_empty()) {
            // Discard the log buffer now, because we've potentially blocked output for a while
            // and allowed it to fill with stale messages. (If not much time has passed, the
            // request to discard will be ignored anyway).
            discard_console_log_buffer();
            enable_console_log(true);
        }
        else {
            service_record * front = console_queue.pop_front();
            front->acquired_console();
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x30, %rdi
callq 0x4ed90
testb $0x1, %al
jne 0x4e673
jmp 0x4e684
callq 0x6b480
movl $0x1, %edi
callq 0x6b1e0
jmp 0x4e69e
movq -0x18(%rbp), %rdi
addq $0x30, %rdi
callq 0x4ee80
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4d4f0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/includes/dinit-ll.h
// Function: dlist<service_record, &extract_console_queue(service_record*)>::unlink(service_record*)
void unlink(T *record) noexcept
    {
        auto &node = E(record);
        if (first == record) {
            first = node.next;
            if (first == record) {
                // unlinking the only node in the list:
                first = nullptr;
            }
        }
        E(node.next).prev = node.prev;
        E(node.prev).next = node.next;
        node.next = nullptr;
        node.prev = nullptr;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x16a40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x4ed09
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x4ed07
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
jmp 0x4ed09
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x16a40
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16a40
movq -0x28(%rbp), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/includes/dinit-ll.h
// Function: dlist<service_record, &extract_console_queue(service_record*)>::append(service_record*)
void append(T *e) noexcept
    {
        auto &node = E(e);
        if (first == nullptr) {
            first = e;
            node.next = e;
            node.prev = e;
        }
        else {
            node.next = first;
            node.prev = E(first).prev;
            E(E(first).prev).next = e;
            E(first).prev = e;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x16a40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x18(%rbp)
cmpq $0x0, (%rax)
jne 0x4ee06
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x4ee6e
movq -0x20(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rcx
movq %rdx, (%rcx)
movq (%rax), %rdi
callq 0x16a40
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rcx), %rdx
movq -0x18(%rbp), %rcx
movq %rdx, 0x8(%rcx)
movq -0x10(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movq (%rax), %rdi
callq 0x16a40
movq 0x8(%rax), %rdi
callq 0x16a40
movq -0x30(%rbp), %rdx
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rdx, (%rcx)
movq -0x10(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rdi
callq 0x16a40
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: davmac314[P]dinit/src/includes/dinit-ll.h
// Function: dlist<service_record, &extract_console_queue(service_record*)>::pop_front()
T * pop_front() noexcept
    {
        auto r = first;
        auto &first_node = E(first);
        if (first_node.next == first) {
            // Only one node in the queue:
            first_node.next = nullptr;
            first_node.prev = nullptr;
            first = nullptr;
        }
        else {
            // Unlink first node:
            auto &node = E(first_node.next);
            node.prev = first_node.prev;
            E(node.prev).next = first_node.next;
            first = first_node.next;
            // Return original first node:
            first_node.next = nullptr;
            first_node.prev = nullptr;
        }
        return r;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq (%rax), %rcx
movq %rcx, -0x10(%rbp)
movq (%rax), %rdi
callq 0x16a40
movq -0x28(%rbp), %rcx
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpq (%rcx), %rax
jne 0x4eedb
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movq $0x0, (%rcx)
movq -0x18(%rbp), %rcx
movq $0x0, 0x8(%rcx)
movq $0x0, (%rax)
jmp 0x4ef42
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x16a40
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16a40
movq -0x30(%rbp), %rdx
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rdx, (%rcx)
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: separate_args(ha_string&, std::__cxx11::list<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>> const&)
std::vector<const char *> separate_args(ha_string &s,
        const std::list<std::pair<unsigned,unsigned>> &arg_indices)
{
    std::vector<const char *> r;
    r.reserve(arg_indices.size() + 1);

    // First store nul terminator for each part:
    for (auto index_pair : arg_indices) {
        if (index_pair.second < s.length()) {
            s[index_pair.second] = 0;
        }
    }

    // Now we can get the C string (c_str) and store offsets into it:
    const char * cstr = s.c_str();
    for (auto index_pair : arg_indices) {
        r.push_back(cstr + index_pair.first);
    }
    r.push_back(nullptr);
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x90(%rbp)
movq %rdi, %rax
movq %rax, -0x98(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x15570
movq -0x18(%rbp), %rdi
callq 0x46520
movq -0x90(%rbp), %rdi
movq %rax, %rsi
incq %rsi
callq 0x527f0
jmp 0x4f27e
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x528f0
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
callq 0x52920
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x52950
testb $0x1, %al
jne 0x4f2b3
jmp 0x4f325
leaq -0x40(%rbp), %rdi
callq 0x52980
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x40740
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x4f315
movq -0x10(%rbp), %rdi
movl -0x4c(%rbp), %eax
movl %eax, %esi
callq 0x529b0
movb $0x0, (%rax)
jmp 0x4f315
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x177c0
jmp 0x4f3ea
jmp 0x4f317
leaq -0x40(%rbp), %rdi
callq 0x529d0
jmp 0x4f2a0
movq -0x10(%rbp), %rdi
callq 0x40720
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x528f0
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x52920
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x52950
testb $0x1, %al
jne 0x4f367
jmp 0x4f3a4
leaq -0x68(%rbp), %rdi
callq 0x52980
movq -0x90(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rax
movl -0x78(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x36320
jmp 0x4f397
jmp 0x4f399
leaq -0x68(%rbp), %rdi
callq 0x529d0
jmp 0x4f354
movq -0x90(%rbp), %rdi
movq $0x0, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x36320
jmp 0x4f3c4
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x4f3da
movq -0x90(%rbp), %rdi
callq 0x177c0
movq -0x98(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0xacc0
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: process_service::exec_succeeded()
void process_service::exec_succeeded() noexcept
{
    tracking_child = true;

    // This could be a smooth recovery (state already STARTED). No need to do anything here in
    // that case. Otherwise, we are STARTING or STOPPING:

    if (get_state() == service_state_t::STARTING) {
        if (force_notification_fd != -1 || !notification_var.empty()) {
            // Wait for readiness notification:
            readiness_watcher.set_enabled(event_loop, true);
        }
        else {
            if (waiting_stopstart_timer) {
                process_timer.stop_timer(event_loop);
                waiting_stopstart_timer = false;
            }
            started();
        }
    }
    else if (get_state() == service_state_t::STARTED) {
        // Smooth recovery (is now complete, if we don't need readiness notification)
        if (waiting_stopstart_timer && notification_fd == -1) {
            process_timer.stop_timer(event_loop);
            waiting_stopstart_timer = false;
        }
    }
    else if (get_state() == service_state_t::STOPPING) {
        // stopping, but smooth recovery was in process. That's now over so we can
        // commence normal stop. Note that if pid == -1 the process already stopped,
        // that is correctly handled by bring_down().
        if (stop_check_dependents()) {
            bring_down();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
movb 0x4f4(%rdi), %al
andb $-0x9, %al
orb $0x8, %al
movb %al, 0x4f4(%rdi)
callq 0x2f0d0
cmpb $0x1, %al
jne 0x4f4bd
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x4b0(%rax)
jne 0x4f452
movq -0x10(%rbp), %rdi
addq $0x4b8, %rdi            # imm = 0x4B8
callq 0xac70
testb $0x1, %al
jne 0x4f470
movq -0x10(%rbp), %rdi
addq $0x510, %rdi            # imm = 0x510
leaq 0x596fc(%rip), %rsi     # 0xa8b60
movl $0x1, %edx
callq 0x17c00
jmp 0x4f4b8
movq -0x10(%rbp), %rax
movb 0x4f4(%rax), %al
shrb %al
andb $0x1, %al
testb $0x1, %al
je 0x4f4af
movq -0x10(%rbp), %rdi
addq $0x3b0, %rdi            # imm = 0x3B0
leaq 0x596cc(%rip), %rsi     # 0xa8b60
callq 0x529f0
movq -0x10(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x4f4(%rax)
movq -0x10(%rbp), %rdi
callq 0x4d570
jmp 0x4f544
movq -0x10(%rbp), %rdi
callq 0x2f0d0
cmpb $0x2, %al
jne 0x4f518
movq -0x10(%rbp), %rax
movb 0x4f4(%rax), %al
shrb %al
andb $0x1, %al
testb $0x1, %al
je 0x4f516
movq -0x10(%rbp), %rax
cmpl $-0x1, 0x4e8(%rax)
jne 0x4f516
movq -0x10(%rbp), %rdi
addq $0x3b0, %rdi            # imm = 0x3B0
leaq 0x59665(%rip), %rsi     # 0xa8b60
callq 0x529f0
movq -0x10(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x4f4(%rax)
jmp 0x4f542
movq -0x10(%rbp), %rdi
callq 0x2f0d0
cmpb $0x3, %al
jne 0x4f540
movq -0x10(%rbp), %rdi
callq 0x4d3e0
testb $0x1, %al
jne 0x4f534
jmp 0x4f53e
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x4f540
jmp 0x4f542
jmp 0x4f544
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: service_child_watcher::status_change(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, dasynq::dprivate::proc_status)
dasynq::rearm service_child_watcher::status_change(eventloop_t &loop, pid_t child,
        service_child_watcher::proc_status_t status) noexcept
{
    base_process_service *sr = service;

    sr->pid = -1;
    sr->exit_status = status;

    // Ok, for a process service, any process death which we didn't rig ourselves is a bit... unexpected.
    // Probably, the child died because we asked it to (sr->service_state == STOPPING). But even if we
    // didn't, there's not much we can do.

    // Must stop watch now since handle_exit_status might result in re-launch:
    // (stop_watch instead of deregister, so that we hold watch reservation).
    stop_watch(loop);

    if (sr->waiting_for_execstat) {
        // We still don't have an exec() status from the forked child, wait for that
        // before doing any further processing.
        return dasynq::rearm::NOOP; // hold watch reservation
    }

    if (sr->waiting_stopstart_timer) {
        sr->process_timer.stop_timer(loop);
        sr->waiting_stopstart_timer = false;
    }

    sr->handle_exit_status();
    return dasynq::rearm::NOOP;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rcx, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movq 0x40(%rdi), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl $0xffffffff, 0x4d8(%rax) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
movq -0xc(%rbp), %rcx
movq %rcx, 0x4dc(%rax)
movq -0x20(%rbp), %rsi
callq 0x52b90
movq -0x30(%rbp), %rax
movl 0x10c(%rax), %eax
shrl $0x7, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x4fbb9
movl $0x2, -0x4(%rbp)
jmp 0x4fc06
movq -0x30(%rbp), %rax
movb 0x4f4(%rax), %al
shrb %al
andb $0x1, %al
testb $0x1, %al
je 0x4fbf5
movq -0x30(%rbp), %rdi
addq $0x3b0, %rdi            # imm = 0x3B0
movq -0x20(%rbp), %rsi
callq 0x529f0
movq -0x30(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x4f4(%rax)
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x68(%rax)
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: davmac314[P]dinit/src/proc-service.cc
// Function: stop_child_watcher::status_change(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, dasynq::dprivate::proc_status)
dasynq::rearm stop_child_watcher::status_change(eventloop_t &loop, pid_t child,
        stop_child_watcher::proc_status_t status) noexcept
{
    process_service *sr = service;

    sr->stop_pid = -1;
    sr->stop_status = status;
    stop_watch(loop);

    if (sr->waiting_for_execstat) {
        // no exec status yet, wait for that first
        return dasynq::rearm::NOOP;
    }

    sr->handle_stop_exit();
    sr->services->process_queues();
    return dasynq::rearm::NOOP;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rcx, -0xc(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movq -0x18(%rbp), %rdi
movq 0x40(%rdi), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl $0xffffffff, 0x504(%rax) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
movq -0xc(%rbp), %rcx
movq %rcx, 0x508(%rax)
movq -0x20(%rbp), %rsi
callq 0x52b90
movq -0x30(%rbp), %rax
movl 0x10c(%rax), %eax
shrl $0x7, %eax
andl $0x1, %eax
testl $0x1, %eax
je 0x4fc79
movl $0x2, -0x4(%rbp)
jmp 0x4fc99
movq -0x30(%rbp), %rdi
callq 0x52a50
movq -0x30(%rbp), %rax
movq 0x148(%rax), %rdi
callq 0x173c0
movl $0x2, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: process_service::exec_failed(run_proc_err)
void process_service::exec_failed(run_proc_err errcode) noexcept
{
    log(loglevel_t::ERROR, get_name(), ": execution failed - ",
            exec_stage_descriptions[static_cast<int>(errcode.stage)], ": ", strerror(errcode.st_errno));

    if (waiting_stopstart_timer) {
        process_timer.stop_timer(event_loop);
        waiting_stopstart_timer = false;
    }

    if (notification_fd != -1) {
        readiness_watcher.deregister(event_loop);
        bp_sys::close(notification_fd);
        notification_fd = -1;
    }

    if (get_state() == service_state_t::STARTING) {
        stop_reason = stopped_reason_t::EXECFAILED;
        set_state(service_state_t::STOPPING);
        failed_to_start();
    }
    else {
        // Process service in smooth recovery:
        doing_smooth_recovery = false;
        stop_reason = stopped_reason_t::TERMINATED;
        unrecoverable_stop();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x2d420
movq %rax, -0x30(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x571a4(%rip), %rax     # 0xa75a0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x4(%rbp), %edi
callq 0xa1f0
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rcx
movq %rax, -0x18(%rbp)
movl $0x3, %edi
leaq 0x28650(%rip), %rdx     # 0x78a77
leaq 0x267d8(%rip), %r8      # 0x76c06
leaq -0x18(%rbp), %r9
callq 0x50520
movq -0x20(%rbp), %rax
movb 0x4f4(%rax), %al
shrb %al
andb $0x1, %al
testb $0x1, %al
je 0x50476
movq -0x20(%rbp), %rdi
addq $0x3b0, %rdi            # imm = 0x3B0
leaq 0x58705(%rip), %rsi     # 0xa8b60
callq 0x529f0
movq -0x20(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x4f4(%rax)
movq -0x20(%rbp), %rax
cmpl $-0x1, 0x4e8(%rax)
je 0x504b9
movq -0x20(%rbp), %rdi
addq $0x510, %rdi            # imm = 0x510
leaq 0x586cb(%rip), %rsi     # 0xa8b60
callq 0x17d20
movq -0x20(%rbp), %rax
movl 0x4e8(%rax), %edi
callq 0xad80
jmp 0x504ab
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x4e8(%rax) # imm = 0xFFFFFFFF
movq -0x20(%rbp), %rdi
callq 0x2f0d0
cmpb $0x1, %al
jne 0x504f0
movq -0x20(%rbp), %rdi
movl $0x4, 0x1c4(%rdi)
movl $0x3, %esi
callq 0x52b70
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x4cf90
jmp 0x5050a
movq -0x20(%rbp), %rdi
movb $0x0, 0x5b8(%rdi)
movl $0x6, 0x1c4(%rdi)
callq 0x4d730
addq $0x30, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: bgproc_service::exec_failed(run_proc_err)
void bgproc_service::exec_failed(run_proc_err errcode) noexcept
{
    log(loglevel_t::ERROR, get_name(), ": execution failed - ",
            exec_stage_descriptions[static_cast<int>(errcode.stage)], ": ", strerror(errcode.st_errno));

    if (waiting_stopstart_timer) {
        process_timer.stop_timer(event_loop);
        waiting_stopstart_timer = false;
    }

    if (doing_smooth_recovery) {
        doing_smooth_recovery = false;
        stop_reason = stopped_reason_t::TERMINATED;
        unrecoverable_stop();
    }
    else {
        // Only time we execute is for startup:
        stop_reason = stopped_reason_t::EXECFAILED;
        set_state(service_state_t::STOPPING);
        failed_to_start();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x2d420
movq %rax, -0x30(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x56774(%rip), %rax     # 0xa75a0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movl -0x4(%rbp), %edi
callq 0xa1f0
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rcx
movq %rax, -0x18(%rbp)
movl $0x3, %edi
leaq 0x27c20(%rip), %rdx     # 0x78a77
leaq 0x25da8(%rip), %r8      # 0x76c06
leaq -0x18(%rbp), %r9
callq 0x50520
movq -0x20(%rbp), %rax
movb 0x4f4(%rax), %al
shrb %al
andb $0x1, %al
testb $0x1, %al
je 0x50ea6
movq -0x20(%rbp), %rdi
addq $0x3b0, %rdi            # imm = 0x3B0
leaq 0x57cd5(%rip), %rsi     # 0xa8b60
callq 0x529f0
movq -0x20(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x4f4(%rax)
movq -0x20(%rbp), %rax
testb $0x1, 0x5b8(%rax)
je 0x50ecf
movq -0x20(%rbp), %rdi
movb $0x0, 0x5b8(%rdi)
movl $0x6, 0x1c4(%rdi)
callq 0x4d730
jmp 0x50ef7
movq -0x20(%rbp), %rdi
movl $0x4, 0x1c4(%rdi)
movl $0x3, %esi
callq 0x52b70
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x4cf90
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: scripted_service::exec_failed(run_proc_err)
void scripted_service::exec_failed(run_proc_err errcode) noexcept
{
    log(loglevel_t::ERROR, get_name(), ": execution failed - ",
            exec_stage_descriptions[static_cast<int>(errcode.stage)], ": ", strerror(errcode.st_errno));
    auto current_state = get_state();
    if (current_state == service_state_t::STARTING) {
        stop_reason = stopped_reason_t::EXECFAILED;
        failed_to_start();
    }
    else if (current_state == service_state_t::STOPPING) {
        // We've logged the failure, but it's probably better not to leave the service in
        // STOPPING state:
        stopped();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x2d420
movq %rax, -0x38(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x56164(%rip), %rax     # 0xa75a0
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x4(%rbp), %edi
callq 0xa1f0
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rcx
movq %rax, -0x18(%rbp)
movl $0x3, %edi
leaq 0x27610(%rip), %rdx     # 0x78a77
leaq 0x25798(%rip), %r8      # 0x76c06
leaq -0x18(%rbp), %r9
callq 0x50520
movq -0x28(%rbp), %rdi
callq 0x2f0d0
movb %al, -0x19(%rbp)
cmpb $0x1, -0x19(%rbp)
jne 0x514a5
movq -0x28(%rbp), %rdi
movl $0x4, 0x1c4(%rdi)
xorl %esi, %esi
movl $0x1, %edx
callq 0x4cf90
jmp 0x514b6
cmpb $0x3, -0x19(%rbp)
jne 0x514b4
movq -0x28(%rbp), %rdi
callq 0x4bb20
jmp 0x514b6
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: process_service::kill_with_fire()
void process_service::kill_with_fire() noexcept
{
    base_process_service::kill_with_fire();

    if (stop_pid != -1) {
        log(loglevel_t::WARN, "Service ", get_name(), " stop command, with pid ", pid,
                ", exceeded allowed stop time; killing.");
        pid_t pgid = bp_sys::getpgid(stop_pid);
        if (pgid == -1) {
            // On OpenBSD, not allowed to query pgid of a process in another session, but in that
            // case we know the group anyway:
            pgid = stop_pid;
        }
        bp_sys::kill(-pgid, SIGKILL);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
callq 0x56d10
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x504(%rax)
je 0x51c70
movq -0x18(%rbp), %rdi
callq 0x2d420
movq -0x18(%rbp), %r8
movq %rax, %rdx
addq $0x4d8, %r8             # imm = 0x4D8
movl $0x2, %edi
leaq 0x26de6(%rip), %rsi     # 0x78a0f
leaq 0x26f68(%rip), %rcx     # 0x78b98
leaq 0x26f7a(%rip), %r9      # 0x78bb1
callq 0x51c80
movq -0x18(%rbp), %rax
movl 0x504(%rax), %edi
callq 0xad10
movl %eax, -0xc(%rbp)
cmpl $-0x1, -0xc(%rbp)
jne 0x51c61
movq -0x18(%rbp), %rax
movl 0x504(%rax), %eax
movl %eax, -0xc(%rbp)
xorl %edi, %edi
subl -0xc(%rbp), %edi
movl $0x9, %esi
callq 0xaa90
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: davmac314[P]dinit/src/proc-service.cc
// Function: scripted_service::bring_down()
void scripted_service::bring_down() noexcept
{
    if (pid != -1) {
        // We're already running the stop script; nothing to do.
        return;
    }

    if (stop_command.length() == 0) {
        stopped();
    }
    else if (! start_ps_process(stop_arg_parts, false)) {
        // Couldn't execute stop script, but there's not much we can do:
        stopped();
    }
    else {
        // successfully started stop script: start kill timer:
        if (stop_timeout != time_val(0,0)) {
            process_timer.arm_timer_rel(event_loop, stop_timeout);
            waiting_stopstart_timer = true;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $-0x1, 0x4d8(%rax)
je 0x51cf2
jmp 0x51dc1
movq -0x30(%rbp), %rdi
addq $0x230, %rdi            # imm = 0x230
callq 0x40740
cmpq $0x0, %rax
jne 0x51d16
movq -0x30(%rbp), %rdi
callq 0x4bb20
jmp 0x51dc1
movq -0x30(%rbp), %rdi
movq %rdi, %rsi
addq $0x240, %rsi            # imm = 0x240
xorl %edx, %edx
callq 0x55400
testb $0x1, %al
jne 0x51d3d
movq -0x30(%rbp), %rdi
callq 0x4bb20
jmp 0x51dbf
movq -0x30(%rbp), %rax
addq $0x488, %rax            # imm = 0x488
movq %rax, -0x38(%rbp)
leaq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1c100
movq -0x38(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x52e50
testb $0x1, %al
jne 0x51d6e
jmp 0x51dbd
movq -0x30(%rbp), %rdi
movq %rdi, %rax
addq $0x3b0, %rax            # imm = 0x3B0
movq %rax, -0x40(%rbp)
addq $0x488, %rdi            # imm = 0x488
callq 0x153b0
movq -0x40(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x56dc2(%rip), %rsi     # 0xa8b60
leaq -0x28(%rbp), %rdx
callq 0x18220
movq -0x30(%rbp), %rax
movb 0x4f4(%rax), %cl
andb $-0x3, %cl
orb $0x2, %cl
movb %cl, 0x4f4(%rax)
jmp 0x51dbf
jmp 0x51dc1
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/includes/proc-service.h
// Function: process_service::handle_stop_exit()
void handle_stop_exit() noexcept
    {
        if (!stop_status.did_exit_clean()) {
            if (stop_status.did_exit()) {
                log(loglevel_t::ERROR, "Service ", get_name(), " stop command terminated with exit code ",
                        stop_status.get_exit_status());
            }
            else if (stop_status.was_signalled()) {
                log(loglevel_t::ERROR, "Service ", get_name(), " stop command terminated due to signal ",
                        stop_status.get_signal());
            }
        }

        if (pid == -1 || !tracking_child) {
            // If service process has already finished, we were just waiting for the stop command
            // process:
            stop_issued = false; // reset for next time
            stopped();
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x508, %rdi            # imm = 0x508
callq 0x4e260
testb $0x1, %al
jne 0x52b2a
movq -0x18(%rbp), %rdi
addq $0x508, %rdi            # imm = 0x508
callq 0x4ed70
testb $0x1, %al
jne 0x52a8e
jmp 0x52ad0
movq -0x18(%rbp), %rdi
callq 0x2d420
movq -0x18(%rbp), %rdi
movq %rax, -0x20(%rbp)
addq $0x508, %rdi            # imm = 0x508
callq 0x4e590
movq -0x20(%rbp), %rdx
movl %eax, -0xc(%rbp)
movl $0x3, %edi
leaq 0x25f51(%rip), %rsi     # 0x78a0f
leaq 0x262a2(%rip), %rcx     # 0x78d67
leaq -0xc(%rbp), %r8
callq 0x51e80
jmp 0x52b28
movq -0x18(%rbp), %rdi
addq $0x508, %rdi            # imm = 0x508
callq 0x4e4b0
testb $0x1, %al
jne 0x52ae6
jmp 0x52b26
movq -0x18(%rbp), %rdi
callq 0x2d420
movq -0x18(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x508, %rdi            # imm = 0x508
callq 0x4e500
movq -0x28(%rbp), %rdx
movl %eax, -0x10(%rbp)
movl $0x3, %edi
leaq 0x25ef9(%rip), %rsi     # 0x78a0f
leaq 0x25fd0(%rip), %rcx     # 0x78aed
leaq -0x10(%rbp), %r8
callq 0x51350
jmp 0x52b28
jmp 0x52b2a
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x4d8(%rax)
je 0x52b4a
movq -0x18(%rbp), %rax
movb 0x4f4(%rax), %al
shrb $0x3, %al
andb $0x1, %al
testb $0x1, %al
jne 0x52b63
movq -0x18(%rbp), %rdi
movb 0x500(%rdi), %al
andb $-0x3, %al
orb $0x0, %al
movb %al, 0x500(%rdi)
callq 0x4bb20
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: davmac314[P]dinit/src/includes/dinit-utmp.h
// Function: clear_utmp_entry(char const*, char const*)
inline void clear_utmp_entry(const char *utmp_id, const char *utmp_line)
{
    struct utmpx record;
    memset(&record, 0, sizeof(record));

    record.ut_type = DEAD_PROCESS;
    set_current_time(&record);
    strncpy(record.ut_id, utmp_id, sizeof(record.ut_id));
    strncpy(record.ut_line, utmp_line, sizeof(record.ut_line));

    struct utmpx *result;

    setutxent();

    // Try to find an existing entry by id/line and copy the process ID:
    if (*utmp_id) {
        result = getutxid(&record);
    }
    else {
        result = getutxline(&record);
    }

    if (result) {
        record.ut_pid = result->ut_pid;
    }

    pututxline(&record);
    endutxent();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x190(%rbp), %rdi
xorl %esi, %esi
movl $0x180, %edx            # imm = 0x180
callq 0xa3a0
movw $0x8, -0x190(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x17ce0
leaq -0x190(%rbp), %rdi
addq $0x28, %rdi
movq -0x8(%rbp), %rsi
movl $0x4, %edx
callq 0xa370
leaq -0x190(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
movl $0x20, %edx
callq 0xa370
callq 0xa2e0
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x52cd0
leaq -0x190(%rbp), %rdi
callq 0xab90
movq %rax, -0x198(%rbp)
jmp 0x52ce3
leaq -0x190(%rbp), %rdi
callq 0xacf0
movq %rax, -0x198(%rbp)
cmpq $0x0, -0x198(%rbp)
je 0x52cfd
movq -0x198(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x18c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0xa0c0
callq 0xa120
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw (%rax,%rax)
// File: davmac314[P]dinit/src/includes/dinit-util.h
// Function: complete_read(int, void*, unsigned long)
inline ssize_t complete_read(int fd, void * buf, size_t n)
{
    char * cbuf = static_cast<char *>(buf);
    ssize_t r = 0;
    while ((size_t)r < n) {
        ssize_t res = bp_sys::read(fd, cbuf + r, n - r);
        if (res == 0) {
            return r;
        }
        if (res < 0) {
            if (errno == EINTR) {
                continue;
            }

            // If any other error, and we have successfully read some, return it:
            if (r == 0) {
                return -1;
            }
            else {
                return r;
            }
        }
        r += res;
    }
    return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x52dd6
movl -0xc(%rbp), %edi
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0xaac0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x52d9a
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x52dde
cmpq $0x0, -0x38(%rbp)
jge 0x52dc8
callq 0xa060
cmpl $0x4, (%rax)
jne 0x52dad
jmp 0x52d63
cmpq $0x0, -0x30(%rbp)
jne 0x52dbe
movq $-0x1, -0x8(%rbp)
jmp 0x52dde
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x52dde
movq -0x38(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x52d63
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::child_proc_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_reserved(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)
void add_reserved(event_loop_t &eloop, pid_t child, int prio = DEFAULT_PRIORITY) noexcept
    {
        base_watcher::init();
        this->watch_pid = child;
        this->priority = prio;
        eloop.register_reserved_child(this, child);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x135c0
jmp 0x52e25
movq -0x20(%rbp), %rsi
movl -0x14(%rbp), %eax
movl %eax, 0x30(%rsi)
movl -0x18(%rbp), %eax
movl %eax, 0x18(%rsi)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
callq 0x53ff0
addq $0x20, %rsp
popq %rbp
retq
movq %rax, %rdi
callq 0xfa30
nop
// File: davmac314[P]dinit/src/includes/proc-service.h
// Function: process_service::check_restart()
virtual bool check_restart() noexcept override
    {
        if (max_restart_interval_count != 0) {
            // Check whether we're still in the most recent restart check interval:
            time_val current_time;
            event_loop.get_time(current_time, clock_type::MONOTONIC);
            time_val int_diff = current_time - restart_interval_time;
            if (int_diff < restart_interval) {
                // Within the restart limiting interval; check number of restarts
                if (restart_interval_count >= max_restart_interval_count) {
                    log(loglevel_t::ERROR, "Service ", get_name(), " restarting too quickly; stopping.");
                    set_target_state(service_state_t::STOPPED);
                    return false;
                }
                ++restart_interval_count;
            }
            else {
                // Not within the last limiting interval; start a new interval
                restart_interval_time = current_time;
                restart_interval_count = 1;
            }
        }

        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0x470(%rax)
je 0x531e9
leaq -0x20(%rbp), %rdi
callq 0x18380
leaq 0x55a3f(%rip), %rdi     # 0xa8b60
leaq -0x20(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x53720
movq -0x38(%rbp), %rsi
addq $0x448, %rsi            # imm = 0x448
leaq -0x20(%rbp), %rdi
callq 0x1d430
movq -0x38(%rbp), %rsi
movq %rax, -0x30(%rbp)
movq %rdx, -0x28(%rbp)
addq $0x460, %rsi            # imm = 0x460
leaq -0x30(%rbp), %rdi
callq 0x1d6f0
testb $0x1, %al
jne 0x53167
jmp 0x531c3
movq -0x38(%rbp), %rcx
movl 0x458(%rcx), %eax
cmpl 0x470(%rcx), %eax
jl 0x531ae
movq -0x38(%rbp), %rdi
callq 0x2d420
movq %rax, %rdx
movl $0x3, %edi
leaq 0x2587e(%rip), %rsi     # 0x78a0f
leaq 0x25bf8(%rip), %rcx     # 0x78d90
callq 0x51fb0
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x53760
movb $0x0, -0x1(%rbp)
jmp 0x531ed
movq -0x38(%rbp), %rax
movl 0x458(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x458(%rax)
jmp 0x531e7
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rcx, 0x448(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x450(%rax)
movl $0x1, 0x458(%rax)
jmp 0x531e9
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)