// File: /workspace/github_c_makefile_star2_O3/lucvoo[P]sparse-dev/evaluate.c
// Function: evaluate_binop
static struct symbol *evaluate_binop(struct expression *expr)
{
	struct symbol *ltype, *rtype, *ctype;
	int lclass = classify_type(expr->left->ctype, &ltype);
	int rclass = classify_type(expr->right->ctype, &rtype);
	int op = expr->op;

	/* number op number */
	if (lclass & rclass & TYPE_NUM) {
		expr->flags = expr->left->flags & expr->right->flags;
		expr->flags &= ~CEF_CONST_MASK;

		if ((lclass | rclass) & TYPE_FLOAT) {
			switch (op) {
			case '+': case '-': case '*': case '/':
				break;
			default:
				return bad_expr_type(expr);
			}
		}

		if (op == SPECIAL_LEFTSHIFT || op == SPECIAL_RIGHTSHIFT) {
			// shifts do integer promotions, but that's it.
			unrestrict(expr->left, lclass, &ltype);
			unrestrict(expr->right, rclass, &rtype);
			ctype = ltype = integer_promotion(ltype);
			rtype = integer_promotion(rtype);
		} else {
			// The rest do usual conversions
			const unsigned left_not  = expr->left->type == EXPR_PREOP
			                           && expr->left->op == '!';
			const unsigned right_not = expr->right->type == EXPR_PREOP
			                           && expr->right->op == '!';
			if ((op == '&' || op == '|') && (left_not || right_not))
				warning(expr->pos, "dubious: %sx %c %sy",
				        left_not ? "!" : "",
					op,
					right_not ? "!" : "");

			ltype = usual_conversions(op, expr->left, expr->right,
						  lclass, rclass, ltype, rtype);
			ctype = rtype = ltype;
		}

		expr->left = cast_to(expr->left, ltype);
		expr->right = cast_to(expr->right, rtype);
		expr->ctype = ctype;
		return ctype;
	}

	/* pointer (+|-) integer */
	if (lclass & TYPE_PTR && is_int(rclass) && (op == '+' || op == '-')) {
		unrestrict(expr->right, rclass, &rtype);
		return evaluate_ptr_add(expr, rtype);
	}

	/* integer + pointer */
	if (rclass & TYPE_PTR && is_int(lclass) && op == '+') {
		struct expression *index = expr->left;
		unrestrict(index, lclass, &ltype);
		expr->left = expr->right;
		expr->right = index;
		return evaluate_ptr_add(expr, ltype);
	}

	/* pointer - pointer */
	if (lclass & rclass & TYPE_PTR && expr->op == '-')
		return evaluate_ptr_sub(expr);

