// File: /workspace/github_cpp_makefile_star2_O1/joncampbell123[P]haxcc/haxpp.cpp
// Function: pp_if_eval(expression&, unsigned long)
signed long long pp_if_eval(expression &expr,expression::node::node_t node) {
    if (node == expression::node::none)
        throw invalid_argument("expression tree with no root");

    const auto &n = expr.getnode(node);
    switch (n.tval.tval) {
        case token::INTEGER:
            return n.tval.i.s;
        case token::FLOAT:
            throw invalid_argument("Floating point not allowed in expressions at preprocessor level");
        case token::STRING:
            throw invalid_argument("Strings not allowed in expressions at preprocessor level");
        case token::ASSIGNMENT:
            throw invalid_argument("Assignment not permitted in macro preprocessor");
        case token::POSTINCREMENT:
        case token::POSTDECREMENT:
        case token::PREINCREMENT:
        case token::PREDECREMENT:
            throw invalid_argument("increment/decrement not allowed in macro preprocessor");
        case token::DEREFERENCE:
        case token::STRUCTREF:
        case token::ADDRESSOF:
            throw invalid_argument("struct/pointer ref not allowed in macro preprocessor");
        case token::SIZEOF:
            throw invalid_argument("sizeof not allowed in macro preprocessor");
        case token::COMMA:
            return pp_if_eval(expr,n.children.at(1)); /* a,b -> b */
        case token::PLUS:
            if (n.children.size() == 2)
                return pp_if_eval(expr,n.children.at(0)) + pp_if_eval(expr,n.children.at(1));
            else if (n.children.size() == 1)
                return pp_if_eval(expr,n.children.at(0)); /* +a -> a */
        case token::NEGATE:
            return -pp_if_eval(expr,n.children.at(0));
        case token::MINUS:
            return pp_if_eval(expr,n.children.at(0)) - pp_if_eval(expr,n.children.at(1));
        case token::NOT:
            return (pp_if_eval(expr,n.children.at(0)) == 0) ? 1 : 0;
        case token::COMPLEMENT:
            return ~pp_if_eval(expr,n.children.at(0));
        case token::MULTIPLY:
            return pp_if_eval(expr,n.children.at(0)) * pp_if_eval(expr,n.children.at(1));
        case token::DIVISION:
            return pp_if_eval(expr,n.children.at(0)) / pp_if_eval(expr,n.children.at(1));
        case token::MODULUS:
            return pp_if_eval(expr,n.children.at(0)) % pp_if_eval(expr,n.children.at(1));
        case token::LOGICAL_AND:
            return ((pp_if_eval(expr,n.children.at(0)) != 0ll) && (pp_if_eval(expr,n.children.at(1)) != 0ll)) ? 1 : 0;
        case token::LOGICAL_OR:
            return ((pp_if_eval(expr,n.children.at(0)) != 0ll) || (pp_if_eval(expr,n.children.at(1)) != 0ll)) ? 1 : 0;
        case token::BINARY_AND:
            return pp_if_eval(expr,n.children.at(0)) & pp_if_eval(expr,n.children.at(1));
        case token::BINARY_XOR:
            return pp_if_eval(expr,n.children.at(0)) ^ pp_if_eval(expr,n.children.at(1));
        case token::BINARY_OR:
            return pp_if_eval(expr,n.children.at(0)) | pp_if_eval(expr,n.children.at(1));
        case token::EQUALS:
            return (pp_if_eval(expr,n.children.at(0)) == pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::NOT_EQUALS:
            return (pp_if_eval(expr,n.children.at(0)) != pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::LESS_THAN:
            return (pp_if_eval(expr,n.children.at(0)) < pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::LESS_THAN_OR_EQUAL:
            return (pp_if_eval(expr,n.children.at(0)) <= pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::GREATER_THAN:
            return (pp_if_eval(expr,n.children.at(0)) > pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::GREATER_THAN_OR_EQUAL:
            return (pp_if_eval(expr,n.children.at(0)) >= pp_if_eval(expr,n.children.at(1))) ? 1 : 0;
        case token::TERNARY:
            return (pp_if_eval(expr,n.children.at(0)) != 0ll) ?
                    pp_if_eval(expr,n.children.at(1)) :
                    pp_if_eval(expr,n.children.at(2));
        case token::IDENTIFIER:
            return 0ll; /* if the macro expansion did not replace the identifier with a value then it is zero */
        case token::DEFINED:
            {
                const auto &c = expr.getnode(n.children.at(0));
                if (c.tval.tval == token::IDENTIFIER)
                    return is_macro(c.tval.sval) ? 1 : 0;
                else
                    throw invalid_argument("defined() used with a non-identifier");
            }
        case token::TYPECAST: /* .at(0)=type tokens .at(1)=expression to typecast */
            fprintf(stderr,"WARNING: Typecasts are ignored by the macro processor\n");
            return pp_if_eval(expr,n.children.at(n.children.size()-size_t(1)));
        default:
            break;
    };

    throw invalid_argument(string("unsupported expression in preprocessor level, token ")+to_string(n.tval));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rcx
movq %rdi, %r14
xorl %ebx, %ebx
movabsq $-0x71c71c71c71c71c7, %r13 # imm = 0x8E38E38E38E38E39
leaq 0x6e37(%rip), %rbp      # 0x133f8
cmpq $-0x1, %rcx
je 0xcc56
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
sarq $0x4, %rax
imulq %r13, %rax
cmpq %rcx, %rax
jbe 0xcc77
leaq (%rcx,%rcx,8), %rcx
shlq $0x4, %rcx
leaq (%rsi,%rcx), %r15
movl (%rsi,%rcx), %ecx
leal -0x5(%rcx), %edx
cmpl $0x3f, %edx
ja 0xc625
movslq (%rbp,%rdx,4), %rax
addq %rbp, %rax
jmpq *%rax
movq 0x70(%r15), %rax
movq 0x78(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq $0x1, %rcx
jne 0xc6bc
movq (%rax), %rcx
jmp 0xc5c1
cmpl $0x7e, %ecx
jne 0xc713
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq 0x70(%r15), %rcx
movq 0x78(%r15), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
testq %rax, %rax
je 0xc690
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rcx), %rcx
jmp 0xc5c1
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rcx
jmp 0xc5c1
cmpq $0x2, %rdx
jbe 0xcdeb
movq 0x10(%rcx), %rcx
jmp 0xc5c1
leaq 0x28(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2428
movq (%r12), %rcx
jmp 0xc5c1
cmpq $0x2, %rcx
jne 0xc6f2
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq 0x70(%r15), %rcx
movq 0x78(%r15), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rcx), %rcx
addq %rax, %rbx
jmp 0xc5c1
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
subq %rax, %rbx
jmp 0xcc23
cmpl $0x63, %ecx
jne 0xcce7
movq 0x70(%r15), %rcx
cmpq %rcx, 0x78(%r15)
je 0xccd5
movq (%rcx), %rcx
cmpq %rax, %rcx
jae 0xcdfc
leaq (%rcx,%rcx,8), %rax
shlq $0x4, %rax
cmpl $0x5, (%rsi,%rax)
jne 0xce1d
addq %rax, %rsi
addq $0x48, %rsi
leaq 0xdaba(%rip), %rdi      # 0x1a210
callq 0x10c44
leaq 0xdab6(%rip), %rdx      # 0x1a218
xorl %ecx, %ecx
cmpq %rdx, %rax
jmp 0xc96e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
testq %rax, %rax
jne 0xcac8
xorl %ecx, %ecx
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
setge %cl
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
orq %r12, %rax
jmp 0xcc20
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
setl %cl
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
addq %rdx, %rbx
jmp 0xcc23
movq 0x8(%r15), %rcx
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %rcx
movq %r12, %rax
cqto
idivq %rcx
jmp 0xcc20
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
setne %cl
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
subq %rax, %r12
addq %r12, %rbx
jmp 0xcc23
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
notq %rax
jmp 0xcc20
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
setle %cl
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
cmpq $0x1, %rax
adcq $0x0, %rbx
jmp 0xcc23
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
imulq %r12, %rax
jmp 0xcc20
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movl $0x1, %ecx
testq %rax, %rax
jne 0xcb8e
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
cmpq $0x1, %rax
sbbq $-0x1, %rbx
jmp 0xcc23
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
sete %cl
jmp 0xcb8e
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorl %ecx, %ecx
cmpq %rax, %r12
setg %cl
addq %rcx, %rbx
jmp 0xcc23
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
andq %r12, %rax
jmp 0xcc20
movq 0x70(%r15), %rax
cmpq %rax, 0x78(%r15)
je 0xccd5
movq (%rax), %rsi
movq %r14, %rdi
callq 0xc59a
movq %rax, %r12
movq 0x70(%r15), %rax
movq 0x78(%r15), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq $0x1, %rdx
jbe 0xccc7
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0xc59a
xorq %r12, %rax
addq %rax, %rbx
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x7692(%rip), %rsi      # 0x142db
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x75ac(%rip), %rsi      # 0x14216
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x7a2c(%rip), %rsi      # 0x146b7
movq %rax, %rdi
callq 0x20b0
movq 0xd35e(%rip), %rsi      # 0x19ff8
movq 0xd30f(%rip), %rdx      # 0x19fb0
jmp 0xcde3
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x7657(%rip), %rsi      # 0x14311
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
leaq 0x7b8c(%rip), %rdi      # 0x1485a
movl $0x1, %esi
jmp 0xcce0
leaq 0x7b7e(%rip), %rdi      # 0x1485a
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x22a0
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x76c6(%rip), %rsi      # 0x143cb
leaq 0x76f3(%rip), %rdx      # 0x143ff
leaq 0x8(%rsp), %rdi
callq 0x10bb4
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x5221
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0xeeef
movb $0x1, %bpl
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x2350
xorl %ebp, %ebp
movq 0xd288(%rip), %rsi      # 0x19fd8
movq 0xd269(%rip), %rdx      # 0x19fc0
movq %rbx, %rdi
callq 0x2330
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x75d3(%rip), %rsi      # 0x14346
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x74e2(%rip), %rsi      # 0x14273
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x7484(%rip), %rsi      # 0x14233
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x74df(%rip), %rsi      # 0x142ac
movq %rax, %rdi
callq 0x23a0
movq 0xd1fc(%rip), %rsi      # 0x19fd8
movq 0xd1dd(%rip), %rdx      # 0x19fc0
movq %rbx, %rdi
callq 0x2330
leaq 0x7a68(%rip), %rdi      # 0x1485a
movl $0x2, %esi
jmp 0xcce0
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x78a7(%rip), %rsi      # 0x146b7
movq %rax, %rdi
callq 0x20b0
jmp 0xcc93
movl $0x10, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x753e(%rip), %rsi      # 0x1436f
movq %rax, %rdi
callq 0x23a0
jmp 0xcdd5
jmp 0xcebc
jmp 0xcebc
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xce65
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0xce65
movq %rax, %r14
movb $0x1, %bpl
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xce88
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0xce88
movq %rax, %r14
movb $0x1, %bpl
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xceaf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0xceaf
jmp 0xcebc
jmp 0xcebc
jmp 0xcebc
jmp 0xcebc
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
jne 0xcebf
jmp 0xcec7
jmp 0xcebc
jmp 0xcebc
jmp 0xcebc
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
movq %r14, %rdi
callq 0x2360