// File: davmac314[P]dinit/src/includes/load-service.h
// Function: void dinit_load::value_var_subst<enable_disable_service(int, cpbuffer<1024u>&, service_dir_opt&, char const*, char const*, bool, bool, unsigned short)::$_1>(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::list<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>&, enable_disable_service(int, cpbuffer<1024u>&, service_dir_opt&, char const*, char const*, bool, bool, unsigned short)::$_1 const&, char const*)
static void value_var_subst(const char *setting_name, std::string &line,
        std::list<std::pair<unsigned,unsigned>> &offsets, const T &var_resolve, const char *argval)
{
    auto dindx = line.find('$');
    if (dindx == string::npos) {
        return;
    }

    if (line.length() > (size_t)std::numeric_limits<int>::max()) {
        // (avoid potential for overflow later)
        throw std::length_error("string too long");
    }

    auto i = offsets.begin();
    unsigned xpos = 0; // position to copy from in original line
    std::string r_line;
    int offadj = 0;

    while (i != offsets.end()) {

        i->first += offadj; // don't adjust end yet

        // inhibit_collapse is set if we process anything which may be empty but shouldn't collapse
        // to "no argument"
        bool inhibit_collapse = false;
        bool do_collapse = false;

        while (i->second > dindx) {
            r_line.append(line, xpos, dindx - xpos); // copy unmatched part
            if (line[dindx + 1] == '$') {
                // double dollar, collapse to single
                r_line += '$';
                xpos = dindx + 2;
                --offadj;
            }
            else {
                // variable
                auto token_end = std::next(line.begin(), i->second);
                auto spos = dindx + 1;
                bool wsplit = line[spos] == '/';
                if (wsplit) ++spos;
                bool brace = line[spos] == '{';
                if (brace) ++spos;
                auto j = std::next(line.begin(), spos);
                // may be a service argument
                bool is_arg = false;
                // read environment variable name
                string name = read_config_name(j, token_end, true, &is_arg);
                if (name.empty()) {
                    throw service_description_exc(setting_name, "invalid/missing variable name after '$'");
                }
                else if (is_arg && name != "1") {
                    // only one arg is supported
                    throw service_description_exc(setting_name, "only one service argument may be present");
                }
                char altmode = '\0';
                bool colon = false;
                auto altbeg = j, altend = j;
                if (brace) {
                    /* ${foo+val}, ${foo-val}, ${foo:+val}, ${foo:-val} */
                    if (*j == ':') {
                        colon = true;
                        ++j;
                        if (*j != '+' && *j != '-') {
                            throw service_description_exc(setting_name, "invalid syntax in variable substitution");
                        }
                    }
                    if (*j == '+' || *j == '-') {
                        altmode = *j;
                        altbeg = ++j;
                        while (j != token_end && *j != '}') {
                            ++j;
                        }
                        altend = j;
                    }
                    if (*j != '}') {
                        throw service_description_exc(setting_name, "unmatched '{' in variable substitution");
                    }
                    ++j;
                }
                size_t line_len_before = r_line.size();
                string_view resolved_vw;
                auto *resolved = is_arg ? argval : var_resolve(name);
                if (resolved) {
                    resolved_vw = resolved;
                }
                /* apply shell-like substitutions */
                if (altmode == '-') {
                    if (!resolved || (colon && !*resolved)) {
                        resolved_vw = {line.c_str() + (altbeg - line.begin()), (size_t)(altend - altbeg)};
                    }
                }
                else if (altmode == '+') {
                    if (resolved && (!colon || *resolved)) {
                        resolved_vw = {line.c_str() + (altbeg - line.begin()), (size_t)(altend - altbeg)};
                    }
                }
                else if (is_arg && !argval) {
                    // $1 and ${1} is special in that it must be set or it is an error
                    // however, we want the more complex syntaxes for conditional substitution
                    throw service_description_exc(setting_name, "missing value in argument substitution");
                }

                xpos = j - line.begin();
                int name_len = xpos - dindx;
                offadj -= name_len;

                if (!wsplit) {
                    inhibit_collapse = true;
                    do_collapse = false;
                    if (!resolved_vw.empty()) {
                        r_line.append(resolved_vw.data(), resolved_vw.length());
                    }
                }
                else {
                    // Must perform word splitting. Find first whitespace:
                    auto r_vw_beg = resolved_vw.data();
                    auto r_vw_end = r_vw_beg + resolved_vw.length();
                    const char *wsp = findws(r_vw_beg, r_vw_end);

                    // If we have whitespace, append up to that whitespace and then split:
                    while (wsp != r_vw_end) {
                        if (wsp != r_vw_beg) {
                            r_line.append(r_vw_beg, wsp - r_vw_beg);
                        }

                        auto orig_i_second = i->second;

                        size_t line_len_after = r_line.size();
                        if (i->first == line_len_after && !inhibit_collapse) {
                            // whitespace at the start of the word; just trim it
                            goto next_section;
                        }

                        // Break here:
                        i->second = r_line.length();

                        r_line += ' ';
                        ++line_len_after;

                        if (line_len_after > (size_t)std::numeric_limits<int>::max()) {
                            // (avoid potential overflow)
                            throw service_description_exc(setting_name, "value too long (after substitution)");
                        }

                        // Create new argument from split:
                        i = offsets.insert(std::next(i), {r_line.length(), orig_i_second});
                        offadj += (int)line_len_after - (int)line_len_before;
                        line_len_before = r_line.size();

                        // Find the next break, if any:
                        next_section:
                        r_vw_beg = skipws(wsp, r_vw_end);
                        wsp = findws(r_vw_beg, r_vw_end);
                        inhibit_collapse = false;
                    }

                    if (r_vw_beg != r_vw_end) {
                        r_line.append(r_vw_beg, r_vw_end - r_vw_beg);
                    }

                    do_collapse = !inhibit_collapse;
                }

                size_t line_len_after = r_line.size();

                if (line_len_after > (size_t)std::numeric_limits<int>::max()) {
                    // (avoid potential overflow)
                    throw service_description_exc(setting_name, "value too long (after substitution)");
                }

                offadj += (int)line_len_after - (int)line_len_before;
            }

            dindx = line.find('$', xpos);
        }

        i->second += offadj;

        if (do_collapse && i->first == i->second) {
            i = offsets.erase(i);
        }
        else {
            ++i;
        }

        while (i != offsets.end() && i->second < dindx) {
            i->first += offadj;
            i->second += offadj;
            ++i;
        }
    }

    r_line.append(line, xpos); // copy final unmatched part
    line = std::move(r_line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl $0x24, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x5540
movq %rax, -0x30(%rbp)
cmpq $-0x1, -0x30(%rbp)
jne 0xeed1
jmp 0x10156
movq -0x10(%rbp), %rdi
callq 0x5620
movq %rax, -0x300(%rbp)
callq 0x1b500
movl %eax, %ecx
movq -0x300(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jbe 0xef53
movl $0x10, %edi
callq 0x51c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x308(%rbp)
leaq 0x1602b(%rip), %rsi     # 0x24f40
callq 0x5490
jmp 0xef1c
movq -0x308(%rbp), %rdi
movq 0x23096(%rip), %rsi     # 0x31fc0
movq 0x23057(%rip), %rdx     # 0x31f88
callq 0x56b0
movq -0x308(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x52f0
jmp 0x10168
movq -0x18(%rbp), %rdi
callq 0x1b510
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x55c0
movl $0x0, -0x74(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1af60
movq %rax, -0x80(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x1b540
testb $0x1, %al
jne 0xef9a
jmp 0x10125
movl -0x74(%rbp), %eax
movl %eax, -0x30c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl -0x30c(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movb $0x0, -0x81(%rbp)
movb $0x0, -0x82(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl 0x4(%rax), %eax
cmpq -0x30(%rbp), %rax
jbe 0xffe6
movq -0x10(%rbp), %rsi
movl -0x4c(%rbp), %eax
movl %eax, %edx
movq -0x30(%rbp), %rcx
subq %rdx, %rcx
leaq -0x70(%rbp), %rdi
callq 0x55b0
jmp 0xeff5
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x57a0
movq %rax, -0x318(%rbp)
jmp 0xf00e
movq -0x318(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x24, %eax
jne 0xf057
leaq -0x70(%rbp), %rdi
movl $0x24, %esi
callq 0x5290
jmp 0xf02d
movq -0x30(%rbp), %rax
addq $0x2, %rax
movl %eax, -0x4c(%rbp)
movl -0x74(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xffca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1015f
movq -0x10(%rbp), %rdi
callq 0x5380
movq %rax, -0x98(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl 0x4(%rax), %eax
movl %eax, %esi
movq -0x98(%rbp), %rdi
callq 0x1b590
movq %rax, -0x320(%rbp)
jmp 0xf08a
movq -0x320(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x57a0
movq %rax, -0x328(%rbp)
jmp 0xf0bf
movq -0x328(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
sete %al
andb $0x1, %al
movb %al, -0xa1(%rbp)
testb $0x1, -0xa1(%rbp)
je 0xf0f2
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x57a0
movq %rax, -0x330(%rbp)
jmp 0xf10b
movq -0x330(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7b, %eax
sete %al
andb $0x1, %al
movb %al, -0xa2(%rbp)
testb $0x1, -0xa2(%rbp)
je 0xf13e
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5380
movq %rax, -0xb8(%rbp)
movq -0xa0(%rbp), %rsi
movq -0xb8(%rbp), %rdi
callq 0x1b590
movq %rax, -0x338(%rbp)
jmp 0xf16a
movq -0x338(%rbp), %rax
movq %rax, -0xb0(%rbp)
movb $0x0, -0xb9(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movl $0x1, %ecx
leaq -0xb9(%rbp), %r8
callq 0x19760
leaq -0xe0(%rbp), %rdi
callq 0x56a0
testb $0x1, %al
jne 0xf1c8
jmp 0xf2aa
movb $0x1, -0x10a(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x350(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x348(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x5700
movq -0x340(%rbp), %rdx
leaq 0x15d44(%rip), %rsi     # 0x24f50
leaq -0x108(%rbp), %rdi
callq 0x10f00
jmp 0xf21a
movq -0x348(%rbp), %rsi
movq -0x350(%rbp), %rdi
leaq -0x108(%rbp), %rdx
callq 0x1b5c0
jmp 0xf236
movq -0x350(%rbp), %rdi
movb $0x0, -0x10a(%rbp)
leaq 0x22aa5(%rip), %rsi     # 0x31cf0
leaq 0xa31e(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf282
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x5280
leaq -0x109(%rbp), %rdi
callq 0x5440
testb $0x1, -0x10a(%rbp)
jne 0xf299
jmp 0xf2a5
movq -0x350(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
testb $0x1, -0xb9(%rbp)
je 0xf3d4
leaq 0x14bf2(%rip), %rsi     # 0x23eb0
leaq -0xe0(%rbp), %rdi
callq 0x1b610
movb %al, -0x351(%rbp)
jmp 0xf2d2
movb -0x351(%rbp), %al
testb $0x1, %al
jne 0xf2e1
jmp 0xf3d4
movb $0x1, -0x132(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x370(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x368(%rbp)
leaq -0x131(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x5700
movq -0x360(%rbp), %rdx
leaq 0x15c53(%rip), %rsi     # 0x24f78
leaq -0x130(%rbp), %rdi
callq 0x10f00
jmp 0xf333
movq -0x368(%rbp), %rsi
movq -0x370(%rbp), %rdi
leaq -0x130(%rbp), %rdx
callq 0x1b5c0
jmp 0xf34f
movq -0x370(%rbp), %rdi
movb $0x0, -0x132(%rbp)
leaq 0x2298c(%rip), %rsi     # 0x31cf0
leaq 0xa205(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xffb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf3ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x5280
leaq -0x131(%rbp), %rdi
callq 0x5440
testb $0x1, -0x132(%rbp)
jne 0xf3c3
jmp 0xf3cf
movq -0x370(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
jmp 0xf3d6
movb $0x0, -0x133(%rbp)
movb $0x0, -0x134(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x148(%rbp)
testb $0x1, -0xa2(%rbp)
je 0xf70f
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0xf54c
movb $0x1, -0x134(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x19740
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0xf54a
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0xf54a
movb $0x1, -0x16a(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x388(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x380(%rbp)
leaq -0x169(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x5700
movq -0x378(%rbp), %rdx
leaq 0x15af5(%rip), %rsi     # 0x24fa1
leaq -0x168(%rbp), %rdi
callq 0x10f00
jmp 0xf4ba
movq -0x380(%rbp), %rsi
movq -0x388(%rbp), %rdi
leaq -0x168(%rbp), %rdx
callq 0x1b5c0
jmp 0xf4d6
movq -0x388(%rbp), %rdi
movb $0x0, -0x16a(%rbp)
leaq 0x22805(%rip), %rsi     # 0x31cf0
leaq 0xa07e(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf522
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x5280
leaq -0x169(%rbp), %rdi
callq 0x5440
testb $0x1, -0x16a(%rbp)
jne 0xf539
jmp 0xf545
movq -0x388(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
jmp 0xf54c
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0xf578
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0xf609
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movb (%rax), %al
movb %al, -0x133(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x19740
movq (%rax), %rax
movq %rax, -0x140(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x19700
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x389(%rbp)
jne 0xf5c6
jmp 0xf5e1
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x7d, %eax
setne %al
movb %al, -0x389(%rbp)
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0xf5ed
jmp 0xf5fb
leaq -0xb0(%rbp), %rdi
callq 0x19740
jmp 0xf5a2
movq -0xb0(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x172b0
movsbl (%rax), %eax
cmpl $0x7d, %eax
je 0xf703
movb $0x1, -0x192(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x3a8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3a0(%rbp)
leaq -0x191(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x5700
movq -0x398(%rbp), %rdx
leaq 0x15964(%rip), %rsi     # 0x24fc9
leaq -0x190(%rbp), %rdi
callq 0x10f00
jmp 0xf673
movq -0x3a0(%rbp), %rsi
movq -0x3a8(%rbp), %rdi
leaq -0x190(%rbp), %rdx
callq 0x1b5c0
jmp 0xf68f
movq -0x3a8(%rbp), %rdi
movb $0x0, -0x192(%rbp)
leaq 0x2264c(%rip), %rsi     # 0x31cf0
leaq 0x9ec5(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xf6db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x5280
leaq -0x191(%rbp), %rdi
callq 0x5440
testb $0x1, -0x192(%rbp)
jne 0xf6f2
jmp 0xf6fe
movq -0x3a8(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
leaq -0xb0(%rbp), %rdi
callq 0x19740
leaq -0x70(%rbp), %rdi
callq 0x52c0
movq %rax, -0x1a0(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x1b640
testb $0x1, -0xb9(%rbp)
je 0xf741
movq -0x28(%rbp), %rax
movq %rax, -0x3b0(%rbp)
jmp 0xf76a
movq -0x20(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x10180
movq %rax, -0x3b8(%rbp)
jmp 0xf75a
movq -0x3b8(%rbp), %rax
movq %rax, -0x3b0(%rbp)
jmp 0xf76a
movq -0x3b0(%rbp), %rax
movq %rax, -0x1b8(%rbp)
cmpq $0x0, -0x1b8(%rbp)
je 0xf7b1
movq -0x1b8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x1b660
movq -0x1c8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1c0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movsbl -0x133(%rbp), %eax
cmpl $0x2d, %eax
jne 0xf879
cmpq $0x0, -0x1b8(%rbp)
je 0xf7e8
testb $0x1, -0x134(%rbp)
je 0xf874
movq -0x1b8(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xf874
movq -0x10(%rbp), %rdi
callq 0x5160
movq %rax, -0x3c8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5380
movq %rax, -0x1e0(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x1b6a0
movq %rax, %rcx
movq -0x3c8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x3c0(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x1b6a0
movq -0x3c0(%rbp), %rsi
movq %rax, %rdx
leaq -0x1d8(%rbp), %rdi
callq 0x15c10
movq -0x1d8(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1d0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
jmp 0xfa3f
movsbl -0x133(%rbp), %eax
cmpl $0x2b, %eax
jne 0xf941
cmpq $0x0, -0x1b8(%rbp)
je 0xf93c
testb $0x1, -0x134(%rbp)
je 0xf8b0
movq -0x1b8(%rbp), %rax
cmpb $0x0, (%rax)
je 0xf93c
movq -0x10(%rbp), %rdi
callq 0x5160
movq %rax, -0x3d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5380
movq %rax, -0x1f8(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x1b6a0
movq %rax, %rcx
movq -0x3d8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x3d0(%rbp)
leaq -0x148(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x1b6a0
movq -0x3d0(%rbp), %rsi
movq %rax, %rdx
leaq -0x1f0(%rbp), %rdi
callq 0x15c10
movq -0x1f0(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1e8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
jmp 0xfa3d
testb $0x1, -0xb9(%rbp)
je 0xfa3b
cmpq $0x0, -0x28(%rbp)
jne 0xfa3b
movb $0x1, -0x21a(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x3f0(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x3e8(%rbp)
leaq -0x219(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x5700
movq -0x3e0(%rbp), %rdx
leaq 0x15653(%rip), %rsi     # 0x24ff0
leaq -0x218(%rbp), %rdi
callq 0x10f00
jmp 0xf9ab
movq -0x3e8(%rbp), %rsi
movq -0x3f0(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0x1b5c0
jmp 0xf9c7
movq -0x3f0(%rbp), %rdi
movb $0x0, -0x21a(%rbp)
leaq 0x22314(%rip), %rsi     # 0x31cf0
leaq 0x9b8d(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfa13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x5280
leaq -0x219(%rbp), %rdi
callq 0x5440
testb $0x1, -0x21a(%rbp)
jne 0xfa2a
jmp 0xfa36
movq -0x3f0(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
jmp 0xfa3d
jmp 0xfa3f
movq -0x10(%rbp), %rdi
callq 0x5380
movq %rax, -0x228(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x1b6a0
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
subq -0x30(%rbp), %rax
movl %eax, -0x22c(%rbp)
movl -0x22c(%rbp), %ecx
movl -0x74(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x74(%rbp)
testb $0x1, -0xa1(%rbp)
jne 0xfae9
movb $0x1, -0x81(%rbp)
movb $0x0, -0x82(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x15c60
testb $0x1, %al
jne 0xfae4
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x1b6e0
movq -0x400(%rbp), %rdi
movq %rax, -0x3f8(%rbp)
callq 0x15c40
movq -0x3f8(%rbp), %rsi
movq %rax, %rdx
leaq -0x70(%rbp), %rdi
callq 0x5080
jmp 0xfae2
jmp 0xfae4
jmp 0xfe7e
leaq -0x1b0(%rbp), %rdi
callq 0x1b6e0
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rax
movq %rax, -0x408(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x15c40
movq %rax, %rcx
movq -0x408(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x240(%rbp)
movq -0x238(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x1b700
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rax
cmpq -0x240(%rbp), %rax
je 0xfe40
movq -0x248(%rbp), %rax
cmpq -0x238(%rbp), %rax
je 0xfb86
movq -0x238(%rbp), %rsi
movq -0x248(%rbp), %rdx
subq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x5080
jmp 0xfb84
jmp 0xfb86
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl 0x4(%rax), %eax
movl %eax, -0x24c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x52c0
movq %rax, -0x258(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl (%rax), %eax
cmpq -0x258(%rbp), %rax
jne 0xfbca
testb $0x1, -0x81(%rbp)
jne 0xfbca
jmp 0xfe00
leaq -0x70(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x5620
movl %eax, -0x414(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl -0x414(%rbp), %ecx
movq -0x410(%rbp), %rdi
movl %ecx, 0x4(%rax)
movl $0x20, %esi
callq 0x5290
jmp 0xfc05
movq -0x258(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
movq %rax, -0x420(%rbp)
callq 0x1b500
movl %eax, %ecx
movq -0x420(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jbe 0xfd21
movb $0x1, -0x27a(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x438(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x430(%rbp)
leaq -0x279(%rbp), %rdi
movq %rdi, -0x428(%rbp)
callq 0x5700
movq -0x428(%rbp), %rdx
leaq 0x15394(%rip), %rsi     # 0x25017
leaq -0x278(%rbp), %rdi
callq 0x10f00
jmp 0xfc91
movq -0x430(%rbp), %rsi
movq -0x438(%rbp), %rdi
leaq -0x278(%rbp), %rdx
callq 0x1b5c0
jmp 0xfcad
movq -0x438(%rbp), %rdi
movb $0x0, -0x27a(%rbp)
leaq 0x2202e(%rip), %rsi     # 0x31cf0
leaq 0x98a7(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfcf9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x5280
leaq -0x279(%rbp), %rdi
callq 0x5440
testb $0x1, -0x27a(%rbp)
jne 0xfd10
jmp 0xfd1c
movq -0x438(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
movq -0x18(%rbp), %rax
movq %rax, -0x448(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rdi
movl $0x1, %esi
callq 0x1b7b0
movq %rax, -0x440(%rbp)
jmp 0xfd51
movq -0x440(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x290(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x1b7e0
leaq -0x70(%rbp), %rdi
callq 0x5620
movq %rax, -0x2b0(%rbp)
leaq -0x2a8(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
leaq -0x24c(%rbp), %rdx
callq 0x1b800
jmp 0xfd9e
movq -0x448(%rbp), %rdi
movq -0x290(%rbp), %rsi
leaq -0x2a8(%rbp), %rdx
callq 0x1b770
movq %rax, -0x450(%rbp)
jmp 0xfdc1
movq -0x450(%rbp), %rax
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x258(%rbp), %rax
movq -0x1a0(%rbp), %rcx
subl %ecx, %eax
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x52c0
movq %rax, -0x1a0(%rbp)
movq -0x248(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x1b830
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rdi
movq -0x240(%rbp), %rsi
callq 0x1b700
movq %rax, -0x248(%rbp)
movb $0x0, -0x81(%rbp)
jmp 0xfb44
movq -0x238(%rbp), %rax
cmpq -0x240(%rbp), %rax
je 0xfe6e
movq -0x238(%rbp), %rsi
movq -0x240(%rbp), %rdx
subq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x5080
jmp 0xfe6c
jmp 0xfe6e
movb -0x81(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x82(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x52c0
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rax
movq %rax, -0x458(%rbp)
callq 0x1b500
movl %eax, %ecx
movq -0x458(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jbe 0xff95
movb $0x1, -0x2da(%rbp)
movl $0x70, %edi
callq 0x51c0
movq %rax, -0x470(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x468(%rbp)
leaq -0x2d9(%rbp), %rdi
movq %rdi, -0x460(%rbp)
callq 0x5700
movq -0x460(%rbp), %rdx
leaq 0x1511d(%rip), %rsi     # 0x25017
leaq -0x2d8(%rbp), %rdi
callq 0x10f00
jmp 0xff08
movq -0x468(%rbp), %rsi
movq -0x470(%rbp), %rdi
leaq -0x2d8(%rbp), %rdx
callq 0x1b5c0
jmp 0xff24
movq -0x470(%rbp), %rdi
movb $0x0, -0x2da(%rbp)
leaq 0x21db7(%rip), %rsi     # 0x31cf0
leaq 0x9630(%rip), %rdx      # 0x19570
callq 0x56b0
jmp 0x10171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xff70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2d8(%rbp), %rdi
callq 0x5280
leaq -0x2d9(%rbp), %rdi
callq 0x5440
testb $0x1, -0x2da(%rbp)
jne 0xff87
jmp 0xff93
movq -0x470(%rbp), %rdi
callq 0x52f0
jmp 0xffb9
movq -0x2b8(%rbp), %rax
movq -0x1a0(%rbp), %rcx
subl %ecx, %eax
addl -0x74(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x5280
jmp 0xffca
leaq -0xe0(%rbp), %rdi
callq 0x5280
jmp 0x1015f
movq -0x10(%rbp), %rdi
movl -0x4c(%rbp), %eax
movl %eax, %edx
movl $0x24, %esi
callq 0x5540
movq %rax, -0x30(%rbp)
jmp 0xefc4
movl -0x74(%rbp), %eax
movl %eax, -0x474(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl -0x474(%rbp), %ecx
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
testb $0x1, -0x82(%rbp)
je 0x10077
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl (%rax), %eax
movl %eax, -0x478(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movq %rax, %rcx
movl -0x478(%rbp), %eax
cmpl 0x4(%rcx), %eax
jne 0x10077
movq -0x18(%rbp), %rax
movq %rax, -0x480(%rbp)
leaq -0x2f0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1b7e0
movq -0x480(%rbp), %rdi
movq -0x2f0(%rbp), %rsi
callq 0x1b8a0
movq %rax, -0x2e8(%rbp)
movq -0x2e8(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x10080
leaq -0x48(%rbp), %rdi
callq 0x1b8f0
jmp 0x10082
movq -0x18(%rbp), %rdi
callq 0x1af60
movq %rax, -0x2f8(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x2f8(%rbp), %rsi
callq 0x1b540
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x481(%rbp)
jne 0x100b3
jmp 0x100cc
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl 0x4(%rax), %eax
cmpq -0x30(%rbp), %rax
setb %al
movb %al, -0x481(%rbp)
movb -0x481(%rbp), %al
testb $0x1, %al
jne 0x100d8
jmp 0x10120
movl -0x74(%rbp), %eax
movl %eax, -0x48c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl -0x48c(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0x74(%rbp), %eax
movl %eax, -0x488(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x1b570
movl -0x488(%rbp), %ecx
addl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
leaq -0x48(%rbp), %rdi
callq 0x1b8f0
jmp 0x10082
jmp 0xef77
movq -0x10(%rbp), %rsi
movl -0x4c(%rbp), %eax
movl %eax, %edx
leaq -0x70(%rbp), %rdi
movq $-0x1, %rcx
callq 0x55b0
jmp 0x10140
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5500
leaq -0x70(%rbp), %rdi
callq 0x5280
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x5280
movq -0x38(%rbp), %rdi
callq 0x56f0
nopw %cs:(%rax,%rax)