LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/load-service.cc
// Function: check_cycle(std::__cxx11::list<prelim_dep, std::allocator<prelim_dep>>&, service_record*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void check_cycle(service_dep_list &deps, service_record *orig, const std::string &report_svc_name)
{
    linked_uo_set<service_record *> pending;
    for (auto &new_dep : deps) {
        if (new_dep.to == orig) {
            throw service_cyclic_dependency(report_svc_name);
        }
        pending.add_back(new_dep.to);
    }

    for (auto i = pending.begin(); i != pending.end(); ++i) {
        auto &dep_list = (*i)->get_dependencies();
        for (auto &dep : dep_list) {
            if (dep.get_to() == orig) {
                throw service_cyclic_dependency(report_svc_name);
            }
            pending.add_back(dep.get_to());
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq 0x20(%rsp), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbp)
movups %xmm0, 0x10(%rbp)
movups %xmm0, (%rbp)
movq $0x0, 0x30(%rbp)
leaq 0x18(%rsp), %r13
movq %rdi, %rbx
movq (%rbx), %rbx
cmpq %r12, %rbx
je 0x14060
cmpq %r15, 0x10(%rbx)
je 0x14107
leaq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x1e880
jmp 0x14040
movq %r14, 0x8(%rsp)
movq 0x48(%rsp), %rbp
testq %rbp, %rbp
je 0x140b7
leaq 0x18(%rsp), %r12
leaq 0x10(%rsp), %r13
movq (%rbp), %r14
movq 0x118(%r14), %rbx
addq $0x118, %r14            # imm = 0x118
cmpq %r14, %rbx
je 0x140ae
movq 0x18(%rbx), %rax
cmpq %r15, %rax
je 0x140d0
movq %rax, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1e880
movq (%rbx), %rbx
jmp 0x1408b
movq 0x8(%rbp), %rbp
testq %rbp, %rbp
jne 0x14079
leaq 0x20(%rsp), %rdi
callq 0x1eed8
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x40, %edi
callq 0x82c0
movq %rax, %r15
movq %rax, %rdi
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rbp
callq 0x1a582
leaq 0x3114a(%rip), %rsi     # 0x45240
leaq -0x69e3(%rip), %rdx     # 0xd71a
movq %r15, %rdi
callq 0x8aa0
jmp 0x14135
movl $0x40, %edi
callq 0x82c0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1a582
leaq 0x3111a(%rip), %rsi     # 0x45240
leaq -0x6a13(%rip), %rdx     # 0xd71a
movq %r15, %rdi
callq 0x8aa0
jmp 0x1413b
jmp 0x14140
jmp 0x1413b
movq %rax, %r14
jmp 0x14155
movq %rax, %r14
movq %r15, %rdi
callq 0x8440
jmp 0x14155
movq %rax, %r14
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
callq 0x1eed8
movq %r14, %rdi
callq 0x8ab0
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/load-service.cc
// Function: update_command_and_dependencies(base_process_service*, dinit_load::service_settings_wrapper<prelim_dep>&, std::__cxx11::list<service_dep, std::allocator<service_dep>>&)
static void update_command_and_dependencies(base_process_service *service,
        dinit_load::service_settings_wrapper<prelim_dep> &settings,
        std::list<service_dep> &before_deps)
{
    // Get the current command parts
    ha_string orig_cmd; std::vector<const char *> orig_arg_parts;
    service->get_command(orig_cmd, orig_arg_parts);

    // Separate the new command parts and set
    std::vector<const char *> cmd_arg_parts = separate_args(settings.command, settings.command_offsets);
    service->set_command(std::move(settings.command), std::move(cmd_arg_parts));

    try {
        update_depenencies(service, settings, before_deps);
    }
    catch (...) {
        // restore original command
        service->set_command(std::move(orig_cmd), std::move(orig_arg_parts));

        // re-throw the exception
        throw;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x208(%rbx), %rsi
callq 0x1f314
leaq 0x218(%rbx), %rsi
movq %rsp, %rdi
callq 0x1f35e
leaq 0x10(%r15), %rdx
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x23a88
leaq 0x38(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1f2c2
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x14ffc
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x14f55
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x8620
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x14f6b
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14f7a
callq 0x87c0
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x8210
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x1f2c2
callq 0x8920
movq %rax, %rbx
callq 0x8a50
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x14fcf
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x8620
jmp 0x14fcf
movq %rax, %rdi
callq 0xb8be
jmp 0x14fcc
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x14fe5
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x8620
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14ff4
callq 0x87c0
movq %rbx, %rdi
callq 0x8ab0
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/proc-service.h
// Function: base_process_service::set_log_mode(log_type_id)
void set_log_mode(log_type_id log_type) noexcept
    {
        if (this->log_type == log_type) {
            return;
        }
        if (log_output_fd != -1) {
            if (this->log_type == log_type_id::BUFFER) {
                log_output_listener.deregister(event_loop);
            }
            if (!value(log_type).is_in(log_type_id::BUFFER, log_type_id::PIPE)) {
                bp_sys::close(log_output_fd);
                bp_sys::close(log_input_fd);
                log_output_fd = log_input_fd = -1;
            }
        }
        this->log_type = log_type;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x298(%rdi), %eax
cmpl %esi, %eax
je 0x1b96b
movl %esi, %ebx
movq %rdi, %r14
cmpl $-0x1, 0x4ec(%rdi)
je 0x1b964
cmpl $0x2, %eax
jne 0x1b937
leaq 0x408(%r14), %rsi
movl 0x424(%r14), %edx
leaq 0x2b0fe(%rip), %rdi     # 0x46a30
callq 0xda6a
movl %ebx, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
je 0x1b964
movl 0x4ec(%r14), %edi
callq 0x8b60
movl 0x4f0(%r14), %edi
callq 0x8b60
movq $-0x1, 0x4ec(%r14)
movl %ebx, 0x298(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0xb8be
nop
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/service.h
// Function: service_record::service_record(service_set*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, service_type_t, std::__cxx11::list<prelim_dep, std::allocator<prelim_dep>> const&)
service_record(service_set *set, const string &name, service_type_t record_type_p,
            const std::list<prelim_dep> &deplist_p)
        : service_record(set, name)
    {
        services = set;
        service_name = name;
        this->record_type = record_type_p;

        try {
            for (auto & pdep : deplist_p) {
                auto b = depends_on.emplace(depends_on.end(), this, pdep.to, pdep.dep_type);
                try {
                    pdep.to->dependents.push_back(&(*b));
                }
                catch (...) {
                    // we'll roll back one now and re-throw:
                    depends_on.pop_back();
                    throw;
                }
            }
        }
        catch (...) {
            for (auto & dep : depends_on) {
                dep.get_to()->dependents.pop_back();
            }
            throw;
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
callq 0x1c3cc
movq %r12, 0x148(%rbx)
leaq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0x8340
movl %ebp, 0x28(%rbx)
movq (%r15), %r13
cmpq %r15, %r13
je 0x1baf4
leaq 0x118(%rbx), %r14
movl $0x28, %edi
callq 0x8600
movq %rax, %r12
movq 0x10(%r13), %rax
movl 0x18(%r13), %ecx
movq %rbx, 0x10(%r12)
movq %rax, 0x18(%r12)
movw $0x0, 0x20(%r12)
movl %ecx, 0x24(%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0x8060
incq 0x128(%rbx)
movq 0x10(%r13), %rbp
movl $0x18, %edi
callq 0x8600
addq $0x10, %r12
leaq 0x130(%rbp), %rsi
movq %r12, 0x10(%rax)
movq %rax, %rdi
callq 0x8060
incq 0x140(%rbp)
movq (%r13), %r13
cmpq %r15, %r13
jne 0x1ba81
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x1bb77
movq %rax, %r15
jmp 0x1bb2c
movq %rax, %rdi
callq 0x8210
movq %r14, %rdi
callq 0x1e6f4
callq 0x8920
jmp 0x1bb6f
movq %rax, %r15
callq 0x8a50
movq %r15, %rdi
callq 0x8210
movq (%r14), %r12
cmpq %r14, %r12
je 0x1bb6a
movq 0x18(%r12), %rax
movq 0x138(%rax), %r15
decq 0x140(%rax)
movq %r15, %rdi
callq 0x8a40
movl $0x18, %esi
movq %r15, %rdi
callq 0x8620
movq (%r12), %r12
jmp 0x1bb37
callq 0x8920
movq %rax, %r14
callq 0x8a50
movq %rbx, %rdi
callq 0x1e714
movq %r14, %rdi
callq 0x8ab0
movq %rax, %rdi
callq 0xb8be
nop
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/service.h
// Function: placeholder_service::get_output_pipe_fd()
int get_output_pipe_fd() noexcept override
    {
        if (log_input_fd != -1) {
            return log_input_fd;
        }

        int pipefds[2];
        if (bp_sys::pipe2(pipefds, O_CLOEXEC) == -1) {
            log(loglevel_t::ERROR, get_name(), " (placeholder): Can't open output pipe: ", std::strerror(errno));
            return -1;
        }
        log_input_fd = pipefds[0];
        log_output_fd = pipefds[1];
        return log_input_fd;
    }

// Assembly:
movl 0x20c(%rdi), %eax
cmpl $-0x1, %eax
je 0x1e65e
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %rdi
movl $0x80000, %esi          # imm = 0x80000
callq 0x83e0
cmpl $-0x1, %eax
je 0x1e68c
movl (%rsp), %eax
movl %eax, 0x20c(%rbx)
movl 0x4(%rsp), %ecx
movl %ecx, 0x208(%rbx)
jmp 0x1e6c2
callq 0x8050
movl (%rax), %edi
callq 0x81d0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl $0x3, %edi
callq 0x2e63a
leaq 0x16570(%rip), %rdi     # 0x34c20
callq 0x2e73d
movq %r14, %rdi
callq 0x2e759
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/dinit-util.h
// Function: linked_uo_set<service_record*, std::hash<service_record*>, std::equal_to<service_record*>>::add_back(service_record* const&)
bool add_back(const value_type &value)
    {
        auto it_b = backing.insert({value, nullptr});
        if (it_b.second) {
            auto *new_ent = &(*it_b.first);
            if (last != nullptr) {
                last->next = new_ent;
            }
            last = new_ent;
            if (first == nullptr) {
                first = new_ent;
            }
            return true;
        }
        return false;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq (%rsi), %rax
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq $0x0, 0x8(%rdx)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1e8e2
movb 0x18(%r14), %al
cmpb $0x1, %al
jne 0x1e8da
movq 0x20(%rsp), %rcx
addq $0x10, %rcx
movq 0x38(%rbx), %rdx
testq %rdx, %rdx
je 0x1e8cb
movq %rcx, 0x8(%rdx)
movq %rcx, 0x38(%rbx)
cmpq $0x0, 0x30(%rbx)
jne 0x1e8da
movq %rcx, 0x30(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/dinit-util.h
// Function: ha_string::operator=(ha_string const&)
ha_string &operator=(const ha_string &other)
    {
        char *new_str_data = new char[other.str_len + 1];
        delete[] str_data;
        memcpy(new_str_data, other.str_data, other.str_len + 1);
        str_data = new_str_data;
        str_len = other.str_len;
        return *this;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rdi
incq %rdi
callq 0x8030
movq %rax, %r15
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1f33b
callq 0x87c0
movq (%r14), %rsi
movq 0x8(%r14), %r14
leaq 0x1(%r14), %rdx
movq %r15, %rdi
callq 0x84d0
movq %r15, (%rbx)
movq %r14, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/service.h
// Function: service_record::add_dep(service_record*, dependency_type, std::_List_iterator<service_dep>)
service_dep &add_dep(service_record *to, dependency_type dep_type, dep_list::iterator i)
    {
        auto pre_i = depends_on.emplace(i, this, to, dep_type);
        try {
            to->dependents.push_back(&(*pre_i));
        }
        catch (...) {
            depends_on.erase(pre_i);
            throw;
        }

        if (dep_type != dependency_type::BEFORE && dep_type != dependency_type::AFTER) {
            if (dep_type == dependency_type::REGULAR
                    || to->get_state() == service_state_t::STARTED
                    || to->get_state() == service_state_t::STARTING) {
                if (service_state == service_state_t::STARTING
                        || service_state == service_state_t::STARTED) {
                    to->require();
                    pre_i->holding_acq = true;
                }
            }
        }

        return *pre_i;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbp
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %r14
movl $0x28, %edi
callq 0x8600
movq %rax, %r12
movq %rax, %rbx
movq %r14, 0x10(%rax)
movq %r15, 0x18(%rax)
movw $0x0, 0x20(%rax)
movl %r13d, 0x24(%rax)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x8060
incq 0x128(%r14)
movl $0x18, %edi
callq 0x8600
addq $0x10, %r12
leaq 0x130(%r15), %rsi
movq %r12, 0x10(%rax)
movq %rax, %rdi
callq 0x8060
incq 0x140(%r15)
leal -0x6(%r13), %eax
cmpl $-0x2, %eax
jae 0x1f665
testl %r13d, %r13d
je 0x1f64f
movb 0x2c(%r15), %al
decb %al
cmpb $0x1, %al
ja 0x1f665
movb 0x2c(%r14), %al
decb %al
cmpb $0x1, %al
ja 0x1f665
movq %r15, %rdi
callq 0x22962
movb $0x1, 0x21(%rbx)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x118, %r14            # imm = 0x118
movq %rax, %rdi
callq 0x8210
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1f734
callq 0x8920
movq %rax, %rbx
callq 0x8a50
movq %rbx, %rdi
callq 0x8ab0
movq %rax, %rdi
callq 0xb8be
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/includes/service.h
// Function: service_record::rm_dep(std::_List_iterator<service_dep>)
dep_list::iterator rm_dep(dep_list::iterator i) noexcept
    {
        auto to = i->get_to();
        for (auto j = to->dependents.begin(); ; ++j) {
            if (*j == &(*i)) {
                to->dependents.erase(j);
                break;
            }
        }
        if (i->holding_acq) {
            to->release();
        }
        return depends_on.erase(i);
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x10(%rsi), %rax
movq 0x18(%rsi), %r15
leaq 0x130(%r15), %r12
movq (%r12), %r12
cmpq %rax, 0x10(%r12)
jne 0x1f6cb
decq 0x140(%r15)
movq %r12, %rdi
callq 0x8a40
movl $0x18, %esi
movq %r12, %rdi
callq 0x8620
cmpb $0x1, 0x21(%rbx)
jne 0x1f705
movq %r15, %rdi
movl $0x1, %esi
callq 0x22740
movq (%rbx), %r15
decq 0x128(%r14)
movq %rbx, %rdi
callq 0x8a40
movl $0x28, %esi
movq %rbx, %rdi
callq 0x8620
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_set::find_service(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
service_record * service_set::find_service(const std::string &name, bool find_placeholders) noexcept
{
    service_record *r = ::find_service(records, name.c_str());
    if (r != nullptr && !find_placeholders && r->get_type() == service_type_t::PLACEHOLDER) {
        return nullptr;
    }
    return r;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r15
addq $0x10, %r15
movq (%rsi), %r12
movq %r15, %r13
movq (%r13), %r13
cmpq %r15, %r13
je 0x22333
movq 0x10(%r13), %r14
movq 0x8(%r14), %rdi
movq %r12, %rsi
callq 0x8880
testl %eax, %eax
jne 0x22314
jmp 0x22336
xorl %r14d, %r14d
testq %r14, %r14
sete %al
orb %bl, %al
jne 0x2234a
cmpl $0x0, 0x28(%r14)
jne 0x2234a
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::prepare_for_unload()
void service_record::prepare_for_unload() noexcept
{
    // Remove all dependencies:
    for (auto &dep : depends_on) {
        service_record *dependency = dep.get_to();
        auto &dep_dpts = dependency->dependents;
        dep_dpts.erase(std::find(dep_dpts.begin(), dep_dpts.end(), &dep));
        if (dep.dep_type == dependency_type::AFTER) {
            if (dependency->get_type() == service_type_t::PLACEHOLDER) {
                if (dependency->is_unrefd()) {
                    services->remove_service(dependency);
                    delete dependency;
                }
            }
        }
    }
    depends_on.clear();

    // Also remove all dependents. This should not be necessary except for "before" links.
    for (auto i = dependents.begin(); i != dependents.end();) {
        service_record *before_svc = (*i)->get_from();
        before_svc->rm_dep(**i++);
        if (before_svc->get_type() == service_type_t::PLACEHOLDER && before_svc->is_unrefd()) {
            services->remove_service(before_svc);
            delete before_svc;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x118(%rdi), %r14
movq 0x118(%rdi), %r13
cmpq %r14, %r13
je 0x22415
movq 0x18(%r13), %r15
leaq 0x130(%r15), %rbp
movq 0x130(%r15), %r12
cmpq %rbp, %r12
je 0x223a8
leaq 0x10(%r13), %rax
cmpq %rax, 0x10(%r12)
je 0x223a8
movq (%r12), %r12
cmpq %rbp, %r12
jne 0x22398
decq 0x140(%r15)
movq %r12, %rdi
callq 0x8a40
movl $0x18, %esi
movq %r12, %rdi
callq 0x8620
cmpl $0x5, 0x24(%r13)
jne 0x223d2
cmpl $0x0, 0x28(%r15)
je 0x223d8
movq (%r13), %r13
jmp 0x22374
leaq 0x118(%r15), %rax
cmpq %rax, 0x118(%r15)
jne 0x223d2
cmpq %rbp, 0x130(%r15)
jne 0x223d2
cmpq $0x0, 0x188(%r15)
jne 0x223d2
movq 0x148(%rbx), %rdi
movq %r15, %rsi
callq 0x1b726
movq (%r15), %rax
movq %r15, %rdi
callq *0x38(%rax)
jmp 0x223d2
movq %r14, %rdi
callq 0x23942
leaq 0x130(%rbx), %r15
movq 0x130(%rbx), %r12
cmpq %r15, %r12
je 0x224a3
movq 0x10(%r12), %rax
movq (%r12), %r12
movq (%rax), %r14
leaq 0x118(%r14), %r13
movq %r13, %rsi
movq (%rsi), %rsi
cmpq %r13, %rsi
je 0x2245f
leaq 0x10(%rsi), %rcx
cmpq %rax, %rcx
jne 0x22446
movq %r14, %rdi
callq 0x1f6ae
cmpl $0x0, 0x28(%r14)
jne 0x2242b
cmpq %r13, 0x118(%r14)
jne 0x2242b
leaq 0x130(%r14), %rax
cmpq %rax, 0x130(%r14)
jne 0x2242b
cmpq $0x0, 0x188(%r14)
jne 0x2242b
movq 0x148(%rbx), %rdi
movq %r14, %rsi
callq 0x1b726
movq (%r14), %rax
movq %r14, %rdi
callq *0x38(%rax)
jmp 0x2242b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::dependency_started()
void service_record::dependency_started() noexcept
{
    // Note that we check for STARTED state here in case the service is in smooth recovery while pinned.
    // In that case it will wait for dependencies to start before restarting the process.
    if ((service_state == service_state_t::STARTING || service_state == service_state_t::STARTED)
            && waiting_for_deps) {
        services->add_transition_queue(this);
    }
}

// Assembly:
movb 0x2c(%rdi), %al
decb %al
cmpb $0x1, %al
ja 0x2273f
testb $0x10, 0x10c(%rdi)
je 0x2273f
movq 0x148(%rdi), %rax
cmpq $0x0, 0x200(%rdi)
setne %dl
movq 0x40(%rax), %rcx
cmpq %rdi, %rcx
sete %sil
orb %dl, %sil
jne 0x2273f
movq %rcx, 0x200(%rdi)
movq %rdi, 0x40(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::release(bool)
void service_record::release(bool issue_stop) noexcept
{
    if (--required_by == 0) {
        if (service_state == service_state_t::STOPPING) {
            // If we are stopping but would have restarted, we now need to notify that the restart
            // has been cancelled. Other start-cancelled cases are handled by do_stop() (called
            // below).
            if (desired_state == service_state_t::STARTED && !is_start_pinned()) {
                notify_listeners(service_event_t::STARTCANCELLED);
            }
        }
        desired_state = service_state_t::STOPPED;

        if (is_start_pinned()) return;

        // Can stop, and can release dependencies now. We don't need to issue a release if
        // a require was pending though:
        prop_release = !prop_require;
        prop_require = false;
        if (prop_release) {
            services->add_prop_queue(this);
        }

        if (service_state != service_state_t::STOPPED && service_state != service_state_t::STOPPING
                && issue_stop) {
            stop_reason = stopped_reason_t::NORMAL;
            do_stop();
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
decl 0x110(%rdi)
jne 0x2279f
movl %esi, %ebp
movq %rdi, %rbx
cmpb $0x3, 0x2c(%rdi)
jne 0x22791
cmpb $0x2, 0x2d(%rbx)
jne 0x22791
testb $0xc, 0x10c(%rbx)
setne %al
movq 0x160(%rbx), %r14
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x22791
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl $0x3, %edx
callq *(%rax)
movq (%r14), %r14
testq %r14, %r14
jne 0x22778
movb $0x0, 0x2d(%rbx)
movl 0x10c(%rbx), %eax
testb $0xc, %al
je 0x227a4
popq %rbx
popq %r14
popq %rbp
retq
leal (%rax,%rax), %ecx
movl $0x400, %edx            # imm = 0x400
andl %edx, %ecx
andl $0xfffff9f3, %eax       # imm = 0xFFFFF9F3
orl %ecx, %eax
xorl %edx, %eax
movl %eax, 0x10c(%rbx)
testl %ecx, %ecx
jne 0x227ee
movq 0x148(%rbx), %rax
cmpq $0x0, 0x1f8(%rbx)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
jne 0x227ee
movq %rcx, 0x1f8(%rbx)
movq %rbx, 0x38(%rax)
movzbl 0x2c(%rbx), %eax
testl %eax, %eax
je 0x2279f
cmpl $0x3, %eax
je 0x2279f
testb %bpl, %bpl
je 0x2279f
movl $0x0, 0x1c4(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x229b4
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::initiate_start()
void service_record::initiate_start() noexcept
{
    start_failed = false;
    start_skipped = false;
    service_state = service_state_t::STARTING;
    waiting_for_deps = true;

    if (start_check_dependencies()) {
        // Note: we can't set waiting_for_deps false here since ordering dependencies might still kick in
        services->add_transition_queue(this);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x1, 0x2c(%rdi)
movl $0xfffe7fef, %eax       # imm = 0xFFFE7FEF
andl 0x10c(%rdi), %eax
orl $0x10, %eax
movl %eax, 0x10c(%rdi)
callq 0x22d8e
testb %al, %al
je 0x228a8
movq 0x148(%rbx), %rax
cmpq $0x0, 0x200(%rbx)
setne %dl
movq 0x40(%rax), %rcx
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
jne 0x228a8
movq %rcx, 0x200(%rbx)
movq %rbx, 0x40(%rax)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::require()
void service_record::require() noexcept
{
    if (required_by++ == 0) {
        if (service_state != service_state_t::STARTING && service_state != service_state_t::STARTED) {
            prop_start = true;
            services->add_prop_queue(this);
            // Note: pin is checked in start().
            // Require will be propagated to dependencies if/when the service actually starts.
        }
    }
}

// Assembly:
movl 0x110(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x110(%rdi)
testl %eax, %eax
je 0x22976
retq
movb 0x2c(%rdi), %al
decb %al
cmpb $0x2, %al
jb 0x22975
orb $0x10, 0x10d(%rdi)
movq 0x148(%rdi), %rax
cmpq $0x0, 0x1f8(%rdi)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rdi, %rcx
sete %sil
orb %dl, %sil
jne 0x22975
movq %rcx, 0x1f8(%rdi)
movq %rdi, 0x38(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::release_dependencies()
void service_record::release_dependencies() noexcept
{
    for (auto & dependency : depends_on) {
        service_record * dep_to = dependency.get_to();
        if (dependency.holding_acq) {
            // We must clear holding_acq before calling release, otherwise the dependency
            // may decide to stop, check this link and release itself a second time.
            dependency.holding_acq = false;
            dep_to->release();
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x118(%rdi), %r14
addq $0x118, %rbx            # imm = 0x118
cmpq %rbx, %r14
je 0x22c4d
cmpb $0x1, 0x21(%r14)
jne 0x22c48
movq 0x18(%r14), %rdi
movb $0x0, 0x21(%r14)
movl $0x1, %esi
callq 0x22740
movq (%r14), %r14
jmp 0x22c29
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::start_check_dependencies()
bool service_record::start_check_dependencies() noexcept
{
    bool all_deps_started = true;

    for (auto & dep : depends_on) {
        service_record * to = dep.get_to();
        if (dep.is_only_ordering()
                && to->service_state != service_state_t::STARTING) continue;
        if (to->service_state != service_state_t::STARTED) {
            dep.waiting_on = true;
            all_deps_started = false;
        }
    }

    for (auto * dept : dependents) {
        if (!dept->waiting_on && dept->is_only_ordering()) {
            service_record *from = dept->get_from();
            if (from->get_state() == service_state_t::STARTING) {
                dept->waiting_on = true;
            }
        }
    }

    return all_deps_started;
}

// Assembly:
leaq 0x118(%rdi), %rcx
movq 0x118(%rdi), %rdx
movb $0x1, %al
cmpq %rcx, %rdx
je 0x22dcc
movq 0x18(%rdx), %rsi
movl 0x24(%rdx), %r8d
andl $-0x2, %r8d
cmpl $0x4, %r8d
jne 0x22dbb
cmpb $0x1, 0x2c(%rsi)
jne 0x22dc7
cmpb $0x2, 0x2c(%rsi)
je 0x22dc7
movb $0x1, 0x20(%rdx)
xorl %eax, %eax
movq (%rdx), %rdx
jmp 0x22d9e
movq 0x130(%rdi), %rcx
addq $0x130, %rdi            # imm = 0x130
cmpq %rdi, %rcx
je 0x22e06
movq 0x10(%rcx), %rdx
cmpb $0x0, 0x10(%rdx)
jne 0x22e01
movl 0x14(%rdx), %esi
andl $-0x2, %esi
cmpl $0x4, %esi
jne 0x22e01
movq (%rdx), %rsi
cmpb $0x1, 0x2c(%rsi)
jne 0x22e01
movb $0x1, 0x10(%rdx)
movq (%rcx), %rcx
jmp 0x22dda
andb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x23211
cmpl $0x1, %eax
jne 0x23272
leaq 0x118(%rbx), %rax
movq %rax, %rcx
movq (%rcx), %rcx
cmpq %rax, %rcx
je 0x23201
cmpb $0x1, 0x20(%rcx)
jne 0x231ee
cmpq %rax, %rcx
jne 0x23272
andb $-0x11, 0x10c(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2329c
movq %rbx, %rdi
callq 0x232f2
testb %al, %al
je 0x23272
andb $-0x11, 0x10c(%rbx)
testb $0x8, 0x2f(%rbx)
je 0x23268
leaq 0x1281b(%rip), %rdx     # 0x35a4c
movl $0x1, %edi
movl $0x1, %esi
callq 0x2e635
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
movq %rax, %rdi
callq 0xb8be
// File: /workspace/github_cpp_makefile_star2_O1/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 0x23294
cmpb $0x1, 0x20(%rax)
jne 0x23286
cmpq %rdi, %rax
sete %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
testb $0x8, 0x2e(%rdi)
je 0x232c9
movl 0x10c(%rbx), %eax
testb $0x40, %al
jne 0x232c9
orl $0x20, %eax
movl %eax, 0x10c(%rbx)
movq 0x148(%rbx), %rdi
movq %rbx, %rsi
popq %rbx
jmp 0x2397e
andb $-0x11, 0x10c(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testb %al, %al
je 0x232de
popq %rbx
retq
movb $0x3, 0x2c(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
popq %rbx
jmp 0x23018
// File: /workspace/github_cpp_makefile_star2_O1/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:
addq $0x130, %rdi            # imm = 0x130
movb $0x1, %dl
movq %rdi, %rcx
movq (%rcx), %rcx
cmpq %rdi, %rcx
je 0x2333d
movq 0x10(%rcx), %rax
movl 0x14(%rax), %esi
testl %esi, %esi
je 0x2331c
cmpl $0x3, %esi
jne 0x2332f
cmpb $0x1, 0x10(%rax)
jne 0x2332f
cmpb $0x1, 0x11(%rax)
jne 0x2332f
xorl %esi, %esi
cmpb $0x1, 0x10(%rax)
movl $0x0, %eax
jne 0x23334
movb $0x1, %sil
movl %edx, %eax
movl %eax, %edx
testb %sil, %sil
jne 0x232fe
jmp 0x2333f
movl %edx, %eax
andb $0x1, %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x23399
leaq 0x118(%rdi), %rcx
movq %rcx, %rdx
movq (%rdx), %rdx
cmpq %rcx, %rdx
je 0x2329c
cmpb $0x1, 0x20(%rdx)
jne 0x2337e
cmpq %rcx, %rdx
je 0x2329c
movl %eax, 0x10c(%rdi)
movq 0x148(%rdi), %rdi
jmp 0x239d6
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x233e4
testb $0x4, 0x2e(%rbx)
jne 0x233e4
callq 0x8190
xorl %edi, %edi
movl %eax, %esi
callq 0x88c0
andb $-0x41, 0x10c(%rbx)
movq 0x148(%rbx), %rdi
callq 0x239d6
movq 0x8(%rbx), %rdi
callq 0x2e7f1
movb $0x2, 0x2c(%rbx)
movq 0x160(%rbx), %r14
testq %r14, %r14
je 0x23410
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
xorl %edx, %edx
callq *(%rax)
movq (%r14), %r14
jmp 0x233f8
testb $0x1, 0x2e(%rbx)
je 0x2341b
callq 0xb2bd
testb $0x2, 0x2e(%rbx)
je 0x23426
callq 0xafd9
cmpb $0x0, 0x190(%rbx)
jne 0x23465
cmpb $0x0, 0x2d(%rbx)
je 0x23465
movq 0x130(%rbx), %r14
addq $0x130, %rbx            # imm = 0x130
cmpq %rbx, %r14
je 0x23474
movq 0x10(%r14), %r15
cmpb $0x1, 0x10(%r15)
jne 0x23460
movq (%r15), %rdi
callq 0x22700
movb $0x0, 0x10(%r15)
movq (%r14), %r14
jmp 0x23443
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x229b4
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x2349b
movb $0x1, 0x190(%rdi)
movl 0x10c(%rdi), %eax
testb $0xc, %al
je 0x2349c
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 0x2349b
movq %rcx, 0x1f8(%rdi)
movq %rdi, 0x38(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
jae 0x234fd
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
movl %eax, 0x10c(%rdi)
decl 0x110(%rdi)
movl 0x110(%rdi), %ecx
testl %ecx, %ecx
sete %al
orb %sil, %al
cmpb $0x1, %al
jne 0x23513
movb $0x0, 0x2d(%rdi)
movl 0x10c(%rdi), %eax
testb $0xc, %al
je 0x2351e
retq
testl %ecx, %ecx
je 0x23529
testb %sil, %sil
jne 0x23573
jmp 0x2351d
leal (%rax,%rax), %ecx
movl $0x400, %edx            # imm = 0x400
andl %edx, %ecx
andl $0xfffffbf3, %eax       # imm = 0xFFFFFBF3
orl %ecx, %eax
xorl %edx, %eax
movl %eax, 0x10c(%rdi)
testl %ecx, %ecx
jne 0x23573
movq 0x148(%rdi), %rax
cmpq $0x0, 0x1f8(%rdi)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rdi, %rcx
sete %sil
orb %dl, %sil
jne 0x23573
movq %rcx, 0x1f8(%rdi)
movq %rdi, 0x38(%rax)
cmpb $0x0, 0x2c(%rdi)
je 0x2351d
movl $0x0, 0x1c4(%rdi)
xorl %esi, %esi
jmp 0x229b4
// File: /workspace/github_cpp_makefile_star2_O1/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), %eax
testb $0x4, %al
jne 0x237ff
testb $0x8, %al
jne 0x237f8
leaq 0x118(%rdi), %rax
movq 0x118(%rdi), %rcx
cmpq %rax, %rcx
je 0x237f8
movl 0x24(%rcx), %edx
testl %edx, %edx
je 0x237a5
cmpl $0x3, %edx
jne 0x237f3
cmpb $0x1, 0x20(%rcx)
jne 0x237f3
movq 0x18(%rcx), %rdx
movl 0x10c(%rdx), %esi
testb $0x8, %sil
jne 0x237f3
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 0x237f3
movq %r8, 0x1f8(%rsi)
movq %rsi, 0x38(%rdx)
movq (%rcx), %rcx
jmp 0x2378e
orb $0x4, 0x10c(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x2382a
movl 0x10c(%rbx), %eax
testb $0x2, %al
je 0x238b1
andl $-0x3, %eax
movl %eax, 0x10c(%rbx)
jmp 0x238b1
movl %eax, %ecx
andl $-0x5, %ecx
movl %ecx, 0x10c(%rbx)
testb $0x8, %al
jne 0x238b1
leaq 0x118(%rbx), %rax
movq 0x118(%rbx), %rcx
cmpq %rax, %rcx
je 0x238b3
movl 0x24(%rcx), %edx
testl %edx, %edx
je 0x2385e
cmpl $0x3, %edx
jne 0x238ac
cmpb $0x1, 0x20(%rcx)
jne 0x238ac
movq 0x18(%rcx), %rdx
movl 0x10c(%rdx), %esi
testb $0x8, %sil
je 0x238ac
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 0x238ac
movq %rdi, 0x1f8(%rsi)
movq %rsi, 0x38(%rdx)
movq (%rcx), %rcx
jmp 0x23847
popq %rbx
retq
cmpb $0x2, 0x2c(%rbx)
jne 0x2380e
cmpl $0x0, 0x110(%rbx)
jne 0x238fa
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 0x238fa
movq %rcx, 0x1f8(%rbx)
movq %rbx, 0x38(%rax)
cmpb $0x0, 0x2d(%rbx)
je 0x2390d
cmpb $0x1, 0x190(%rbx)
jne 0x2380e
movq %rbx, %rdi
xorl %esi, %esi
callq 0x229b4
movq 0x148(%rbx), %rdi
callq 0xd8da
jmp 0x2380e
// File: /workspace/github_cpp_makefile_star2_O1/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 0x23a20
leaq 0x1e8(%rdi), %rcx
movq 0x1e8(%rdi), %rdx
cmpq %rdi, %rdx
je 0x23a31
movq 0x1f0(%rdi), %rsi
movq %rsi, 0x1f0(%rdx)
movq %rdx, 0x1e8(%rsi)
movq 0x1e8(%rdi), %rdx
movq %rdx, 0x30(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
jmp 0x2335c
pushq %rax
callq 0x2e4fc
movl $0x1, %edi
popq %rax
jmp 0x2e371
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq $0x0, 0x30(%rax)
jmp 0x2335c
// File: /workspace/github_cpp_makefile_star2_O1/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 0x25564
movq (%r14), %rax
cmpq %r14, %rax
je 0x23ad5
movl 0x14(%rax), %ecx
cmpq %rcx, 0x8(%r15)
jbe 0x23ad0
movq (%r15), %rdx
movb $0x0, (%rdx,%rcx)
movq (%rax), %rax
jmp 0x23abb
movq (%r14), %r12
cmpq %r14, %r12
je 0x23b06
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 0x1d620
movq (%r12), %r12
cmpq %r14, %r12
jne 0x23ae5
leaq 0x8(%rsp), %rsi
movq $0x0, (%rsi)
movq %rbx, %rdi
callq 0x1d620
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x23b2f
jmp 0x23b2f
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x23b46
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x8620
movq %r14, %rdi
callq 0x8ab0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x23be9
cmpl $0x2, %ecx
je 0x23bba
cmpl $0x1, %ecx
jne 0x23bff
cmpl $-0x1, 0x4b0(%rbx)
jne 0x23c01
cmpq $0x0, 0x4c0(%rbx)
jne 0x23c01
testb $0x2, %al
je 0x23bb1
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x22e8b(%rip), %rdi     # 0x46a30
callq 0x25df4
andb $-0x3, 0x4f4(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x233ac
testb $0x2, %al
je 0x23bff
cmpl $-0x1, 0x4e8(%rbx)
jne 0x23bff
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
leaq 0x22e55(%rip), %rdi     # 0x46a30
callq 0x25df4
andb $-0x3, 0x4f4(%rbx)
jmp 0x23bff
movq %rbx, %rdi
callq 0x232f2
testb %al, %al
je 0x23bff
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
jmpq *0x8(%rax)
popq %rbx
retq
addq $0x510, %rbx            # imm = 0x510
leaq 0x22e21(%rip), %rsi     # 0x46a30
movq %rbx, %rdi
movl $0x1, %edx
popq %rbx
jmp 0xd9d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0xda6a
movl 0x1c(%r15), %edi
callq 0x8b60
testl %r12d, %r12d
jle 0x23cdd
movl 0x4d8(%rbx), %edx
cmpl $-0x1, %edx
je 0x23cbd
leaq 0x338(%rbx), %rsi
leaq 0x22da9(%rip), %rdi     # 0x46a30
callq 0x25e62
movb 0x4f4(%rbx), %al
movl %eax, %ecx
andb $-0x5, %cl
movb %cl, 0x4f4(%rbx)
testb $0x2, %al
je 0x23cbd
movl 0x3fc(%rbx), %edx
leaq 0x3d0(%rbx), %rsi
movq %r14, %rdi
callq 0x25df4
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 0x23cf8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x78(%rax)
cmpl $-0x1, 0x4d8(%rbx)
jne 0x23cf8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movq 0x148(%rbx), %rdi
callq 0xd8da
movl $0x4, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xb8be
nop