// File: /workspace/github_cpp_makefile_star2_O1/davmac314[P]dinit/src/service.cc
// Function: service_record::do_start()
void service_record::do_start() noexcept
{
    bool was_active = service_state != service_state_t::STOPPED;

    desired_state = service_state_t::STARTED;

    if (pinned_stopped) {
        if (!was_active) {
            failed_to_start(false, false);
        }
        return;
    }

    // re-attach any soft dependents, now that we are starting again
    if (!was_active) {
        for (auto dept : dependents) {
            if (!dept->is_hard()) {
                service_state_t dept_state = dept->get_from()->service_state;
                if (!dept->holding_acq
                        && (dept_state == service_state_t::STARTED || dept_state == service_state_t::STARTING)) {
                    dept->holding_acq = true;
                    ++required_by;
                }
            }
        }
    }

    if (was_active) {
        // We're already starting/started, or we are stopping and need to wait for
        // that the complete.
        if (service_state != service_state_t::STOPPING) {
            return;
        }

        if (! can_interrupt_stop()) {
            return;
        }

        // We're STOPPING, and that can be interrupted. Our dependencies might be STOPPING,
        // but if so they are waiting (for us), so they too can be instantly returned to
        // STARTING state.
        notify_listeners(service_event_t::STOPCANCELLED);
    }
    else { // !was_active
        services->service_active(this);
        prop_require = !prop_release;
        prop_release = false;
        if (prop_require) {
            services->add_prop_queue(this);
        }
    }

    initiate_start();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x2c(%rdi), %al
movb $0x2, 0x2d(%rdi)
testb $0x2, 0x10c(%rdi)
jne 0x22cad
testb %al, %al
je 0x22cbd
cmpb $0x3, %al
jne 0x22cb5
testb $0x10, 0x10c(%rbx)
je 0x22cb5
testb $0x1, 0x190(%rbx)
jne 0x22cb5
movq 0x160(%rbx), %r14
testq %r14, %r14
je 0x22d6b
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl $0x4, %edx
callq *(%rax)
movq (%r14), %r14
jmp 0x22c8e
testb %al, %al
je 0x22d7a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x130(%rbx), %rax
movq 0x130(%rbx), %rcx
cmpq %rax, %rcx
je 0x22d16
movl 0x110(%rbx), %edx
movq 0x10(%rcx), %rsi
movl 0x14(%rsi), %edi
testl %edi, %edi
je 0x22d0e
cmpl $0x3, %edi
jne 0x22cec
cmpb $0x0, 0x10(%rsi)
jne 0x22d0e
cmpb $0x0, 0x11(%rsi)
jne 0x22d0e
movq (%rsi), %rdi
movb 0x2c(%rdi), %dil
decb %dil
cmpb $0x1, %dil
ja 0x22d0e
movb $0x1, 0x11(%rsi)
incl %edx
movl %edx, 0x110(%rbx)
movq (%rcx), %rcx
cmpq %rax, %rcx
jne 0x22cd6
movq 0x148(%rbx), %rax
incl 0x8(%rax)
movl 0x10c(%rbx), %ecx
movl %ecx, %edx
shrl %edx
movl $0x200, %esi            # imm = 0x200
andl %esi, %edx
andl $0xfffff9ff, %ecx       # imm = 0xFFFFF9FF
orl %edx, %ecx
xorl %esi, %ecx
movl %ecx, 0x10c(%rbx)
testl %edx, %edx
jne 0x22d6b
cmpq $0x0, 0x1f8(%rbx)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
jne 0x22d6b
movq %rcx, 0x1f8(%rbx)
movq %rbx, 0x38(%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x22856
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x23018
nop