// File: davmac314[P]dinit/src/dinitcheck.cc
// Function: load_service(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, service_record*, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, service_record*>>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<dir_entry, std::allocator<dir_entry>> const&)
service_record *load_service(service_set_t &services, const std::string &name,
        const service_dir_pathlist &service_dirs)
{
    using namespace std;
    using namespace dinit_load;
    using ::string_view;

    auto found = services.find(name);
    if (found != services.end()) {
        return found->second;
    }

    string_view base_name = name;

    string service_arg;
    auto at_pos = name.find('@');
    if (at_pos != string::npos) {
    	service_arg = name.substr(at_pos + 1);
    	base_name = string_view(name.data(), at_pos);
    }

    string service_wdir;
    string service_filename;
    dio::istream service_file;
    fd_holder sdf_parent_dir_fd;

    int fail_load_errno = 0;
    std::string fail_load_path;

    // Couldn't find one. Have to load it.
    for (auto &service_dir : service_dirs) {
        service_filename = service_dir.get_dir();
        service_wdir = service_filename;
        if (*(service_filename.rbegin()) != '/') {
            service_filename += '/';
        }
        service_filename += base_name;

        auto sdf_fds = open_with_dir(service_dir.get_dir(), ((std::string)base_name).c_str());
        if (sdf_fds.first != -1) {
            // Found
            sdf_parent_dir_fd = sdf_fds.first;
            service_file.set_fd(sdf_fds.second);
            break;
        }

        if (sdf_fds.second != ENOENT && fail_load_errno == 0) {
            fail_load_errno = sdf_fds.second;
            fail_load_path = std::move(service_filename);
        }
    }

    if (!service_file) {
        if (fail_load_errno == 0) {
            throw service_not_found(name);
        }
        else {
            throw service_load_error(name, std::move(fail_load_path), fail_load_errno);
        }
    }

    bool issued_var_subst_warning = false;

    environment::env_map renvmap = menv.build();

    auto resolve_var = [&](const string &name) {
        if (offline_operation && !issued_var_subst_warning) {
            report_general_warning("Variable substitution performed by dinitcheck "
                    "for file paths may not match dinit daemon (environment may differ); "
                    "use --online to avoid this warning");
            issued_var_subst_warning = true;
        }
        return resolve_env_var(name, renvmap);
    };

    service_settings_wrapper<prelim_dep> settings;

    file_input_stack input_stack;
    input_stack.push(std::move(service_filename), std::move(service_file), sdf_parent_dir_fd.release());

    try {
        process_service_file(name, input_stack,
                [&](string &line, file_pos_ref input_pos, string &setting, setting_op_t op,
                        string_iterator &i, string_iterator &end) -> void {

                    auto process_dep_dir_n = [&](std::list<prelim_dep> &deplist,
                    		const std::string &waitsford,
                            dependency_type dep_type) -> void {
                        const string &service_filename = input_stack.current_file_name();
                        process_dep_dir(name.c_str(), service_filename, deplist, waitsford, dep_type);
                    };

                    auto load_service_n = [&](const string &dep_name) -> const string & {
                        return dep_name;
                    };

                    try {
                        process_service_line(settings, name.c_str(), service_arg.c_str(), line,
                        		input_pos, setting, op, i, end, load_service_n, process_dep_dir_n,
								resolve_var);
                    }
                    catch (service_description_exc &exc) {
                        if (exc.service_name.empty()) {
                            exc.service_name = name;
                        }
                        report_service_description_exc(exc);
                    }
                },
                service_arg.c_str(), resolve_var);
    }
    catch (std::system_error &sys_err)
    {
        report_error(sys_err, name);
        throw service_load_exc(name, input_stack.current_file_name() + ": error while reading service description");
    }

    auto report_err = [&](const char *msg) {
        report_service_description_err(name, msg);
    };

    environment srv_env{};

    // Fill user vars before reading env file
    if (settings.export_passwd_vars) {
        try {
            fill_environment_userinfo(settings.run_as_uid, name, srv_env);
        }
        catch (service_load_exc &load_exc) {
            report_service_description_err(name, load_exc.exc_description);
        }
    }

    // Set service name in environment if desired
    if (settings.export_service_name) {
        std::string envname = "DINIT_SERVICE=";
        envname += name;
        srv_env.set_var(std::move(envname));
    }

    if (!settings.env_file.empty()) {
        try {
            std::string fullpath = combine_paths(service_wdir, settings.env_file.c_str());

            auto log_inv_env_setting = [&](int line_num) {
                report_service_description_err(name,
                        std::string("Invalid environment variable setting in environment file " + fullpath
                                + " (line ") + std::to_string(line_num) + ")");
            };
            auto log_bad_env_command = [&](int line_num) {
                report_service_description_err(name,
                        std::string("Bad command in environment file ") + fullpath + " (line " + std::to_string(line_num) + ")");
            };

            read_env_file_inline(fullpath.c_str(), false, srv_env, true, log_inv_env_setting, log_bad_env_command);
        } catch (const std::system_error &se) {
            report_service_description_err(name, std::string("could not load environment file: ") + se.what());
        }
    }

    renvmap = srv_env.build(menv);

    settings.finalise(report_err, nullptr, report_err, resolve_var);

    if (!settings.working_dir.empty()) {
        service_wdir = settings.working_dir;
    }
    int oflags = O_DIRECTORY;
#ifdef O_PATH
    oflags |= O_PATH;
#else
    oflags |= O_RDONLY;
#endif
    int dirfd = open(service_wdir.c_str(), oflags);
    if (dirfd < 0) {
        report_service_description_err(name,
                std::string("could not open service working directory: ") + strerror(errno));
        dirfd = AT_FDCWD;
    }

    auto check_command = [&](const char *setting_name, const char *command) {
        struct stat command_stat;
        if (command[0] != '/') {
            report_service_description_err(name,
                    std::string("executable '") + command + "' is not an absolute path");
        }
        else if (fstatat(dirfd, command, &command_stat, 0) == -1) {
            report_service_description_err(name,
                    std::string("could not stat ") + setting_name + " executable '" + command
                    + "': " + strerror(errno));
        }
        else {
            if ((command_stat.st_mode & S_IFMT) != S_IFREG) {
                report_service_description_err(name, std::string(setting_name) + " executable '"
                        + command + "' is not a regular file.");
            }
            else if ((command_stat.st_mode & S_IXUSR) == 0) {
                report_service_description_err(name, std::string(setting_name) + " executable '" + command
                        + "' is not executable by owner.");
            }
        }
    };

    if (!settings.command.empty()) {
        int offset_start = settings.command_offsets.front().first;
        int offset_end = settings.command_offsets.front().second;
        check_command("command", settings.command.substr(offset_start, offset_end - offset_start).c_str());
    }
    if (!settings.stop_command.empty()) {
        int offset_start = settings.stop_command_offsets.front().first;
        int offset_end = settings.stop_command_offsets.front().second;
        check_command("stop command",
                settings.stop_command.substr(offset_start, offset_end - offset_start).c_str());
    }

    if (settings.log_type == log_type_id::LOGFILE && !settings.logfile.empty()) {
        string logfile_dir = parent_path(settings.logfile);
        if (!logfile_dir.empty()) {
            struct stat logfile_dir_stat;
            if (fstatat(dirfd, logfile_dir.c_str(), &logfile_dir_stat, 0) == -1) {
                report_service_description_err(name,
                        std::string("could not access logfile directory '") + logfile_dir + "': " + strerror(errno));
            }
            else {
                if ((logfile_dir_stat.st_mode & S_IFDIR) == 0) {
                    report_service_description_err(name, std::string("logfile directory '")
                            + logfile_dir + "' exists but is not a directory.");
                }
            }
        }
    }

    if (dirfd != AT_FDCWD) {
        close(dirfd);
    }

    return new service_record(name, settings.service_type, settings.chain_to_name, settings.depends,
            settings.before_svcs, settings.after_svcs, settings.consumer_of_name, settings.log_type);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb70, %rsp            # imm = 0xB70
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x149b0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x14930
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x14960
testb $0x1, %al
jne 0x8f18
jmp 0x8f2e
leaq -0x28(%rbp), %rdi
callq 0x149e0
movq 0x20(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0xa43c
movq -0x18(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x14fe0
leaq -0x60(%rbp), %rdi
callq 0x5700
movq -0x18(%rbp), %rdi
movl $0x40, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x5670
movq %rax, -0x68(%rbp)
cmpq $-0x1, -0x68(%rbp)
je 0x8fec
movq -0x18(%rbp), %rsi
movq -0x68(%rbp), %rdx
incq %rdx
leaq -0x88(%rbp), %rdi
movq $-0x1, %rcx
callq 0x54c0
jmp 0x8f85
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5600
leaq -0x88(%rbp), %rdi
callq 0x5320
movq -0x18(%rbp), %rdi
callq 0x5660
movq %rax, %rsi
movq -0x68(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x15030
movq -0xa8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x8fec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa431
leaq -0xc8(%rbp), %rdi
callq 0x5700
leaq -0xe8(%rbp), %rdi
callq 0x5700
leaq -0x100(%rbp), %rdi
callq 0x15060
leaq -0x104(%rbp), %rdi
callq 0x15090
jmp 0x901e
movl $0x0, -0x108(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x5700
movq -0x20(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
callq 0x150b0
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rdi
callq 0x150e0
movq %rax, -0x140(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x15110
testb $0x1, %al
jne 0x9081
jmp 0x9279
leaq -0x138(%rbp), %rdi
callq 0x15150
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rdi
callq 0x15170
movq %rax, -0xa40(%rbp)
jmp 0x90a9
movq -0xa40(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
callq 0x56d0
jmp 0x90be
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x5060
jmp 0x90d3
leaq -0x150(%rbp), %rdi
movq %rdi, -0xa50(%rbp)
leaq -0xe8(%rbp), %rsi
callq 0x5860
movq -0xa50(%rbp), %rdi
callq 0x15190
movq %rax, -0xa48(%rbp)
jmp 0x9102
movq -0xa48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x9154
leaq -0xe8(%rbp), %rdi
movl $0x2f, %esi
callq 0x5330
jmp 0x9124
jmp 0x9154
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa40d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa3f5
leaq -0x170(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x151c0
jmp 0x9166
leaq -0xe8(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x5640
jmp 0x917b
leaq -0x170(%rbp), %rdi
callq 0x5320
movq -0x148(%rbp), %rdi
callq 0x15170
movq %rax, -0xa58(%rbp)
jmp 0x919c
leaq -0x198(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x151c0
jmp 0x91ae
leaq -0x198(%rbp), %rdi
callq 0x51b0
movq -0xa58(%rbp), %rdi
movq %rax, %rsi
movl $0xffffff9c, %edx       # imm = 0xFFFFFF9C
callq 0x15250
movq %rax, -0x178(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x5320
cmpl $-0x1, -0x178(%rbp)
je 0x9235
movl -0x178(%rbp), %esi
leaq -0x104(%rbp), %rdi
callq 0x15600
jmp 0x91fe
movl -0x174(%rbp), %esi
leaq -0x100(%rbp), %rdi
callq 0x36250
jmp 0x9279
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x5320
jmp 0xa3f5
cmpl $0x2, -0x174(%rbp)
je 0x9266
cmpl $0x0, -0x108(%rbp)
jne 0x9266
movl -0x174(%rbp), %eax
movl %eax, -0x108(%rbp)
leaq -0x128(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x5600
jmp 0x9268
leaq -0x138(%rbp), %rdi
callq 0x15640
jmp 0x9065
leaq -0x100(%rbp), %rdi
callq 0x38350
testb $0x1, %al
jne 0x936b
cmpl $0x0, -0x108(%rbp)
jne 0x92fa
movl $0x40, %edi
callq 0x5220
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa60(%rbp)
movq -0x18(%rbp), %rsi
callq 0x15660
jmp 0x92b8
movq -0xa60(%rbp), %rdi
leaq 0x478ca(%rip), %rsi     # 0x50b90
leaq 0xc443(%rip), %rdx      # 0x15710
callq 0x5840
jmp 0xa45d
movq -0xa60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
callq 0x53a0
jmp 0xa3f5
movl $0x40, %edi
callq 0x5220
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xa68(%rbp)
movq -0x18(%rbp), %rsi
movl -0x108(%rbp), %ecx
leaq -0x128(%rbp), %rdx
callq 0x15730
jmp 0x9329
movq -0xa68(%rbp), %rdi
leaq 0x47871(%rip), %rsi     # 0x50ba8
leaq 0xc4c2(%rip), %rdx      # 0x15800
callq 0x5840
jmp 0xa45d
movq -0xa68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
callq 0x53a0
jmp 0xa3f5
movb $0x0, -0x199(%rbp)
leaq 0x484ef(%rip), %rsi     # 0x51868
leaq -0x1f0(%rbp), %rdi
callq 0x15820
jmp 0x9387
leaq -0x199(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x1f0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x158b0
jmp 0x93b1
leaq -0x4f8(%rbp), %rdi
callq 0x15bc0
jmp 0x93bf
leaq -0x518(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x52f0
leaq -0x104(%rbp), %rdi
callq 0x15c70
movl %eax, -0xa6c(%rbp)
jmp 0x93e6
movl -0xa6c(%rbp), %ecx
leaq -0x4f8(%rbp), %rdi
leaq -0x518(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x15be0
jmp 0x9408
leaq -0x518(%rbp), %rdi
callq 0x5320
movq -0x18(%rbp), %rsi
leaq -0x538(%rbp), %rdi
callq 0x51d0
jmp 0x9426
leaq -0x4f8(%rbp), %rax
movq %rax, -0xa80(%rbp)
movq %rax, -0x560(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x558(%rbp)
leaq -0x4a8(%rbp), %rax
movq %rax, -0x550(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x548(%rbp)
leaq -0x200(%rbp), %rax
movq %rax, -0xa78(%rbp)
movq %rax, -0x540(%rbp)
callq 0x51b0
movq -0xa80(%rbp), %rsi
movq -0xa78(%rbp), %rcx
movq %rax, %rdx
movq -0x540(%rbp), %rdi
movq %rsp, %rax
movq %rdi, 0x20(%rax)
movups -0x560(%rbp), %xmm0
movups -0x550(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x538(%rbp), %rdi
callq 0xa4c0
jmp 0x94bb
leaq -0x538(%rbp), %rdi
callq 0x5320
jmp 0x9688
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa3e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa3dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x518(%rbp), %rdi
callq 0x5320
jmp 0xa3d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x954f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x5320
movl -0x94(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa3d1
movq -0x90(%rbp), %rdi
callq 0x51a0
movq %rax, -0x568(%rbp)
movq -0x568(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xb340
jmp 0x9587
movb $0x1, -0x589(%rbp)
movl $0x40, %edi
callq 0x5220
movq %rax, -0xa98(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa90(%rbp)
leaq -0x4f8(%rbp), %rdi
callq 0x15d10
movq %rax, -0xa88(%rbp)
jmp 0x95bf
movq -0xa88(%rbp), %rsi
leaq 0x30314(%rip), %rdx     # 0x398e1
leaq -0x588(%rbp), %rdi
callq 0x15c90
jmp 0x95db
movq -0xa90(%rbp), %rsi
movq -0xa98(%rbp), %rdi
leaq -0x588(%rbp), %rdx
callq 0x15d30
jmp 0x95f7
movq -0xa98(%rbp), %rdi
movb $0x0, -0x589(%rbp)
leaq 0x47574(%rip), %rsi     # 0x50b80
leaq 0xc75d(%rip), %rdx      # 0x15d70
callq 0x5840
jmp 0xa45d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x967c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9663
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x588(%rbp), %rdi
callq 0x5320
testb $0x1, -0x589(%rbp)
jne 0x966e
jmp 0x967a
movq -0xa98(%rbp), %rdi
callq 0x53a0
jmp 0x967c
callq 0x5810
jmp 0x9683
jmp 0xa3d1
movq -0x18(%rbp), %rax
movq %rax, -0x598(%rbp)
leaq -0x668(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x5290
leaq -0x668(%rbp), %rdi
callq 0x135c0
testb $0x1, -0x3f8(%rbp)
je 0x9767
movl -0x2a0(%rbp), %edi
movq -0x18(%rbp), %rsi
leaq -0x668(%rbp), %rdx
callq 0x15da0
jmp 0x96d7
jmp 0x9730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0xa3c5
movq -0x90(%rbp), %rdi
callq 0x51a0
movq %rax, -0x670(%rbp)
movq -0x18(%rbp), %rdi
movq -0x670(%rbp), %rsi
addq $0x20, %rsi
callq 0xb3c0
jmp 0x9727
callq 0x5810
jmp 0x972e
jmp 0x9730
jmp 0x9767
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
callq 0x5810
jmp 0x9762
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa3c5
jmp 0xa3c5
testb $0x1, -0x3f7(%rbp)
je 0x982c
leaq -0x691(%rbp), %rdi
movq %rdi, -0xaa0(%rbp)
callq 0x5880
movq -0xaa0(%rbp), %rdx
leaq 0x30176(%rip), %rsi     # 0x3990b
leaq -0x690(%rbp), %rdi
callq 0x13710
jmp 0x97a3
leaq -0x691(%rbp), %rdi
callq 0x5520
movq -0x18(%rbp), %rsi
leaq -0x690(%rbp), %rdi
callq 0x5640
jmp 0x97c1
leaq -0x668(%rbp), %rdi
leaq -0x690(%rbp), %rsi
xorl %edx, %edx
callq 0x162b0
jmp 0x97d8
leaq -0x690(%rbp), %rdi
callq 0x5320
jmp 0x982c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x691(%rbp), %rdi
callq 0x5520
jmp 0xa3c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x690(%rbp), %rdi
callq 0x5320
jmp 0xa3c5
leaq -0x4a8(%rbp), %rdi
addq $0x90, %rdi
callq 0x5830
testb $0x1, %al
jne 0x9a56
leaq -0x6c8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x14fe0
jmp 0x985c
leaq -0x418(%rbp), %rdi
callq 0x51b0
movq %rax, %rcx
movq -0x6c8(%rbp), %rsi
movq -0x6c0(%rbp), %rdx
leaq -0x6b8(%rbp), %rdi
callq 0x16400
jmp 0x9887
movq -0x18(%rbp), %rax
movq %rax, -0x6d8(%rbp)
leaq -0x6b8(%rbp), %rdi
movq %rdi, -0x6d0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x6e8(%rbp)
movq %rdi, -0x6e0(%rbp)
callq 0x51b0
movq %rax, %rdi
xorl %esi, %esi
leaq -0x668(%rbp), %rdx
movl $0x1, %ecx
leaq -0x6d8(%rbp), %r8
leaq -0x6e8(%rbp), %r9
callq 0xb430
jmp 0x98dd
leaq -0x6b8(%rbp), %rdi
callq 0x5320
jmp 0x99ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9920
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x6b8(%rbp), %rdi
callq 0x5320
movl -0x94(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa3c5
movq -0x90(%rbp), %rdi
callq 0x51a0
movq %rax, -0x6f0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xab0(%rbp)
leaq -0x731(%rbp), %rdi
movq %rdi, -0xaa8(%rbp)
callq 0x5880
movq -0xaa8(%rbp), %rdx
leaq 0x2ffa8(%rip), %rsi     # 0x3991a
leaq -0x730(%rbp), %rdi
callq 0x13710
jmp 0x9980
movq -0x6f0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, %rdx
leaq -0x710(%rbp), %rdi
leaq -0x730(%rbp), %rsi
callq 0x16640
jmp 0x99a8
movq -0xab0(%rbp), %rdi
leaq -0x710(%rbp), %rsi
callq 0xb3c0
jmp 0x99bd
leaq -0x710(%rbp), %rdi
callq 0x5320
leaq -0x730(%rbp), %rdi
callq 0x5320
leaq -0x731(%rbp), %rdi
callq 0x5520
callq 0x5810
jmp 0x99e8
jmp 0x99ea
jmp 0x9a56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9a3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9a32
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x710(%rbp), %rdi
callq 0x5320
leaq -0x730(%rbp), %rdi
callq 0x5320
leaq -0x731(%rbp), %rdi
callq 0x5520
callq 0x5810
jmp 0x9a51
jmp 0xa3c5
leaq 0x47e0b(%rip), %rdx     # 0x51868
leaq -0x788(%rbp), %rdi
leaq -0x668(%rbp), %rsi
callq 0x16690
jmp 0x9a72
leaq -0x1f0(%rbp), %rdi
leaq -0x788(%rbp), %rsi
movq %rsi, -0xab8(%rbp)
callq 0x16b00
movq -0xab8(%rbp), %rdi
callq 0x16b40
xorl %eax, %eax
movl %eax, %edx
leaq -0x4a8(%rbp), %rdi
leaq -0x598(%rbp), %rcx
leaq -0x200(%rbp), %r8
movq %rcx, %rsi
callq 0xc150
jmp 0x9abb
leaq -0x4a8(%rbp), %rdi
addq $0x50, %rdi
callq 0x5830
testb $0x1, %al
jne 0x9ae6
leaq -0x458(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x5060
jmp 0x9ae4
jmp 0x9ae6
movl $0x10000, -0x78c(%rbp)  # imm = 0x10000
movb -0x78a(%rbp), %al
orb $0x20, %al
movb %al, -0x78a(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x51b0
movq %rax, %rdi
movl -0x78c(%rbp), %esi
xorl %eax, %eax
callq 0x53b0
movl %eax, -0xabc(%rbp)
jmp 0x9b22
movl -0xabc(%rbp), %eax
movl %eax, -0x790(%rbp)
cmpl $0x0, -0x790(%rbp)
jge 0x9c41
movq -0x18(%rbp), %rax
movq %rax, -0xad0(%rbp)
leaq -0x7d1(%rbp), %rdi
movq %rdi, -0xac8(%rbp)
callq 0x5880
movq -0xac8(%rbp), %rdx
leaq 0x2fdd5(%rip), %rsi     # 0x3993c
leaq -0x7d0(%rbp), %rdi
callq 0x13710
jmp 0x9b75
callq 0x5070
movl (%rax), %edi
callq 0x5160
movq %rax, %rdx
leaq -0x7b0(%rbp), %rdi
leaq -0x7d0(%rbp), %rsi
callq 0x16640
jmp 0x9b99
movq -0xad0(%rbp), %rdi
leaq -0x7b0(%rbp), %rsi
callq 0xb3c0
jmp 0x9bae
leaq -0x7b0(%rbp), %rdi
callq 0x5320
leaq -0x7d0(%rbp), %rdi
callq 0x5320
leaq -0x7d1(%rbp), %rdi
callq 0x5520
movl $0xffffff9c, -0x790(%rbp) # imm = 0xFFFFFF9C
jmp 0x9c41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9c30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x9c24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x7b0(%rbp), %rdi
callq 0x5320
leaq -0x7d0(%rbp), %rdi
callq 0x5320
leaq -0x7d1(%rbp), %rdi
callq 0x5520
jmp 0xa3c5
movq -0x18(%rbp), %rax
movq %rax, -0x7e8(%rbp)
leaq -0x790(%rbp), %rax
movq %rax, -0x7e0(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x16b70
testb $0x1, %al
jne 0x9d1c
leaq -0x498(%rbp), %rdi
movq %rdi, -0xad8(%rbp)
callq 0x16b90
movq -0xad8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x7ec(%rbp)
callq 0x16b90
movl 0x4(%rax), %eax
movl %eax, -0x7f0(%rbp)
movslq -0x7ec(%rbp), %rdx
movl %edx, %ecx
movl -0x7f0(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq -0x810(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x16bc0
jmp 0x9cc7
leaq -0x810(%rbp), %rdi
callq 0x51b0
movq %rax, %rdx
leaq 0x30094(%rip), %rsi     # 0x39d71
leaq -0x7e8(%rbp), %rdi
callq 0xc670
jmp 0x9ceb
leaq -0x810(%rbp), %rdi
callq 0x5320
jmp 0x9d1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x810(%rbp), %rdi
callq 0x5320
jmp 0xa3c5
leaq -0x4a8(%rbp), %rdi
addq $0x28, %rdi
callq 0x16b70
testb $0x1, %al
jne 0x9de2
leaq -0x470(%rbp), %rdi
movq %rdi, -0xae0(%rbp)
callq 0x16b90
movq -0xae0(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x814(%rbp)
callq 0x16b90
movl 0x4(%rax), %eax
movl %eax, -0x818(%rbp)
leaq -0x480(%rbp), %rsi
movslq -0x814(%rbp), %rdx
movl %edx, %ecx
movl -0x818(%rbp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq -0x838(%rbp), %rdi
callq 0x16bc0
jmp 0x9d8d
leaq -0x838(%rbp), %rdi
callq 0x51b0
movq %rax, %rdx
leaq 0x2fbc4(%rip), %rsi     # 0x39967
leaq -0x7e8(%rbp), %rdi
callq 0xc670
jmp 0x9db1
leaq -0x838(%rbp), %rdi
callq 0x5320
jmp 0x9de2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x838(%rbp), %rdi
callq 0x5320
jmp 0xa3c5
cmpl $0x1, -0x3a8(%rbp)
jne 0xa1c1
leaq -0x4a8(%rbp), %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x5830
testb $0x1, %al
jne 0xa1c1
leaq -0x3a0(%rbp), %rsi
leaq -0x878(%rbp), %rdi
callq 0x14fe0
jmp 0x9e1f
movq -0x878(%rbp), %rdi
movq -0x870(%rbp), %rsi
callq 0x16cf0
movq %rdx, -0xaf0(%rbp)
movq %rax, -0xae8(%rbp)
jmp 0x9e42
movq -0xaf0(%rbp), %rax
movq -0xae8(%rbp), %rcx
movq %rcx, -0x868(%rbp)
movq %rax, -0x860(%rbp)
leaq -0x858(%rbp), %rdi
leaq -0x868(%rbp), %rsi
callq 0x151c0
jmp 0x9e73
leaq -0x858(%rbp), %rdi
callq 0x5830
testb $0x1, %al
jne 0xa1a2
movl -0x790(%rbp), %eax
movl %eax, -0xaf4(%rbp)
leaq -0x858(%rbp), %rdi
callq 0x51b0
movl -0xaf4(%rbp), %edi
movq %rax, %rsi
leaq -0x908(%rbp), %rdx
xorl %ecx, %ecx
callq 0x5140
cmpl $-0x1, %eax
jne 0xa04e
movq -0x18(%rbp), %rax
movq %rax, -0xb08(%rbp)
leaq -0x989(%rbp), %rdi
movq %rdi, -0xb00(%rbp)
callq 0x5880
movq -0xb00(%rbp), %rdx
leaq 0x2fa89(%rip), %rsi     # 0x39974
leaq -0x988(%rbp), %rdi
callq 0x13710
jmp 0x9ef9
leaq -0x968(%rbp), %rdi
leaq -0x988(%rbp), %rsi
leaq -0x858(%rbp), %rdx
callq 0x16dd0
jmp 0x9f15
leaq 0x2f842(%rip), %rdx     # 0x3975e
leaq -0x948(%rbp), %rdi
leaq -0x968(%rbp), %rsi
callq 0x16640
jmp 0x9f31
callq 0x5070
movl (%rax), %edi
callq 0x5160
movq %rax, %rdx
leaq -0x928(%rbp), %rdi
leaq -0x948(%rbp), %rsi
callq 0x16640
jmp 0x9f55
movq -0xb08(%rbp), %rdi
leaq -0x928(%rbp), %rsi
callq 0xb3c0
jmp 0x9f6a
leaq -0x928(%rbp), %rdi
callq 0x5320
leaq -0x948(%rbp), %rdi
callq 0x5320
leaq -0x968(%rbp), %rdi
callq 0x5320
leaq -0x988(%rbp), %rdi
callq 0x5320
leaq -0x989(%rbp), %rdi
callq 0x5520
jmp 0xa1a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa03d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa031
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa025
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa019
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x928(%rbp), %rdi
callq 0x5320
leaq -0x948(%rbp), %rdi
callq 0x5320
leaq -0x968(%rbp), %rdi
callq 0x5320
leaq -0x988(%rbp), %rdi
callq 0x5320
leaq -0x989(%rbp), %rdi
callq 0x5520
jmp 0xa1b0
movl -0x8f0(%rbp), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0xa19e
movq -0x18(%rbp), %rax
movq %rax, -0xb18(%rbp)
leaq -0x9f1(%rbp), %rdi
movq %rdi, -0xb10(%rbp)
callq 0x5880
movq -0xb10(%rbp), %rdx
leaq 0x2f8f7(%rip), %rsi     # 0x39985
leaq -0x9f0(%rbp), %rdi
callq 0x13710
jmp 0xa09c
leaq -0x9d0(%rbp), %rdi
leaq -0x9f0(%rbp), %rsi
leaq -0x858(%rbp), %rdx
callq 0x16dd0
jmp 0xa0b8
leaq 0x2f8da(%rip), %rdx     # 0x39999
leaq -0x9b0(%rbp), %rdi
leaq -0x9d0(%rbp), %rsi
callq 0x16640
jmp 0xa0d4
movq -0xb18(%rbp), %rdi
leaq -0x9b0(%rbp), %rsi
callq 0xb3c0
jmp 0xa0e9
leaq -0x9b0(%rbp), %rdi
callq 0x5320
leaq -0x9d0(%rbp), %rdi
callq 0x5320
leaq -0x9f0(%rbp), %rdi
callq 0x5320
leaq -0x9f1(%rbp), %rdi
callq 0x5520
jmp 0xa19e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa190
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa184
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa178
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x9b0(%rbp), %rdi
callq 0x5320
leaq -0x9d0(%rbp), %rdi
callq 0x5320
leaq -0x9f0(%rbp), %rdi
callq 0x5320
leaq -0x9f1(%rbp), %rdi
callq 0x5520
jmp 0xa1b0
jmp 0xa1a0
jmp 0xa1a2
leaq -0x858(%rbp), %rdi
callq 0x5320
jmp 0xa1c1
leaq -0x858(%rbp), %rdi
callq 0x5320
jmp 0xa3c5
cmpl $-0x64, -0x790(%rbp)
je 0xa1d9
movl -0x790(%rbp), %edi
callq 0x5900
jmp 0xa1d7
jmp 0xa1d9
movl $0xb8, %edi
callq 0x54a0
movq %rax, -0xb20(%rbp)
jmp 0xa1ec
movb $0x1, -0xa31(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb38(%rbp)
movl -0x3f4(%rbp), %eax
movl %eax, -0xb2c(%rbp)
leaq -0x288(%rbp), %rax
movq %rax, -0xb28(%rbp)
leaq -0x3f0(%rbp), %rsi
leaq -0xa10(%rbp), %rdi
callq 0x16e20
jmp 0xa22d
leaq -0x3d8(%rbp), %rax
movq %rax, -0xb48(%rbp)
leaq -0x3c0(%rbp), %rax
movq %rax, -0xb40(%rbp)
leaq -0x268(%rbp), %rsi
leaq -0xa30(%rbp), %rdi
callq 0x51d0
jmp 0xa25e
movq -0xb48(%rbp), %r9
movq -0xb28(%rbp), %rcx
movl -0xb2c(%rbp), %edx
movq -0xb38(%rbp), %rsi
movq -0xb20(%rbp), %rdi
movq -0xb40(%rbp), %r8
movl -0x3a8(%rbp), %r10d
movq %rsp, %rax
movl %r10d, 0x10(%rax)
leaq -0xa30(%rbp), %r10
movq %r10, 0x8(%rax)
movq %r8, (%rax)
leaq -0xa10(%rbp), %r8
callq 0x16ee0
jmp 0xa2b1
movq -0xb20(%rbp), %rax
movb $0x0, -0xa31(%rbp)
movq %rax, -0x8(%rbp)
leaq -0xa30(%rbp), %rdi
callq 0x5320
leaq -0xa10(%rbp), %rdi
callq 0x17030
leaq -0x668(%rbp), %rdi
callq 0x13610
leaq -0x4f8(%rbp), %rdi
callq 0x17050
leaq -0x4a8(%rbp), %rdi
callq 0x17070
leaq -0x1f0(%rbp), %rdi
callq 0x16b40
leaq -0x128(%rbp), %rdi
callq 0x5320
leaq -0x104(%rbp), %rdi
callq 0x17180
leaq -0x100(%rbp), %rdi
callq 0x38370
leaq -0xe8(%rbp), %rdi
callq 0x5320
leaq -0xc8(%rbp), %rdi
callq 0x5320
leaq -0x60(%rbp), %rdi
callq 0x5320
jmp 0xa43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa3a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0xa39b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xa30(%rbp), %rdi
callq 0x5320
leaq -0xa10(%rbp), %rdi
callq 0x17030
testb $0x1, -0xa31(%rbp)
jne 0xa3b2
jmp 0xa3c3
movq -0xb20(%rbp), %rdi
movl $0xb8, %esi
callq 0x54b0
jmp 0xa3c5
leaq -0x668(%rbp), %rdi
callq 0x13610
leaq -0x4f8(%rbp), %rdi
callq 0x17050
leaq -0x4a8(%rbp), %rdi
callq 0x17070
leaq -0x1f0(%rbp), %rdi
callq 0x16b40
leaq -0x128(%rbp), %rdi
callq 0x5320
leaq -0x104(%rbp), %rdi
callq 0x17180
leaq -0x100(%rbp), %rdi
callq 0x38370
leaq -0xe8(%rbp), %rdi
callq 0x5320
leaq -0xc8(%rbp), %rdi
callq 0x5320
leaq -0x60(%rbp), %rdi
callq 0x5320
jmp 0xa449
movq -0x8(%rbp), %rax
addq $0xb70, %rsp            # imm = 0xB70
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x5870
movq %rax, %rdi
callq 0x138d0
nopl (%rax)