// File: /workspace/github_cpp_makefile_star2_O3/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), %cl
movb $0x2, 0x2d(%rdi)
movl 0x10c(%rdi), %eax
testb $0x2, %al
jne 0x22f96
testb %cl, %cl
je 0x22fa6
cmpb $0x3, %cl
jne 0x22f9e
testb $0x10, %al
je 0x22f9e
testb $0x1, 0x190(%rbx)
jne 0x22f9e
movq 0x160(%rbx), %r14
testq %r14, %r14
je 0x23054
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
movl $0x4, %edx
callq *(%rax)
movq (%r14), %r14
jmp 0x22f77
testb %cl, %cl
je 0x23063
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x130(%rbx), %rax
movq 0x130(%rbx), %rcx
cmpq %rax, %rcx
je 0x22fff
movl 0x110(%rbx), %edx
movq 0x10(%rcx), %rsi
movl 0x14(%rsi), %edi
testl %edi, %edi
je 0x22ff7
cmpl $0x3, %edi
jne 0x22fd5
cmpb $0x0, 0x10(%rsi)
jne 0x22ff7
cmpb $0x0, 0x11(%rsi)
jne 0x22ff7
movq (%rsi), %rdi
movb 0x2c(%rdi), %dil
decb %dil
cmpb $0x1, %dil
ja 0x22ff7
movb $0x1, 0x11(%rsi)
incl %edx
movl %edx, 0x110(%rbx)
movq (%rcx), %rcx
cmpq %rax, %rcx
jne 0x22fbf
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 0x23054
cmpq $0x0, 0x1f8(%rbx)
setne %dl
movq 0x38(%rax), %rcx
cmpq %rbx, %rcx
sete %sil
orb %dl, %sil
jne 0x23054
movq %rcx, 0x1f8(%rbx)
movq %rbx, 0x38(%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x22b3a
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x23316