// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]haxcc/haxpp.cpp
// Function: do_macro_expand(std::vector<token, std::allocator<token>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>&, __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void do_macro_expand(token_string &tokens,const string &ident,string::iterator &li,const string::iterator lie,const int32_t lineno,const string &source) {
    auto mi = macro_store.find(ident);
    if (mi != macro_store.end()) {
        const macro_t &macro = mi->second;
        bool variadic_given = false;
        vector<string> param;
        string fstr;

        if (macro.parens) {
            parse_skip_whitespace(li,lie);
            if (strit_next_match_inc(li,lie,'(')) {
                do {
                    bool variad = macro.last_param_variadic && (param.size()+size_t(1)) == macro.param.size();

                    if (variad)
                        variadic_given = variad;

                    parse_skip_whitespace(li,lie);
                    if (li == lie) throw invalid_argument("macro invocation parameter list ended suddenly");
                    if (strit_next_match_inc(li,lie,')')) break;

                    if (param.size() >= macro.param.size())
                        throw invalid_argument("macro invocation parameter list with too many parameters");
                    param.push_back(do_macro_expand_read_invoke_param(li,lie,variad));

                    parse_skip_whitespace(li,lie);
                    if (li == lie) throw invalid_argument("macro invocation parameter list ended suddenly");
                    if (strit_next_match_inc(li,lie,')'))
                        break;
                    else if (!strit_next_match_inc(li,lie,','))
                        throw invalid_argument(string("macro invocation parameter list unexpected char ") + *li);
                } while(1);

                /* enforce required param count. the one for the variadic macro is not required to be present. */
                size_t reqd_params = macro.param.size();
                if (macro.last_param_variadic && macro.last_param_optional && reqd_params != size_t(0)) reqd_params--;
                if (param.size() < reqd_params)
                    throw invalid_argument("macro invocation parameter list has too few parameters");

                /* fill in the rest with blank */
                while (param.size() < macro.param.size())
                    param.push_back(string());

                parse_skip_whitespace(li,lie);
            }
            else {
                throw invalid_argument("macro invoked without parenthesis when defined with parameters");
            }
        }

        for (vector<token>::const_iterator si=macro.subst.begin();si!=macro.subst.end();) {
            if (do_macro_expand_val(fstr,si,macro.subst.end(),param,macro,variadic_given)) {
                while (si != macro.subst.end() && (*si).tval == token::TOKEN_PASTE) {
                    si++;
                    if (si == macro.subst.end())
                        throw invalid_argument("token paste must be followed by another token");
                    if (!do_macro_expand_val(fstr,si,macro.subst.end(),param,macro,variadic_given))
                        throw invalid_argument("token paste was not followed by expandable value");
                }

                if (si != macro.subst.end())
                    fstr += " ";
            }
            else if ((*si).tval == token::STRINGIFY) {
                si++;
                if (si == macro.subst.end())
                    throw invalid_argument("macro stringify with nothing to stringify");

                string tmpr;
                if (!do_macro_expand_val(tmpr,si,macro.subst.end(),param,macro,variadic_given))
                    throw invalid_argument("stringify was not followed by expandable value");

                if (!tmpr.empty())
                    fstr += pp_stringify(tmpr) + " ";
            }
            else if ((*si).tval == token::COMMA) {
                si++;
                auto si2 = si;
                if (si2 != macro.subst.end() && (*si2).tval == token::TOKEN_PASTE) { /* , ## */
                    si2++;
                    if (si2 != macro.subst.end() && (*si2).tval == token::VA_ARGS) { /* , ## __VA_ARGS__ */
                        si = si2;

                        if (variadic_given) {
                            fstr += ",";
                            do_macro_expand_val(fstr,si,macro.subst.end(),param,macro,variadic_given);
                        }
                        else {
                            si++;
                        }

                        continue;
                    }
                }

                fstr += ",";
            }
            else {
                throw invalid_argument("unexpected token in macro expansion");
            }
        }

        parse_tokens(tokens,fstr.begin(),fstr.end(),lineno,source);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %r9, %rbx
movl %r8d, %ebp
movq %rcx, %r13
movq %rdx, %r12
movq %rdi, %r14
leaq 0x1382e(%rip), %rdi     # 0x1a210
callq 0x10bc4
movq %rax, %r15
leaq 0x13827(%rip), %rax     # 0x1a218
cmpq %rax, %r15
je 0x6f74
movq %r14, 0x98(%rsp)
movl %ebp, 0x94(%rsp)
movq %rbx, 0xa0(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x60(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, 0x68(%rsp)
movq %rcx, -0x8(%rax)
movb $0x0, (%rax)
cmpb $0x1, 0x72(%r15)
jne 0x6c52
movq (%r12), %rax
cmpq %r13, %rax
je 0x6a63
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6a5a
cmpl $0x9, %ecx
jne 0x6a63
incq %rax
movq %rax, (%r12)
jmp 0x6a48
cmpq %r13, %rax
je 0x7132
cmpb $0x28, (%rax)
jne 0x7132
leaq 0x40(%rsp), %rbp
movq $0x0, 0x68(%rsp)
leaq 0x30(%rsp), %rbx
leaq 0x50(%rsp), %r14
incq %rax
movq %rax, (%r12)
movb 0x70(%r15), %cl
cmpb $0x1, %cl
jne 0x6acf
movq 0x58(%rsp), %rdx
subq 0x50(%rsp), %rdx
sarq $0x5, %rdx
incq %rdx
movq 0x60(%r15), %rsi
subq 0x58(%r15), %rsi
sarq $0x5, %rsi
cmpq %rsi, %rdx
sete %dl
movq 0x68(%rsp), %rsi
orb %dl, %sil
movq %rsi, 0x68(%rsp)
jmp 0x6ad1
xorl %edx, %edx
cmpq %r13, %rax
je 0x6aec
movzbl (%rax), %esi
cmpl $0x20, %esi
je 0x6ae3
cmpl $0x9, %esi
jne 0x6aec
incq %rax
movq %rax, (%r12)
jmp 0x6ad1
cmpq %r13, %rax
je 0x6fd6
cmpb $0x29, (%rax)
movq 0x60(%r15), %rsi
je 0x6b91
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
subq 0x58(%r15), %rsi
cmpq %rsi, %rax
jae 0x6ff4
movzbl %dl, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x681c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10c4e
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6b4c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq (%r12), %rax
cmpq %r13, %rax
je 0x6b6b
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6b62
cmpl $0x9, %ecx
jne 0x6b6b
incq %rax
movq %rax, (%r12)
jmp 0x6b50
cmpq %r13, %rax
je 0x7012
movzbl (%rax), %ecx
cmpl $0x2c, %ecx
je 0x6a8d
cmpl $0x29, %ecx
jne 0x7044
movq 0x60(%r15), %rsi
movb 0x70(%r15), %cl
incq %rax
movq %rax, (%r12)
movq 0x58(%r15), %r8
movq %rsi, %rdx
subq %r8, %rdx
movq %rdx, %rdi
sarq $0x5, %rdi
testb $0x1, %cl
je 0x6bbe
cmpq %r8, %rsi
setne %cl
andb 0x71(%r15), %cl
movzbl %cl, %ecx
subq %rcx, %rdi
movq 0x58(%rsp), %rcx
subq 0x50(%rsp), %rcx
movq %rcx, %rsi
sarq $0x5, %rsi
cmpq %rdi, %rsi
jb 0x7166
cmpq %rdx, %rcx
jae 0x6c4d
leaq 0x50(%rsp), %rbx
leaq 0x30(%rsp), %r14
movq %rbp, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10c4e
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6c1c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
movq 0x60(%r15), %rcx
subq 0x58(%r15), %rcx
cmpq %rcx, %rax
jb 0x6be7
movq (%r12), %rax
jmp 0x6c4d
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6c46
cmpl $0x9, %ecx
jne 0x6c52
incq %rax
movq %rax, (%r12)
cmpq %r13, %rax
jne 0x6c39
movq 0x40(%r15), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%r15), %rdx
cmpq %rdx, %rax
je 0x6f25
movzbl 0x68(%rsp), %ebp
andl $0x1, %ebp
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x30(%rsp), %r14
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
movl 0x70(%r15), %r9d
movzbl 0x71(%r15), %eax
movq %r12, %rdi
movq %r13, %rsi
pushq %rbp
pushq %rax
callq 0x7316
addq $0x10, %rsp
testb %al, %al
je 0x6d01
movq 0x48(%r15), %rdx
movq 0x8(%rsp), %rax
cmpq %rdx, %rax
je 0x6f07
cmpl $0x7b, (%rax)
jne 0x6e4c
addq $0x70, %rax
movq %rax, 0x8(%rsp)
cmpq %rdx, %rax
je 0x6f86
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
movl 0x70(%r15), %r9d
movzbl 0x71(%r15), %eax
movq %r12, %rdi
movq %r13, %rsi
pushq %rbp
pushq %rax
callq 0x7316
addq $0x10, %rsp
testb %al, %al
jne 0x6ca7
jmp 0x6fa4
movq 0x8(%rsp), %rax
movl (%rax), %ecx
cmpl $0x17, %ecx
je 0x6dd7
cmpl $0x7a, %ecx
jne 0x7111
addq $0x70, %rax
movq %rax, 0x8(%rsp)
movq 0x48(%r15), %rdx
cmpq %rdx, %rax
je 0x70f0
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movb $0x0, 0x40(%rsp)
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
movl 0x70(%r15), %r9d
movzbl 0x71(%r15), %eax
movq %r14, %rdi
movq %r13, %rsi
pushq %rbp
pushq %rax
callq 0x7316
addq $0x10, %rsp
testb %al, %al
je 0x70b9
cmpq $0x0, 0x38(%rsp)
je 0x6eeb
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6901
movq %rbx, %rdi
leaq 0xce92(%rip), %rsi      # 0x13c2f
callq 0x23b0
leaq 0x80(%rsp), %rsi
movq %rsi, 0x70(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6e74
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0x6e7a
leaq 0x70(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq 0x48(%r15), %rcx
cmpq %rcx, %rdx
je 0x6e60
cmpl $0x7b, (%rdx)
jne 0x6e60
leaq 0xe0(%rax), %rdx
cmpq %rcx, %rdx
je 0x6e60
cmpl $0x7c, (%rdx)
jne 0x6e60
movq %rdx, 0x8(%rsp)
testb $0x1, 0x68(%rsp)
je 0x6f18
movq %r12, %rdi
leaq 0xd2e7(%rip), %rsi      # 0x14100
callq 0x23b0
movq 0x48(%r15), %rdx
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
movl 0x70(%r15), %r9d
movzbl 0x71(%r15), %eax
movq %r12, %rdi
movq %r13, %rsi
pushq $0x1
pushq %rax
callq 0x7316
addq $0x10, %rsp
jmp 0x6f07
movq %r12, %rdi
leaq 0xcdd9(%rip), %rsi      # 0x13c2f
callq 0x23b0
jmp 0x6f07
movq %r12, %rdi
leaq 0xd296(%rip), %rsi      # 0x14100
callq 0x23b0
jmp 0x6f07
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x78(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq %r12, %rdi
callq 0x2090
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x6ec6
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x6eeb
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x6f07
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x48(%r15), %rdx
cmpq %rdx, 0x8(%rsp)
jne 0x6c7f
jmp 0x6f25
addq $0x150, %rax            # imm = 0x150
movq %rax, 0x8(%rsp)
jmp 0x6f07
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
addq %rsi, %rdx
movq 0x98(%rsp), %rdi
movl 0x94(%rsp), %ecx
movq 0xa0(%rsp), %r8
callq 0x756e
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x6f6a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x50(%rsp), %rdi
callq 0xf064
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xd0ae(%rip), %rsi      # 0x14048
movq %rax, %rdi
callq 0x23a0
jmp 0x6fc0
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xd0be(%rip), %rsi      # 0x14076
movq %rax, %rdi
callq 0x23a0
movq 0x13011(%rip), %rsi     # 0x19fd8
movq 0x12ff2(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcf4f(%rip), %rsi      # 0x13f39
movq %rax, %rdi
callq 0x23a0
jmp 0x702e
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcf60(%rip), %rsi      # 0x13f68
movq %rax, %rdi
callq 0x23a0
jmp 0x702e
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcf13(%rip), %rsi      # 0x13f39
movq %rax, %rdi
callq 0x23a0
movq 0x12fa3(%rip), %rsi     # 0x19fd8
movq 0x12f84(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xcf3d(%rip), %rsi      # 0x13fa1
leaq 0xcf66(%rip), %rdx      # 0x13fd1
leaq 0x70(%rsp), %rdi
callq 0x10b2e
movq (%r12), %rax
movsbl (%rax), %edx
leaq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xed69
movb $0x1, %r12b
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x2350
xorl %r12d, %r12d
movq 0x12f33(%rip), %rsi     # 0x19fd8
movq 0x12f14(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x7198
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xd004(%rip), %rsi      # 0x140d1
movq %rax, %rdi
callq 0x23a0
movq 0x12efc(%rip), %rsi     # 0x19fd8
movq 0x12edd(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x7198
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcfa3(%rip), %rsi      # 0x140a7
movq %rax, %rdi
callq 0x23a0
jmp 0x6fc0
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcfdd(%rip), %rsi      # 0x14102
movq %rax, %rdi
callq 0x23a0
jmp 0x6fc0
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcec3(%rip), %rsi      # 0x14009
movq %rax, %rdi
callq 0x23a0
movq 0x12e83(%rip), %rsi     # 0x19fd8
movq 0x12e64(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x7198
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xce58(%rip), %rsi      # 0x13fd2
movq %rax, %rdi
callq 0x23a0
movq 0x12e4f(%rip), %rsi     # 0x19fd8
movq 0x12e30(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x72e5
jmp 0x72d6
jmp 0x72d6
jmp 0x72e5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x71c6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x71e0
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
testb %r12b, %r12b
leaq 0x20(%rsp), %r15
jne 0x728a
jmp 0x72ed
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x7285
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x7285
jmp 0x72d6
jmp 0x72d6
jmp 0x729c
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x729f
movq %rax, %rbx
jmp 0x725b
jmp 0x729c
movq %rax, %rbx
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x725b
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x729f
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x729f
movq %rax, %rbx
leaq 0x20(%rsp), %r15
movq %r14, %rdi
callq 0x2160
jmp 0x72ed
jmp 0x72d6
jmp 0x72d6
jmp 0x72d6
jmp 0x72e5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
jne 0x72c1
jmp 0x72e8
jmp 0x72b4
jmp 0x72e5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x72e8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x72e8
jmp 0x72e5
jmp 0x72e5
jmp 0x72d6
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x72e8
jmp 0x72e5
movq %rax, %rbx
leaq 0x20(%rsp), %r15
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x7304
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x50(%rsp), %rdi
callq 0xf064
movq %rbx, %rdi
callq 0x2360