// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/dinit-monitor.cc
// Function: dinit_monitor_main(int, char**)
int dinit_monitor_main(int argc, char **argv)
{
    bool show_help = argc < 2;
    std::string control_socket_str;
    const char *control_socket_path = nullptr;
    bool user_dinit = (getuid() != 0);  // communicate with user daemon
    bool issue_init = false;  // request initial service state
    bool use_environ = false;  // listening on activation environment changes
    bool exit_after = false;  // exit after first issued command
    const char *str_started = "started";
    const char *str_stopped = "stopped";
    const char *str_failed = "failed";
    const char *str_set = "set";
    const char *str_unset = "unset";

    const char *command_str = nullptr;
    std::vector<const char *> services;

    for (int i = 1; i < argc; i++) {
        if (argv[i][0] == '-') {
            if (strcmp(argv[i], "--help") == 0) {
                show_help = true;
                break;
            }
            else if (strcmp(argv[i], "--version") == 0) {
                std::cout << "Dinit version " << DINIT_VERSION << ".\n";
                return 0;
            }
            else if (strcmp(argv[i], "--exit") == 0 || strcmp(argv[i], "-e") == 0) {
                exit_after = true;
            }
            else if (strcmp(argv[i], "--env") == 0 || strcmp(argv[i], "-E") == 0) {
                use_environ = true;
            }
            else if (strcmp(argv[i], "--system") == 0 || strcmp(argv[i], "-s") == 0) {
                user_dinit = false;
            }
            else if (strcmp(argv[i], "--user") == 0 || strcmp(argv[i], "-u") == 0) {
                user_dinit = true;
            }
            else if (strcmp(argv[i], "--initial") == 0 || strcmp(argv[i], "-i") == 0) {
                issue_init = true;
            }
            else if (strcmp(argv[i], "--socket-path") == 0 || strcmp(argv[i], "-p") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --socket-path/-p should be followed by socket path\n";
                    return 1;
                }
                control_socket_str = argv[i];
            }
            else if (strcmp(argv[i], "--str-started") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --str-started should be followed by an argument\n";
                    return 1;
                }
                str_started = argv[i];
            }
            else if (strcmp(argv[i], "--str-stopped") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --str-stopped should be followed by an argument\n";
                    return 1;
                }
                str_stopped = argv[i];
            }
            else if (strcmp(argv[i], "--str-failed") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --str-failed should be followed by an argument\n";
                    return 1;
                }
                str_failed = argv[i];
            }
            else if (strcmp(argv[i], "--str-set") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --str-set should be followed by an argument\n";
                    return 1;
                }
                str_set = argv[i];
            }
            else if (strcmp(argv[i], "--str-unset") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --str-unset should be followed by an argument\n";
                    return 1;
                }
                str_unset = argv[i];
            }
            else if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--command") == 0) {
                ++i;
                if (i == argc) {
                    std::cerr << "dinit-monitor: --command/-c should be followed by command\n";
                    return 1;
                }
                command_str = argv[i];
            }
        }
        else {
            services.emplace_back(argv[i]);
        }
    }

    if (show_help) {
        std::cout << "dinit-monitor:   monitor Dinit services\n"
                "\n"
                "Usage:\n"
                "    dinit-monitor [options] <service-names|environ-names...>\n"
                "\n"
                "Options:\n"
                "  --help           : show this help\n"
                "  -e, --exit       : exit after the first issued command\n"
                "  -E, --env        : monitor activation environment changes\n"
                "  -s, --system     : monitor system daemon (default if run as root)\n"
                "  -u, --user       : monitor user daemon\n"
                "  -i, --initial    : also execute command for initial service state\n"
                "  --str-started <started-text>\n"
                "                   : specify text describing status when service starts\n"
                "  --str-stopped <stopped-text>\n"
                "                   : specify text describing status when service stops\n"
                "  --str-failed <failed-text>\n"
                "                   : specify text describing status when service fails\n"
                "  --socket-path <path>, -p <path>\n"
                "                   : specify socket for communication with daemon\n"
                "  -c, --command    : specify command to execute on service status change\n"
                "                     (%n for service name, %s for status)\n";
        return 1;
    }

    if (services.empty() && !use_environ) {
        std::cerr << "dinit-monitor: specify at least one service name\n";
        return 1;
    }

    if (command_str == nullptr) {
        std::cerr << "dinit-monitor: command must specified\n";
        return 1;
    }

    std::vector<stringview> command_parts = split_command(command_str);
    if (command_parts.size() == 0) {
        std::cerr << "dinit-monitor: specified command is empty\n";
        return 1;
    }

    // Ignore SIGPIPE to avoid dying due to it, and set up a SIGCHLD handler (but mask it)
    sigset_t signal_mask;
    sigprocmask(SIG_SETMASK, nullptr, &signal_mask);
    sigaddset(&signal_mask, SIGCHLD);
    sigprocmask(SIG_SETMASK, &signal_mask, nullptr);
    signal(SIGPIPE, SIG_IGN);
    signal(SIGCHLD, sigchld_handler);

    // Locate control socket
    if (! control_socket_str.empty()) {
        control_socket_path = control_socket_str.c_str();
    }
    else {
        control_socket_path = get_default_socket_path(control_socket_str, user_dinit);
        if (control_socket_path == nullptr) {
            std::cerr << "dinit-monitor: cannot locate user home directory (set XDG_RUNTIME_DIR, "
                    "HOME, check /etc/passwd file, or specify socket path via -p)\n";
            return 1;
        }
    }

    try {
        int socknum = connect_to_daemon(control_socket_path);

        // Start by querying protocol version:
        cpbuffer_t rbuffer;
        uint16_t protocol_ver = check_protocol_version(min_cp_version, max_cp_version, rbuffer, socknum);

        // Load all services
        std::unordered_map<handle_t, const char *> service_map;
        std::unordered_set<std::string> environ_set;
        std::vector<std::pair<const char *, service_state_t>> service_init_state;
        std::string env_value;

        for (const char *service_name : services) {

            handle_t hndl;
            service_state_t state;

            if (use_environ) {
                environ_set.emplace(service_name);
                continue;
            }

            if (!load_service(socknum, rbuffer, service_name, &hndl, &state)) {
                std::cerr << "dinit-monitor: cannot load service: " << service_name << "\n";
                return 1;
            }

            service_map.emplace(hndl, service_name);
            service_init_state.push_back(std::make_pair(service_name, state));
        }

        if (use_environ) {
            // Request listening on environ events
            request_environ(socknum, rbuffer, protocol_ver);
            if (issue_init) {
                // Get the whole block and see if it's already set
                auto envsz = get_allenv(socknum, rbuffer);
                while (envsz > 0) {
                    bool issued;
                    envsz = read_var_and_issue(socknum, rbuffer, envsz, environ_set, env_value, command_parts, issued, str_set, str_unset);
                    if (issued && exit_after) {
                        return 0;
                    }
                }
            }
        }
        else if (issue_init) {
            // Issue initial status commands if requested
            for (auto state : service_init_state ) {
                if (state.second == service_state_t::STARTED) {
                    issue_command(state.first, nullptr, str_started, command_parts);
                    if (exit_after) {
                        return 0;
                    }
                }
                else if (state.second == service_state_t::STOPPED) {
                    issue_command(state.first, nullptr, str_stopped, command_parts);
                    if (exit_after) {
                        return 0;
                    }
                }
            }
        }

        // Watch information packets; execute notification

        int r = rbuffer.fill_to(socknum, 2);
        while (r > 0) {
            if (rbuffer[0] >= 100) {
                int pktlen = (unsigned char) rbuffer[1];
                fill_buffer_to(rbuffer, socknum, pktlen);

                if (use_environ && rbuffer[0] == (char)cp_info::ENVEVENT) {
                    envvar_len_t envln;
                    rbuffer.extract((char *) &envln, 3, sizeof(envln));
                    rbuffer.consume(pktlen);
                    // this will return 0, we don't want to consume after this
                    bool issued;
                    pktlen = read_var_and_issue(socknum, rbuffer, envln, environ_set, env_value, command_parts, issued, str_set, str_unset);
                    if (issued && exit_after) {
                        return 0;
                    }
                }
                else if (!use_environ && rbuffer[0] == (char)cp_info::SERVICEEVENT) {
                    handle_t ev_handle;
                    rbuffer.extract((char *) &ev_handle, 2, sizeof(ev_handle));
                    service_event_t event = static_cast<service_event_t>(rbuffer[2 + sizeof(ev_handle)]);

                    const char *service_name = service_map.at(ev_handle);
                    const char *event_str;

                    if (event == service_event_t::STARTED) {
                        event_str = str_started;
                    }
                    else if (event == service_event_t::STOPPED) {
                        event_str = str_stopped;
                    }
                    else if (event == service_event_t::FAILEDSTART) {
                        event_str = str_failed;
                    }
                    else {
                        goto consume_packet;
                    }
                    issue_command(service_name, nullptr, event_str, command_parts);
                    if (exit_after) {
                        return 0;
                    }
                }

                consume_packet:

                rbuffer.consume(pktlen);
                r = rbuffer.fill_to(socknum, 2);
            }
            else {
                // Not an information packet?
                std::cerr << "dinit-monitor: protocol error\n";
                return 1;
            }
        }

        if (r == -1) {
            perror("dinit-monitor: read");
        }
        else {
            std::cerr << "dinit-monitor: connection closed by server\n";
        }
        return 1;
    }
    catch (cp_old_client_exception &e) {
        std::cerr << "dinit-monitor: too old (server reports newer protocol version)\n";
    }
    catch (cp_old_server_exception &e) {
        std::cerr << "dinit-monitor: server too old or protocol error\n";
    }
    catch (cp_read_exception &e) {
        std::cerr << "dinit-monitor: control socket read failure or protocol error\n";
    }
    catch (cp_write_exception &e) {
        std::cerr << "dinit-monitor: control socket write error: " << std::strerror(e.errcode) << "\n";
    }
    catch (dinit_protocol_error &e) {
        std::cerr << "dinit-monitor: protocol error\n";
    }
    catch (general_error &ge) {
        std::cerr << "dinit-monitor";
        if (ge.get_action() != nullptr) {
            std::cerr << ": " << ge.get_action();
            std::string &arg = ge.get_arg();
            if (!arg.empty()) {
                std::cerr << " " << arg;
            }
        }
        if (ge.get_err() != 0) {
            std::cerr << ": " << strerror(ge.get_err());
        }
        std::cerr << '\n';
    }

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x608, %rsp            # imm = 0x608
movq %rsi, %r15
movl %edi, %ebp
leaq 0xe0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
callq 0x2130
testl %eax, %eax
setne %al
movl %eax, 0xc(%rsp)
leaq 0x90(%rsp), %r14
andq $0x0, 0x10(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
leaq 0x3b16(%rip), %rax      # 0x60a5
movq %rax, 0x48(%rsp)
leaq 0x3b58(%rip), %rax      # 0x60f3
movq %rax, 0x50(%rsp)
leaq 0x3b9a(%rip), %rax      # 0x6141
movq %rax, 0x88(%rsp)
leaq 0x3bd7(%rip), %rax      # 0x618d
movq %rax, 0x60(%rsp)
leaq 0x3c11(%rip), %rax      # 0x61d3
movq %rax, 0x58(%rsp)
pushq $0x1
popq %rbx
xorl %r12d, %r12d
leaq 0x3c88(%rip), %rax      # 0x625c
movq %rax, 0x28(%rsp)
movq 0x79f0(%rip), %rax      # 0x9fd0
movq %rax, 0x68(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x40(%rsp)
cmpl %ebp, %ebx
jge 0x28d9
movslq %ebx, %rax
movq (%r15,%rax,8), %r13
cmpb $0x2d, (%r13)
jne 0x27ec
movq %r13, %rdi
leaq 0x39e0(%rip), %rsi      # 0x6004
callq 0x2320
testl %eax, %eax
je 0x2aa0
movq %r13, %rdi
leaq 0x39d0(%rip), %rsi      # 0x600b
callq 0x2320
testl %eax, %eax
je 0x2a2f
movq %r13, %rdi
leaq 0x39d5(%rip), %rsi      # 0x6027
callq 0x2320
testl %eax, %eax
je 0x27fd
cmpb $0x65, 0x1(%r13)
jne 0x2671
cmpb $0x0, 0x2(%r13)
je 0x27fd
movq %r13, %rdi
leaq 0x39b3(%rip), %rsi      # 0x602e
callq 0x2320
testl %eax, %eax
je 0x2809
cmpb $0x45, 0x1(%r13)
jne 0x269a
cmpb $0x0, 0x2(%r13)
je 0x2809
movq %r13, %rdi
leaq 0x3990(%rip), %rsi      # 0x6034
callq 0x2320
testl %eax, %eax
je 0x2815
cmpb $0x73, 0x1(%r13)
jne 0x26c3
cmpb $0x0, 0x2(%r13)
je 0x2815
movq %r13, %rdi
leaq 0x3970(%rip), %rsi      # 0x603d
callq 0x2320
testl %eax, %eax
je 0x2822
cmpb $0x75, 0x1(%r13)
jne 0x26ec
cmpb $0x0, 0x2(%r13)
je 0x2822
movq %r13, %rdi
leaq 0x394e(%rip), %rsi      # 0x6044
callq 0x2320
testl %eax, %eax
je 0x282d
cmpb $0x69, 0x1(%r13)
jne 0x2715
cmpb $0x0, 0x2(%r13)
je 0x282d
movq %r13, %rdi
leaq 0x392f(%rip), %rsi      # 0x604e
callq 0x2320
testl %eax, %eax
je 0x2839
cmpb $0x70, 0x1(%r13)
jne 0x273e
cmpb $0x0, 0x2(%r13)
je 0x2839
movq %r13, %rdi
leaq 0x3957(%rip), %rsi      # 0x609f
callq 0x2320
testl %eax, %eax
je 0x2859
movq %r13, %rdi
leaq 0x398e(%rip), %rsi      # 0x60ed
callq 0x2320
testl %eax, %eax
je 0x2871
movq %r13, %rdi
leaq 0x39c5(%rip), %rsi      # 0x613b
callq 0x2320
testl %eax, %eax
je 0x2889
movq %r13, %rdi
leaq 0x39fa(%rip), %rsi      # 0x6187
callq 0x2320
testl %eax, %eax
je 0x28a4
movq %r13, %rdi
leaq 0x3a29(%rip), %rsi      # 0x61cd
callq 0x2320
testl %eax, %eax
je 0x28bc
cmpb $0x63, 0x1(%r13)
jne 0x27bf
cmpb $0x0, 0x2(%r13)
je 0x27d6
movq %r13, %rdi
leaq 0x3a4e(%rip), %rsi      # 0x6217
callq 0x2320
testl %eax, %eax
jne 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31ed
movslq %ebx, %rax
movq (%r15,%rax,8), %r12
jmp 0x28d2
leaq (%r15,%rax,8), %rsi
movq %r14, %rdi
callq 0x3a66
jmp 0x28d2
movb $0x1, %al
movq %rax, 0x10(%rsp)
jmp 0x28d2
movb $0x1, %al
movq %rax, 0x20(%rsp)
jmp 0x28d2
movl $0x0, 0xc(%rsp)
jmp 0x28d2
movb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x28d2
movb $0x1, %al
movq %rax, 0x40(%rsp)
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31a3
movslq %ebx, %rax
movq (%r15,%rax,8), %rsi
leaq 0xd0(%rsp), %rdi
callq 0x2400
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31ac
movslq %ebx, %rax
movq (%r15,%rax,8), %rax
movq %rax, 0x48(%rsp)
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31b5
movslq %ebx, %rax
movq (%r15,%rax,8), %rax
movq %rax, 0x50(%rsp)
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31d2
movslq %ebx, %rax
movq (%r15,%rax,8), %rax
movq %rax, 0x88(%rsp)
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31db
movslq %ebx, %rax
movq (%r15,%rax,8), %rax
movq %rax, 0x60(%rsp)
jmp 0x28d2
incl %ebx
cmpl %ebp, %ebx
je 0x31e4
movslq %ebx, %rax
movq (%r15,%rax,8), %rax
movq %rax, 0x58(%rsp)
incl %ebx
jmp 0x2600
cmpl $0x2, %ebp
jl 0x2aa0
movq 0x90(%rsp), %rax
cmpq 0x98(%rsp), %rax
jne 0x28ff
testb $0x1, 0x20(%rsp)
je 0x2a88
testq %r12, %r12
je 0x2a64
callq 0x2300
movq %rax, %rbx
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
leaq 0x180(%rsp), %r15
movb (%r12), %al
testb %al, %al
je 0x29b7
movsbl %al, %edi
movq %rbx, %rsi
callq 0x46eb
testb %al, %al
je 0x2949
incq %r12
jmp 0x2929
movb (%r12), %al
testb %al, %al
je 0x29b7
movq %r12, %r13
testb %al, %al
je 0x2988
movsbl %al, %edi
movq %rbx, %rsi
callq 0x46eb
testb %al, %al
jne 0x2988
cmpb $0x22, (%r13)
jne 0x297f
movzbl 0x1(%r13), %eax
incq %r13
testl %eax, %eax
je 0x297f
cmpl $0x22, %eax
jne 0x296e
movb 0x1(%r13), %al
incq %r13
jmp 0x2954
movq %r13, %rax
subq %r12, %rax
movq %r12, 0x180(%rsp)
movq %rax, 0x188(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x4708
cmpb $0x0, (%r13)
movq %r13, %r12
jne 0x2929
movq 0x78(%rsp), %rax
cmpq 0x70(%rsp), %rax
je 0x2a6d
pushq $0x2
popq %rbx
leaq 0x588(%rsp), %r14
movl %ebx, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x2110
pushq $0x11
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x2360
movl %ebx, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2110
pushq $0xd
popq %rdi
pushq $0x1
popq %rbx
movq %rbx, %rsi
callq 0x2270
leaq 0xb44(%rip), %rsi       # 0x3550
movl %ebp, %edi
callq 0x2270
cmpq $0x0, 0xd8(%rsp)
je 0x2ae0
movq 0xd0(%rsp), %rdi
jmp 0x2b01
movq 0x759a(%rip), %rdi      # 0x9fd0
leaq 0x35d8(%rip), %rsi      # 0x6015
callq 0x2210
leaq 0x3fcf(%rip), %rsi      # 0x6a18
movq %rax, %rdi
callq 0x2210
xorl %ebx, %ebx
leaq 0x35ca(%rip), %rsi      # 0x6024
movq %rax, %rdi
callq 0x2210
jmp 0x2ab2
leaq 0x3bfd(%rip), %rax      # 0x6668
jmp 0x2a8f
movq 0x757c(%rip), %rdi      # 0x9ff0
leaq 0x3c14(%rip), %rsi      # 0x668f
callq 0x2210
pushq $0x1
popq %rbx
jmp 0x317c
leaq 0x3ba7(%rip), %rax      # 0x6636
movq %rax, 0x28(%rsp)
movq 0x7555(%rip), %rax      # 0x9ff0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x2210
pushq $0x1
popq %rbx
leaq 0x90(%rsp), %rdi
callq 0x4ae6
leaq 0xd0(%rsp), %rdi
callq 0x2100
movl %ebx, %eax
addq $0x608, %rsp            # imm = 0x608
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl 0xc(%rsp), %esi
andl $0x1, %esi
leaq 0xd0(%rsp), %rdi
callq 0x3a9d
movq %rax, %rdi
testq %rax, %rax
je 0x318b
callq 0x3b4b
leaq 0x180(%rsp), %rdx
andq $0x0, 0x400(%rdx)
pushq $0x1
popq %rdi
pushq $0x5
popq %rsi
movl %eax, 0xc(%rsp)
movl %eax, %ecx
callq 0x3cfc
movw %ax, 0x28(%rsp)
leaq 0x178(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rbx, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x140(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rbx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %ecx, -0x10(%rax)
leaq 0xb0(%rsp), %rcx
andq $0x0, 0x10(%rcx)
movups %xmm0, -0x8(%rax)
movaps %xmm0, (%rcx)
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x90(%rsp), %r15
movq 0x98(%rsp), %r14
cmpq %r14, %r15
je 0x2d03
movq (%r15), %r12
movq %r12, 0x18(%rsp)
testb $0x1, 0x20(%rsp)
je 0x2bcd
leaq 0x110(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x4c1a
jmp 0x2cfa
movq %r12, %rdi
callq 0x20e0
movq %rax, %rbx
movzwl %bx, %ebp
addl $0x3, %ebp
movq %rbp, %rdi
callq 0x2030
movq %rax, %r13
movq %rax, 0x30(%rsp)
movb $0x2, (%rax)
movw %bx, 0x1(%rax)
movq %rax, %rdi
addq $0x3, %rdi
movzwl %bx, %edx
movq %r12, %rsi
callq 0x21a0
movl 0xc(%rsp), %ebx
movl %ebx, %edi
movq %r13, %rsi
movl %ebp, %edx
callq 0x4093
leaq 0x30(%rsp), %rdi
callq 0x489e
leaq 0x180(%rsp), %rdi
movl %ebx, %esi
callq 0x40c5
movl 0x580(%rsp), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
movzbl 0x180(%rsp,%rcx), %eax
cmpl $0x3b, %eax
jne 0x30e0
leaq 0x180(%rsp), %rdi
movl 0xc(%rsp), %esi
pushq $0x6
popq %rdx
callq 0x3e2b
leaq 0x180(%rsp), %rdi
leaq 0xcc(%rsp), %r12
movq %r12, %rsi
pushq $0x2
popq %rdx
pushq $0x4
popq %rcx
callq 0x3e92
movl 0x580(%rsp), %eax
leal 0x1(%rax), %ecx
leal -0x3ff(%rax), %edx
movl $0x400, %esi            # imm = 0x400
cmpl %esi, %ecx
cmovbl %ecx, %edx
movb 0x180(%rsp,%rdx), %bl
leal 0x7(%rax), %ecx
addl $0xfffffc07, %eax       # imm = 0xFFFFFC07
cmpl %esi, %ecx
cmovbl %ecx, %eax
movl %eax, 0x580(%rsp)
addl $-0x7, 0x584(%rsp)
leaq 0x148(%rsp), %rdi
movq %r12, %rsi
leaq 0x18(%rsp), %rdx
callq 0x4f90
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movb %bl, 0x38(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x52d4
addq $0x8, %r15
jmp 0x2b9e
testb $0x1, 0x20(%rsp)
je 0x2e86
movb $0x1b, 0x30(%rsp)
cmpw $0x5, 0x28(%rsp)
movl 0xc(%rsp), %ebp
jb 0x321e
leaq 0x30(%rsp), %rbx
pushq $0x1
popq %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x4093
leaq 0x180(%rsp), %rdi
movl %ebp, %esi
callq 0x40c5
movl 0x580(%rsp), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x32, 0x180(%rsp,%rcx)
jne 0x3227
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movl %eax, 0x580(%rsp)
decl 0x584(%rsp)
testb $0x1, 0x40(%rsp)
je 0x2ee5
leaq 0x18(%rsp), %rsi
movw $0x18, (%rsi)
pushq $0x2
popq %rdx
movl 0xc(%rsp), %ebp
movl %ebp, %edi
callq 0x4093
leaq 0x180(%rsp), %rdi
movl %ebp, %esi
callq 0x40c5
movl 0x580(%rsp), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x4e, 0x180(%rsp,%rcx)
jne 0x3243
leaq 0x180(%rsp), %r14
pushq $0x9
popq %rdx
movq %r14, %rdi
movl %ebp, %esi
callq 0x3df2
pushq $0x1
popq %rdx
pushq $0x8
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3e92
movl 0x400(%r14), %eax
leal 0x9(%rax), %ecx
addl $0xfffffc09, %eax       # imm = 0xFFFFFC09
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movl %eax, 0x400(%r14)
addl $-0x9, 0x404(%r14)
movq 0x30(%rsp), %rax
leaq 0x110(%rsp), %r12
leaq 0xf0(%rsp), %r13
leaq 0x70(%rsp), %rbp
testq %rax, %rax
je 0x2ee5
subq $0x8, %rsp
movl 0x14(%rsp), %edi
movq %r14, %rsi
movq %rax, %rdx
movq %r12, %rcx
movq %r13, %r8
movq %rbp, %r9
pushq 0x60(%rsp)
pushq 0x70(%rsp)
pushq %rbx
callq 0x3551
addq $0x20, %rsp
movq 0x10(%rsp), %rcx
testb %cl, 0x30(%rsp)
je 0x2e42
xorl %ebx, %ebx
jmp 0x3148
testb $0x1, 0x40(%rsp)
je 0x2ee5
movq 0xb0(%rsp), %r14
movq 0xb8(%rsp), %r15
leaq 0x70(%rsp), %rbx
cmpq %r15, %r14
je 0x2ee5
movq (%r14), %rdi
movzbl 0x8(%r14), %eax
testl %eax, %eax
je 0x2ec9
cmpl $0x2, %eax
jne 0x2edf
xorl %esi, %esi
movq 0x48(%rsp), %rdx
movq %rbx, %rcx
callq 0x376b
jmp 0x2ed8
xorl %esi, %esi
movq 0x50(%rsp), %rdx
movq %rbx, %rcx
callq 0x376b
testb $0x1, 0x10(%rsp)
jne 0x2e7f
addq $0x10, %r14
jmp 0x2ea2
leaq 0x180(%rsp), %r12
pushq $0x2
popq %r13
movq %r12, %rdi
movl 0xc(%rsp), %ebp
movl %ebp, %esi
movl %r13d, %edx
callq 0x3df2
leaq 0x30(%rsp), %rbx
movq 0x48(%rsp), %r15
testl %eax, %eax
jle 0x311d
movl 0x580(%rsp), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
cmpb $0x64, 0x180(%rsp,%rcx)
jl 0x3132
leal 0x1(%rax), %ecx
addl $0xfffffc01, %eax       # imm = 0xFFFFFC01
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movzbl 0x180(%rsp,%rax), %r14d
movq %r12, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x3e2b
movl 0x580(%rsp), %eax
leal -0x400(%rax), %ecx
cmpl $0x400, %eax            # imm = 0x400
cmovbl %eax, %ecx
movb 0x180(%rsp,%rcx), %al
testb $0x1, 0x20(%rsp)
je 0x301a
cmpb $0x66, %al
jne 0x30a3
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x3
popq %rdx
movl %r13d, %ecx
callq 0x3e92
movl 0x580(%rsp), %eax
leal (%rax,%r14), %ecx
cmpl $0x400, %ecx            # imm = 0x400
leal -0x400(%rax,%r14), %eax
cmovbl %ecx, %eax
movl %eax, 0x580(%rsp)
subl %r14d, 0x584(%rsp)
movzwl 0x30(%rsp), %edx
subq $0x8, %rsp
movl %ebp, %edi
movq %r12, %rsi
leaq 0x118(%rsp), %rcx
leaq 0xf8(%rsp), %r8
leaq 0x78(%rsp), %r9
pushq 0x60(%rsp)
pushq 0x70(%rsp)
leaq 0x30(%rsp), %rax
pushq %rax
callq 0x3551
addq $0x20, %rsp
movq %rax, %r14
movq 0x10(%rsp), %rax
testb %al, 0x18(%rsp)
je 0x30a3
jmp 0x2e7f
cmpb $0x64, %al
jne 0x30a3
movq %r12, %rdi
movq %rbx, %rsi
movl %r13d, %edx
pushq $0x4
popq %rcx
callq 0x3e92
movl 0x580(%rsp), %eax
leal 0x6(%rax), %ecx
addl $0xfffffc06, %eax       # imm = 0xFFFFFC06
cmpl $0x400, %ecx            # imm = 0x400
cmovbl %ecx, %eax
movzbl 0x180(%rsp,%rax), %ebp
leaq 0x148(%rsp), %rdi
movq %rbx, %rsi
callq 0x5454
movq (%rax), %rdi
movq %r15, %rdx
testl %ebp, %ebp
je 0x3088
movq 0x50(%rsp), %rdx
cmpl $0x1, %ebp
je 0x3088
cmpl $0x2, %ebp
movl 0xc(%rsp), %ebp
jne 0x30a3
movq 0x88(%rsp), %rdx
xorl %esi, %esi
leaq 0x70(%rsp), %rcx
callq 0x376b
testb $0x1, 0x10(%rsp)
movl 0xc(%rsp), %ebp
jne 0x2e7f
movl 0x580(%rsp), %eax
leal (%rax,%r14), %ecx
cmpl $0x400, %ecx            # imm = 0x400
leal -0x400(%rax,%r14), %eax
cmovbl %ecx, %eax
movl %eax, 0x580(%rsp)
subl %r14d, 0x584(%rsp)
movq %r12, %rdi
movl %ebp, %esi
movl %r13d, %edx
callq 0x3df2
jmp 0x2f0c
cmpl $0x3c, %eax
jne 0x3205
movq 0x6f00(%rip), %rdi      # 0x9ff0
leaq 0x3648(%rip), %rsi      # 0x673f
callq 0x2210
pushq $0x1
popq %rbx
movq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x2210
leaq 0x3797(%rip), %rsi      # 0x68aa
movq %rax, %rdi
callq 0x2210
jmp 0x3148
cmpl $-0x1, %eax
je 0x31be
leaq 0x366a(%rip), %rsi      # 0x6797
pushq $0x1
popq %rbx
jmp 0x313c
pushq $0x1
popq %rbx
leaq 0x3628(%rip), %rsi      # 0x6764
movq 0x6ead(%rip), %rdi      # 0x9ff0
callq 0x2210
leaq 0xf0(%rsp), %rdi
callq 0x2100
leaq 0xb0(%rsp), %rdi
callq 0x4be6
leaq 0x110(%rsp), %rdi
callq 0x41b0
leaq 0x148(%rsp), %rdi
callq 0x426e
leaq 0x70(%rsp), %rdi
callq 0x4bc8
jmp 0x2ab2
movq 0x6e5e(%rip), %rdi      # 0x9ff0
leaq 0x3521(%rip), %rsi      # 0x66ba
callq 0x2210
jmp 0x2a80
leaq 0x2eb2(%rip), %rsi      # 0x605c
jmp 0x31f4
leaq 0x2efa(%rip), %rsi      # 0x60ad
jmp 0x31f4
leaq 0x2f3f(%rip), %rsi      # 0x60fb
jmp 0x31f4
leaq 0x35be(%rip), %rdi      # 0x6783
callq 0x21c0
pushq $0x1
popq %rbx
jmp 0x3148
leaq 0x2f6f(%rip), %rsi      # 0x6148
jmp 0x31f4
leaq 0x2faf(%rip), %rsi      # 0x6191
jmp 0x31f4
leaq 0x2fee(%rip), %rsi      # 0x61d9
jmp 0x31f4
leaq 0x302d(%rip), %rsi      # 0x6221
movq 0x6df5(%rip), %rdi      # 0x9ff0
callq 0x2210
jmp 0x2aaf
pushq $0x1
popq %rdi
callq 0x2120
leaq 0x6b14(%rip), %rsi      # 0x9d28
movq %rax, %rdi
xorl %edx, %edx
callq 0x23b0
leaq 0x6b2b(%rip), %rbx      # 0x9d50
jmp 0x322e
leaq 0x6afa(%rip), %rbx      # 0x9d28
pushq $0x1
popq %rdi
callq 0x2120
movq %rax, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x23b0
pushq $0x1
popq %rdi
callq 0x2120
leaq 0x6ad6(%rip), %rsi      # 0x9d28
movq %rax, %rdi
xorl %edx, %edx
callq 0x23b0
jmp 0x32b1
jmp 0x32b1
jmp 0x3262
movq %rax, %rbx
jmp 0x3524
jmp 0x326c
movq %rdx, %r14
movq %rax, %rbx
jmp 0x32eb
jmp 0x32b1
jmp 0x32b1
jmp 0x32b1
jmp 0x32b1
jmp 0x351c
jmp 0x32b1
jmp 0x32b1
jmp 0x32b1
jmp 0x351c
jmp 0x32b1
jmp 0x351c
movq %rdx, %r14
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x489e
jmp 0x32b7
jmp 0x32b1
jmp 0x3521
jmp 0x3521
movq %rdx, %r14
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x2100
leaq 0xb0(%rsp), %rdi
callq 0x4be6
leaq 0x110(%rsp), %rdi
callq 0x41b0
leaq 0x148(%rsp), %rdi
callq 0x426e
cmpl $0x6, %r14d
jne 0x3316
movq %rbx, %rdi
callq 0x20c0
movq 0x6cf0(%rip), %rdi      # 0x9ff0
leaq 0x3565(%rip), %rsi      # 0x686c
callq 0x2210
callq 0x23a0
jmp 0x2a80
cmpl $0x5, %r14d
jne 0x3341
movq %rbx, %rdi
callq 0x20c0
movq 0x6cc5(%rip), %rdi      # 0x9ff0
leaq 0x3509(%rip), %rsi      # 0x683b
callq 0x2210
callq 0x23a0
jmp 0x2a80
cmpl $0x4, %r14d
jne 0x336c
movq %rbx, %rdi
callq 0x20c0
movq 0x6c9a(%rip), %rdi      # 0x9ff0
leaq 0x34a0(%rip), %rsi      # 0x67fd
callq 0x2210
callq 0x23a0
jmp 0x2a80
cmpl $0x3, %r14d
jne 0x33be
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
movq 0x6c6c(%rip), %rdi      # 0x9ff0
leaq 0x3446(%rip), %rsi      # 0x67d1
callq 0x2210
movq %rax, %r14
movl (%rbx), %edi
callq 0x2090
movq %r14, %rdi
movq %rax, %rsi
callq 0x2210
leaq 0x34fe(%rip), %rsi      # 0x68aa
movq %rax, %rdi
callq 0x2210
callq 0x23a0
jmp 0x2a80
cmpl $0x2, %r14d
jne 0x33e9
movq %rbx, %rdi
callq 0x20c0
movq 0x6c1d(%rip), %rdi      # 0x9ff0
leaq 0x338a(%rip), %rsi      # 0x6764
callq 0x2210
callq 0x23a0
jmp 0x2a80
cmpl $0x1, %r14d
jne 0x3265
movq %rbx, %rdi
callq 0x20c0
movq %rax, %rbx
movq 0x6beb(%rip), %rdi      # 0x9ff0
leaq 0x33b7(%rip), %rsi      # 0x67c3
callq 0x2210
cmpq $0x0, 0x8(%rbx)
je 0x3460
movq 0x6bd1(%rip), %rdi      # 0x9ff0
leaq 0x333b(%rip), %rsi      # 0x6761
callq 0x2210
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x2210
cmpq $0x0, 0x18(%rbx)
je 0x3460
movq 0x6bab(%rip), %rdi      # 0x9ff0
leaq 0x3316(%rip), %rsi      # 0x6762
callq 0x2210
movq %rbx, %rsi
addq $0x10, %rsi
movq %rax, %rdi
callq 0x21f0
cmpl $0x0, (%rbx)
je 0x348d
movq 0x6b84(%rip), %rdi      # 0x9ff0
leaq 0x32ee(%rip), %rsi      # 0x6761
callq 0x2210
movq %rax, %r14
movl (%rbx), %edi
callq 0x2090
movq %r14, %rdi
movq %rax, %rsi
callq 0x2210
movq 0x6b5c(%rip), %rdi      # 0x9ff0
pushq $0xa
popq %rsi
callq 0x2250
callq 0x23a0
jmp 0x2a80
jmp 0x34d6
jmp 0x3262
jmp 0x3262
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
jmp 0x3262
jmp 0x3262
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
jmp 0x3262
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
jmp 0x3262
movq %rax, %rbx
callq 0x23a0
jmp 0x3265
movq %rax, %rdi
callq 0x3f34
movq %rax, %rbx
jmp 0x352e
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x4bc8
leaq 0x90(%rsp), %rdi
callq 0x4ae6
leaq 0xd0(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x23d0