LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/service.cc
// Function: service_record::execute_transition()
void service_record::execute_transition() noexcept
{
    if (service_state == service_state_t::STARTING) {
        if (check_deps_started()) {
            waiting_for_deps = false;
            all_deps_started();
        }
    }
    else if (service_state == service_state_t::STOPPING) {
        if (stop_check_dependents()) {
            waiting_for_deps = false;
            if (onstart_flags.kill_all_on_stop) {
                log(loglevel_t::NOTICE, true, "Sending TERM/KILL to all processes...\n");
                kill(-1, SIGTERM);
                sleep(1);
                kill(-1, SIGKILL);
            }
            bring_down();
        }
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzbl 0x2c(%rdi), %eax
cmpl $0x3, %eax
je 0x234f4
cmpl $0x1, %eax
jne 0x23555
leaq 0x118(%rbx), %rax
movq %rax, %rcx
movq (%rcx), %rcx
cmpq %rax, %rcx
je 0x23557
cmpb $0x0, 0x20(%rcx)
je 0x234e4
jmp 0x23555
movq %rbx, %rdi
callq 0x235f0
testb %al, %al
je 0x23555
andb $-0x11, 0x10c(%rbx)
testb $0x8, 0x2f(%rbx)
je 0x2354b
leaq 0x124ef(%rip), %rdx     # 0x35a03
movl $0x1, %edi
movl $0x1, %esi
callq 0x2e40d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0xf, %esi
callq 0x88d0
movl $0x1, %edi
callq 0x8470
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x9, %esi
callq 0x88d0
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x8(%rax)
popq %rbx
retq
andb $-0x11, 0x10c(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x23590
movq %rax, %rdi
callq 0xb74e
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/service.cc
// Function: service_record::check_deps_started()
bool service_record::check_deps_started() noexcept
{
    for (auto & dep : depends_on) {
        if (dep.waiting_on) {
            return false;
        }
    }

    return true;
}

// Assembly:
addq $0x118, %rdi            # imm = 0x118
movq %rdi, %rax
movq (%rax), %rax
cmpq %rdi, %rax
je 0x23588
cmpb $0x1, 0x20(%rax)
jne 0x2357a
cmpq %rdi, %rax
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movb 0x2e(%rdi), %cl
shrb $0x3, %cl
movl 0x10c(%rdi), %eax
testb $0x40, %al
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x235c5
orl $0x20, %eax
movl %eax, 0x10c(%rbx)
movq 0x148(%rbx), %rdi
movq %rbx, %rsi
popq %rbx
jmp 0x23c8c
andl $-0x11, %eax
movl %eax, 0x10c(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testb %al, %al
je 0x235dc
popq %rbx
retq
movb $0x3, 0x2c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
popq %rbx
jmp 0x23316
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq 0x130(%rdi), %rcx
addq $0x130, %rdi            # imm = 0x130
movb $0x1, %al
cmpq %rdi, %rcx
je 0x2362e
movq 0x10(%rcx), %rdx
movl 0x14(%rdx), %esi
testl %esi, %esi
je 0x2361b
cmpl $0x3, %esi
jne 0x23627
cmpb $0x1, 0x10(%rdx)
jne 0x23627
cmpb $0x1, 0x11(%rdx)
jne 0x23627
cmpb $0x1, 0x10(%rdx)
jne 0x2362c
movq (%rcx), %rcx
jmp 0x23600
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0x10c(%rdi), %eax
andl $-0x61, %eax
leal 0x40(%rax), %ecx
movl %ecx, 0x10c(%rdi)
cmpb $0x1, 0x2c(%rdi)
jne 0x2367e
leaq 0x118(%rdi), %rcx
movq %rcx, %rdx
movq (%rdx), %rdx
cmpq %rcx, %rdx
je 0x23590
cmpb $0x0, 0x20(%rdx)
je 0x2366c
movl %eax, 0x10c(%rdi)
movq 0x148(%rdi), %rdi
jmp 0x23cd2
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testb $0x40, 0x10c(%rdi)
je 0x236c8
testb $0x4, 0x2e(%rbx)
jne 0x236c8
callq 0x8190
xorl %edi, %edi
movl %eax, %esi
callq 0x88c0
andb $-0x41, 0x10c(%rbx)
movq 0x148(%rbx), %rdi
callq 0x23cd2
movq 0x8(%rbx), %rdi
callq 0x2e5de
movb $0x2, 0x2c(%rbx)
movq 0x160(%rbx), %r14
testq %r14, %r14
je 0x236f4
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
xorl %edx, %edx
callq *(%rax)
movq (%r14), %r14
jmp 0x236dc
movzwl 0x2e(%rbx), %eax
testb $0x1, %al
je 0x23705
callq 0xb146
movzwl 0x2e(%rbx), %eax
testb $0x2, %al
je 0x2370e
callq 0xae62
cmpb $0x0, 0x190(%rbx)
jne 0x2374d
cmpb $0x0, 0x2d(%rbx)
je 0x2374d
movq 0x130(%rbx), %r14
addq $0x130, %rbx            # imm = 0x130
cmpq %rbx, %r14
je 0x2375c
movq 0x10(%r14), %r15
cmpb $0x1, 0x10(%r15)
jne 0x23748
movq (%r15), %rdi
callq 0x229e4
movb $0x0, 0x10(%r15)
movq (%r14), %r14
jmp 0x2372b
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x22c98
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpb $0x0, 0x2c(%rdi)
je 0x23783
movb $0x1, 0x190(%rdi)
movl 0x10c(%rdi), %eax
testb $0xc, %al
je 0x23784
retq
orl $0x2000, %eax           # imm = 0x2000
movl %eax, 0x10c(%rdi)
movq 0x148(%rdi), %rax
cmpq $0x0, 0x1f8(%rdi)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rdi, %rcx
sete %sil
orb %dl, %sil
jne 0x23783
movq %rcx, 0x1f8(%rdi)
movq %rdi, 0x38(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0x10c(%rdi), %eax
btl $0x8, %eax
jb 0x237dc
movl 0x110(%rdi), %ecx
jmp 0x237f5
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
movl %eax, 0x10c(%rdi)
movl 0x110(%rdi), %ecx
decl %ecx
movl %ecx, 0x110(%rdi)
testl %ecx, %ecx
sete %dl
orb %sil, %dl
cmpb $0x1, %dl
jne 0x23806
movb $0x0, 0x2d(%rdi)
testb $0xc, %al
je 0x2380b
retq
testl %ecx, %ecx
je 0x23816
testb %sil, %sil
jne 0x23860
jmp 0x2380a
leal (%rax,%rax), %ecx
movl $0x400, %edx            # imm = 0x400
andl %edx, %ecx
andl $0xfffffaf3, %eax       # imm = 0xFFFFFAF3
orl %ecx, %eax
xorl %edx, %eax
movl %eax, 0x10c(%rdi)
testl %ecx, %ecx
jne 0x23860
movq 0x148(%rdi), %rax
cmpq $0x0, 0x1f8(%rdi)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rdi, %rcx
sete %sil
orb %dl, %sil
jne 0x23860
movq %rcx, 0x1f8(%rdi)
movq %rdi, 0x38(%rax)
cmpb $0x0, 0x2c(%rdi)
je 0x2380a
movl $0x0, 0x1c4(%rdi)
xorl %esi, %esi
jmp 0x22c98
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0x10c(%rdi), %edx
testb $0x4, %dl
jne 0x23b0c
testb $0x8, %dl
jne 0x23b03
leaq 0x118(%rdi), %rax
movq 0x118(%rdi), %rcx
cmpq %rax, %rcx
je 0x23b03
movl 0x24(%rcx), %edx
testl %edx, %edx
je 0x23aa7
cmpl $0x3, %edx
jne 0x23af5
cmpb $0x1, 0x20(%rcx)
jne 0x23af5
movq 0x18(%rcx), %rdx
movl 0x10c(%rdx), %esi
testb $0x8, %sil
jne 0x23af5
orl $0x4000, %esi           # imm = 0x4000
movl %esi, 0x10c(%rdx)
movq 0x148(%rdi), %rdx
movq 0x18(%rcx), %rsi
cmpq $0x0, 0x1f8(%rsi)
setne %r9b
movq 0x38(%rdx), %r8
cmpq %rsi, %r8
sete %r10b
orb %r9b, %r10b
jne 0x23af5
movq %r8, 0x1f8(%rsi)
movq %rsi, 0x38(%rdx)
movq (%rcx), %rcx
cmpq %rax, %rcx
jne 0x23a95
movl 0x10c(%rdi), %edx
orl $0x4, %edx
movl %edx, 0x10c(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/service.cc
// Function: service_record::unpin()
void service_record::unpin() noexcept
{
    if (pinned_started) {
        pinned_started = false;

        if (dept_pinned_started) return;

        // unpin dependencies
        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());
            }
        }

        // We only need special handling here if service was in STARTED state
        if (service_state == service_state_t::STARTED) {
            // If any dependents are stopping, then force_stop should already be set.

            // If we reached required_by 0, we need to propagate release now (since it wasn't
            // propagated as it normally would be when we hit 0, due to the pin)
            if (required_by == 0) {
                prop_release = true;
                services->add_prop_queue(this);
            }

            if (desired_state == service_state_t::STOPPED || force_stop) {
                do_stop();
                services->process_queues();
            }
        }
    }
    if (pinned_stopped) {
        pinned_stopped = false;
        // We don't need to check state. If we're pinned stopped we can't be required and so desired
        // state should always be stopped.
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x10c(%rdi), %eax
testb $0x4, %al
jne 0x23b38
movl 0x10c(%rbx), %eax
testb $0x2, %al
je 0x23bbf
andl $-0x3, %eax
movl %eax, 0x10c(%rbx)
jmp 0x23bbf
movl %eax, %ecx
andl $-0x5, %ecx
movl %ecx, 0x10c(%rbx)
testb $0x8, %al
jne 0x23bbf
leaq 0x118(%rbx), %rax
movq 0x118(%rbx), %rcx
cmpq %rax, %rcx
je 0x23bc1
movl 0x24(%rcx), %edx
testl %edx, %edx
je 0x23b6c
cmpl $0x3, %edx
jne 0x23bba
cmpb $0x1, 0x20(%rcx)
jne 0x23bba
movq 0x18(%rcx), %rdx
movl 0x10c(%rdx), %esi
testb $0x8, %sil
je 0x23bba
orl $0x4000, %esi           # imm = 0x4000
movl %esi, 0x10c(%rdx)
movq 0x148(%rbx), %rdx
movq 0x18(%rcx), %rsi
cmpq $0x0, 0x1f8(%rsi)
setne %r8b
movq 0x38(%rdx), %rdi
cmpq %rsi, %rdi
sete %r9b
orb %r8b, %r9b
jne 0x23bba
movq %rdi, 0x1f8(%rsi)
movq %rsi, 0x38(%rdx)
movq (%rcx), %rcx
jmp 0x23b55
popq %rbx
retq
cmpb $0x2, 0x2c(%rbx)
jne 0x23b1c
cmpl $0x0, 0x110(%rbx)
jne 0x23c08
orb $0x4, 0x10d(%rbx)
movq 0x148(%rbx), %rax
cmpq $0x0, 0x1f8(%rbx)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
jne 0x23c08
movq %rcx, 0x1f8(%rbx)
movq %rbx, 0x38(%rax)
cmpb $0x0, 0x2d(%rbx)
je 0x23c1b
cmpb $0x1, 0x190(%rbx)
jne 0x23b1c
movq %rbx, %rdi
xorl %esi, %esi
callq 0x22c98
movq 0x148(%rbx), %rdi
callq 0xd37e
jmp 0x23b1c
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq %rdi, %rax
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x23d0f
leaq 0x1e8(%rdi), %rcx
movq 0x1e8(%rdi), %rdx
cmpq %rdi, %rdx
je 0x23d20
movq 0x1f0(%rdi), %rsi
movq %rsi, 0x1f0(%rdx)
movq %rdx, 0x1e8(%rsi)
movq 0x1e8(%rdi), %rdx
jmp 0x23d22
pushq %rax
callq 0x2e2d4
movl $0x1, %edi
popq %rax
jmp 0x2e149
xorl %edx, %edx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq %rdx, 0x30(%rax)
jmp 0x2364a
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x10(%rdx), %rsi
incq %rsi
callq 0x256de
movq (%r14), %r12
cmpq %r14, %r12
je 0x23dca
movl 0x14(%r12), %eax
cmpq %rax, 0x8(%r15)
jbe 0x23dbe
movq (%r15), %rcx
movb $0x0, (%rcx,%rax)
movq (%r12), %r12
cmpq %r14, %r12
jne 0x23dac
movq (%r14), %r12
cmpq %r14, %r12
je 0x23df8
movq (%r15), %r13
leaq 0x8(%rsp), %r15
movl 0x10(%r12), %eax
addq %r13, %rax
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1d63a
movq (%r12), %r12
cmpq %r14, %r12
jne 0x23dd7
leaq 0x8(%rsp), %rsi
movq $0x0, (%rsi)
movq %rbx, %rdi
callq 0x1d63a
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x23e21
jmp 0x23e21
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x23e38
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq %r14, %rdi
callq 0x8ab0
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movq %rdi, %rbx
movb 0x4f4(%rdi), %al
movl %eax, %ecx
orb $0x8, %cl
movb %cl, 0x4f4(%rdi)
movzbl 0x2c(%rdi), %ecx
cmpl $0x3, %ecx
je 0x23edb
cmpl $0x2, %ecx
je 0x23eac
cmpl $0x1, %ecx
jne 0x23ef1
cmpl $-0x1, 0x4b0(%rbx)
jne 0x23ef3
cmpq $0x0, 0x4c0(%rbx)
jne 0x23ef3
testb $0x2, %al
je 0x23ea3
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x22b99(%rip), %rdi     # 0x46a30
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x23690
testb $0x2, %al
je 0x23ef1
cmpl $-0x1, 0x4e8(%rbx)
jne 0x23ef1
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x22b63(%rip), %rdi     # 0x46a30
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
jmp 0x23ef1
movq %rbx, %rdi
callq 0x235f0
testb %al, %al
je 0x23ef1
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x8(%rax)
popq %rbx
retq
addq $0x510, %rbx            # imm = 0x510
leaq 0x22b2f(%rip), %rsi     # 0x46a30
movq %rbx, %rdi
movl $0x1, %edx
popq %rbx
jmp 0xd486
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/proc-service.cc
// Function: exec_status_pipe_watcher::fd_event(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)
rearm exec_status_pipe_watcher::fd_event(eventloop_t &loop, int fd, int flags) noexcept
{
    base_process_service *sr = service;
    sr->waiting_for_execstat = false;

    run_proc_err exec_status;
    int r = read(get_watched_fd(), &exec_status, sizeof(exec_status));
    deregister(loop);
    close(get_watched_fd());

    if (r > 0) {
        // We read an errno code; exec() failed, and the service startup failed.
        if (sr->pid != -1) {
            sr->child_listener.deregister(event_loop, sr->pid);
            sr->reserved_child_watch = false;
            if (sr->waiting_stopstart_timer) {
                sr->process_timer.stop_timer(loop);
                sr->waiting_stopstart_timer = false;
            }
        }
        sr->pid = -1;
        sr->exec_err_info = exec_status;
        sr->exec_failed(exec_status);
    }
    else {
        sr->exec_succeeded();

        if (sr->pid == -1) {
            // Somehow the process managed to complete before we even saw the exec() status.
            sr->handle_exit_status();
        }
    }

    sr->services->process_queues();

    return rearm::REMOVED;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq 0x28(%rdi), %rbx
andl $0xffffff7f, 0x10c(%rbx) # imm = 0xFFFFFF7F
movl 0x1c(%rdi), %edi
movq %rsp, %rsi
movl $0x8, %edx
callq 0x88f0
movq %rax, %r12
movl 0x1c(%r15), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xd520
movl 0x1c(%r15), %edi
callq 0x8b60
testl %r12d, %r12d
jle 0x23fcf
movl 0x4d8(%rbx), %edx
cmpl $-0x1, %edx
je 0x23faf
leaq 0x338(%rbx), %rsi
leaq 0x22ab7(%rip), %rdi     # 0x46a30
callq 0x25fd0
movb 0x4f4(%rbx), %al
movl %eax, %ecx
andb $-0x5, %cl
movb %cl, 0x4f4(%rbx)
testb $0x2, %al
je 0x23faf
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
movq %r14, %rdi
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
movl $0xffffffff, 0x4d8(%rbx) # imm = 0xFFFFFFFF
movq (%rsp), %rsi
movq %rsi, 0x4f8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x70(%rax)
jmp 0x23fea
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x78(%rax)
cmpl $-0x1, 0x4d8(%rbx)
jne 0x23fea
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movq 0x148(%rbx), %rdi
callq 0xd37e
movl $0x4, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xb74e
nop
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/proc-service.cc
// Function: stop_status_pipe_watcher::fd_event(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)
rearm stop_status_pipe_watcher::fd_event(eventloop_t &loop, int fd, int flags) noexcept
{
    process_service *sr = service;
    sr->waiting_for_execstat = false;

    run_proc_err exec_status;
    int r = read(get_watched_fd(), &exec_status, sizeof(exec_status));
    deregister(loop);
    close(get_watched_fd());

    if (r > 0) {
        // We read an errno code; exec() failed, and the service startup failed.
        if (sr->stop_pid != -1) {
            log(loglevel_t::ERROR, "Service ", sr->get_name(), ": could not fork for stop command: ",
                    exec_stage_descriptions[static_cast<int>(exec_status.stage)], ": ",
                    strerror(exec_status.st_errno));

            sr->stop_watcher.deregister(event_loop, sr->stop_pid);
            sr->reserved_child_watch = false;
            sr->stop_pid = -1;
            if (sr->pid != -1) {
                if (sr->term_signal != 0) {
                    sr->kill_pg(sr->term_signal);
                }
                if (!sr->tracking_child) {
                    sr->stop_issued = false;
                    sr->stopped();
                }
            }
        }
    }
    else {
        // Nothing to do really but wait for termination - unless it's already happened, so let's
        // check that now:
        if (sr->stop_pid == -1) {
            sr->handle_stop_exit();
        }
    }

    sr->services->process_queues();

    return rearm::REMOVED;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r14
movq 0x28(%rdi), %rbx
andl $0xffffff7f, 0x10c(%rbx) # imm = 0xFFFFFF7F
movl 0x1c(%rdi), %edi
movq %rsp, %rsi
movl $0x8, %edx
callq 0x88f0
movq %rax, %r15
movl 0x1c(%r14), %edx
movq %r12, %rdi
movq %r14, %rsi
callq 0xd520
movl 0x1c(%r14), %edi
callq 0x8b60
movl 0x504(%rbx), %eax
testl %r15d, %r15d
jle 0x24130
cmpl $-0x1, %eax
je 0x2413d
movslq (%rsp), %r15
leaq 0x21646(%rip), %r12     # 0x456c0
movl 0x4(%rsp), %edi
callq 0x81d0
movq %rax, %r14
leaq 0x119c2(%rip), %rsi     # 0x35a4f
movl $0x3, %edi
callq 0x2e412
movq 0x8(%rbx), %rdi
callq 0x2e520
leaq 0x119b1(%rip), %rdi     # 0x35a58
callq 0x2e520
movq (%r12,%r15,8), %rdi
callq 0x2e520
leaq 0xfafc(%rip), %rdi      # 0x33bb8
callq 0x2e520
movq %r14, %rdi
callq 0x2e53c
leaq 0x540(%rbx), %rsi
movl 0x504(%rbx), %edx
leaq 0x22953(%rip), %rdi     # 0x46a30
callq 0x25fd0
movb 0x4f4(%rbx), %al
andb $-0x5, %al
movb %al, 0x4f4(%rbx)
movl $0xffffffff, 0x504(%rbx) # imm = 0xFFFFFFFF
cmpl $-0x1, 0x4d8(%rbx)
je 0x2413d
movl 0x194(%rbx), %esi
testl %esi, %esi
je 0x2411b
movq %rbx, %rdi
callq 0x27940
movb 0x4f4(%rbx), %al
testb $0x8, %al
jne 0x2413d
andb $-0x3, 0x500(%rbx)
movq %rbx, %rdi
callq 0x22792
jmp 0x2413d
cmpl $-0x1, %eax
jne 0x2413d
movq %rbx, %rdi
callq 0x2577a
movq 0x148(%rbx), %rdi
callq 0xd37e
movl $0x4, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xb74e
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/proc-service.cc
// Function: ready_notify_watcher::fd_event(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)
rearm ready_notify_watcher::fd_event(eventloop_t &, int fd, int flags) noexcept
{
    char buf[128];
    if (service->get_state() == service_state_t::STARTING) {
        // can we actually read anything from the notification pipe?
        int r = bp_sys::read(fd, buf, sizeof(buf));
        if (r > 0) {
            if (service->waiting_stopstart_timer) {
                service->process_timer.stop_timer(event_loop);
                service->waiting_stopstart_timer = false;
            }
            service->started();
        }
        else if (r == 0 || errno != EAGAIN) {
            if (service->waiting_stopstart_timer) {
                service->process_timer.stop_timer(event_loop);
                service->waiting_stopstart_timer = false;
            }
            service->set_state(service_state_t::STOPPING);
            service->failed_to_start(false, false);
            service->bring_down();
        }
        service->services->process_queues();
    }
    else {
        // Just keep consuming data from the pipe:
        int r = bp_sys::read(fd, buf, sizeof(buf));
        if (r == 0) {
            // Process closed write end or terminated
            close(fd);
            service->notification_fd = -1;
            return rearm::DISARM;
        }
    }

    return rearm::REARM;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x88, %rsp
movl %edx, %ebp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
cmpb $0x1, 0x2c(%rax)
jne 0x241cf
movq %rsp, %rsi
movl $0x80, %edx
movl %ebp, %edi
callq 0x88f0
testl %eax, %eax
jle 0x24207
movq 0x28(%rbx), %rsi
testb $0x2, 0x4f4(%rsi)
je 0x241c2
movl 0x3fc(%rsi), %edx
addq $0x3d0, %rsi            # imm = 0x3D0
leaq 0x22882(%rip), %rdi     # 0x46a30
callq 0x25f62
movq 0x28(%rbx), %rax
andb $-0x3, 0x4f4(%rax)
movq 0x28(%rbx), %rsi
movq %rsi, %rdi
callq 0x23690
jmp 0x24262
movq %rsp, %rsi
movl $0x80, %edx
movl %ebp, %edi
callq 0x88f0
movq %rax, %rcx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x24274
movl %ebp, %edi
callq 0x8b60
movq 0x28(%rbx), %rax
movl $0xffffffff, 0x4e8(%rax) # imm = 0xFFFFFFFF
movl $0x1, %eax
jmp 0x24274
je 0x24213
callq 0x8050
cmpl $0xb, (%rax)
je 0x24262
movq 0x28(%rbx), %rsi
testb $0x2, 0x4f4(%rsi)
je 0x24248
movl 0x3fc(%rsi), %edx
addq $0x3d0, %rsi            # imm = 0x3D0
leaq 0x227fc(%rip), %rdi     # 0x46a30
callq 0x25f62
movq 0x28(%rbx), %rax
andb $-0x3, 0x4f4(%rax)
movq 0x28(%rbx), %rsi
movb $0x3, 0x2c(%rsi)
movq %rsi, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x23316
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x28(%rbx), %rax
movq 0x148(%rax), %rdi
callq 0xd37e
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rdi
callq 0xb74e
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq 0x40(%rdi), %rbx
movl $0xffffffff, 0x4d8(%rbx) # imm = 0xFFFFFFFF
movq %rcx, 0x4dc(%rbx)
cmpq $0x0, 0x28(%rdi)
je 0x242b9
movq %rdi, %rsi
addq $0x20, %rsi
leaq 0x28(%r14), %rdi
callq 0xb996
testb $-0x80, 0x10c(%rbx)
jne 0x242f0
testb $0x2, 0x4f4(%rbx)
je 0x242e7
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
movq %r14, %rdi
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movl $0x2, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movq 0x40(%rdi), %rbx
movl $0xffffffff, 0x504(%rbx) # imm = 0xFFFFFFFF
movq %rcx, 0x508(%rbx)
cmpq $0x0, 0x28(%rdi)
je 0x24331
movq %rdi, %rax
addq $0x20, %rax
addq $0x28, %rsi
movq %rsi, %rdi
movq %rax, %rsi
callq 0xb996
testb $-0x80, 0x10c(%rbx)
jne 0x2434e
movq %rbx, %rdi
callq 0x2577a
movq 0x148(%rbx), %rdi
callq 0xd37e
movl $0x2, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r15
movq %rsi, %rdi
shrq $0x20, %rdi
leaq 0x20fda(%rip), %r12     # 0x456c0
callq 0x81d0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl $0x3, %edi
callq 0x2e412
leaq 0x113b4(%rip), %rdi     # 0x35ab7
callq 0x2e520
movq (%r12,%r15,8), %rdi
callq 0x2e520
leaq 0xf4a0(%rip), %rdi      # 0x33bb8
callq 0x2e520
movq %r14, %rdi
callq 0x2e53c
testb $0x2, 0x4f4(%rbx)
je 0x2474e
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x222ee(%rip), %rdi     # 0x46a30
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
cmpl $-0x1, 0x4e8(%rbx)
je 0x24785
leaq 0x510(%rbx), %rsi
movl 0x52c(%rbx), %edx
leaq 0x222c5(%rip), %rdi     # 0x46a30
callq 0xd520
movl 0x4e8(%rbx), %edi
callq 0x8b60
movl $0xffffffff, 0x4e8(%rbx) # imm = 0xFFFFFFFF
cmpb $0x1, 0x2c(%rbx)
jne 0x247b3
movl $0x4, 0x1c4(%rbx)
movb $0x3, 0x2c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x23316
movb $0x0, 0x5b8(%rbx)
movl $0x6, 0x1c4(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x23762
movq %rax, %rdi
callq 0xb74e
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r15
movq %rsi, %rdi
shrq $0x20, %rdi
leaq 0x2096e(%rip), %r12     # 0x456c0
callq 0x81d0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl $0x3, %edi
callq 0x2e412
leaq 0x10d48(%rip), %rdi     # 0x35ab7
callq 0x2e520
movq (%r12,%r15,8), %rdi
callq 0x2e520
leaq 0xee34(%rip), %rdi      # 0x33bb8
callq 0x2e520
movq %r14, %rdi
callq 0x2e53c
testb $0x2, 0x4f4(%rbx)
je 0x24dba
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x21c82(%rip), %rdi     # 0x46a30
callq 0x25f62
andb $-0x3, 0x4f4(%rbx)
cmpb $0x1, 0x5b8(%rbx)
jne 0x24de7
movb $0x0, 0x5b8(%rbx)
movl $0x6, 0x1c4(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x23762
movl $0x4, 0x1c4(%rbx)
movb $0x3, 0x2c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x23316
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %r15
movq %rsi, %rdi
shrq $0x20, %rdi
leaq 0x20622(%rip), %r12     # 0x456c0
callq 0x81d0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl $0x3, %edi
callq 0x2e412
leaq 0x109fc(%rip), %rdi     # 0x35ab7
callq 0x2e520
movq (%r12,%r15,8), %rdi
callq 0x2e520
leaq 0xeae8(%rip), %rdi      # 0x33bb8
callq 0x2e520
movq %r14, %rdi
callq 0x2e53c
movzbl 0x2c(%rbx), %eax
cmpl $0x3, %eax
je 0x2510f
cmpl $0x1, %eax
jne 0x25122
movl $0x4, 0x1c4(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x23316
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x22792
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x27978
cmpl $-0x1, 0x504(%rbx)
je 0x25605
leaq 0x104c2(%rip), %rsi     # 0x35a4f
movl $0x2, %edi
callq 0x2e412
movq 0x8(%rbx), %rdi
callq 0x2e520
leaq 0x10631(%rip), %rdi     # 0x35bd8
callq 0x2e520
movl 0x4d8(%rbx), %ecx
leaq 0x111f3(%rip), %rdx     # 0x367ac
leaq 0xc(%rsp), %r14
movl $0xc, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x89e0
movq %r14, %rdi
callq 0x2e520
leaq 0x10615(%rip), %rdi     # 0x35bf1
callq 0x2e53c
movl 0x504(%rbx), %edi
callq 0x8ae0
cmpl $-0x1, %eax
jne 0x255f7
movl 0x504(%rbx), %eax
negl %eax
movl %eax, %edi
movl $0x9, %esi
callq 0x88d0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0x20, %rsp
cmpl $-0x1, 0x4d8(%rdi)
je 0x25622
addq $0x20, %rsp
popq %rbx
retq
movq %rdi, %rbx
cmpq $0x0, 0x238(%rdi)
je 0x25698
leaq 0x240(%rbx), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x26974
testb %al, %al
je 0x25698
movq 0x488(%rbx), %rax
movq 0x490(%rbx), %rdi
movq %rax, %rcx
orq %rdi, %rcx
je 0x2561c
movl 0x3fc(%rbx), %r9d
xorps %xmm0, %xmm0
movq %rsp, %rcx
movaps %xmm0, (%rcx)
leaq 0x3d0(%rbx), %rsi
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq %rdi, 0x8(%rdx)
leaq 0x213ac(%rip), %rdi     # 0x46a30
movl $0x1, %r8d
callq 0xd65c
orb $0x2, 0x4f4(%rbx)
jmp 0x2561c
movq %rbx, %rdi
addq $0x20, %rsp
popq %rbx
jmp 0x22792
nop
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x50c(%rdi), %ebp
testl %ebp, %ebp
je 0x257f0
movl 0x508(%rbx), %r14d
leaq 0x102b2(%rip), %rsi     # 0x35a4f
movl $0x3, %edi
callq 0x2e412
movq 0x8(%rbx), %rdi
callq 0x2e520
cmpl $0x1, %r14d
jne 0x257bf
leaq 0x105ea(%rip), %rdi     # 0x35da7
jmp 0x257c6
leaq 0x10367(%rip), %rdi     # 0x35b2d
callq 0x2e520
leaq 0x10fda(%rip), %rdx     # 0x367ac
leaq 0x4(%rsp), %r14
movl $0xc, %esi
movq %r14, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x89e0
movq %r14, %rdi
callq 0x2e53c
cmpl $-0x1, 0x4d8(%rbx)
je 0x25802
testb $0x8, 0x4f4(%rbx)
jne 0x25811
andb $-0x3, 0x500(%rbx)
movq %rbx, %rdi
callq 0x22792
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18(%rsp), %r15
movl $0x180, %edx            # imm = 0x180
movq %r15, %rdi
xorl %esi, %esi
callq 0x8350
movw $0x8, (%r15)
movq %rsp, %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x8a10
pshufd $0xe8, (%r12), %xmm0    # xmm0 = mem[0,2,2,3]
movq %xmm0, 0x154(%r15)
leaq 0x40(%rsp), %rdi
movl $0x4, %edx
movq %rbx, %rsi
callq 0x8310
leaq 0x20(%rsp), %rdi
movl $0x20, %edx
movq %r14, %rsi
callq 0x8310
callq 0x8270
cmpb $0x0, (%rbx)
je 0x2589f
leaq 0x18(%rsp), %rdi
callq 0x89c0
jmp 0x258a9
leaq 0x18(%rsp), %rdi
callq 0x8ad0
testq %rax, %rax
je 0x258b5
movl 0x4(%rax), %eax
movl %eax, 0x1c(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x80c0
callq 0x8100
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r14
pushq %rbx
subq $0x10, %rsp
movb $0x1, %bpl
cmpl $0x0, 0x470(%rdi)
je 0x25a85
movq %rdi, %rbx
movq %rsp, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x8560
movq (%r14), %rcx
subq 0x448(%rbx), %rcx
movq 0x8(%r14), %rdx
movq 0x450(%rbx), %rax
movq 0x460(%rbx), %rsi
xorl %edi, %edi
cmpq %rax, %rdx
setl %dil
subq %rdi, %rcx
cmpq %rsi, %rcx
jl 0x25a27
leaq 0x3b9aca00(%rdx), %rdi
cmpq %rax, %rdx
cmovgeq %rdx, %rdi
cmpq %rsi, %rcx
jne 0x25a6d
subq %rax, %rdi
cmpq 0x468(%rbx), %rdi
jge 0x25a6d
movl 0x458(%rbx), %eax
cmpl 0x470(%rbx), %eax
jge 0x25a3f
incl %eax
movl %eax, 0x458(%rbx)
jmp 0x25a85
leaq 0x10009(%rip), %rsi     # 0x35a4f
movl $0x3, %edi
callq 0x2e412
movq 0x8(%rbx), %rdi
callq 0x2e520
leaq 0x10370(%rip), %rdi     # 0x35dd0
callq 0x2e53c
movb $0x0, 0x2d(%rbx)
xorl %ebp, %ebp
jmp 0x25a85
leaq 0x448(%rbx), %rax
movups (%rsp), %xmm0
movups %xmm0, (%rax)
movl $0x1, 0x458(%rbx)
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/proc-service.h
// Function: process_service::~process_service()
~process_service() noexcept
    {
        if (reserved_stop_watch) {
            stop_watcher.unreserve(event_loop);
        }
        if (consumer_for != nullptr) {
            consumer_for->set_log_consumer(nullptr);
        }
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1fcca(%rip), %rax     # 0x45768
movq %rax, (%rdi)
testb $0x1, 0x500(%rdi)
je 0x25ad0
leaq 0x560(%rbx), %rsi
leaq 0x20f78(%rip), %r14     # 0x46a30
leaq 0x28(%r14), %rdi
callq 0x1f214
leaq 0x550(%rbx), %rsi
movq %r14, %rdi
callq 0xc75c
movq 0x5c0(%rbx), %rax
testq %rax, %rax
je 0x25ae7
movq $0x0, 0x188(%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x25d58
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/proc-service.h
// Function: base_process_service::transfer_output_pipe()
std::pair<int,int> transfer_output_pipe() noexcept override
    {
        std::pair<int,int> r { log_input_fd, log_output_fd };
        if (log_type == log_type_id::BUFFER && log_output_fd != -1) {
            log_output_listener.deregister(event_loop);
        }
        log_input_fd = log_output_fd = -1;
        return r;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movl 0x4f0(%rdi), %r15d
movl 0x4ec(%rdi), %eax
movl %eax, %ebx
cmpl $0x2, 0x298(%rdi)
setne %cl
cmpl $-0x1, %eax
sete %al
orb %cl, %al
jne 0x25bdb
leaq 0x408(%r14), %rsi
movl 0x424(%r14), %edx
leaq 0x20e5a(%rip), %rdi     # 0x46a30
callq 0xd520
movq $-0x1, 0x4ec(%r14)
shlq $0x20, %rbx
orq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/includes/proc-service.h
// Function: base_process_service::~base_process_service()
~base_process_service() noexcept
    {
        if (reserved_child_watch) {
            child_listener.unreserve(event_loop);
        }
        process_timer.deregister(event_loop);
        set_log_mode(log_type_id::NONE);
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1fc32(%rip), %rax     # 0x45998
addq $0x10, %rax
movq %rax, (%rdi)
testb $0x4, 0x4f4(%rdi)
je 0x25d9c
leaq 0x358(%rbx), %rsi
leaq 0x20cac(%rip), %r14     # 0x46a30
leaq 0x28(%r14), %rdi
callq 0x1f214
leaq 0x348(%rbx), %rsi
movq %r14, %rdi
callq 0xc75c
leaq 0x3b0(%rbx), %rsi
movl 0x3fc(%rbx), %edx
leaq 0x20c80(%rip), %rdi     # 0x46a30
callq 0x25f1a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1b98e
movq 0x4b8(%rbx), %rdi
leaq 0x4c8(%rbx), %rax
cmpq %rax, %rdi
je 0x25ddd
movq (%rax), %rsi
incq %rsi
callq 0x8620
movq 0x318(%rbx), %rdi
leaq 0x328(%rbx), %rax
cmpq %rax, %rdi
je 0x25dfb
movq (%rax), %rsi
incq %rsi
callq 0x8620
movq 0x300(%rbx), %rdi
testq %rdi, %rdi
je 0x25e16
movq 0x310(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x2d8(%rbx), %rdi
testq %rdi, %rdi
je 0x25e31
movq 0x2e8(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x2a0(%rbx), %rdi
leaq 0x2b0(%rbx), %rax
cmpq %rax, %rdi
je 0x25e4f
movq (%rax), %rsi
incq %rsi
callq 0x8620
movq 0x278(%rbx), %rdi
leaq 0x288(%rbx), %rax
cmpq %rax, %rdi
je 0x25e6d
movq (%rax), %rsi
incq %rsi
callq 0x8620
movq 0x258(%rbx), %rdi
leaq 0x268(%rbx), %rax
cmpq %rax, %rdi
je 0x25e8b
movq (%rax), %rsi
incq %rsi
callq 0x8620
movq 0x240(%rbx), %rdi
testq %rdi, %rdi
je 0x25ea6
movq 0x250(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x230(%rbx), %rdi
testq %rdi, %rdi
je 0x25eb7
callq 0x87c0
movq 0x218(%rbx), %rdi
testq %rdi, %rdi
je 0x25ed2
movq 0x228(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x208(%rbx), %rdi
testq %rdi, %rdi
je 0x25ee3
callq 0x87c0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1e78a