	return bad_expr_type(expr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %rax
movq 0x10(%rax), %r14
movzbl (%r14), %eax
cmpl $0x3, %eax
jne 0x33119
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpl $0xa, %eax
jne 0x33139
movq %r14, %rdi
callq 0x2b0b8
movq %rax, %r14
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x33139
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpl $0x9, %eax
jne 0x33146
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpl $0x2, %eax
jne 0x33161
movq 0x60(%r14), %rcx
cmpq 0x2ce32(%rip), %rcx     # 0x5ff88
je 0x3316f
cmpq 0x2cdf1(%rip), %rcx     # 0x5ff50
je 0x33176
movl %eax, %eax
leaq 0x16a46(%rip), %rcx     # 0x49bb0
movl (%rcx,%rax,4), %ebp
jmp 0x3317b
movl $0x1, %ebp
jmp 0x3317b
movl $0x9, %ebp
movq 0x28(%rbx), %rax
movq 0x10(%rax), %r15
movzbl (%r15), %eax
cmpl $0x3, %eax
jne 0x33194
movq 0x60(%r15), %r15
movzbl (%r15), %eax
cmpl $0xa, %eax
jne 0x331b4
movq %r15, %rdi
callq 0x2b0b8
movq %rax, %r15
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x331b4
movq 0x60(%r15), %r15
movzbl (%r15), %eax
cmpl $0x9, %eax
jne 0x331c1
movq 0x60(%r15), %r15
movzbl (%r15), %eax
cmpl $0x2, %eax
jne 0x331dc
movq 0x60(%r15), %rcx
cmpq 0x2cdb7(%rip), %rcx     # 0x5ff88
je 0x331eb
cmpq 0x2cd76(%rip), %rcx     # 0x5ff50
je 0x331f3
movl %eax, %eax
leaq 0x169cb(%rip), %rcx     # 0x49bb0
movl (%rcx,%rax,4), %r12d
jmp 0x331f9
movl $0x1, %r12d
jmp 0x331f9
movl $0x9, %r12d
movl 0x4(%rbx), %r13d
movl %r12d, %eax
andl %ebp, %eax
testb $0x1, %al
jne 0x33275
testb $0x10, %bpl
je 0x332e0
movl %r12d, %ecx
andl $0x9, %ecx
cmpl $0x1, %ecx
jne 0x332e0
cmpl $0x2d, %r13d
je 0x3322f
cmpl $0x2b, %r13d
jne 0x332e0
testb $0x4, %r12b
je 0x3326a
movq %rbx, %r14
movq 0x28(%rbx), %rbx
testb $0x40, %r12b
je 0x33246
movq 0x60(%r15), %r15
movq %r15, %rdi
callq 0x237c5
movq 0x8(%rbx), %rdi
leaq 0x16c3a(%rip), %rsi     # 0x49e93
movq %rax, %rdx
xorl %eax, %eax
callq 0x118fc
movq 0x60(%r15), %r15
movq %r14, %rbx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x33342
movq %rbx, %rcx
movq 0x20(%rbx), %rbx
movq 0x28(%rcx), %rdx
movl (%rbx), %eax
andl (%rdx), %eax
andl $0xf400, %eax           # imm = 0xF400
movq %rcx, 0x8(%rsp)
movb %ah, 0x1(%rcx)
movl %r12d, %eax
orl %ebp, %eax
testb $0x8, %al
je 0x332bb
cmpl $0x2f, %r13d
ja 0x336d6
movl %r13d, %eax
movabsq $0xac0000000000, %rcx   # imm = 0xAC0000000000
btq %rax, %rcx
jae 0x336d6
movl %r13d, %eax
andl $-0x2, %eax
cmpl $0x112, %eax            # imm = 0x112
jne 0x3349f
testb $0x4, %bpl
jne 0x334b5
movq 0x8(%rsp), %rbx
jmp 0x334e9
testb $0x10, %r12b
je 0x33355
movl %ebp, %ecx
andl $0x9, %ecx
xorl $0x1, %ecx
movl %r13d, %edx
xorl $0x2b, %edx
orl %ecx, %edx
jne 0x33355
movq %rbx, %r15
movq 0x20(%rbx), %rbx
testb $0x4, %bpl
je 0x33330
testb $0x40, %bpl
je 0x3330f
movq 0x60(%r14), %r14
movq %r14, %rdi
callq 0x237c5
movq 0x8(%rbx), %rdi
leaq 0x16b71(%rip), %rsi     # 0x49e93
movq %rax, %rdx
xorl %eax, %eax
callq 0x118fc
movq 0x60(%r14), %r14
movq %r15, %rdi
movq 0x28(%r15), %rax
movq %rax, 0x20(%r15)
movq %rbx, 0x28(%r15)
movq %r14, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3733c
shrb $0x4, %al
cmpl $0x2d, %r13d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x334ad
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rbp
movq %r12, %rdi
callq 0x32bf6
movq %rax, %r14
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x3338d
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpl $0xa, %eax
jne 0x333ad
movq %r14, %rdi
callq 0x2b0b8
movq %rax, %r14
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x333ad
movq 0x60(%r14), %r14
movzbl (%r14), %eax
movq %rbx, %r15
cmpl $0x9, %eax
jne 0x333b9
movq 0x60(%r14), %r14
movq %rbp, %rdi
callq 0x32bf6
movq %rax, %rbx
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x333d3
movq 0x60(%rbx), %rbx
movzbl (%rbx), %eax
cmpl $0xa, %eax
jne 0x333f2
movq %rbx, %rdi
callq 0x2b0b8
movq %rax, %rbx
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x333f2
movq 0x60(%rbx), %rbx
movzbl (%rbx), %eax
cmpl $0x9, %eax
jne 0x333fb
movq 0x60(%rbx), %rbx
movq %r14, %rdi
callq 0x2baa4
movq %rax, %r13
movq %rbx, %rdi
callq 0x2baa4
movq 0x60(%rbx), %rax
movq 0x68(%rbx), %rdx
andl $0x11000e00, %edx       # imm = 0x11000E00
testq %rax, %rax
je 0x3342a
xorl %ecx, %ecx
cmpb $0x6, (%rax)
cmoveq %rcx, %rdx
leaq 0x60(%r14), %rdi
addq $0x60, %rbx
movq 0x60(%r14), %rax
movq 0x68(%r14), %rcx
andl $0x11000e00, %ecx       # imm = 0x11000E00
testq %rax, %rax
je 0x3344e
xorl %esi, %esi
cmpb $0x6, (%rax)
cmoveq %rsi, %rcx
movq %rbx, %rsi
callq 0x31898
testq %rax, %rax
movq %r15, %rbx
je 0x33472
leaq 0x16bfb(%rip), %rsi     # 0x4a060
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11b04
testq %r13, %r13
je 0x3359a
cmpb $0x5, (%r13)
jne 0x3359a
leaq 0x16c02(%rip), %rsi     # 0x4a08f
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11b04
jmp 0x336e7
cmpb $0x9, (%rbx)
jne 0x33505
cmpl $0x21, 0x4(%rbx)
sete %al
jmp 0x33507
movq %rbx, %rdi
jmp 0x336db
testb $0x40, %bpl
je 0x334bf
movq 0x60(%r14), %r14
movq %r14, %rdi
callq 0x237c5
movq 0x8(%rbx), %rdi
leaq 0x169c1(%rip), %rsi     # 0x49e93
movq %rax, %rdx
xorl %eax, %eax
callq 0x118fc
movq 0x60(%r14), %r14
movq 0x8(%rsp), %rbx
movq 0x28(%rbx), %rdx
testb $0x4, %r12b
je 0x33641
testb $0x40, %r12b
jne 0x33618
movq %rdx, %r12
jmp 0x3361f
xorl %eax, %eax
cmpb $0x9, (%rdx)
jne 0x33515
cmpl $0x21, 0x4(%rdx)
sete %cl
jmp 0x33517
xorl %ecx, %ecx
cmpl $0x7c, %r13d
je 0x33523
cmpl $0x26, %r13d
jne 0x33573
movl %eax, %esi
orb %cl, %sil
testb $0x1, %sil
je 0x33573
leaq 0x1360e(%rip), %rsi     # 0x46b43
leaq 0xd391(%rip), %r8       # 0x408cd
testb %al, %al
movq %r8, %rdx
cmovneq %rsi, %rdx
testb %cl, %cl
cmovneq %rsi, %r8
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rdi
movq %rax, %rbx
leaq 0x16a63(%rip), %rsi     # 0x49fc1
movl %r13d, %ecx
xorl %eax, %eax
callq 0x118fc
movq %rbx, %rax
movq 0x20(%rbx), %rbx
movq 0x28(%rax), %rdx
movq %r15, (%rsp)
movl %r13d, %edi
movq %rbx, %rsi
movl %ebp, %ecx
movl %r12d, %r8d
movq %r14, %r9
callq 0x36814
movq %rax, %r14
movq %rax, %r15
movq 0x8(%rsp), %rbx
jmp 0x336b0
movq %rbp, 0x10(%rsp)
leaq 0x31082(%rip), %rax     # 0x64628
movq (%rax), %r14
movq %r14, 0x10(%rbx)
movl 0x50(%r13), %eax
leaq 0x31148(%rip), %rbp     # 0x64700
cmpl (%rbp), %eax
jle 0x336e7
movq %r12, %r15
movq 0x8(%rbx), %r14
xorl %edi, %edi
callq 0x2f9f5
movq %rbx, %rcx
movq %rax, %rbx
movq %r14, 0x8(%rax)
movw $0x5, (%rax)
movq %rcx, 0x8(%rsp)
movq 0x8(%rcx), %r12
xorl %edi, %edi
callq 0x2f9f5
movq %rax, %r14
movq %r12, 0x8(%rax)
movw $0x1, (%rax)
movl 0x50(%r13), %eax
testl %eax, %eax
js 0x336f9
movl (%rbp), %ecx
addl %ecx, %eax
decl %eax
cltd
idivl %ecx
movslq %eax, %rbp
jmp 0x33700
movq %rdx, %r12
movq 0x60(%r15), %r15
movq %r15, %rdi
callq 0x237c5
movq 0x8(%r12), %rdi
leaq 0x16860(%rip), %rsi     # 0x49e93
movq %rax, %rdx
xorl %eax, %eax
callq 0x118fc
movq 0x60(%r15), %r15
movl 0x50(%r14), %ecx
cmpb $0xb, (%r14)
jne 0x3364f
movq 0x60(%r14), %r14
leaq 0x310b2(%rip), %rax     # 0x64708
movl (%rax), %eax
cmpl %eax, %ecx
jge 0x33665
leaq 0x380d5(%rip), %r14     # 0x6b738
jmp 0x3367d
testb $0x2, 0x57(%r14)
je 0x3367d
movq 0x68(%r14), %rcx
btl $0xe, %ecx
jae 0x3365c
leaq 0x3827b(%rip), %r14     # 0x6b8f8
movl 0x50(%r15), %ecx
cmpb $0xb, (%r15)
jne 0x3368b
movq 0x60(%r15), %r15
cmpl %eax, %ecx
jge 0x33698
leaq 0x380a2(%rip), %r15     # 0x6b738
jmp 0x336b0
testb $0x2, 0x57(%r15)
je 0x336b0
movq 0x68(%r15), %rax
btl $0xe, %eax
jae 0x3368f
leaq 0x38248(%rip), %r15     # 0x6b8f8
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x32aa9
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x32aa9
movq %rax, 0x28(%rbx)
movq %r14, 0x10(%rbx)
jmp 0x336e7
movq 0x8(%rsp), %rdi
callq 0x37201
leaq 0x391d1(%rip), %r14     # 0x6c8b8
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $-0x1, %rbp
movq %r15, %r12
leaq 0x30f16(%rip), %rax     # 0x64620
movq (%rax), %rax
movq %rax, 0x10(%r14)
movq %rbp, 0x20(%r14)
leaq -0x1(%rbp), %rax
testq %rax, %rbp
je 0x33766
leaq 0x33703(%rip), %rax     # 0x66e28
cmpl $0x0, (%rax)
je 0x33766
movq 0x8(%rsp), %r12
movq 0x8(%r12), %rdi
leaq 0x1697f(%rip), %rsi     # 0x4a0ba
xorl %eax, %eax
callq 0x118fc
movq %r13, %rdi
callq 0x237c5
movq 0x8(%r12), %rdi
movq %r15, %r12
leaq 0x1698b(%rip), %rsi     # 0x4a0e4
movq %rax, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x1178c
movl $0x2d, 0x4(%rbx)
leaq 0x30eb4(%rip), %rcx     # 0x64628
movq (%rcx), %rax
movq %rax, 0x10(%rbx)
movq %r12, 0x20(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x8(%rsp), %r15
movl $0x2f, 0x4(%r15)
movq %rbx, 0x20(%r15)
movq %r14, 0x28(%r15)
movq (%rcx), %r14
jmp 0x336e7