// File: /workspace/github_cpp_makefile_star2_O3/joncampbell123[P]haxcc/haxpp.cpp
// Function: parse_expr_typecast(expression&, __gnu_cxx::__normal_iterator<token*, std::vector<token, std::allocator<token>>>&, __gnu_cxx::__normal_iterator<token*, std::vector<token, std::allocator<token>>> const&, bool)
expression::node::node_t parse_expr_typecast(expression &expr,token_string::iterator &ti,const token_string::iterator &tie,const bool exprfollow=true) {
    token::token_t repl;
    auto tmpti = ti;

    if (tmpti != tie && (*tmpti).tval == token::OPEN_PARENS) {
        tmpti++;
        if (tmpti != tie && is_type_token(/*&*/repl,*tmpti)) {
            ti = tmpti;

            const expression::node::node_t opnode = expr.newnode(exprfollow ? token::TYPECAST : token::TYPESPEC);

            /* NTS: Treat LOGICAL_AND as if two ADDRESSOF so && works properly here */
            while (ti != tie && (is_type_token(/*&*/repl,*ti) || (*ti).tval == token::LOGICAL_AND)) {
                if ((*ti).tval == token::LOGICAL_AND) {
                    expr.getnode(opnode).children.push_back(expr.newnode(token::ADDRESSOF));
                    expr.getnode(opnode).children.push_back(expr.newnode(token::ADDRESSOF));
                    ti++;
                }
                else {
                    expr.getnode(opnode).children.push_back(expr.newnode(*(ti++),repl));
                }
            }

            if (ti == tie)
                throw invalid_argument("missing closing parens");
            if ((*ti).tval != token::CLOSE_PARENS)
                throw invalid_argument("missing closing parens");
            ti++;

            if (exprfollow)
                expr.getnode(opnode).children.push_back(parse_expr(expr,ti,tie));

            return opnode;
        }
    }

    return expression::node::none;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq (%rsi), %r13
movq %rdx, 0x18(%rsp)
movq (%rdx), %rax
movq $-0x1, %rbx
cmpq %r13, %rax
je 0xbfbb
cmpl $0x20, (%r13)
jne 0xbfbb
addq $0x70, %r13
cmpq %rax, %r13
je 0xbfbb
movl %ecx, %ebp
movq %rsi, %r15
movq %rdi, %r12
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
callq 0xbb6e
testb %al, %al
je 0xbfbb
movq %r13, (%r15)
movzbl %bpl, %eax
movl $0x8, %ecx
subl %eax, %ecx
leaq 0x88(%rsp), %r14
movl %ecx, -0x58(%r14)
xorl %eax, %eax
movb %al, -0x54(%r14)
movq %rax, -0x50(%r14)
movb $0x1, -0x48(%r14)
fldz
fstpt 0x50(%rsp)
movl $0x0, -0x28(%r14)
movq $-0x1, -0x18(%r14)
movq %r14, -0x10(%r14)
movq %rax, -0x8(%r14)
movb %al, (%r14)
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0xadc6
movl %ebp, 0x2c(%rsp)
movq %rax, 0x10(%rsp)
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
je 0xbc88
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
movq (%r15), %r13
movq 0x18(%rsp), %rax
movq (%rax), %rbp
cmpq %rbp, %r13
je 0xbefc
movq 0x10(%rsp), %rax
leaq (%rax,%rax,8), %r14
shlq $0x4, %r14
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdi
movq %r13, %rsi
callq 0xbb6e
movl (%r13), %ecx
testb %al, %al
je 0xbd2f
cmpl $0x43, %ecx
je 0xbd38
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x71c71c71c71c71c7, %rdx # imm = 0x8E38E38E38E38E39
imulq %rdx, %rcx
cmpq %rcx, 0x10(%rsp)
jae 0xc00c
leaq (%rax,%r14), %rbp
addq $0x70, %rbp
leaq 0x70(%r13), %rax
movq %rax, (%r15)
movl 0xc(%rsp), %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0xae2e
movq %rax, 0x30(%rsp)
movq 0x8(%rbp), %rsi
cmpq 0x10(%rbp), %rsi
je 0xbedb
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rbp)
jmp 0xbee8
cmpl $0x43, %ecx
jne 0xbf2b
movq (%r12), %r13
movq 0x8(%r12), %rax
subq %r13, %rax
sarq $0x4, %rax
movabsq $-0x71c71c71c71c71c7, %rcx # imm = 0x8E38E38E38E38E39
imulq %rcx, %rax
movq 0x10(%rsp), %rbp
cmpq %rax, %rbp
jae 0xbfee
movl $0x16, 0x30(%rsp)
movb %bl, 0x34(%rsp)
movq %rbx, 0x38(%rsp)
movb $0x1, 0x40(%rsp)
fldz
fstpt 0x50(%rsp)
movl $0x0, 0x60(%rsp)
movq $-0x1, 0x70(%rsp)
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq %rbx, 0x80(%rsp)
movb %bl, 0x88(%rsp)
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0xadc6
leaq (%r14,%r13), %rdi
addq $0x70, %rdi
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xbdde
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xbde8
leaq 0x20(%rsp), %rdx
callq 0x11a42
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbe0a
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
movq (%r12), %r13
movq 0x8(%r12), %rax
subq %r13, %rax
sarq $0x4, %rax
movabsq $-0x71c71c71c71c71c7, %rcx # imm = 0x8E38E38E38E38E39
imulq %rcx, %rax
cmpq %rax, %rbp
jae 0xbfd0
movl $0x16, 0x30(%rsp)
movb %bl, 0x34(%rsp)
movq %rbx, 0x38(%rsp)
movb $0x1, 0x40(%rsp)
fldz
fstpt 0x50(%rsp)
movl $0x0, 0x60(%rsp)
movq $-0x1, 0x70(%rsp)
leaq 0x88(%rsp), %rbp
movq %rbp, 0x78(%rsp)
movq %rbx, 0x80(%rsp)
movb %bl, 0x88(%rsp)
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0xadc6
leaq (%r14,%r13), %rdi
addq $0x70, %rdi
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xbeab
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xbeb5
leaq 0x20(%rsp), %rdx
callq 0x11a42
movq 0x78(%rsp), %rdi
cmpq %rbp, %rdi
je 0xbecf
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
movq (%r15), %r13
addq $0x70, %r13
movq %r13, (%r15)
jmp 0xbeeb
movq %rbp, %rdi
leaq 0x30(%rsp), %rdx
callq 0x11a42
movq (%r15), %r13
movq 0x18(%rsp), %rax
movq (%rax), %rbp
cmpq %rbp, %r13
jne 0xbcab
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8328(%rip), %rsi      # 0x14238
movq %rax, %rdi
callq 0x23a0
movq 0xe0b9(%rip), %rsi      # 0x19fd8
movq 0xe09a(%rip), %rdx      # 0x19fc0
jmp 0xc036
cmpq %rbp, %r13
je 0xbefc
cmpl $0x21, (%r13)
jne 0xc03e
addq $0x70, %r13
movq %r13, (%r15)
cmpb $0x0, 0x2c(%rsp)
movq 0x10(%rsp), %rbx
je 0xbfbb
movq (%r12), %rax
movq 0x8(%r12), %rcx
subq %rax, %rcx
sarq $0x4, %rcx
movabsq $-0x71c71c71c71c71c7, %rdx # imm = 0x8E38E38E38E38E39
imulq %rdx, %rcx
cmpq %rcx, %rbx
jae 0xc05f
leaq (%rax,%r14), %r13
addq $0x70, %r13
movq %r12, %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0xb07c
movq %rax, 0x30(%rsp)
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0xbfae
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%r13)
jmp 0xbfbb
leaq 0x30(%rsp), %rdx
movq %r13, %rdi
callq 0x11a42
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8763(%rip), %rsi      # 0x14747
movq %rax, %rdi
callq 0x20b0
jmp 0xc028
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8745(%rip), %rsi      # 0x14747
movq %rax, %rdi
callq 0x20b0
jmp 0xc028
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8727(%rip), %rsi      # 0x14747
movq %rax, %rdi
callq 0x20b0
movq 0xdfc9(%rip), %rsi      # 0x19ff8
movq 0xdf7a(%rip), %rdx      # 0x19fb0
movq %r14, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x81e6(%rip), %rsi      # 0x14238
movq %rax, %rdi
callq 0x23a0
jmp 0xbf18
movl $0x10, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x86d4(%rip), %rsi      # 0x14747
movq %rax, %rdi
callq 0x20b0
jmp 0xc028
jmp 0xc096
jmp 0xc096
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r14, %rdi
jne 0xc0c7
jmp 0xc0d7
jmp 0xc096
jmp 0xc096
jmp 0xc096
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0xc0d7
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
jne 0xc0c7
jmp 0xc0d7
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %rbp, %rdi
je 0xc0d7
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2360