// File: 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 namespace std;

    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." << endl;
        }
        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." << endl;
            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" << endl;
                    break;
                case service_state_t::STARTING:
                    cout << "STARTING" << endl;
                    break;
                case service_state_t::STARTED:
                    cout << "STARTED" << endl;
                    break;
                case service_state_t::STOPPING:
                    cout << "STOPPING" << endl;
                }
            }
            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
movq %rsp, %rbp
subq $0xa0, %rsp
movl %r8d, -0x78(%rbp)
movl %ecx, %eax
movl -0x78(%rbp), %ecx
movl %eax, -0x74(%rbp)
movq %rdx, %rax
movl -0x74(%rbp), %edx
movq %rax, -0x70(%rbp)
movq %rsi, %rax
movq -0x70(%rbp), %rsi
movq %rax, -0x68(%rbp)
movl %edi, %r8d
movq -0x68(%rbp), %rdi
movb %r9b, %al
movl %r8d, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movw %cx, -0x1e(%rbp)
andb $0x1, %al
movb %al, -0x1f(%rbp)
cmpl $0xa, -0x1c(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x20(%rbp)
movl -0x8(%rbp), %edi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0xccc0
cmpl $0x1, %eax
jne 0xa51c
movl $0x1, -0x4(%rbp)
jmp 0xad0d
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x11350
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x3c, %eax
jne 0xa56f
testb $0x1, -0x20(%rbp)
je 0xa563
movq 0x27aa0(%rip), %rdi     # 0x31fe8
leaq 0x1a062(%rip), %rsi     # 0x245b1
callq 0x53d0
movq %rax, %rdi
movq 0x27a0a(%rip), %rsi     # 0x31f68
callq 0x5410
movl $0x1, -0x4(%rbp)
jmp 0xad0d
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movb -0x20(%rbp), %al
leaq -0x24(%rbp), %rdx
xorl %ecx, %ecx
andb $0x1, %al
movzbl %al, %r8d
callq 0xcd90
cmpl $0x0, %eax
je 0xa59b
movl $0x1, -0x4(%rbp)
jmp 0xad0d
movzwl -0x1e(%rbp), %eax
subl $0x5, %eax
setge %al
shlb $0x3, %al
orb $0x12, %al
movb %al, -0x25(%rbp)
movzwl -0x1e(%rbp), %eax
subl $0x5, %eax
setge %al
movzbl %al, %ecx
movl %ecx, %eax
leal 0xa(,%rax,4), %eax
movl %eax, -0x2c(%rbp)
leaq -0x33(%rbp), %rdi
leaq -0x25(%rbp), %rsi
callq 0x11b60
movb %al, -0x32(%rbp)
leaq -0x32(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x131e0
movl %eax, %ecx
movl %ecx, -0x31(%rbp)
shrq $0x20, %rax
movb %al, -0x2d(%rbp)
movl -0x8(%rbp), %edi
leaq -0x31(%rbp), %rsi
callq 0x13220
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x11350
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x46, %eax
je 0xa648
movq 0x279c7(%rip), %rdi     # 0x31fe8
leaq 0x19b1d(%rip), %rsi     # 0x24145
callq 0x53d0
movq %rax, %rdi
movq 0x27931(%rip), %rsi     # 0x31f68
callq 0x5410
movl $0x1, -0x4(%rbp)
jmp 0xad0d
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x115f0
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl -0x2c(%rbp), %edx
addl $0x1, %edx
callq 0x11440
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x115f0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movb %al, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x113e0
movb %al, -0x35(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x113e0
movsbl %al, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
movl -0x3c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3e(%rbp)
movl -0x3c(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3f(%rbp)
movl -0x3c(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x40(%rbp)
movl -0x3c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x41(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x113e0
movsbl %al, %eax
movl %eax, -0x48(%rbp)
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
testb $0x1, -0x41(%rbp)
je 0xa74d
movq -0x10(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
movl $0x6, %edx
movl $0x4, %ecx
callq 0x11540
jmp 0xa79f
movzwl -0x1e(%rbp), %eax
cmpl $0x5, %eax
jge 0xa76f
movq -0x10(%rbp), %rdi
leaq -0x50(%rbp), %rsi
movl $0x6, %edx
movl $0x4, %ecx
callq 0x11540
jmp 0xa79d
movq -0x10(%rbp), %rdi
leaq -0x54(%rbp), %rsi
movl $0x6, %edx
movl $0x4, %ecx
callq 0x11540
movq -0x10(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0xa, %edx
movl $0x4, %ecx
callq 0x11540
jmp 0xa79f
movl -0x1c(%rbp), %eax
addl $-0x17, %eax
subl $0x1, %eax
ja 0xa8b9
jmp 0xa7b0
testb $0x1, -0x1f(%rbp)
je 0xa870
movzbl -0x34(%rbp), %eax
movq %rax, -0x80(%rbp)
subq $0x3, %rax
ja 0xa86e
movq -0x80(%rbp), %rax
leaq 0x1882d(%rip), %rcx     # 0x23004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x277b1(%rip), %rdi     # 0x31f98
leaq 0x19f43(%rip), %rsi     # 0x24731
callq 0x53d0
movq %rax, %rdi
movq 0x2776b(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0xa86e
movq 0x2778d(%rip), %rdi     # 0x31f98
leaq 0x19f27(%rip), %rsi     # 0x24739
callq 0x53d0
movq %rax, %rdi
movq 0x27747(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0xa86e
movq 0x27769(%rip), %rdi     # 0x31f98
leaq 0x19f0c(%rip), %rsi     # 0x24742
callq 0x53d0
movq %rax, %rdi
movq 0x27723(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0xa86e
movq 0x27745(%rip), %rdi     # 0x31f98
leaq 0x19ef0(%rip), %rsi     # 0x2474a
callq 0x53d0
movq %rax, %rdi
movq 0x276ff(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0xa870
cmpl $0x17, -0x1c(%rbp)
jne 0xa88a
cmpb $0x2, -0x34(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xad0d
cmpb $0x0, -0x34(%rbp)
jne 0xa8ad
movl -0x48(%rbp), %eax
addl $-0x2, %eax
subl $0x3, %eax
ja 0xa8a9
jmp 0xa89d
movl $0x0, -0x4(%rbp)
jmp 0xad0d
jmp 0xa8ab
jmp 0xa8ad
movl $0x1, -0x4(%rbp)
jmp 0xad0d
jmp 0xa8bb
movq 0x276d6(%rip), %rdi     # 0x31f98
leaq 0x19e8a(%rip), %rsi     # 0x24753
callq 0x53d0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x53d0
movq %rax, %rdi
leaq 0x19e79(%rip), %rsi     # 0x2475d
callq 0x53d0
movzbl -0x34(%rbp), %eax
movq %rax, -0x88(%rbp)
subq $0x3, %rax
ja 0xac45
movq -0x88(%rbp), %rax
leaq 0x18708(%rip), %rcx     # 0x23014
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2767c(%rip), %rdi     # 0x31f98
leaq 0x19e0e(%rip), %rsi     # 0x24731
callq 0x53d0
movl -0x48(%rbp), %eax
movq %rax, -0x90(%rbp)
subq $0x6, %rax
ja 0xab38
movq -0x90(%rbp), %rax
leaq 0x186da(%rip), %rcx     # 0x23024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x2763e(%rip), %rdi     # 0x31f98
leaq 0x19e09(%rip), %rsi     # 0x2476a
callq 0x53d0
jmp 0xab38
movq 0x27626(%rip), %rdi     # 0x31f98
leaq 0x19e09(%rip), %rsi     # 0x24782
callq 0x53d0
jmp 0xab38
movq 0x2760e(%rip), %rdi     # 0x31f98
leaq 0x19e11(%rip), %rsi     # 0x247a2
callq 0x53d0
movzwl -0x1e(%rbp), %eax
cmpl $0x5, %eax
jge 0xa9c2
cmpl $0x0, -0x50(%rbp)
je 0xa9c0
movq 0x275ec(%rip), %rdi     # 0x31f98
leaq 0x19e01(%rip), %rsi     # 0x247b4
callq 0x53d0
movl -0x50(%rbp), %edi
callq 0xd2c0
jmp 0xa9e8
cmpl $0x0, -0x58(%rbp)
je 0xa9e6
movq 0x275c9(%rip), %rdi     # 0x31f98
leaq 0x19dde(%rip), %rsi     # 0x247b4
callq 0x53d0
movl -0x54(%rbp), %edi
movl -0x58(%rbp), %esi
callq 0xd240
jmp 0xa9e8
movq 0x275a9(%rip), %rdi     # 0x31f98
leaq 0x1a421(%rip), %rsi     # 0x24e17
callq 0x53d0
jmp 0xab38
movq -0x10(%rbp), %rdi
leaq -0x5a(%rbp), %rsi
movl $0x4, %edx
movl $0x2, %ecx
callq 0x11540
cmpl $0x0, -0x50(%rbp)
jne 0xaa23
movl -0x54(%rbp), %eax
movl %eax, -0x50(%rbp)
movq 0x2756e(%rip), %rdi     # 0x31f98
leaq 0x19d86(%rip), %rsi     # 0x247b7
callq 0x53d0
movq 0x2755b(%rip), %rdi     # 0x31f98
leaq 0x19983(%rip), %rsi     # 0x243c7
callq 0x53d0
movq %rax, %rdi
movzwl -0x5a(%rbp), %eax
movl %eax, %ecx
leaq 0x271c7(%rip), %rax     # 0x31c20
movq (%rax,%rcx,8), %rsi
callq 0x53d0
movq %rax, %rdi
leaq 0x1a049(%rip), %rsi     # 0x24ab5
callq 0x53d0
movq 0x27520(%rip), %rdi     # 0x31f98
leaq 0x19958(%rip), %rsi     # 0x243d7
callq 0x53d0
movq %rax, -0x98(%rbp)
movl -0x50(%rbp), %edi
callq 0x5100
movq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
jmp 0xab38
movq 0x274ea(%rip), %rdi     # 0x31f98
leaq 0x19d1c(%rip), %rsi     # 0x247d1
callq 0x53d0
movzwl -0x1e(%rbp), %eax
cmpl $0x5, %eax
jge 0xaae6
cmpl $0x0, -0x50(%rbp)
je 0xaae4
movq 0x274c8(%rip), %rdi     # 0x31f98
leaq 0x19cdd(%rip), %rsi     # 0x247b4
callq 0x53d0
movl -0x50(%rbp), %edi
callq 0xd2c0
jmp 0xab0c
cmpl $0x0, -0x58(%rbp)
je 0xab0a
movq 0x274a5(%rip), %rdi     # 0x31f98
leaq 0x19cba(%rip), %rsi     # 0x247b4
callq 0x53d0
movl -0x54(%rbp), %edi
movl -0x58(%rbp), %esi
callq 0xd240
jmp 0xab0c
movq 0x27485(%rip), %rdi     # 0x31f98
leaq 0x1a2fd(%rip), %rsi     # 0x24e17
callq 0x53d0
jmp 0xab38
movq 0x27470(%rip), %rdi     # 0x31f98
leaq 0x19caf(%rip), %rsi     # 0x247de
callq 0x53d0
jmp 0xab38
jmp 0xab38
jmp 0xac45
movq 0x27454(%rip), %rdi     # 0x31f98
leaq 0x19bee(%rip), %rsi     # 0x24739
callq 0x53d0
cmpb $0x0, -0x35(%rbp)
jne 0xab69
movq 0x2743b(%rip), %rdi     # 0x31f98
leaq 0x19c8d(%rip), %rsi     # 0x247f1
callq 0x53d0
jmp 0xac45
movq 0x27423(%rip), %rdi     # 0x31f98
leaq 0x19bc6(%rip), %rsi     # 0x24742
callq 0x53d0
testb $0x1, -0x3f(%rbp)
je 0xab9a
movq 0x2740a(%rip), %rdi     # 0x31f98
leaq 0x19c75(%rip), %rsi     # 0x2480a
callq 0x53d0
jmp 0xac45
movq 0x273f2(%rip), %rdi     # 0x31f98
leaq 0x19b9d(%rip), %rsi     # 0x2474a
callq 0x53d0
cmpb $0x2, -0x35(%rbp)
jne 0xabcb
movq 0x273d9(%rip), %rdi     # 0x31f98
leaq 0x19c57(%rip), %rsi     # 0x2481d
callq 0x53d0
movzwl -0x1e(%rbp), %eax
cmpl $0x5, %eax
jge 0xac0a
cmpl $0x0, -0x50(%rbp)
je 0xac08
movq 0x273b7(%rip), %rdi     # 0x31f98
leaq 0x19c4e(%rip), %rsi     # 0x24836
callq 0x53d0
movl -0x50(%rbp), %edi
callq 0xd2c0
movq 0x2739c(%rip), %rdi     # 0x31f98
leaq 0x1a214(%rip), %rsi     # 0x24e17
callq 0x53d0
jmp 0xac43
cmpl $0x0, -0x58(%rbp)
je 0xac41
movq 0x27381(%rip), %rdi     # 0x31f98
leaq 0x19c18(%rip), %rsi     # 0x24836
callq 0x53d0
movl -0x54(%rbp), %edi
movl -0x58(%rbp), %esi
callq 0xd240
movq 0x27363(%rip), %rdi     # 0x31f98
leaq 0x1a1db(%rip), %rsi     # 0x24e17
callq 0x53d0
jmp 0xac43
jmp 0xac45
testb $0x1, -0x3d(%rbp)
je 0xac5e
movq 0x27346(%rip), %rdi     # 0x31f98
leaq 0x19beb(%rip), %rsi     # 0x24844
callq 0x53d0
testb $0x1, -0x3e(%rbp)
je 0xac77
movq 0x2732d(%rip), %rdi     # 0x31f98
leaq 0x19a80(%rip), %rsi     # 0x246f2
callq 0x53d0
movq 0x2731a(%rip), %rdi     # 0x31f98
leaq 0x19e30(%rip), %rsi     # 0x24ab5
callq 0x53d0
cmpb $0x2, -0x35(%rbp)
jne 0xacd3
movq 0x27301(%rip), %rdi     # 0x31f98
leaq 0x19bb9(%rip), %rsi     # 0x24857
callq 0x53d0
testb $0x1, -0x40(%rbp)
je 0xacbe
movq 0x272e8(%rip), %rdi     # 0x31f98
leaq 0x19bb1(%rip), %rsi     # 0x24868
callq 0x53d0
jmp 0xacd1
movq 0x272d3(%rip), %rdi     # 0x31f98
leaq 0x19bb0(%rip), %rsi     # 0x2487c
callq 0x53d0
jmp 0xacd3
cmpl $-0x1, -0x4c(%rbp)
je 0xad06
movq 0x272b8(%rip), %rdi     # 0x31f98
leaq 0x19bb0(%rip), %rsi     # 0x24897
callq 0x53d0
movq %rax, %rdi
movl -0x4c(%rbp), %esi
callq 0x56d0
movq %rax, %rdi
leaq 0x19db4(%rip), %rsi     # 0x24ab5
callq 0x53d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)