// File: /workspace/github_cpp_makefile_star2_O1/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, 0xa0(%rsp)
movl %r8d, 0x74(%rsp)
movq %rcx, %r13
movq %rdx, %r12
movq %rdi, 0x98(%rsp)
leaq 0x13702(%rip), %rdi     # 0x1a210
callq 0x10c44
movq %rax, %r15
leaq 0x136fb(%rip), %rax     # 0x1a218
cmpq %rax, %r15
je 0x7082
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x40(%rsp)
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, 0x28(%rsp)
movq %rcx, -0x8(%rax)
movb $0x0, (%rax)
cmpb $0x1, 0x72(%r15)
jne 0x6d9d
movq (%r12), %rax
cmpq %r13, %rax
je 0x6b7b
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6b72
cmpl $0x9, %ecx
jne 0x6b7b
incq %rax
movq %rax, (%r12)
jmp 0x6b60
movq (%r12), %rax
cmpq %r13, %rax
je 0x723d
cmpb $0x28, (%rax)
jne 0x723d
incq %rax
movq %rax, (%r12)
leaq 0x18(%rsp), %rbp
movq $0x0, 0x28(%rsp)
movl $0x1, %r14d
leaq 0x8(%rsp), %rbx
cmpb $0x1, 0x70(%r15)
jne 0x6bdd
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
sarq $0x5, %rax
movq 0x60(%r15), %rcx
subq 0x58(%r15), %rcx
incq %rax
sarq $0x5, %rcx
cmpq %rcx, %rax
sete %al
jmp 0x6bdf
xorl %eax, %eax
movq 0x28(%rsp), %rcx
movzbl %cl, %ecx
testb %al, %al
cmovnel %r14d, %ecx
movq %rcx, 0x28(%rsp)
movq (%r12), %rcx
cmpq %r13, %rcx
je 0x6c11
movzbl (%rcx), %edx
cmpl $0x20, %edx
je 0x6c08
cmpl $0x9, %edx
jne 0x6c11
incq %rcx
movq %rcx, (%r12)
jmp 0x6bf6
movq (%r12), %rcx
cmpq %r13, %rcx
je 0x7156
cmpb $0x29, (%rcx)
je 0x6cca
movq 0x38(%rsp), %rcx
subq 0x30(%rsp), %rcx
movq 0x60(%r15), %rdx
subq 0x58(%r15), %rdx
cmpq %rdx, %rcx
jae 0x7174
movzbl %al, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x6940
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x10cce
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6c77
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq (%r12), %rax
cmpq %r13, %rax
je 0x6c96
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6c8d
cmpl $0x9, %ecx
jne 0x6c96
incq %rax
movq %rax, (%r12)
jmp 0x6c7b
movq (%r12), %rcx
cmpq %r13, %rcx
je 0x7192
cmpb $0x29, (%rcx)
je 0x6cca
movq (%r12), %rax
cmpq %r13, %rax
je 0x70e4
cmpb $0x2c, (%rax)
jne 0x70e4
incq %rax
movq %rax, (%r12)
jmp 0x6bb1
incq %rcx
movq %rcx, (%r12)
movq 0x58(%r15), %rcx
movq 0x60(%r15), %rdx
movq %rdx, %rax
subq %rcx, %rax
sarq $0x5, %rax
cmpb $0x1, 0x70(%r15)
jne 0x6cfa
cmpq %rcx, %rdx
setne %cl
andb 0x71(%r15), %cl
movzbl %cl, %ecx
subq %rcx, %rax
movq 0x38(%rsp), %rcx
subq 0x30(%rsp), %rcx
sarq $0x5, %rcx
cmpq %rax, %rcx
jb 0x7271
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
movq 0x60(%r15), %rcx
subq 0x58(%r15), %rcx
cmpq %rcx, %rax
jae 0x6d7e
leaq 0x30(%rsp), %rbx
leaq 0x8(%rsp), %r14
movq %rbp, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10cce
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6d67
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
movq 0x60(%r15), %rcx
subq 0x58(%r15), %rcx
cmpq %rcx, %rax
jb 0x6d32
movq (%r12), %rax
cmpq %r13, %rax
je 0x6d9d
movzbl (%rax), %ecx
cmpl $0x20, %ecx
je 0x6d94
cmpl $0x9, %ecx
jne 0x6d9d
incq %rax
movq %rax, (%r12)
jmp 0x6d82
movq 0x40(%r15), %rax
movq %rax, (%rsp)
movq 0x48(%r15), %rdx
cmpq %rdx, %rax
je 0x702d
movq %r15, %r12
addq $0x40, %r12
movzbl 0x28(%rsp), %r13d
andl $0x1, %r13d
leaq 0x78(%rsp), %rbx
movq %rsp, %rbp
leaq 0x30(%rsp), %r14
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %r12, %r8
movl %r13d, %r9d
callq 0x73f6
testb %al, %al
je 0x6e30
movq 0x48(%r15), %rdx
movq (%rsp), %rax
cmpq %rdx, %rax
je 0x7016
cmpl $0x7b, (%rax)
jne 0x6f58
addq $0x70, %rax
movq %rax, (%rsp)
cmpq %rdx, %rax
je 0x7094
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %r12, %r8
movl %r13d, %r9d
callq 0x73f6
testb %al, %al
jne 0x6de8
jmp 0x70b2
movq (%rsp), %rax
movl (%rax), %ecx
cmpl $0x17, %ecx
je 0x6ef4
cmpl $0x7a, %ecx
jne 0x71c4
addq $0x70, %rax
movq %rax, (%rsp)
movq 0x48(%r15), %rdx
cmpq %rdx, %rax
je 0x721c
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
leaq 0x8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %r12, %r8
movl %r13d, %r9d
callq 0x73f6
testb %al, %al
je 0x71e5
cmpq $0x0, 0x10(%rsp)
je 0x6ffa
leaq 0xa8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x6a25
leaq 0xa8(%rsp), %rdi
leaq 0xccdf(%rip), %rsi      # 0x13b9f
callq 0x23b0
leaq 0x60(%rsp), %rsi
movq %rsi, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x6f89
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x6f8f
leaq 0x70(%rax), %rdx
movq %rdx, (%rsp)
movq 0x48(%r15), %rcx
cmpq %rcx, %rdx
je 0x6f75
cmpl $0x7b, (%rdx)
jne 0x6f75
addq $0xe0, %rax
cmpq %rcx, %rax
je 0x6f75
cmpl $0x7c, (%rax)
jne 0x6f75
movq %rax, (%rsp)
testb $0x1, 0x28(%rsp)
je 0x7026
movq %rbx, %rdi
leaq 0xd13d(%rip), %rsi      # 0x14070
callq 0x23b0
movq 0x48(%r15), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rcx
movq %r12, %r8
movl $0x1, %r9d
callq 0x73f6
jmp 0x7016
cmpq %rdx, %rax
je 0x7016
movq %rbx, %rdi
leaq 0xcc34(%rip), %rsi      # 0x13b9f
callq 0x23b0
jmp 0x7016
movq %rbx, %rdi
leaq 0xd0f1(%rip), %rsi      # 0x14070
callq 0x23b0
jmp 0x7016
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x2090
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x6fd5
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x6ffa
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x7016
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x48(%r15), %rdx
cmpq %rdx, (%rsp)
jne 0x6dd0
jmp 0x702d
addq $0x70, (%rsp)
jmp 0x7016
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
addq %rsi, %rdx
movq 0x98(%rsp), %rdi
movl 0x74(%rsp), %ecx
movq 0xa0(%rsp), %r8
callq 0x7655
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x7078
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x30(%rsp), %rdi
callq 0xf0dc
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 0xcf10(%rip), %rsi      # 0x13fb8
movq %rax, %rdi
callq 0x23a0
jmp 0x70ce
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcf20(%rip), %rsi      # 0x13fe6
movq %rax, %rdi
callq 0x23a0
movq 0x12f03(%rip), %rsi     # 0x19fd8
movq 0x12ee4(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x60(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xce10(%rip), %rsi      # 0x13f11
leaq 0xce39(%rip), %rdx      # 0x13f41
leaq 0x50(%rsp), %rdi
callq 0x10bb4
movq (%r12), %rax
movsbl (%rax), %edx
leaq 0x8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xede1
movb $0x1, %r12b
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2350
xorl %r12d, %r12d
movq 0x12e96(%rip), %rsi     # 0x19fd8
movq 0x12e77(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x72a3
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcd3f(%rip), %rsi      # 0x13ea9
movq %rax, %rdi
callq 0x23a0
jmp 0x71ae
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcd50(%rip), %rsi      # 0x13ed8
movq %rax, %rdi
callq 0x23a0
jmp 0x71ae
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcd03(%rip), %rsi      # 0x13ea9
movq %rax, %rdi
callq 0x23a0
movq 0x12e23(%rip), %rsi     # 0x19fd8
movq 0x12e04(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xce9a(%rip), %rsi      # 0x14072
movq %rax, %rdi
callq 0x23a0
jmp 0x70ce
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xce48(%rip), %rsi      # 0x14041
movq %rax, %rdi
callq 0x23a0
movq 0x12dd0(%rip), %rsi     # 0x19fd8
movq 0x12db1(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x72a3
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcde7(%rip), %rsi      # 0x14017
movq %rax, %rdi
callq 0x23a0
jmp 0x70ce
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xcd28(%rip), %rsi      # 0x13f79
movq %rax, %rdi
callq 0x23a0
movq 0x12d78(%rip), %rsi     # 0x19fd8
movq 0x12d59(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x72a3
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xccbd(%rip), %rsi      # 0x13f42
movq %rax, %rdi
callq 0x23a0
movq 0x12d44(%rip), %rsi     # 0x19fd8
movq 0x12d25(%rip), %rdx     # 0x19fc0
movq %r14, %rdi
callq 0x2330
jmp 0x73bf
jmp 0x73b0
jmp 0x73b0
jmp 0x73bf
jmp 0x73b0
jmp 0x7369
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x736c
jmp 0x73b0
movq %rax, %rbx
jmp 0x72ff
jmp 0x7369
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x72ff
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x736c
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x736c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7348
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x7348
movq %rax, %rbx
movb $0x1, %r12b
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x7383
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x7383
jmp 0x73b0
jmp 0x73b0
jmp 0x73b0
jmp 0x73bf
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
jne 0x739b
jmp 0x73c2
movq %rax, %rbx
movb $0x1, %r12b
testb %r12b, %r12b
jne 0x73b3
jmp 0x73c2
jmp 0x73bf
jmp 0x738e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x73c2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x73c2
jmp 0x73bf
jmp 0x73bf
jmp 0x73b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x73c2
jmp 0x73bf
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x73e4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x30(%rsp), %rdi
callq 0xf0dc
movq %rbx, %rdi
callq 0x2360