// File: rofl0r[P]ascc/eval_if.c
// Function: do_eval
static int do_eval(struct tokenizer *t, int *result) {
	tokenizer_register_custom_token(t, TT_LAND, "&&");
	tokenizer_register_custom_token(t, TT_LOR, "||");
	tokenizer_register_custom_token(t, TT_LTE, "<=");
	tokenizer_register_custom_token(t, TT_GTE, ">=");
	tokenizer_register_custom_token(t, TT_SHL, "<<");
	tokenizer_register_custom_token(t, TT_SHR, ">>");
	tokenizer_register_custom_token(t, TT_EQ, "==");
	tokenizer_register_custom_token(t, TT_NEQ, "!=");

	tokenizer_register_custom_token(t, TT_LT, "<");
	tokenizer_register_custom_token(t, TT_GT, ">");

	tokenizer_register_custom_token(t, TT_BAND, "&");
	tokenizer_register_custom_token(t, TT_BOR, "|");
	tokenizer_register_custom_token(t, TT_XOR, "^");
	tokenizer_register_custom_token(t, TT_NEG, "~");

	tokenizer_register_custom_token(t, TT_PLUS, "+");
	tokenizer_register_custom_token(t, TT_MINUS, "-");
	tokenizer_register_custom_token(t, TT_MUL, "*");
	tokenizer_register_custom_token(t, TT_DIV, "/");
	tokenizer_register_custom_token(t, TT_MOD, "%");

	tokenizer_register_custom_token(t, TT_LPAREN, "(");
	tokenizer_register_custom_token(t, TT_RPAREN, ")");
	tokenizer_register_custom_token(t, TT_LNOT, "!");

	int err = 0;
	*result = expr(t, 0, &err);
#ifdef DEBUG
	dprintf(2, "eval result: %d\n", *result);
#endif
	return !err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
leaq 0x42aa(%rip), %rdx      # 0x339da
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3e9, %esi            # imm = 0x3E9
leaq 0x4298(%rip), %rdx      # 0x339dd
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3ea, %esi            # imm = 0x3EA
leaq 0x4265(%rip), %rdx      # 0x339bf
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3eb, %esi            # imm = 0x3EB
leaq 0x4254(%rip), %rdx      # 0x339c3
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3ec, %esi            # imm = 0x3EC
leaq 0x424a(%rip), %rdx      # 0x339ce
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3ed, %esi            # imm = 0x3ED
leaq 0x4238(%rip), %rdx      # 0x339d1
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3ee, %esi            # imm = 0x3EE
leaq 0x4226(%rip), %rdx      # 0x339d4
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3ef, %esi            # imm = 0x3EF
leaq 0x4214(%rip), %rdx      # 0x339d7
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f0, %esi            # imm = 0x3F0
leaq 0x41f7(%rip), %rdx      # 0x339cf
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f1, %esi            # imm = 0x3F1
leaq 0x41e5(%rip), %rdx      # 0x339d2
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f2, %esi            # imm = 0x3F2
leaq 0x41d9(%rip), %rdx      # 0x339db
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f3, %esi            # imm = 0x3F3
leaq 0x41c7(%rip), %rdx      # 0x339de
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f4, %esi            # imm = 0x3F4
leaq 0x4328(%rip), %rdx      # 0x33b54
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f5, %esi            # imm = 0x3F5
leaq 0x4fb4(%rip), %rdx      # 0x347f5
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f6, %esi            # imm = 0x3F6
leaq 0x4171(%rip), %rdx      # 0x339c7
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f7, %esi            # imm = 0x3F7
leaq 0x415f(%rip), %rdx      # 0x339ca
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f8, %esi            # imm = 0x3F8
leaq 0x499c(%rip), %rdx      # 0x3421c
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3f9, %esi            # imm = 0x3F9
leaq 0x4981(%rip), %rdx      # 0x34216
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3fa, %esi            # imm = 0x3FA
leaq 0x4122(%rip), %rdx      # 0x339cc
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3fb, %esi            # imm = 0x3FB
leaq 0x4eb6(%rip), %rdx      # 0x34775
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3fc, %esi            # imm = 0x3FC
leaq 0x2a84(%rip), %rdx      # 0x32358
callq 0x2da90
movq -0x8(%rbp), %rdi
movl $0x3fd, %esi            # imm = 0x3FD
leaq 0x4ee6(%rip), %rdx      # 0x347cf
callq 0x2da90
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
leaq -0x14(%rbp), %rdx
callq 0x2f920
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x14(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x20, %rsp
popq %rbp
retq