// File: /workspace/github_c_makefile_star2_O1/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
cmpb $0x3, (%r14)
jne 0x33b8e
movq 0x60(%r14), %r14
cmpb $0xa, (%r14)
jne 0x33ba8
movq %r14, %rdi
callq 0x2b5f4
movq %rax, %r14
cmpb $0x3, (%rax)
jne 0x33ba8
movq 0x60(%r14), %r14
cmpb $0x9, (%r14)
jne 0x33bb2
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpq $0x2, %rax
jne 0x33bd2
movq 0x60(%r14), %rcx
cmpq 0x2d3b9(%rip), %rcx     # 0x60f80
je 0x33bde
cmpq 0x2d370(%rip), %rcx     # 0x60f40
je 0x33be5
leaq 0x17067(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %ebp
jmp 0x33bea
movl $0x1, %ebp
jmp 0x33bea
movl $0x9, %ebp
movq 0x28(%rbx), %rax
movq 0x10(%rax), %r15
cmpb $0x3, (%r15)
jne 0x33bfc
movq 0x60(%r15), %r15
cmpb $0xa, (%r15)
jne 0x33c16
movq %r15, %rdi
callq 0x2b5f4
movq %rax, %r15
cmpb $0x3, (%rax)
jne 0x33c16
movq 0x60(%r15), %r15
cmpb $0x9, (%r15)
jne 0x33c20
movq 0x60(%r15), %r15
movzbl (%r15), %eax
cmpq $0x2, %rax
jne 0x33c40
movq 0x60(%r15), %rcx
cmpq 0x2d34b(%rip), %rcx     # 0x60f80
je 0x33c4d
cmpq 0x2d302(%rip), %rcx     # 0x60f40
je 0x33c55
leaq 0x16ff9(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %r12d
jmp 0x33c5b
movl $0x1, %r12d
jmp 0x33c5b
movl $0x9, %r12d
movl 0x4(%rbx), %r13d
movl %r12d, %eax
andl %ebp, %eax
testb $0x1, %al
jne 0x33cd7
testb $0x10, %bpl
je 0x33dcc
movl %r12d, %ecx
andl $0x9, %ecx
cmpl $0x1, %ecx
jne 0x33dcc
cmpl $0x2d, %r13d
je 0x33c91
cmpl $0x2b, %r13d
jne 0x33dcc
testb $0x4, %r12b
je 0x33ccc
movq %rbx, %r14
movq 0x28(%rbx), %rbx
testb $0x40, %r12b
je 0x33ca8
movq 0x60(%r15), %r15
movq %r15, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
leaq 0x17268(%rip), %rsi     # 0x4af23
movq %rax, %rdx
xorl %eax, %eax
callq 0x118b4
movq 0x60(%r15), %r15
movq %r14, %rbx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x33e2e
movq %rbx, %rdx
movq 0x20(%rbx), %rbx
movq 0x28(%rdx), %rax
movl (%rbx), %ecx
andl (%rax), %ecx
andl $0xf400, %ecx           # imm = 0xF400
movq %rdx, 0x8(%rsp)
movb %ch, 0x1(%rdx)
movl %r12d, %ecx
orl %ebp, %ecx
testb $0x8, %cl
je 0x33d1f
cmpl $0x2f, %r13d
ja 0x3410c
movl %r13d, %ecx
movabsq $0xac0000000000, %rdx   # imm = 0xAC0000000000
btq %rcx, %rdx
jae 0x3410c
movl %r13d, %ecx
andl $-0x2, %ecx
cmpl $0x112, %ecx            # imm = 0x112
jne 0x33f71
testb $0x4, %bpl
je 0x33d62
testb $0x40, %bpl
je 0x33d41
movq 0x60(%r14), %r14
movq %r14, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
leaq 0x171cf(%rip), %rsi     # 0x4af23
movq %rax, %rdx
xorl %eax, %eax
callq 0x118b4
movq 0x60(%r14), %r14
testb $0x4, %r12b
movq 0x8(%rsp), %rbx
je 0x33da1
movq 0x28(%rbx), %rbx
testb $0x40, %r12b
je 0x33d7b
movq 0x60(%r15), %r15
movq %r15, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
leaq 0x17195(%rip), %rsi     # 0x4af23
movq %rax, %rdx
xorl %eax, %eax
callq 0x118b4
movq 0x60(%r15), %r15
movq 0x8(%rsp), %rbx
movl 0x50(%r14), %ecx
cmpb $0xb, (%r14)
jne 0x33daf
movq 0x60(%r14), %r14
leaq 0x31952(%rip), %rax     # 0x65708
movl (%rax), %eax
cmpl %eax, %ecx
jge 0x33f87
leaq 0x38971(%rip), %r14     # 0x6c738
jmp 0x33fa3
testb $0x10, %r12b
je 0x33e41
movl %ebp, %ecx
andl $0x9, %ecx
xorl $0x1, %ecx
movl %r13d, %edx
xorl $0x2b, %edx
orl %ecx, %edx
jne 0x33e41
movq %rbx, %r15
movq 0x20(%rbx), %rbx
testb $0x4, %bpl
je 0x33e1c
testb $0x40, %bpl
je 0x33dfb
movq 0x60(%r14), %r14
movq %r14, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
leaq 0x17115(%rip), %rsi     # 0x4af23
movq %rax, %rdx
xorl %eax, %eax
callq 0x118b4
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 0x37e59
shrb $0x4, %al
cmpl $0x2d, %r13d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x33f7f
movq 0x20(%rbx), %r14
movq 0x28(%rbx), %r15
movq %r14, %rdi
callq 0x33628
movq %rax, %r13
cmpb $0x3, (%rax)
jne 0x33e72
movq 0x60(%r13), %r13
cmpb $0xa, (%r13)
jne 0x33e8d
movq %r13, %rdi
callq 0x2b5f4
movq %rax, %r13
cmpb $0x3, (%rax)
jne 0x33e8d
movq 0x60(%r13), %r13
cmpb $0x9, (%r13)
jne 0x33e98
movq 0x60(%r13), %r13
movq %r15, %rdi
callq 0x33628
movq %rax, %rbp
cmpb $0x3, (%rax)
jne 0x33eac
movq 0x60(%rbp), %rbp
cmpb $0xa, (%rbp)
jne 0x33ec6
movq %rbp, %rdi
callq 0x2b5f4
movq %rax, %rbp
cmpb $0x3, (%rax)
jne 0x33ec6
movq 0x60(%rbp), %rbp
cmpb $0x9, (%rbp)
jne 0x33ed0
movq 0x60(%rbp), %rbp
movq %r13, %rdi
callq 0x2bfd0
movq %rax, %r12
movq %rbp, %rdi
callq 0x2bfd0
movq 0x60(%rbp), %rax
movq 0x68(%rbp), %rdx
andl $0x11000e00, %edx       # imm = 0x11000E00
testq %rax, %rax
je 0x33eff
xorl %ecx, %ecx
cmpb $0x6, (%rax)
cmoveq %rcx, %rdx
leaq 0x60(%r13), %rdi
addq $0x60, %rbp
movq 0x60(%r13), %rax
movq 0x68(%r13), %rcx
andl $0x11000e00, %ecx       # imm = 0x11000E00
testq %rax, %rax
je 0x33f23
xorl %esi, %esi
cmpb $0x6, (%rax)
cmoveq %rsi, %rcx
movq %rbp, %rsi
callq 0x32020
testq %rax, %rax
je 0x33f44
leaq 0x171b9(%rip), %rsi     # 0x4b0f0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11abc
testq %r12, %r12
je 0x34084
cmpb $0x5, (%r12)
jne 0x34084
leaq 0x171c0(%rip), %rsi     # 0x4b11f
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11abc
jmp 0x341bd
cmpb $0x9, (%rbx)
jne 0x33fc1
cmpl $0x21, 0x4(%rbx)
sete %cl
jmp 0x33fc3
movq %rbx, %rdi
jmp 0x34111
testb $0x2, 0x57(%r14)
je 0x33fa3
movq 0x68(%r14), %rcx
btl $0xe, %ecx
jae 0x33dc0
leaq 0x38955(%rip), %r14     # 0x6c8f8
movl 0x50(%r15), %ecx
cmpb $0xb, (%r15)
jne 0x33fb1
movq 0x60(%r15), %r15
cmpl %eax, %ecx
jge 0x33fd6
leaq 0x3877c(%rip), %r15     # 0x6c738
jmp 0x3405b
xorl %ecx, %ecx
movq 0x8(%rsp), %rbx
cmpb $0x9, (%rax)
jne 0x33ff0
cmpl $0x21, 0x4(%rax)
sete %al
jmp 0x33ff2
testb $0x2, 0x57(%r15)
je 0x3405b
movq 0x68(%r15), %rax
btl $0xe, %eax
jae 0x33fb5
leaq 0x3890a(%rip), %r15     # 0x6c8f8
jmp 0x3405b
xorl %eax, %eax
cmpl $0x7c, %r13d
je 0x33ffe
cmpl $0x26, %r13d
jne 0x34039
movl %ecx, %edx
orb %al, %dl
testb $0x1, %dl
je 0x34039
leaq 0x13bb5(%rip), %rsi     # 0x47bc3
leaq 0xd8b8(%rip), %r8       # 0x418cd
testb %cl, %cl
movq %r8, %rdx
cmovneq %rsi, %rdx
testb %al, %al
cmovneq %rsi, %r8
movq 0x8(%rbx), %rdi
leaq 0x17022(%rip), %rsi     # 0x4b051
movl %r13d, %ecx
xorl %eax, %eax
callq 0x118b4
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r15, (%rsp)
movl %r13d, %edi
movl %ebp, %ecx
movl %r12d, %r8d
movq %r14, %r9
callq 0x37305
movq %rax, %r14
movq %rax, %r15
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x334cd
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
movq %r15, %rsi
callq 0x334cd
movq %rax, 0x28(%rbx)
movq %r14, 0x10(%rbx)
jmp 0x341bd
leaq 0x3159d(%rip), %rcx     # 0x65628
movq (%rcx), %rax
movq %rax, 0x10(%rbx)
movl 0x50(%r12), %eax
movq %rbx, %rbp
leaq 0x3165f(%rip), %rbx     # 0x65700
cmpl (%rbx), %eax
jle 0x341ba
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq 0x8(%rbp), %r14
xorl %edi, %edi
callq 0x30029
movq %rax, %r13
movl (%rax), %eax
orl $0x5, %eax
movq %r14, 0x8(%r13)
andl $0xffff0005, %eax       # imm = 0xFFFF0005
movl %eax, (%r13)
movq %rbp, %r15
movq 0x8(%rbp), %r14
xorl %edi, %edi
callq 0x30029
movq %rax, %rbp
movl (%rax), %eax
orl $0x1, %eax
movq %r14, 0x8(%rbp)
andl $0xffff0001, %eax       # imm = 0xFFFF0001
movl %eax, (%rbp)
movl 0x50(%r12), %eax
testl %eax, %eax
js 0x34122
movl (%rbx), %ecx
addl %ecx, %eax
decl %eax
cltd
idivl %ecx
movslq %eax, %r14
jmp 0x34129
movq 0x8(%rsp), %rdi
callq 0x37d1e
leaq 0x3979b(%rip), %r14     # 0x6d8b8
jmp 0x341bd
movq $-0x1, %r14
leaq 0x314f0(%rip), %rax     # 0x65620
movq (%rax), %rax
movq %rax, 0x10(%rbp)
movq %r14, 0x20(%rbp)
leaq -0x1(%r14), %rax
testq %rax, %r14
je 0x34182
leaq 0x33cdd(%rip), %rax     # 0x67e28
cmpl $0x0, (%rax)
je 0x34182
movq 0x8(%r15), %rdi
leaq 0x16fef(%rip), %rsi     # 0x4b14a
xorl %eax, %eax
callq 0x118b4
movq %r12, %rdi
callq 0x2386c
movq 0x8(%r15), %rdi
leaq 0x16fff(%rip), %rsi     # 0x4b174
movq %rax, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x11744
movl $0x2d, 0x4(%r13)
leaq 0x31497(%rip), %rcx     # 0x65628
movq (%rcx), %rax
movq %rax, 0x10(%r13)
movq 0x8(%rsp), %rax
movq %rax, 0x20(%r13)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%r13)
movl $0x2f, 0x4(%r15)
movq %r13, 0x20(%r15)
movq %rbp, 0x28(%r15)
movq (%rcx), %r14
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq