// File: davmac314[P]dinit/src/dinitctl.cc
// Function: enable_disable_service(int, cpbuffer<1024u>&, service_dir_opt&, char const*, char const*, bool, bool, unsigned short)
static int enable_disable_service(int socknum, cpbuffer_t &rbuffer, service_dir_opt &service_dir_opts,
        const char *from, const char *to, bool enable, bool verbose, uint16_t proto_version)
{
    using namespace std;

    service_state_t from_state = service_state_t::STARTED;
    handle_t from_handle;

    handle_t to_handle;

    vector<string> service_dir_paths;

    string service_file_path;
    string to_service_file_path;
    dio::istream service_file;
    fd_holder parent_dir_fd;

    if (strchr(from, '@') != nullptr) {
        cerr << "dinitctl: cannot enable/disable from a service with argument (service@arg).\n";
        return 1;
    }

    if (socknum >= 0) {
        if (!load_service(socknum, rbuffer, from, &from_handle, &from_state)
                || !load_service(socknum, rbuffer, to, &to_handle, nullptr)) {
            return 1;
        }

        try {
            service_dir_paths = get_service_description_dirs(socknum, rbuffer);
        }
        catch (dinit_protocol_error &) {
            cerr << "dinitctl: unknown configuration or protocol error, unable to load service descriptions\n";
        }

        to_service_file_path = get_service_descr_filename(socknum, rbuffer, to_handle, to);

        std::string from_sdf_dir = get_service_description_dir(socknum, rbuffer, from_handle);
        if (from_sdf_dir.empty())
            throw dinit_protocol_error();

        auto sdf_fds = open_with_dir(from_sdf_dir.c_str(), from);
        if (sdf_fds.first == -1) {
            cerr << "dinitctl: could not open service description file '"
                    << service_file_path << "': " << strerror(sdf_fds.second) << "\n";
            return EXIT_FAILURE;
        }

        parent_dir_fd = sdf_fds.first;
        service_file.set_fd(sdf_fds.second);

        service_file_path = from_sdf_dir;
        if (*service_file_path.rbegin() != '/') service_file_path += '/';
        service_file_path += from;
    }
    else {
        // offline case
        const auto &path_list = service_dir_opts.get_paths();
        for (auto &path : path_list) {
            service_dir_paths.emplace_back(path.get_dir());
        }

        auto sdf_fds = find_service_desc(from, service_dir_paths, service_file_path);
        if (sdf_fds.first == -1) {
            if (sdf_fds.second == ENOENT) {
                cerr << "dinitctl: could not locate service file for service '" << from << "'\n";
            }
            else {
                cerr << "dinitctl: could not open service description file '"
                        << service_file_path << "': " << strerror(sdf_fds.second)
                        << "\n";
            }
            return EXIT_FAILURE;
        }

        parent_dir_fd = sdf_fds.first;
        service_file.set_fd(sdf_fds.second);

        auto to_sdf_fds = find_service_desc(to, service_dir_paths, to_service_file_path);
        if (to_sdf_fds.first == -1 && to_sdf_fds.second == ENOENT) {
            cerr << "dinitctl: could not locate service file for target service '" << to << "'" << endl;
            return EXIT_FAILURE;
        }

        if (to_sdf_fds.first != -1) {
            close(to_sdf_fds.first);
            close(to_sdf_fds.second);
        }
    }

    // We now need to read the service file, identify the waits-for.d directory (bail out if more than one),
    // make sure the service is not listed as a dependency individually.

    string waits_for_d;
    fd_holder waits_for_d_fd;

    file_input_stack input_stack;
    input_stack.push(service_file_path, std::move(service_file), parent_dir_fd.release());

    try {
        auto resolve_var = [](const std::string &name) {
            return (char *)nullptr; // FIXME
        };

        auto is_setting = [](const std::string &setting, dinit_load::setting_id_t setting_id) {
            return (setting == dinit_load::all_settings[(size_t)setting_id].setting_str);
        };

        process_service_file(from, input_stack, [&](string &line, file_pos_ref fpr,
                string &setting, dinit_load::setting_op_t op,
                dinit_load::string_iterator i, dinit_load::string_iterator end) -> void {
                    using namespace dinit_load;

                    if (is_setting(setting, setting_id_t::WAITS_FOR)
                            || is_setting(setting, setting_id_t::DEPENDS_ON)
                            || is_setting(setting, setting_id_t::DEPENDS_MS)) {
                        string dname = dinit_load::read_setting_value(fpr, i, end);
                        if (dname == to) {
                            // There is already a dependency
                            cerr << "dinitctl: there is a fixed dependency to service '" << to
                                    << "' in the service description of '" << from << "'." << endl;
                            throw service_op_cancel();
                        }
                    }
                    else if (is_setting(setting, setting_id_t::WAITS_FOR_D)) {
                        string dname = dinit_load::read_setting_value(fpr, i, end);
                        if (! waits_for_d.empty()) {
                            cerr << "dinitctl: service '" << from << "' has multiple waits-for.d directories "
                                    << "specified in service description" << endl;
                            throw service_op_cancel();
                        }
                        waits_for_d = std::move(dname);
                    }
                },
                nullptr /* service arg */, resolve_var);
    }
    catch (const service_op_cancel &cexc) {
        return 1;
    }
    catch (std::system_error &err) {
        cerr << "dinitctl: " << input_stack.current_file_name() << ": " << strerror(errno) << endl;
        return 1;
    }

    // If the from service has no waits-for.d specified, we can't continue
    if (waits_for_d.empty()) {
        cerr << "dinitctl: service '" << from << "' has no waits-for.d directory specified" << endl;
        return 1;
    }

    // The waits-for.d path is relative to the service file path, combine:
    // XXX should use parent dir fd
    string waits_for_d_full = combine_paths(parent_path(service_file_path), waits_for_d.c_str());

    // check if dependency already exists
    string dep_link_path = combine_paths(waits_for_d_full, to);
    struct stat stat_buf;
    if (lstat(dep_link_path.c_str(), &stat_buf) == -1) {
        if (errno != ENOENT) {
            cerr << "dinitctl: checking for existing dependency link: " << dep_link_path << ": "
                    << strerror(errno) << endl;
            return 1;
        }
    }
    else {
        // dependency already exists
        if (enable) {
            cerr << "dinitctl: service already enabled." << endl;
            return 1;
        }
    }

    if (socknum >= 0) {
        // warn if 'from' service is not started
        if (enable && from_state != service_state_t::STARTED) {
            cerr << "dinitctl: warning: enabling dependency for non-started service" << endl;
        }

        // add/remove dependency
        constexpr int enable_pktsize = 2 + sizeof(handle_t) * 2;
        char cmdbuf[enable_pktsize] = { char(enable ? cp_cmd::ENABLESERVICE : cp_cmd::REM_DEP),
                char(dependency_type::WAITS_FOR)};
        memcpy(cmdbuf + 2, &from_handle, sizeof(from_handle));
        memcpy(cmdbuf + 2 + sizeof(from_handle), &to_handle, sizeof(to_handle));
        write_all_x(socknum, cmdbuf, enable_pktsize);

        wait_for_reply(rbuffer, socknum);

        // check reply
        if (rbuffer[0] == (char)cp_rply::NAK) {
            if (enable) {
                cerr << "dinitctl: could not enable service: possible circular dependency" << endl;
            }
            else {
                cerr << "dinitctl: service not currently enabled" << endl;
            }
            return 1;
        }
        if (rbuffer[0] != (char)cp_rply::ACK) {
            cerr << "dinitctl: control socket protocol error" << endl;
            return 1;
        }
        rbuffer.consume(1);
    }

    // create link
    if (enable) {
        // Guess a relative path to use as the symlink target. Note that if either the waits-for.d directory
        // path, or the "to" service description file path, contains symbolic links or path segments with
        // ".." or ".", this may not produce the "correct" result. We do a "reasonable effort". If the
        // result isn't correct, the only consequence is that the link may be broken or point to the wrong
        // file; Dinit itself won't be affected by this.
        string symlink_target;
        auto spos = waits_for_d_full.rfind('/');
        if (spos != std::string::npos) {
            if (strncmp(waits_for_d_full.c_str(), to_service_file_path.c_str(), spos) == 0) {
                symlink_target = "../";
                symlink_target.append(to_service_file_path, spos + 1, std::string::npos);
            }
        }
        if (symlink_target.empty()) {
            // not yet determined: try full path or just "../(to)"
            if (to_service_file_path[0] == '/') {
                symlink_target = to_service_file_path;
            }
            else {
                symlink_target = "../";
                symlink_target.append(to);
            }
        }

        if (symlink(symlink_target.c_str(), dep_link_path.c_str()) == -1) {
            cerr << "dinitctl: could not create symlink at " << dep_link_path << ": " << strerror(errno);
            if (socknum >= 0) {
                cerr << "\n" "dinitctl: note: service was enabled for now; persistent enable failed.";
            }
            cerr << endl;
            return 1;
        }
    }
    else {
        if (unlink(dep_link_path.c_str()) == -1) {
            cerr << "dinitctl: could not unlink dependency entry " << dep_link_path << ": "
                    << strerror(errno);
            if (socknum >= 0) {
                cerr << "\n" "dinitctl: note: service was disabled for now; persistent disable failed.";
            }
            cerr << endl;
            return 1;
        }
    }

    if (socknum >= 0) {
        if (verbose) {
            cout << "Service '" << to << "' has been " << (enable ? "enabled" : "disabled") << "." << endl;
        }

        char cmd_pkt = (char)(proto_version < 5 ? cp_cmd::SERVICESTATUS : cp_cmd::SERVICESTATUS5);

        // Check status of the service now
        auto m = membuf()
                .append(cmd_pkt)
                .append(to_handle);
        write_all_x(socknum, m);

        int statussize = proto_version < 5 ? STATUS_BUFFER_SIZE : STATUS_BUFFER5_SIZE;

        // For an enable, we want to wait until the service has started so we can report any
        // failure. But, if the service is already started, we won't get any service events, so we
        // have to request status via SERVICESTATUS to catch that case. However, we may get
        // a service event before the reply to SERVICESTATUS and in that case should use it to
        // report status.
        if (enable) {
            int r = rbuffer.fill_to(socknum, 2);
            while (r > 0 && rbuffer[0] >= 100) {
                unsigned pktlen = (unsigned char) rbuffer[1];
                fill_buffer_to(rbuffer, socknum, pktlen);

                if (value(rbuffer[0]).is_in((char)cp_info::SERVICEEVENT, (char)cp_info::SERVICEEVENT5)) {
                    int ret = process_service_event(rbuffer, pktlen, to_handle, to,
                            false /* start */, verbose);
                    if (ret >= 0) {
                        // Consume the outstanding reply packet before returning.
                        wait_for_reply(rbuffer, socknum);
                        if (rbuffer[0] != (char)cp_rply::SERVICESTATUS) {
                            cerr << "dinitctl: protocol error." << endl;
                            return 1;
                        }
                        // +2 is 1 byte packet type, 1 byte reserved
                        fill_buffer_to(rbuffer, socknum, statussize + 2);
                        rbuffer.consume(statussize + 2);
                        return ret;
                    }
                }
                else {
                    rbuffer.consume(pktlen);
                }

                r = rbuffer.fill_to(socknum, 2);
            }
            if (r == -1) {
                throw cp_read_exception(errno);
            }
            if (r == 0) {
                cerr << "dinitctl: protocol error." << endl;
                return 1;
            }
        }
        else {
            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, statussize + 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]);
        rbuffer.consume(statussize);

        if (enable) {
            if (current != service_state_t::STARTED) {
                wait_service_state(socknum, rbuffer, to_handle, to, false /* start */, verbose);
            }
        }
        else {
            if (target != service_state_t::STOPPED) {
                std::cerr << "dinitctl: note: disabled service may have other dependents\n";
            }
        }
    }
    else {
        if (verbose) {
            cout << "Service '" << to << "' has been " << (enable ? "enabled" : "disabled") << "." << endl;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x700, %rsp            # imm = 0x700
movl %r9d, %eax
movq %rcx, -0x430(%rbp)
movq %rdx, %rcx
movq -0x430(%rbp), %rdx
movq %rcx, -0x428(%rbp)
movq %rsi, %rcx
movq -0x428(%rbp), %rsi
movq %rcx, -0x420(%rbp)
movl %edi, %r9d
movq -0x420(%rbp), %rdi
movb %al, %cl
movw 0x18(%rbp), %ax
movb 0x10(%rbp), %al
movl %r9d, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
andb $0x1, %cl
movb %cl, -0x29(%rbp)
andb $0x1, %al
movb %al, -0x2a(%rbp)
movb $0x2, -0x2b(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x134a0
leaq -0x70(%rbp), %rdi
callq 0x55c0
leaq -0x90(%rbp), %rdi
callq 0x55c0
leaq -0xa8(%rbp), %rdi
callq 0x134c0
leaq -0xac(%rbp), %rdi
callq 0x134f0
jmp 0x7c55
movq -0x20(%rbp), %rdi
movl $0x40, %esi
callq 0x5130
cmpq $0x0, %rax
je 0x7cc2
movq 0x2a378(%rip), %rdi     # 0x31fe8
leaq 0x1cd2a(%rip), %rsi     # 0x249a1
callq 0x53d0
jmp 0x7c7e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x9675
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x96c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x96b7
cmpl $0x0, -0x8(%rbp)
jl 0x802e
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq -0x2b(%rbp), %r8
movl $0x1, %r9d
callq 0xc5e0
movb %al, -0x431(%rbp)
jmp 0x7cf2
movb -0x431(%rbp), %al
testb $0x1, %al
jne 0x7cfe
jmp 0x7d31
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x34(%rbp), %rcx
movl $0x1, %r9d
callq 0xc5e0
movb %al, -0x432(%rbp)
jmp 0x7d25
movb -0x432(%rbp), %al
testb $0x1, %al
jne 0x7d47
jmp 0x7d31
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x9675
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq -0xd8(%rbp), %rdi
callq 0x13510
jmp 0x7d5c
leaq -0x50(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x137e0
leaq -0xd8(%rbp), %rdi
callq 0x13810
jmp 0x7dd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x96b7
movq -0xb8(%rbp), %rdi
callq 0x5150
movq %rax, -0xe0(%rbp)
movq 0x2a22f(%rip), %rdi     # 0x31fe8
leaq 0x1cc2e(%rip), %rsi     # 0x249ee
callq 0x53d0
jmp 0x7dc7
callq 0x5680
jmp 0x7dce
jmp 0x7dd0
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x28(%rbp), %r8
leaq -0x100(%rbp), %rdi
callq 0xd360
jmp 0x7dec
leaq -0x90(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movq %rsi, -0x440(%rbp)
callq 0x5500
movq -0x440(%rbp), %rdi
callq 0x5280
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
movl -0x30(%rbp), %ecx
leaq -0x120(%rbp), %rdi
callq 0xd490
jmp 0x7e2a
leaq -0x120(%rbp), %rdi
callq 0x56a0
testb $0x1, %al
jne 0x7e3c
jmp 0x7e9f
movl $0x1, %edi
callq 0x51c0
movq %rax, %rdi
leaq 0x29c90(%rip), %rsi     # 0x31ae0
xorl %eax, %eax
movl %eax, %edx
callq 0x56b0
jmp 0x9701
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
callq 0x5680
jmp 0x7e77
jmp 0x96b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x5280
jmp 0x96b7
leaq -0x120(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
movq -0x20(%rbp), %rsi
movl $0xffffff9c, %edx       # imm = 0xFFFFFF9C
callq 0x13870
movq %rax, -0x128(%rbp)
cmpl $-0x1, -0x128(%rbp)
jne 0x7f6f
movq 0x2a111(%rip), %rdi     # 0x31fe8
leaq 0x1cb68(%rip), %rsi     # 0x24a46
callq 0x53d0
movq %rax, -0x448(%rbp)
jmp 0x7eec
movq -0x448(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x53a0
movq %rax, -0x450(%rbp)
jmp 0x7f05
movq -0x450(%rbp), %rdi
leaq 0x1cb67(%rip), %rsi     # 0x24a7a
callq 0x53d0
movq %rax, -0x458(%rbp)
jmp 0x7f21
movl -0x124(%rbp), %edi
callq 0x5100
movq -0x458(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
movq %rax, -0x460(%rbp)
jmp 0x7f44
movq -0x460(%rbp), %rdi
leaq 0x1cb63(%rip), %rsi     # 0x24ab5
callq 0x53d0
jmp 0x7f59
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x800d
movl -0x128(%rbp), %esi
leaq -0xac(%rbp), %rdi
callq 0x13c20
jmp 0x7f83
movl -0x124(%rbp), %esi
leaq -0xa8(%rbp), %rdi
callq 0x1fb40
leaq -0x70(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x5040
jmp 0x7fa7
leaq -0x130(%rbp), %rdi
movq %rdi, -0x470(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x56e0
movq -0x470(%rbp), %rdi
callq 0x13c60
movq %rax, -0x468(%rbp)
jmp 0x7fd3
movq -0x468(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x7ff4
leaq -0x70(%rbp), %rdi
movl $0x2f, %esi
callq 0x5290
jmp 0x7ff2
jmp 0x7ff4
movq -0x20(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x53c0
jmp 0x8003
movl $0x0, -0xc0(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x5280
movl -0xc0(%rbp), %eax
testl %eax, %eax
jne 0x9675
jmp 0x8029
jmp 0x832b
movq -0x18(%rbp), %rdi
callq 0x13c90
movq %rax, -0x478(%rbp)
jmp 0x8040
movq -0x478(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rdi
callq 0x13cb0
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rdi
callq 0x13ce0
movq %rax, -0x150(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x13d10
testb $0x1, %al
jne 0x809b
jmp 0x80f3
leaq -0x148(%rbp), %rdi
callq 0x13d50
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rdi
callq 0x13df0
movq %rax, -0x480(%rbp)
jmp 0x80c3
movq -0x480(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x13d70
jmp 0x80e3
jmp 0x80e5
leaq -0x148(%rbp), %rdi
callq 0x13e10
jmp 0x8082
movq -0x20(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xd690
movq %rax, -0x488(%rbp)
jmp 0x810d
movq -0x488(%rbp), %rax
movq %rax, -0x168(%rbp)
cmpl $-0x1, -0x168(%rbp)
jne 0x8221
cmpl $0x2, -0x164(%rbp)
jne 0x8180
movq 0x29eb0(%rip), %rdi     # 0x31fe8
leaq 0x1c93f(%rip), %rsi     # 0x24a7e
callq 0x53d0
movq %rax, -0x490(%rbp)
jmp 0x814d
movq -0x490(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x53d0
movq %rax, -0x498(%rbp)
jmp 0x8166
movq -0x498(%rbp), %rdi
leaq 0x1c940(%rip), %rsi     # 0x24ab4
callq 0x53d0
jmp 0x817b
jmp 0x820b
movq 0x29e61(%rip), %rdi     # 0x31fe8
leaq 0x1c8b8(%rip), %rsi     # 0x24a46
callq 0x53d0
movq %rax, -0x4a0(%rbp)
jmp 0x819c
movq -0x4a0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x53a0
movq %rax, -0x4a8(%rbp)
jmp 0x81b5
movq -0x4a8(%rbp), %rdi
leaq 0x1c8b7(%rip), %rsi     # 0x24a7a
callq 0x53d0
movq %rax, -0x4b0(%rbp)
jmp 0x81d1
movl -0x164(%rbp), %edi
callq 0x5100
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
movq %rax, -0x4b8(%rbp)
jmp 0x81f4
movq -0x4b8(%rbp), %rdi
leaq 0x1c8b3(%rip), %rsi     # 0x24ab5
callq 0x53d0
jmp 0x8209
jmp 0x820b
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x9675
movl -0x168(%rbp), %esi
leaq -0xac(%rbp), %rdi
callq 0x13c20
jmp 0x8235
movl -0x164(%rbp), %esi
leaq -0xa8(%rbp), %rdi
callq 0x1fb40
movq -0x28(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0xd690
movq %rax, -0x4c0(%rbp)
jmp 0x8264
movq -0x4c0(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpl $-0x1, -0x170(%rbp)
jne 0x8304
cmpl $0x2, -0x16c(%rbp)
jne 0x8304
movq 0x29d59(%rip), %rdi     # 0x31fe8
leaq 0x1c821(%rip), %rsi     # 0x24ab7
callq 0x53d0
movq %rax, -0x4c8(%rbp)
jmp 0x82a4
movq -0x4c8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x53d0
movq %rax, -0x4d0(%rbp)
jmp 0x82bd
movq -0x4d0(%rbp), %rdi
leaq 0x1b0c4(%rip), %rsi     # 0x2338f
callq 0x53d0
movq %rax, -0x4d8(%rbp)
jmp 0x82d9
movq -0x4d8(%rbp), %rdi
movq 0x29c81(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x82ee
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x9675
cmpl $-0x1, -0x170(%rbp)
je 0x8329
movl -0x170(%rbp), %edi
callq 0x5770
jmp 0x831a
movl -0x16c(%rbp), %edi
callq 0x5770
jmp 0x8327
jmp 0x8329
jmp 0x832b
leaq -0x190(%rbp), %rdi
callq 0x55c0
leaq -0x194(%rbp), %rdi
callq 0x134f0
jmp 0x8345
leaq -0x1e8(%rbp), %rdi
callq 0x13e30
jmp 0x8353
leaq -0x208(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5180
jmp 0x8365
leaq -0xac(%rbp), %rdi
callq 0x13ee0
movl %eax, -0x4dc(%rbp)
jmp 0x8379
movl -0x4dc(%rbp), %ecx
leaq -0x1e8(%rbp), %rdi
leaq -0x208(%rbp), %rsi
leaq -0xa8(%rbp), %rdx
callq 0x13e50
jmp 0x839b
leaq -0x208(%rbp), %rdi
callq 0x5280
movq -0x20(%rbp), %rax
movq %rax, -0x4f0(%rbp)
leaq -0x231(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x5700
movq -0x4f0(%rbp), %rsi
movq -0x4e8(%rbp), %rdx
leaq -0x230(%rbp), %rdi
callq 0x10f00
jmp 0x83e1
leaq -0x20a(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x190(%rbp), %rax
movq %rax, -0x240(%rbp)
movups -0x258(%rbp), %xmm0
movups -0x248(%rbp), %xmm1
movq %rsp, %rax
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
xorl %eax, %eax
movl %eax, %edx
leaq -0x230(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
leaq -0x209(%rbp), %rcx
callq 0xd9b0
jmp 0x844b
leaq -0x230(%rbp), %rdi
callq 0x5280
leaq -0x231(%rbp), %rdi
callq 0x5440
jmp 0x8659
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x9667
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x965b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x964f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x5280
jmp 0x964f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x8502
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x5280
leaq -0x231(%rbp), %rdi
callq 0x5440
movl -0xbc(%rbp), %eax
movl %eax, -0x4f4(%rbp)
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0x8551
movq -0xb8(%rbp), %rdi
callq 0x5150
movq %rax, -0x268(%rbp)
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
callq 0x5680
jmp 0x8654
movl -0x4f4(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x964f
movq -0xb8(%rbp), %rdi
callq 0x5150
movq %rax, -0x260(%rbp)
movq 0x29a6a(%rip), %rdi     # 0x31fe8
leaq 0x1b7db(%rip), %rsi     # 0x23d60
callq 0x53d0
movq %rax, -0x500(%rbp)
jmp 0x8593
leaq -0x1e8(%rbp), %rdi
callq 0x13f00
movq %rax, -0x508(%rbp)
jmp 0x85a8
movq -0x508(%rbp), %rsi
movq -0x500(%rbp), %rdi
callq 0x53a0
movq %rax, -0x510(%rbp)
jmp 0x85c4
movq -0x510(%rbp), %rdi
leaq 0x1c4a9(%rip), %rsi     # 0x24a7b
callq 0x53d0
movq %rax, -0x518(%rbp)
jmp 0x85e0
callq 0x5050
movl (%rax), %edi
callq 0x5100
movq -0x518(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
movq %rax, -0x520(%rbp)
jmp 0x8604
movq -0x520(%rbp), %rdi
movq 0x29956(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8619
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
callq 0x5680
jmp 0x864a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
callq 0x5680
jmp 0x864f
jmp 0x9629
jmp 0x964f
jmp 0x9629
leaq -0x190(%rbp), %rdi
callq 0x56a0
testb $0x1, %al
jne 0x866b
jmp 0x86e7
movq 0x29976(%rip), %rdi     # 0x31fe8
leaq 0x1c47b(%rip), %rsi     # 0x24af4
callq 0x53d0
movq %rax, -0x528(%rbp)
jmp 0x8687
movq -0x528(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x53d0
movq %rax, -0x530(%rbp)
jmp 0x86a0
movq -0x530(%rbp), %rdi
leaq 0x1c45a(%rip), %rsi     # 0x24b08
callq 0x53d0
movq %rax, -0x538(%rbp)
jmp 0x86bc
movq -0x538(%rbp), %rdi
movq 0x2989e(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x86d1
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x9629
leaq -0x2a8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x14240
jmp 0x86f9
movq -0x2a8(%rbp), %rdi
movq -0x2a0(%rbp), %rsi
callq 0x14160
movq %rdx, -0x548(%rbp)
movq %rax, -0x540(%rbp)
jmp 0x871c
movq -0x548(%rbp), %rax
movq -0x540(%rbp), %rcx
movq %rcx, -0x298(%rbp)
movq %rax, -0x290(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x5160
movq %rax, %rcx
movq -0x298(%rbp), %rsi
movq -0x290(%rbp), %rdx
leaq -0x288(%rbp), %rdi
callq 0x13f20
jmp 0x8763
leaq -0x2d8(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x14240
jmp 0x8778
movq -0x28(%rbp), %rcx
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
leaq -0x2c8(%rbp), %rdi
callq 0x13f20
jmp 0x8798
leaq -0x2c8(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
leaq -0x368(%rbp), %rsi
callq 0x5750
cmpl $-0x1, %eax
jne 0x889d
callq 0x5050
cmpl $0x2, (%rax)
je 0x889b
movq 0x29817(%rip), %rdi     # 0x31fe8
leaq 0x1c359(%rip), %rsi     # 0x24b31
callq 0x53d0
movq %rax, -0x550(%rbp)
jmp 0x87e6
movq -0x550(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x53a0
movq %rax, -0x558(%rbp)
jmp 0x8802
movq -0x558(%rbp), %rdi
leaq 0x1c26b(%rip), %rsi     # 0x24a7b
callq 0x53d0
movq %rax, -0x560(%rbp)
jmp 0x881e
callq 0x5050
movl (%rax), %edi
callq 0x5100
movq -0x560(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
movq %rax, -0x568(%rbp)
jmp 0x8842
movq -0x568(%rbp), %rdi
movq 0x29718(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8857
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x961b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x960f
jmp 0x88ec
testb $0x1, -0x29(%rbp)
je 0x88ea
movq 0x2973e(%rip), %rdi     # 0x31fe8
leaq 0x1c2b2(%rip), %rsi     # 0x24b63
callq 0x53d0
movq %rax, -0x570(%rbp)
jmp 0x88bf
movq -0x570(%rbp), %rdi
movq 0x2969b(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x88d4
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
jmp 0x88ec
cmpl $0x0, -0x8(%rbp)
jl 0x8af2
testb $0x1, -0x29(%rbp)
je 0x8935
cmpb $0x2, -0x2b(%rbp)
je 0x8935
movq 0x296df(%rip), %rdi     # 0x31fe8
leaq 0x1c276(%rip), %rsi     # 0x24b86
callq 0x53d0
movq %rax, -0x578(%rbp)
jmp 0x891e
movq -0x578(%rbp), %rdi
movq 0x2963c(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8933
jmp 0x8935
movl $0xa, -0x36c(%rbp)
movb -0x29(%rbp), %cl
movb $0xe, %al
movb $0xc, %dl
movb %dl, -0x57a(%rbp)
testb $0x1, %cl
movb %al, -0x579(%rbp)
jne 0x8963
movb -0x57a(%rbp), %al
movb %al, -0x579(%rbp)
movb -0x579(%rbp), %al
movb %al, -0x376(%rbp)
movb $0x2, -0x375(%rbp)
leaq -0x376(%rbp), %rax
addq $0x2, %rax
leaq -0x376(%rbp), %rcx
addq $0xa, %rcx
movq %rcx, -0x590(%rbp)
movq %rax, -0x588(%rbp)
movq -0x588(%rbp), %rax
movq -0x590(%rbp), %rcx
movb $0x0, (%rax)
addq $0x1, %rax
cmpq %rcx, %rax
movq %rax, -0x588(%rbp)
jne 0x899a
movl -0x30(%rbp), %eax
movl %eax, -0x374(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x370(%rbp)
movl -0x8(%rbp), %edi
leaq -0x376(%rbp), %rsi
movl $0xa, %edx
callq 0x112c0
jmp 0x89e3
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x11350
jmp 0x89f1
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x33, %eax
jne 0x8a8a
testb $0x1, -0x29(%rbp)
je 0x8a41
movq 0x295d3(%rip), %rdi     # 0x31fe8
leaq 0x1c1a9(%rip), %rsi     # 0x24bc5
callq 0x53d0
movq %rax, -0x598(%rbp)
jmp 0x8a2a
movq -0x598(%rbp), %rdi
movq 0x29530(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8a3f
jmp 0x8a74
movq 0x295a0(%rip), %rdi     # 0x31fe8
leaq 0x1c1b7(%rip), %rsi     # 0x24c06
callq 0x53d0
movq %rax, -0x5a0(%rbp)
jmp 0x8a5d
movq -0x5a0(%rbp), %rdi
movq 0x294fd(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8a72
jmp 0x8a74
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x32, %eax
je 0x8ae4
movq 0x29544(%rip), %rdi     # 0x31fe8
leaq 0x1bc5e(%rip), %rsi     # 0x24709
callq 0x53d0
movq %rax, -0x5a8(%rbp)
jmp 0x8ab9
movq -0x5a8(%rbp), %rdi
movq 0x294a1(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8ace
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x115f0
testb $0x1, -0x29(%rbp)
je 0x8d65
leaq -0x398(%rbp), %rdi
callq 0x55c0
leaq -0x288(%rbp), %rdi
movl $0x2f, %esi
movq $-0x1, %rdx
callq 0x5780
movq %rax, -0x3a0(%rbp)
cmpq $-0x1, -0x3a0(%rbp)
je 0x8bd1
leaq -0x288(%rbp), %rdi
callq 0x5160
movq %rax, -0x5b0(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x5160
movq -0x5b0(%rbp), %rdi
movq %rax, %rsi
movq -0x3a0(%rbp), %rdx
callq 0x51b0
cmpl $0x0, %eax
jne 0x8bcf
leaq 0x1c0b8(%rip), %rsi     # 0x24c2e
leaq -0x398(%rbp), %rdi
callq 0x5580
jmp 0x8b84
movq -0x3a0(%rbp), %rdx
incq %rdx
leaq -0x398(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq $-0x1, %rcx
callq 0x55b0
jmp 0x8baa
jmp 0x8bcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x5280
jmp 0x960f
jmp 0x8bd1
leaq -0x398(%rbp), %rdi
callq 0x56a0
testb $0x1, %al
jne 0x8be3
jmp 0x8c4d
xorl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rdi
callq 0x57a0
movq %rax, -0x5b8(%rbp)
jmp 0x8bfc
movq -0x5b8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x8c22
leaq -0x398(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5040
jmp 0x8c20
jmp 0x8c4b
leaq 0x1c005(%rip), %rsi     # 0x24c2e
leaq -0x398(%rbp), %rdi
callq 0x5580
jmp 0x8c37
movq -0x28(%rbp), %rsi
leaq -0x398(%rbp), %rdi
callq 0x5740
jmp 0x8c49
jmp 0x8c4b
jmp 0x8c4d
leaq -0x398(%rbp), %rdi
callq 0x5160
movq %rax, -0x5c0(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x5160
movq -0x5c0(%rbp), %rdi
movq %rax, %rsi
callq 0x5060
cmpl $-0x1, %eax
jne 0x8d3a
movq 0x2935d(%rip), %rdi     # 0x31fe8
leaq 0x1bfa0(%rip), %rsi     # 0x24c32
callq 0x53d0
movq %rax, -0x5c8(%rbp)
jmp 0x8ca0
movq -0x5c8(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x53a0
movq %rax, -0x5d0(%rbp)
jmp 0x8cbc
movq -0x5d0(%rbp), %rdi
leaq 0x1bdb1(%rip), %rsi     # 0x24a7b
callq 0x53d0
movq %rax, -0x5d8(%rbp)
jmp 0x8cd8
callq 0x5050
movl (%rax), %edi
callq 0x5100
movq -0x5d8(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
jmp 0x8cf5
cmpl $0x0, -0x8(%rbp)
jl 0x8d12
movq 0x292e6(%rip), %rdi     # 0x31fe8
leaq 0x1bf50(%rip), %rsi     # 0x24c59
callq 0x53d0
jmp 0x8d10
jmp 0x8d12
movq 0x292cf(%rip), %rdi     # 0x31fe8
movq 0x29248(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8d27
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x8d44
movl $0x0, -0xc0(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x5280
movl -0xc0(%rbp), %eax
testl %eax, %eax
jne 0x95f5
jmp 0x8d60
jmp 0x8e3d
leaq -0x2c8(%rbp), %rdi
callq 0x5160
movq %rax, %rdi
callq 0x51a0
cmpl $-0x1, %eax
jne 0x8e3b
movq 0x2925f(%rip), %rdi     # 0x31fe8
leaq 0x1bf11(%rip), %rsi     # 0x24ca1
callq 0x53d0
movq %rax, -0x5e0(%rbp)
jmp 0x8d9e
movq -0x5e0(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0x53a0
movq %rax, -0x5e8(%rbp)
jmp 0x8dba
movq -0x5e8(%rbp), %rdi
leaq 0x1bcb3(%rip), %rsi     # 0x24a7b
callq 0x53d0
movq %rax, -0x5f0(%rbp)
jmp 0x8dd6
callq 0x5050
movl (%rax), %edi
callq 0x5100
movq -0x5f0(%rbp), %rdi
movq %rax, %rsi
callq 0x53d0
jmp 0x8df3
cmpl $0x0, -0x8(%rbp)
jl 0x8e10
movq 0x291e8(%rip), %rdi     # 0x31fe8
leaq 0x1bec7(%rip), %rsi     # 0x24cce
callq 0x53d0
jmp 0x8e0e
jmp 0x8e10
movq 0x291d1(%rip), %rdi     # 0x31fe8
movq 0x2914a(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8e25
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
jmp 0x8e3d
cmpl $0x0, -0x8(%rbp)
jl 0x9527
testb $0x1, -0x2a(%rbp)
je 0x8f02
movq 0x29140(%rip), %rdi     # 0x31f98
leaq 0x1b206(%rip), %rsi     # 0x24065
callq 0x53d0
movq %rax, -0x5f8(%rbp)
jmp 0x8e6d
movq -0x5f8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x53d0
movq %rax, -0x600(%rbp)
jmp 0x8e86
movq -0x600(%rbp), %rdi
leaq 0x1be84(%rip), %rsi     # 0x24d18
callq 0x53d0
movq %rax, -0x608(%rbp)
jmp 0x8ea2
movq -0x608(%rbp), %rdi
movb -0x29(%rbp), %cl
leaq 0x1bd73(%rip), %rax     # 0x24c26
leaq 0x1be6a(%rip), %rsi     # 0x24d24
testb $0x1, %cl
cmovneq %rax, %rsi
callq 0x53d0
movq %rax, -0x610(%rbp)
jmp 0x8ecf
movq -0x610(%rbp), %rdi
leaq 0x1b2af(%rip), %rsi     # 0x2418c
callq 0x53d0
movq %rax, -0x618(%rbp)
jmp 0x8eeb
movq -0x618(%rbp), %rdi
movq 0x2906f(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x8f00
jmp 0x8f02
movzwl 0x18(%rbp), %eax
subl $0x5, %eax
setge %al
shlb $0x3, %al
orb $0x12, %al
movb %al, -0x3a1(%rbp)
leaq -0x3a8(%rbp), %rdi
leaq -0x3a1(%rbp), %rsi
callq 0x11b60
movb %al, -0x619(%rbp)
jmp 0x8f32
movb -0x619(%rbp), %al
movb %al, -0x3a7(%rbp)
leaq -0x3a7(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x131e0
movq %rax, -0x628(%rbp)
jmp 0x8f57
movq -0x628(%rbp), %rax
movl %eax, %ecx
movl %ecx, -0x3a6(%rbp)
shrq $0x20, %rax
movb %al, -0x3a2(%rbp)
movl -0x8(%rbp), %edi
leaq -0x3a6(%rbp), %rsi
callq 0x13220
jmp 0x8f81
movzwl 0x18(%rbp), %edx
movl $0xe, %eax
movl $0xa, %ecx
cmpl $0x5, %edx
cmovll %ecx, %eax
movl %eax, -0x3ac(%rbp)
testb $0x1, -0x29(%rbp)
je 0x9336
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl $0x2, %edx
callq 0x11710
movl %eax, -0x3b0(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x3b0(%rbp)
movb %al, -0x629(%rbp)
jle 0x8fe7
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x64, %eax
setge %al
movb %al, -0x629(%rbp)
movb -0x629(%rbp), %al
testb $0x1, %al
jne 0x8ff6
jmp 0x926f
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x113e0
movzbl %al, %eax
movl %eax, -0x3b4(%rbp)
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl -0x3b4(%rbp), %edx
callq 0x11440
jmp 0x9021
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movb %al, -0x3c1(%rbp)
leaq -0x3c1(%rbp), %rdi
callq 0x14290
movq %rax, -0x638(%rbp)
jmp 0x9047
movq -0x638(%rbp), %rax
movq %rax, -0x3c0(%rbp)
movb $0x64, -0x3c2(%rbp)
movb $0x65, -0x3c3(%rbp)
leaq -0x3c0(%rbp), %rdi
leaq -0x3c2(%rbp), %rsi
leaq -0x3c3(%rbp), %rdx
callq 0x142c0
movb %al, -0x639(%rbp)
jmp 0x9085
movb -0x639(%rbp), %al
testb $0x1, %al
jne 0x9094
jmp 0x9244
movq -0x10(%rbp), %rax
movq %rax, -0x660(%rbp)
movl -0x3b4(%rbp), %eax
movl %eax, -0x658(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x654(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x650(%rbp)
leaq -0x3e9(%rbp), %rdi
movq %rdi, -0x648(%rbp)
callq 0x5700
movq -0x650(%rbp), %rsi
movq -0x648(%rbp), %rdx
leaq -0x3e8(%rbp), %rdi
callq 0x10f00
jmp 0x90ee
movl -0x654(%rbp), %edx
movl -0x658(%rbp), %esi
movq -0x660(%rbp), %rdi
movzbl -0x2a(%rbp), %r9d
andl $0x1, %r9d
leaq -0x3e8(%rbp), %rcx
xorl %r8d, %r8d
callq 0xcf00
movl %eax, -0x664(%rbp)
jmp 0x9121
leaq -0x3e8(%rbp), %rdi
callq 0x5280
leaq -0x3e9(%rbp), %rdi
callq 0x5440
movl -0x664(%rbp), %eax
movl %eax, -0x3c8(%rbp)
cmpl $0x0, -0x3c8(%rbp)
jl 0x9242
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x11350
jmp 0x9160
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x46, %eax
je 0x9201
movq 0x28e6a(%rip), %rdi     # 0x31fe8
leaq 0x1afc0(%rip), %rsi     # 0x24145
callq 0x53d0
movq %rax, -0x670(%rbp)
jmp 0x9193
movq -0x670(%rbp), %rdi
movq 0x28dc7(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x91a8
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x91f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x3e8(%rbp), %rdi
callq 0x5280
leaq -0x3e9(%rbp), %rdi
callq 0x5440
jmp 0x960f
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl -0x3ac(%rbp), %edx
addl $0x2, %edx
callq 0x11440
jmp 0x9218
movq -0x10(%rbp), %rdi
movl -0x3ac(%rbp), %esi
addl $0x2, %esi
callq 0x115f0
movl -0x3c8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
jmp 0x9253
movq -0x10(%rbp), %rdi
movl -0x3b4(%rbp), %esi
callq 0x115f0
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl $0x2, %edx
callq 0x11710
movl %eax, -0x3b0(%rbp)
jmp 0x8fbc
cmpl $-0x1, -0x3b0(%rbp)
jne 0x92e4
movl $0x4, %edi
callq 0x51c0
movq %rax, -0x678(%rbp)
movq %rax, -0x680(%rbp)
callq 0x5050
movq -0x678(%rbp), %rdi
movl (%rax), %esi
callq 0x11420
jmp 0x92a5
movq -0x680(%rbp), %rdi
leaq 0x2886d(%rip), %rsi     # 0x31b20
xorl %eax, %eax
movl %eax, %edx
callq 0x56b0
jmp 0x9701
movq -0x680(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
callq 0x52f0
jmp 0x960f
cmpl $0x0, -0x3b0(%rbp)
jne 0x9334
movq 0x28cf4(%rip), %rdi     # 0x31fe8
leaq 0x1ae4a(%rip), %rsi     # 0x24145
callq 0x53d0
movq %rax, -0x688(%rbp)
jmp 0x9309
movq -0x688(%rbp), %rdi
movq 0x28c51(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x931e
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
jmp 0x9346
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
callq 0x11350
jmp 0x9344
jmp 0x9346
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movsbl %al, %eax
cmpl $0x46, %eax
je 0x93a0
movq 0x28c88(%rip), %rdi     # 0x31fe8
leaq 0x1adde(%rip), %rsi     # 0x24145
callq 0x53d0
movq %rax, -0x690(%rbp)
jmp 0x9375
movq -0x690(%rbp), %rdi
movq 0x28be5(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x938a
movl $0x1, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
jmp 0x95f5
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x115f0
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl -0x3ac(%rbp), %edx
incl %edx
callq 0x11440
jmp 0x93c4
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x115f0
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x113e0
movb %al, -0x3ea(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x113e0
movb %al, -0x3eb(%rbp)
movq -0x10(%rbp), %rdi
movl -0x3ac(%rbp), %esi
callq 0x115f0
testb $0x1, -0x29(%rbp)
je 0x9500
cmpb $0x2, -0x3ea(%rbp)
je 0x94fe
movl -0x8(%rbp), %eax
movl %eax, -0x6b4(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x6b0(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x6a4(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x6a0(%rbp)
leaq -0x411(%rbp), %rdi
movq %rdi, -0x698(%rbp)
callq 0x5700
movq -0x6a0(%rbp), %rsi
movq -0x698(%rbp), %rdx
leaq -0x410(%rbp), %rdi
callq 0x10f00
jmp 0x9474
movl -0x6a4(%rbp), %edx
movq -0x6b0(%rbp), %rsi
movl -0x6b4(%rbp), %edi
movzbl -0x2a(%rbp), %r9d
andl $0x1, %r9d
leaq -0x410(%rbp), %rcx
xorl %r8d, %r8d
callq 0xc9b0
jmp 0x94a1
leaq -0x410(%rbp), %rdi
callq 0x5280
leaq -0x411(%rbp), %rdi
callq 0x5440
jmp 0x94fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0x94ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x5280
leaq -0x411(%rbp), %rdi
callq 0x5440
jmp 0x960f
jmp 0x9522
cmpb $0x0, -0x3eb(%rbp)
je 0x9520
movq 0x28ad8(%rip), %rdi     # 0x31fe8
leaq 0x1b816(%rip), %rsi     # 0x24d2d
callq 0x53d0
jmp 0x951e
jmp 0x9520
jmp 0x9522
jmp 0x95e4
testb $0x1, -0x2a(%rbp)
je 0x95e2
movq 0x28a60(%rip), %rdi     # 0x31f98
leaq 0x1ab26(%rip), %rsi     # 0x24065
callq 0x53d0
movq %rax, -0x6c0(%rbp)
jmp 0x954d
movq -0x6c0(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x53d0
movq %rax, -0x6c8(%rbp)
jmp 0x9566
movq -0x6c8(%rbp), %rdi
leaq 0x1b7a4(%rip), %rsi     # 0x24d18
callq 0x53d0
movq %rax, -0x6d0(%rbp)
jmp 0x9582
movq -0x6d0(%rbp), %rdi
movb -0x29(%rbp), %cl
leaq 0x1b693(%rip), %rax     # 0x24c26
leaq 0x1b78a(%rip), %rsi     # 0x24d24
testb $0x1, %cl
cmovneq %rax, %rsi
callq 0x53d0
movq %rax, -0x6d8(%rbp)
jmp 0x95af
movq -0x6d8(%rbp), %rdi
leaq 0x1abcf(%rip), %rsi     # 0x2418c
callq 0x53d0
movq %rax, -0x6e0(%rbp)
jmp 0x95cb
movq -0x6e0(%rbp), %rdi
movq 0x2898f(%rip), %rsi     # 0x31f68
callq 0x5410
jmp 0x95e0
jmp 0x95e2
jmp 0x95e4
movl $0x0, -0x4(%rbp)
movl $0x1, -0xc0(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x5280
leaq -0x288(%rbp), %rdi
callq 0x5280
jmp 0x9629
leaq -0x2c8(%rbp), %rdi
callq 0x5280
leaq -0x288(%rbp), %rdi
callq 0x5280
jmp 0x964f
leaq -0x1e8(%rbp), %rdi
callq 0x14310
leaq -0x194(%rbp), %rdi
callq 0x14330
leaq -0x190(%rbp), %rdi
callq 0x5280
jmp 0x9675
leaq -0x1e8(%rbp), %rdi
callq 0x14310
leaq -0x194(%rbp), %rdi
callq 0x14330
leaq -0x190(%rbp), %rdi
callq 0x5280
jmp 0x96b7
leaq -0xac(%rbp), %rdi
callq 0x14330
leaq -0xa8(%rbp), %rdi
callq 0x21c60
leaq -0x90(%rbp), %rdi
callq 0x5280
leaq -0x70(%rbp), %rdi
callq 0x5280
leaq -0x50(%rbp), %rdi
callq 0x13810
movl -0x4(%rbp), %eax
addq $0x700, %rsp            # imm = 0x700
popq %rbp
retq
leaq -0xac(%rbp), %rdi
callq 0x14330
leaq -0xa8(%rbp), %rdi
callq 0x21c60
leaq -0x90(%rbp), %rdi
callq 0x5280
leaq -0x70(%rbp), %rdi
callq 0x5280
leaq -0x50(%rbp), %rdi
callq 0x13810
movq -0xb8(%rbp), %rdi
callq 0x56f0
movq %rax, %rdi
callq 0x103e0
nopw %cs:(%rax,%rax)