// File: /workspace/github_cpp_makefile_star2_O3/davmac314[P]dinit/src/dinitctl.cc
// Function: service_status(int, cpbuffer<1024u>&, char const*, ctl_cmd, unsigned short, bool)
static int service_status(int socknum, cpbuffer_t &rbuffer, const char *service_name,
        ctl_cmd command, uint16_t proto_version, bool verbose)
{
    using std::cout;
    using std::cerr;

    bool is_status = command == ctl_cmd::SERVICE_STATUS;

    if (issue_load_service(socknum, service_name, true) == 1) {
        return 1;
    }

    wait_for_reply(rbuffer, socknum);

    handle_t handle;

    if (rbuffer[0] == (char)cp_rply::NOSERVICE) {
        if (is_status) {
            cerr << "dinitctl: service not loaded.\n";
        }
        return 1;
    }

    if (check_load_reply(socknum, rbuffer, &handle, nullptr, is_status) != 0) {
        return 1;
    }

    // Issue STATUS request
    {
        char status_req_id = proto_version < 5 ? (char)cp_cmd::SERVICESTATUS : (char)cp_cmd::SERVICESTATUS5;
        unsigned status_buf_size = proto_version < 5 ? STATUS_BUFFER_SIZE : STATUS_BUFFER5_SIZE;

        auto m = membuf()
                .append(status_req_id)
                .append(handle);
        write_all_x(socknum, m);

        wait_for_reply(rbuffer, socknum);
        if (rbuffer[0] != (char)cp_rply::SERVICESTATUS) {
            cerr << "dinitctl: protocol error.\n";
            return 1;
        }
        rbuffer.consume(1);

        fill_buffer_to(rbuffer, socknum, status_buf_size + 1 /* reserved */);
        rbuffer.consume(1);

        service_state_t current = static_cast<service_state_t>(rbuffer[0]);
        service_state_t target = static_cast<service_state_t>(rbuffer[1]);

        int console_flags = rbuffer[2];
        bool has_console = (console_flags & 2) != 0;
        bool waiting_console = (console_flags & 1) != 0;
        bool was_skipped = (console_flags & 4) != 0;
        bool marked_active = (console_flags & 8) != 0;
        bool has_pid = (console_flags & 16) != 0;

        stopped_reason_t stop_reason = static_cast<stopped_reason_t>(rbuffer[3]);

        pid_t service_pid = -1;
        int exit_status = 0;
        int exit_si_code = 0;
        int exit_si_status = 0;
        if (has_pid) {
            // 6 = current state (1) + target state (1) + flags (1)
            //                       + stop reason (1) + exec failure stage (2)
            rbuffer.extract((char *)&service_pid, 6, sizeof(service_pid));
        }
        else {
            if (proto_version < 5) {
                rbuffer.extract((char *)&exit_status, 6, sizeof(exit_status));
            }
            else {
                rbuffer.extract((char *)&exit_si_code, 6, sizeof(exit_si_code));
                rbuffer.extract((char *)&exit_si_status, 6 + sizeof(int), sizeof(exit_si_status));
            }
        }

        switch (command) {
        case ctl_cmd::IS_STARTED:
        case ctl_cmd::IS_FAILED:
            if (verbose) {
                switch (current) {
                case service_state_t::STOPPED:
                    cout << "STOPPED\n";
                    break;
                case service_state_t::STARTING:
                    cout << "STARTING\n";
                    break;
                case service_state_t::STARTED:
                    cout << "STARTED\n";
                    break;
                case service_state_t::STOPPING:
                    cout << "STOPPING\n";
                }
            }
            if (command == ctl_cmd::IS_STARTED) {
                // return 0 (success) for started
                return current != service_state_t::STARTED;
            }
            // IS_FAILED:
            // return 0 (success) for specific stopped reasons
            if (current == service_state_t::STOPPED) {
                switch (stop_reason) {
                case stopped_reason_t::DEPFAILED:
                case stopped_reason_t::FAILED:
                case stopped_reason_t::EXECFAILED:
                case stopped_reason_t::TIMEDOUT:
                    return 0;
                default:
                    break;
                }
            }
            return 1;
        default:
            /* status */
            break;
        }

        cout << "Service: " << service_name << "\n"
                "    State: ";

        switch (current) {
        case service_state_t::STOPPED:
            cout << "STOPPED";
            switch (stop_reason) {
            case stopped_reason_t::DEPRESTART:
                cout << " (dependency restarted)";
                break;
            case stopped_reason_t::DEPFAILED:
                cout << " (dependency failed/terminated)";
                break;
            case stopped_reason_t::FAILED:
                cout << " (failed to start";
                if (proto_version < 5) {
                    if (exit_status != 0) {
                        cout << "; ";
                        print_termination_details(exit_status);
                    }
                }
                else {
                    if (exit_si_status != 0) {
                        cout << "; ";
                        print_termination_details(exit_si_code, exit_si_status);
                    }
                }
                cout << ")";
                break;
            case stopped_reason_t::EXECFAILED:
                uint16_t launch_stage;
                rbuffer.extract((char *)&launch_stage, 4, 2);
                if (exit_status == 0) {
                    // (Protocol version 5+)
                    exit_status = exit_si_code;
                }
                cout << " (could not be launched)\n";
                cout << "        Stage: " << exec_stage_descriptions[launch_stage] << "\n";
                cout << "        Error: " << strerror(exit_status);
                break;
            case stopped_reason_t::TERMINATED:
                cout << " (terminated";
                if (proto_version < 5) {
                    if (exit_status != 0) {
                        cout << "; ";
                        print_termination_details(exit_status);
                    }
                }
                else {
                    if (exit_si_status != 0) {
                        cout << "; ";
                        print_termination_details(exit_si_code, exit_si_status);
                    }
                }
                cout << ")";
                break;
            case stopped_reason_t::TIMEDOUT:
                cout << " (start timed out)";
                break;
            case stopped_reason_t::NORMAL:
                break;
            }
            break;
        case service_state_t::STARTING:
            cout << "STARTING";
            if (target == service_state_t::STOPPED) {
                cout << " (target state: STOPPED)";
            }
            break;
        case service_state_t::STARTED:
            cout << "STARTED";
            if (was_skipped) {
                cout << " (startup skipped)";
            }
            break;
        case service_state_t::STOPPING:
            cout << "STOPPING";
            if (target == service_state_t::STARTED) {
                cout << " (target state: STARTED)";
            }
            if (proto_version < 5) {
                if (exit_status != 0) {
                    cout << "(terminated ;";
                    print_termination_details(exit_status);
                    cout << ")";
                }
            }
            else {
                if (exit_si_status != 0) {
                    cout << "(terminated ;";
                    print_termination_details(exit_si_code, exit_si_status);
                    cout << ")";
                }
            }
        }
        if (has_console) {
            cout << " (holding console)";
        }
        if (waiting_console) {
            cout << " (waiting for console)";
        }
        cout << "\n";

        if (target == service_state_t::STARTED) {
            cout << "    Activation: ";
            if (marked_active) {
                cout << "explicitly started\n";
            }
            else {
                cout << "start due to dependent(s)\n";
            }
        }

        if (service_pid != -1) {
            cout << "    Process ID: " << service_pid << "\n";
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x20(%rsp)
movl %r8d, %ebx
movl %ecx, %r12d
movq %rdx, %r15
movq %rsi, %r14
movl %edi, %r13d
movl $0x1, %ebp
movq %rdx, %rsi
movl $0x1, %edx
callq 0xd67c
movq %r14, %rdi
movl %r13d, %esi
callq 0xed47
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x3c, (%r14,%rcx)
jne 0xaafa
cmpl $0xa, %r12d
jne 0xac4e
movq 0x124ff(%rip), %rdi     # 0x1cfe8
leaq 0xbadc(%rip), %rsi      # 0x165cc
movl $0x1e, %edx
jmp 0xac49
movq %r15, 0x38(%rsp)
xorl %r8d, %r8d
cmpl $0xa, %r12d
sete %r8b
xorl %r15d, %r15d
leaq 0x24(%rsp), %rdx
movl %r13d, %edi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xd75c
testl %eax, %eax
jne 0xac4e
movq %r12, 0x30(%rsp)
movl 0x24(%rsp), %eax
movl %eax, %ecx
shll $0x8, %ecx
xorl %edx, %edx
movl %ebx, 0x18(%rsp)
cmpw $0x5, %bx
setae %dl
leal (%rcx,%rdx,8), %ecx
addl $0x12, %ecx
shrl $0x18, %eax
leaq 0x40(%rsp), %rbx
movb %al, 0x4(%rbx)
movl %ecx, (%rbx)
movl $0x5, %r12d
movl %r12d, %edx
movl %r13d, %edi
movq %rbx, %rsi
callq 0x4100
cmpl $-0x1, %eax
je 0xab7c
addl %eax, %r15d
movslq %eax, %rcx
addq %rcx, %rbx
subl %eax, %r12d
jmp 0xab8a
callq 0x4040
cmpl $0x4, (%rax)
jne 0xac5f
testl %r12d, %r12d
jg 0xab5b
cmpl $-0x1, %r15d
je 0xac68
movq %r14, %rdi
movl %r13d, %esi
callq 0xed47
movl 0x400(%r14), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x46, (%r14,%rcx)
movl 0x18(%rsp), %edx
jne 0xac36
xorl %ecx, %ecx
cmpw $0x5, %dx
setae %cl
leal 0x1(%rax), %edx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %edx            # imm = 0x400
cmovbl %edx, %eax
movl %eax, 0x400(%r14)
decl 0x404(%r14)
leal 0xb(,%rcx,4), %ebp
movl 0x404(%r14), %ecx
cmpl %ebp, %ecx
jae 0xac9c
movq %r14, %rdi
movl %r13d, %esi
callq 0xef52
testl %eax, %eax
jg 0xabf3
cmpl $-0x1, %eax
jne 0xac8d
callq 0x4040
cmpl $0x4, (%rax)
je 0xabf3
movq %rax, %rbx
movl $0x4, %edi
callq 0x4190
movl (%rbx), %ecx
movl %ecx, (%rax)
jmp 0xb413
movq 0x123ab(%rip), %rdi     # 0x1cfe8
leaq 0xb519(%rip), %rsi      # 0x1615d
movl $0x1a, %edx
callq 0x4330
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %r15d, %r15d
jg 0xab99
movl $0x4, %edi
callq 0x4190
movq %rax, %rbx
callq 0x4040
movl (%rax), %eax
movl %eax, (%rbx)
leaq 0x11ecb(%rip), %rsi     # 0x1cb50
movq %rbx, %rdi
jmp 0xb41d
testl %eax, %eax
je 0xb403
movl 0x404(%r14), %ecx
movl 0x400(%r14), %r13d
leal 0x1(%r13), %edx
movl $0xfffffc01, %esi       # imm = 0xFFFFFC01
addl %esi, %r13d
movl $0x400, %eax            # imm = 0x400
cmpl %eax, %edx
cmovbl %edx, %r13d
movl %r13d, 0x400(%r14)
decl %ecx
movl %ecx, 0x404(%r14)
leal -0x400(%r13), %ecx
cmpl %eax, %r13d
cmovbl %r13d, %ecx
movzbl (%r14,%rcx), %r15d
leal 0x1(%r13), %ecx
addl %r13d, %esi
cmpl %eax, %ecx
cmovbl %ecx, %esi
movb (%r14,%rsi), %cl
movb %cl, 0x7(%rsp)
leal 0x2(%r13), %ecx
leal -0x3fe(%r13), %edx
cmpl %eax, %ecx
cmovbl %ecx, %edx
movzbl (%r14,%rdx), %r12d
leal 0x3(%r13), %edx
movl $0xfffffc03, %ecx       # imm = 0xFFFFFC03
leal (%rcx,%r13), %esi
cmpl %eax, %edx
cmovbl %edx, %esi
leal 0x6(%r13), %edx
leal -0x3fa(%r13), %ebp
cmpl %eax, %edx
cmovbl %edx, %ebp
addl %ebp, %ecx
xorl %eax, %eax
movzbl (%r14,%rsi), %edx
movq %rdx, 0x28(%rsp)
movl $0xffffffff, 0x1c(%rsp) # imm = 0xFFFFFFFF
movl %eax, 0xc(%rsp)
movl %eax, 0x8(%rsp)
movl %eax, 0x14(%rsp)
testb $0x10, %r12b
jne 0xad87
cmpw $0x4, 0x18(%rsp)
ja 0xadc1
cmpl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
ja 0xae09
movl $0x400, %ebx            # imm = 0x400
subl %ebp, %ebx
movl %ebp, %esi
addq %r14, %rsi
leaq 0xc(%rsp), %rdi
movq %rbx, %rdx
callq 0x4270
leaq (%rsp,%rbx), %rdi
addq $0xc, %rdi
jmp 0xadb0
cmpl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
ja 0xadfd
movl $0x400, %ebx            # imm = 0x400
subl %ebp, %ebx
movl %ebp, %esi
addq %r14, %rsi
leaq 0x1c(%rsp), %rdi
movq %rbx, %rdx
callq 0x4270
leaq (%rsp,%rbx), %rdi
addq $0x1c, %rdi
addl $0xfffffc04, %ebp       # imm = 0xFFFFFC04
movq %r14, %rsi
movq %rbp, %rdx
jmp 0xae75
cmpl $0xfffffbfe, %ecx       # imm = 0xFFFFFBFE
ja 0xae15
movl $0x400, %ebx            # imm = 0x400
subl %ebp, %ebx
movl %ebp, %esi
addq %r14, %rsi
leaq 0x8(%rsp), %rdi
movq %rbx, %rdx
callq 0x4270
leaq (%rsp,%rbx), %rdi
addq $0x8, %rdi
addl $0xfffffc04, %ebp       # imm = 0xFFFFFC04
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4270
jmp 0xae1f
movl %ebp, %eax
movl (%r14,%rax), %eax
movl %eax, 0x1c(%rsp)
jmp 0xae7a
movl %ebp, %eax
movl (%r14,%rax), %eax
movl %eax, 0xc(%rsp)
jmp 0xae7a
movl %ebp, %eax
movl (%r14,%rax), %eax
movl %eax, 0x8(%rsp)
leal 0xa(%r13), %eax
addl $0xfffffc0a, %r13d      # imm = 0xFFFFFC0A
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %r13d
leal -0x3fd(%r13), %eax
movl %r13d, %esi
cmpl $0xfffffbfe, %eax       # imm = 0xFFFFFBFE
ja 0xafa7
movl $0x400, %ebx            # imm = 0x400
subl %r13d, %ebx
addq %r14, %rsi
leaq 0x14(%rsp), %rdi
movq %rbx, %rdx
callq 0x4270
leaq (%rsp,%rbx), %rdi
addq $0x14, %rdi
addl $0xfffffc04, %r13d      # imm = 0xFFFFFC04
movq %r14, %rsi
movq %r13, %rdx
callq 0x4270
movq 0x30(%rsp), %rax
addl $-0x17, %eax
cmpl $0x1, %eax
ja 0xaec7
cmpb $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rbx
je 0xb11d
cmpl $0x3, %r15d
ja 0xb11d
movl %r15d, %eax
leaq 0xa1cd(%rip), %rcx      # 0x15078
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x120ed(%rip), %rdi     # 0x1cfa8
leaq 0xb890(%rip), %rsi      # 0x16752
jmp 0xb0a8
movq 0x120da(%rip), %rbx     # 0x1cfa8
leaq 0xb8a3(%rip), %rsi      # 0x16778
movl $0x9, %edx
movq %rbx, %rdi
callq 0x4330
movq 0x38(%rsp), %r13
testq %r13, %r13
je 0xaf08
movq %r13, %rdi
callq 0x4150
movq 0x120ad(%rip), %rdi     # 0x1cfa8
movq %r13, %rsi
movq %rax, %rdx
callq 0x4330
jmp 0xaf1f
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x44c0
movq 0x12082(%rip), %rdi     # 0x1cfa8
leaq 0xb855(%rip), %rsi      # 0x16782
movl $0xc, %edx
callq 0x4330
cmpl $0x3, %r15d
ja 0xb27d
movl %r15d, %eax
leaq 0xa105(%rip), %rcx      # 0x15050
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1204d(%rip), %rdi     # 0x1cfa8
leaq 0xb82d(%rip), %rsi      # 0x1678f
movl $0x7, %edx
callq 0x4330
movq 0x28(%rsp), %rax
decl %eax
cmpl $0x5, %eax
ja 0xb27d
movq %rax, %rcx
leaq 0xa0da(%rip), %rax      # 0x15060
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x12012(%rip), %rdi     # 0x1cfa8
leaq 0xb7fa(%rip), %rsi      # 0x16797
movl $0x17, %edx
jmp 0xb278
movl (%r14,%rsi), %eax
movl %eax, 0x14(%rsp)
jmp 0xae7a
movq 0x11fed(%rip), %rdi     # 0x1cfa8
leaq 0xb87e(%rip), %rsi      # 0x16840
movl $0x7, %edx
callq 0x4330
testb $0x4, %r12b
je 0xb27d
movq 0x11fcb(%rip), %rdi     # 0x1cfa8
leaq 0xb864(%rip), %rsi      # 0x16848
jmp 0xb155
movq 0x11fb8(%rip), %rdi     # 0x1cfa8
leaq 0xb864(%rip), %rsi      # 0x1685b
movl $0x8, %edx
callq 0x4330
cmpb $0x2, 0x7(%rsp)
jne 0xb020
movq 0x11f99(%rip), %rdi     # 0x1cfa8
leaq 0xb84e(%rip), %rsi      # 0x16864
movl $0x18, %edx
callq 0x4330
cmpw $0x4, 0x18(%rsp)
ja 0xb0bf
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
je 0xb27d
movq 0x11f69(%rip), %r14     # 0x1cfa8
leaq 0xb837(%rip), %rsi      # 0x1687d
movl $0xd, %edx
movq %r14, %rdi
callq 0x4330
movl %ebx, %edi
callq 0xde83
jmp 0xb0f1
movq 0x11f42(%rip), %rdi     # 0x1cfa8
leaq 0xb7b1(%rip), %rsi      # 0x1681e
movl $0x8, %edx
callq 0x4330
cmpb $0x0, 0x7(%rsp)
jne 0xb27d
movq 0x11f1f(%rip), %rdi     # 0x1cfa8
leaq 0xb797(%rip), %rsi      # 0x16827
movl $0x18, %edx
jmp 0xb278
movq 0x11f07(%rip), %rdi     # 0x1cfa8
leaq 0xb6bd(%rip), %rsi      # 0x16765
movl $0x8, %edx
jmp 0xb118
movq 0x11ef2(%rip), %rdi     # 0x1cfa8
leaq 0xb6b1(%rip), %rsi      # 0x1676e
jmp 0xb113
movl 0x14(%rsp), %ebx
testl %ebx, %ebx
je 0xb27d
movq 0x11ed6(%rip), %r14     # 0x1cfa8
leaq 0xb7a4(%rip), %rsi      # 0x1687d
movl $0xd, %edx
movq %r14, %rdi
callq 0x4330
movl 0x8(%rsp), %edi
movl %ebx, %esi
callq 0xde13
leaq 0xbd76(%rip), %rsi      # 0x16e6e
movl $0x1, %edx
movq %r14, %rdi
jmp 0xb278
movq 0x11e9c(%rip), %rdi     # 0x1cfa8
leaq 0xb648(%rip), %rsi      # 0x1675b
movl $0x9, %edx
callq 0x4330
cmpl $0x17, %ebx
jne 0xb12b
cmpl $0x2, %r15d
setne %al
jmp 0xb13f
testl %r15d, %r15d
setne %cl
movq 0x28(%rsp), %rax
addb $-0x6, %al
cmpb $-0x4, %al
setb %al
orb %cl, %al
movzbl %al, %ebp
jmp 0xac4e
movq 0x11e5a(%rip), %rdi     # 0x1cfa8
leaq 0xb6b6(%rip), %rsi      # 0x1680b
movl $0x12, %edx
jmp 0xb278
movq 0x11e42(%rip), %rdi     # 0x1cfa8
leaq 0xb662(%rip), %rsi      # 0x167cf
movl $0x11, %edx
jmp 0xb204
movl 0x400(%r14), %ebx
leal 0x4(%rbx), %eax
addl $0xfffffc04, %ebx       # imm = 0xFFFFFC04
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ebx
leal -0x3ff(%rbx), %eax
cmpl $0xfffffbfe, %eax       # imm = 0xFFFFFBFE
ja 0xb365
movl $0x400, %r15d           # imm = 0x400
subl %ebx, %r15d
movl %ebx, %esi
addq %r14, %rsi
leaq 0x12(%rsp), %rdi
movq %r15, %rdx
callq 0x4270
leaq (%rsp,%r15), %rdi
addq $0x12, %rdi
addl $0xfffffc02, %ebx       # imm = 0xFFFFFC02
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4270
jmp 0xb371
movq 0x11dc8(%rip), %rdi     # 0x1cfa8
leaq 0xb5c8(%rip), %rsi      # 0x167af
movl $0x1f, %edx
jmp 0xb278
movq 0x11db0(%rip), %rdi     # 0x1cfa8
leaq 0xb5ff(%rip), %rsi      # 0x167fe
movl $0xc, %edx
callq 0x4330
cmpw $0x4, 0x18(%rsp)
ja 0xb23a
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
je 0xb265
movq 0x11d88(%rip), %rdi     # 0x1cfa8
leaq 0xb5ba(%rip), %rsi      # 0x167e1
movl $0x2, %edx
callq 0x4330
movl %ebx, %edi
callq 0xde83
jmp 0xb265
movl 0x14(%rsp), %ebx
testl %ebx, %ebx
je 0xb265
movq 0x11d5f(%rip), %rdi     # 0x1cfa8
leaq 0xb591(%rip), %rsi      # 0x167e1
movl $0x2, %edx
callq 0x4330
movl 0x8(%rsp), %edi
movl %ebx, %esi
callq 0xde13
movq 0x11d3c(%rip), %rdi     # 0x1cfa8
leaq 0xbbfb(%rip), %rsi      # 0x16e6e
movl $0x1, %edx
callq 0x4330
testb $0x2, %r12b
je 0xb29b
movq 0x11d1e(%rip), %rdi     # 0x1cfa8
leaq 0xb5fa(%rip), %rsi      # 0x1688b
movl $0x12, %edx
callq 0x4330
testb $0x1, %r12b
je 0xb2b9
movq 0x11d00(%rip), %rdi     # 0x1cfa8
leaq 0xb463(%rip), %rsi      # 0x16712
movl $0x16, %edx
callq 0x4330
movq 0x11ce8(%rip), %rdi     # 0x1cfa8
leaq 0xb839(%rip), %rsi      # 0x16b00
movl $0x1, %edx
callq 0x4330
cmpb $0x2, 0x7(%rsp)
jne 0xb31c
movq 0x11cc9(%rip), %rdi     # 0x1cfa8
leaq 0xb5b8(%rip), %rsi      # 0x1689e
movl $0x10, %edx
callq 0x4330
movq 0x11cb1(%rip), %rdi     # 0x1cfa8
testb $0x8, %r12b
jne 0xb30b
leaq 0xb5bf(%rip), %rsi      # 0x168c3
movl $0x1a, %edx
jmp 0xb317
leaq 0xb59d(%rip), %rsi      # 0x168af
movl $0x13, %edx
callq 0x4330
movl 0x1c(%rsp), %ebx
cmpl $-0x1, %ebx
je 0xb35e
movq 0x11c7c(%rip), %r14     # 0x1cfa8
leaq 0xb5ab(%rip), %rsi      # 0x168de
movl $0x10, %edx
movq %r14, %rdi
callq 0x4330
movq %r14, %rdi
movl %ebx, %esi
callq 0x44e0
leaq 0xb7af(%rip), %rsi      # 0x16b00
movl $0x1, %edx
movq %rax, %rdi
callq 0x4330
xorl %ebp, %ebp
jmp 0xac4e
movl %ebx, %eax
movzwl (%r14,%rax), %eax
movw %ax, 0x12(%rsp)
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
jne 0xb37d
movl 0x8(%rsp), %ebx
movq 0x11c24(%rip), %r14     # 0x1cfa8
leaq 0xb459(%rip), %rsi      # 0x167e4
movl $0x19, %edx
movq %r14, %rdi
callq 0x4330
leaq 0xb042(%rip), %rsi      # 0x163e1
movl $0xf, %edx
movq %r14, %rdi
callq 0x4330
movzwl 0x12(%rsp), %eax
leaq 0x11888(%rip), %rcx     # 0x1cc40
movq (%rcx,%rax,8), %rsi
movq %r14, %rdi
callq 0x42d0
leaq 0xb735(%rip), %rsi      # 0x16b00
movl $0x1, %edx
movq %rax, %rdi
callq 0x4330
leaq 0xb012(%rip), %rsi      # 0x163f1
movl $0xf, %edx
movq %r14, %rdi
callq 0x4330
movl %ebx, %edi
callq 0x40f0
movq %r14, %rdi
movq %rax, %rsi
callq 0x42d0
jmp 0xb27d
movl $0x4, %edi
callq 0x4190
movl $0x0, (%rax)
leaq 0x11726(%rip), %rsi     # 0x1cb40
movq %rax, %rdi
xorl %edx, %edx
callq 0x44d0