// File: /workspace/github_cpp_makefile_star2_O1/joncampbell123[P]haxcc/haxpp.cpp
// Function: do_macro_expand_val(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, __gnu_cxx::__normal_iterator<token const*, std::vector<token, std::allocator<token>>>&, __gnu_cxx::__normal_iterator<token const*, std::vector<token, std::allocator<token>>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, macro_t const&, bool)
static inline bool do_macro_expand_val(string &fstr,vector<token>::const_iterator &si,const vector<token>::const_iterator sie,const vector<string> &param,const macro_t &macro,const bool variadic_given) {
    if (si == sie)
        throw runtime_error("do_macro_expand_val started with iterator == end");

    if ((*si).tval == token::MACROSUBST) {
        fstr += (*si).sval;
        si++;
        return true;
    }
    else if ((*si).tval == token::MACROPARAM) {
        if ((*si).i.u >= (unsigned long long)param.size())
            throw invalid_argument("macro parameter index out of range");

        fstr += param[size_t((*si).i.u)];
        si++;
        return true;
    }
    else if ((*si).tval == token::VA_ARGS) {
        if (!param.empty() && macro.last_param_variadic && macro.last_param_optional)
            fstr += param[param.size() - size_t(1)];

        si++;
        return true;
    }
    else if ((*si).tval == token::VA_OPT) {
        si++;

        if (si == sie)
            throw invalid_argument("__VA_OPT__ must be followed by (");
        if ((*si).tval != token::OPEN_PARENS)
            throw invalid_argument("__VA_OPT__ must be followed by (");
        si++;

        if (si == sie)
            throw invalid_argument("__VA_OPT__ must be followed by something to expand to");
        if ((*si).tval != token::MACROSUBST)
            throw invalid_argument("__VA_OPT__ must be followed by something to expand to");
        if (variadic_given)
            fstr += (*si).sval;
        si++;

        if (si == sie)
            throw invalid_argument("__VA_OPT__ must be followed by )");
        if ((*si).tval != token::CLOSE_PARENS)
            throw invalid_argument("__VA_OPT__ must be followed by )");
        si++;
        return true;
    }

    return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq (%rsi), %rdx
cmpq %r14, %rdx
je 0x7519
movq %rsi, %rbx
movl (%rdx), %esi
xorl %eax, %eax
cmpl $0x7b, %esi
jg 0x7454
cmpl $0x3, %esi
je 0x74d7
cmpl $0x4, %esi
jne 0x74f0
movq 0x8(%rdx), %rax
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
subq %rdx, %rcx
sarq $0x5, %rcx
cmpq %rcx, %rax
jae 0x7548
shlq $0x5, %rax
movq (%rdx,%rax), %rsi
movq 0x8(%rdx,%rax), %rdx
jmp 0x74df
cmpl $0x7c, %esi
je 0x74f8
cmpl $0x7d, %esi
jne 0x74f0
leaq 0x70(%rdx), %rax
movq %rax, (%rbx)
cmpq %r14, %rax
je 0x7569
cmpl $0x20, (%rax)
jne 0x758a
leaq 0xe0(%rdx), %rax
movq %rax, (%rbx)
cmpq %r14, %rax
je 0x75a8
cmpl $0x3, (%rax)
jne 0x75c6
testb %r9b, %r9b
je 0x74b3
movq 0x128(%rdx), %rsi
movq 0x130(%rdx), %rdx
callq 0x2090
movq (%rbx), %rax
leaq 0x70(%rax), %rcx
movq %rcx, (%rbx)
cmpq %r14, %rcx
je 0x75e4
cmpl $0x21, (%rcx)
jne 0x7602
addq $0xe0, %rax
jmp 0x74eb
movq 0x48(%rdx), %rsi
movq 0x50(%rdx), %rdx
callq 0x2090
movq (%rbx), %rax
addq $0x70, %rax
movq %rax, (%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x8(%rcx), %rax
cmpq %rax, (%rcx)
je 0x74e4
cmpb $0x1, 0x30(%r8)
jne 0x74e4
cmpb $0x1, 0x31(%r8)
jne 0x74e4
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
jmp 0x74df
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd0be(%rip), %rsi      # 0x145eb
movq %rax, %rdi
callq 0x20b0
movq 0x12abc(%rip), %rsi     # 0x19ff8
movq 0x12a6d(%rip), %rdx     # 0x19fb0
jmp 0x762c
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd0c0(%rip), %rsi      # 0x1461c
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd0c2(%rip), %rsi      # 0x1463f
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd0a1(%rip), %rsi      # 0x1463f
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd0a4(%rip), %rsi      # 0x14660
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd086(%rip), %rsi      # 0x14660
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd09e(%rip), %rsi      # 0x14696
movq %rax, %rdi
callq 0x23a0
jmp 0x761e
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0xd080(%rip), %rsi      # 0x14696
movq %rax, %rdi
callq 0x23a0
movq 0x129b3(%rip), %rsi     # 0x19fd8
movq 0x12994(%rip), %rdx     # 0x19fc0
movq %rbx, %rdi
callq 0x2330
jmp 0x7642
jmp 0x7642
jmp 0x7642
jmp 0x7642
jmp 0x7642
jmp 0x7642
jmp 0x7642
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
movq %r14, %rdi
callq 0x2360