// File: joncampbell123[P]haxcc/haxpp.cpp
// Function: parse_expr_sizeof(expression&, __gnu_cxx::__normal_iterator<token*, std::vector<token, std::allocator<token>>>&, __gnu_cxx::__normal_iterator<token*, std::vector<token, std::allocator<token>>> const&)
expression::node::node_t parse_expr_sizeof(expression &expr,token_string::iterator &ti,const token_string::iterator &tie) {
    if (ti != tie && (*ti).tval == token::SIZEOF) {
        ti++;

        const expression::node::node_t opnode = expr.newnode(token::SIZEOF);

        expr.getnode(opnode).children.resize(1);
        if (ti != tie && (*ti).tval == token::OPEN_PARENS) {
            expr.getnode(opnode).children[0] = parse_expr_typecast(expr,ti,tie,/*follows*/false);
        }
        else {
            if (ti == tie)
                throw invalid_argument("sizeof without argument");

            expr.getnode(opnode).children[0] = expr.newnode(*(ti++));
        }

        return opnode;
    }

    return expression::node::none;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x16580
testb $0x1, %al
jne 0x11dbd
jmp 0x11fc1
movq -0x18(%rbp), %rdi
callq 0x16600
cmpl $0x26, (%rax)
jne 0x11fc1
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x165c0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
movl $0x26, %esi
callq 0x4170
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x109f0
movq %rax, -0xc0(%rbp)
jmp 0x11e1d
leaq -0xa0(%rbp), %rdi
callq 0x15bf0
movq -0xc0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x16810
movq %rax, %rdi
addq $0x70, %rdi
movl $0x1, %esi
callq 0x168c0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x16580
testb $0x1, %al
jne 0x11e65
jmp 0x11edc
movq -0x18(%rbp), %rdi
callq 0x16600
cmpl $0x20, (%rax)
jne 0x11edc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
xorl %ecx, %ecx
callq 0x11890
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x16810
movq %rax, %rdi
addq $0x70, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16950
movq -0xd8(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x11fb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x15bf0
jmp 0x11fd6
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x16970
testb $0x1, %al
jne 0x11eef
jmp 0x11f51
movl $0x10, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
leaq 0x13612(%rip), %rsi     # 0x2551f
callq 0x3530
jmp 0x11f14
movq -0xe0(%rbp), %rdi
movq 0x210b6(%rip), %rsi     # 0x32fd8
movq 0x21097(%rip), %rdx     # 0x32fc0
callq 0x34b0
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
callq 0x31f0
jmp 0x11fd6
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x165c0
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x16600
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x109f0
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x16810
movq %rax, %rdi
addq $0x70, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x16950
movq -0xe8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11fc9
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)