// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/evaluate.c
// Function: evaluate_compare
static struct symbol *evaluate_compare(struct expression *expr)
{
	struct expression *left = expr->left, *right = expr->right;
	struct symbol *ltype, *rtype, *lbase, *rbase;
	int lclass = classify_type(degenerate(left), &ltype);
	int rclass = classify_type(degenerate(right), &rtype);
	struct symbol *ctype;
	const char *typediff;

	/* Type types? */
	if (is_type_type(ltype) && is_type_type(rtype)) {
		/*
		 * __builtin_types_compatible_p() yields an integer
		 * constant expression
		 */
		expr->flags = CEF_SET_ICE;
		goto OK;
	}

	if (is_safe_type(left->ctype) || is_safe_type(right->ctype))
		warning(expr->pos, "testing a 'safe expression'");

	expr->flags = left->flags & right->flags & ~CEF_CONST_MASK & ~CEF_ADDR;

	/* number on number */
	if (lclass & rclass & TYPE_NUM) {
		ctype = usual_conversions(expr->op, expr->left, expr->right,
					  lclass, rclass, ltype, rtype);
		expr->left = cast_to(expr->left, ctype);
		expr->right = cast_to(expr->right, ctype);
		if (ctype->ctype.modifiers & MOD_UNSIGNED)
			expr->op = modify_for_unsigned(expr->op);
		goto OK;
	}

	/* at least one must be a pointer */
	if (!((lclass | rclass) & TYPE_PTR))
		return bad_expr_type(expr);

	/* equality comparisons can be with null pointer constants */
	if (expr->op == SPECIAL_EQUAL || expr->op == SPECIAL_NOTEQUAL) {
		int is_null1 = is_null_pointer_constant(left);
		int is_null2 = is_null_pointer_constant(right);
		if (is_null1 == NULL_ZERO)
			bad_null(left);
		if (is_null2 == NULL_ZERO)
			bad_null(right);
		if (is_null1 && is_null2) {
			int positive = expr->op == SPECIAL_EQUAL;
			expr->type = EXPR_VALUE;
			expr->value = positive;
			goto OK;
		}
		if (is_null1 && (rclass & TYPE_PTR)) {
			expr->left = cast_to(left, rtype);
			goto OK;
		}
		if (is_null2 && (lclass & TYPE_PTR)) {
			expr->right = cast_to(right, ltype);
			goto OK;
		}
	}
	/* both should be pointers */
	if (!(lclass & rclass & TYPE_PTR))
		return bad_expr_type(expr);
	expr->op = modify_for_unsigned(expr->op);

	lbase = examine_pointer_target(ltype);
	rbase = examine_pointer_target(rtype);

	/* they also have special treatment for pointers to void */
	if (expr->op == SPECIAL_EQUAL || expr->op == SPECIAL_NOTEQUAL) {
		if (ltype->ctype.as == rtype->ctype.as) {
			if (lbase == &void_ctype) {
				expr->right = cast_to(right, ltype);
				goto OK;
			}
			if (rbase == &void_ctype) {
				expr->left = cast_to(left, rtype);
				goto OK;
			}
		}
	}

	typediff = type_difference(&ltype->ctype, &rtype->ctype,
				   target_qualifiers(rtype),
				   target_qualifiers(ltype));
	if (!typediff)
		goto OK;

	expression_error(expr, "incompatible types in comparison expression (%s):", typediff);
	info(expr->pos, "   %s", show_typename(ltype));
	info(expr->pos, "   %s", show_typename(rtype));
	return NULL;

OK:
	/* the result is int [6.5.8(6), 6.5.9(3)]*/
	expr->ctype = &int_ctype;
	return &int_ctype;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x20(%rdi), %r12
movq 0x28(%rdi), %rbp
movq %r12, %rdi
callq 0x33628
movq %rax, %r14
cmpb $0x3, (%rax)
jne 0x3428e
movq 0x60(%r14), %r14
cmpb $0xa, (%r14)
jne 0x342a8
movq %r14, %rdi
callq 0x2b5f4
movq %rax, %r14
cmpb $0x3, (%rax)
jne 0x342a8
movq 0x60(%r14), %r14
cmpb $0x9, (%r14)
jne 0x342b2
movq 0x60(%r14), %r14
movzbl (%r14), %eax
cmpq $0x2, %rax
jne 0x342d2
movq 0x60(%r14), %rcx
cmpq 0x2ccb9(%rip), %rcx     # 0x60f80
je 0x342e2
cmpq 0x2cc70(%rip), %rcx     # 0x60f40
je 0x342ec
leaq 0x16967(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %eax
movl %eax, 0x14(%rsp)
jmp 0x342f4
movl $0x1, 0x14(%rsp)
jmp 0x342f4
movl $0x9, 0x14(%rsp)
movq %rbp, %rdi
callq 0x33628
movq %rax, %r15
cmpb $0x3, (%rax)
jne 0x34308
movq 0x60(%r15), %r15
cmpb $0xa, (%r15)
jne 0x34322
movq %r15, %rdi
callq 0x2b5f4
movq %rax, %r15
cmpb $0x3, (%rax)
jne 0x34322
movq 0x60(%r15), %r15
cmpb $0x9, (%r15)
jne 0x3432c
movq 0x60(%r15), %r15
movzbl (%r15), %eax
cmpq $0x2, %rax
jne 0x3434c
movq 0x60(%r15), %rcx
cmpq 0x2cc3f(%rip), %rcx     # 0x60f80
je 0x34359
cmpq 0x2cbf6(%rip), %rcx     # 0x60f40
je 0x34361
leaq 0x168ed(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %r13d
jmp 0x34367
movl $0x1, %r13d
jmp 0x34367
movl $0x9, %r13d
cmpq 0x2cc0a(%rip), %r14     # 0x60f78
jne 0x3439a
cmpq 0x2cc01(%rip), %r15     # 0x60f78
jne 0x3439a
movb $0x30, 0x1(%rbx)
leaq 0x383b4(%rip), %r12     # 0x6c738
movq %r12, 0x10(%rbx)
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rax
testb $-0x80, 0x6a(%rax)
jne 0x343af
movq 0x10(%rbp), %rax
testb $-0x80, 0x6a(%rax)
je 0x343c1
movq 0x8(%rbx), %rdi
leaq 0x16e07(%rip), %rsi     # 0x4b1c1
xorl %eax, %eax
callq 0x118b4
movl (%r12), %eax
movq %rbp, 0x20(%rsp)
andl (%rbp), %eax
andl $0xb400, %eax           # imm = 0xB400
movb %ah, 0x1(%rbx)
movl %r13d, %ebp
movl 0x14(%rsp), %ecx
andl %ecx, %ebp
testb $0x1, %bpl
jne 0x344e7
movl %r13d, %eax
orl %ecx, %eax
testb $0x10, %al
je 0x345a0
movl 0x4(%rbx), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
jne 0x3459a
movq 0x10(%r12), %rax
movl $0x1, %ecx
movl $0x1, %edx
cmpq 0x2cb94(%rip), %rax     # 0x60fb0
je 0x3443e
xorl %edx, %edx
testb $0x10, 0x1(%r12)
je 0x3443e
movq %r12, %rdi
callq 0xf386
movl $0x1, %ecx
xorl %edx, %edx
testl %eax, %eax
setne %dl
addl %edx, %edx
movq 0x20(%rsp), %rdi
movq 0x10(%rdi), %rax
cmpq 0x2cb62(%rip), %rax     # 0x60fb0
movl %edx, 0x18(%rsp)
je 0x3446e
xorl %ecx, %ecx
testb $0x10, 0x1(%rdi)
je 0x3446e
callq 0xf386
movl 0x18(%rsp), %edx
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
addl %ecx, %ecx
leaq 0x2d14b(%rip), %rax     # 0x615c0
cmpl $0x2, %edx
movl %ecx, 0x1c(%rsp)
jne 0x344a5
cmpl $0x0, (%rax)
je 0x344a5
movq 0x8(%r12), %rdi
leaq 0x16b35(%rip), %rsi     # 0x4afc4
xorl %eax, %eax
callq 0x118b4
leaq 0x2d123(%rip), %rax     # 0x615c0
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
cmpl $0x2, %ecx
jne 0x344ce
cmpl $0x0, (%rax)
je 0x344ce
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x16b05(%rip), %rsi     # 0x4afc4
xorl %eax, %eax
callq 0x118b4
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
testl %edx, %edx
je 0x34551
testl %ecx, %ecx
je 0x34551
xorl %eax, %eax
cmpl $0x10a, 0x4(%rbx)       # imm = 0x10A
sete %al
movb $0x1, (%rbx)
jmp 0x34566
movl 0x4(%rbx), %edi
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq %r15, (%rsp)
movl %r13d, %r8d
movq %r14, %r9
callq 0x37305
movq %rax, %r14
movq 0x20(%rbx), %rdi
movq %rax, %rsi
callq 0x334cd
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x334cd
movq %rax, 0x28(%rbx)
testb $0x40, 0x69(%r14)
je 0x3437d
movl 0x4(%rbx), %eax
cmpl $0x3c, %eax
je 0x3456f
cmpl $0x108, %eax            # imm = 0x108
je 0x3454a
cmpl $0x3e, %eax
jne 0x34576
movl $0x11a, %ecx            # imm = 0x11A
jmp 0x34583
movl $0x11b, %ecx            # imm = 0x11B
jmp 0x34583
testl %edx, %edx
je 0x3458b
andl $0x10, %r13d
je 0x3458b
movq %r12, %rdi
movq %r15, %rsi
callq 0x334cd
movq %rax, 0x20(%rbx)
jmp 0x3437d
movl $0x119, %ecx            # imm = 0x119
jmp 0x34583
cmpl $0x109, %eax            # imm = 0x109
movl $0x11c, %ecx            # imm = 0x11C
cmovnel %eax, %ecx
movl %ecx, 0x4(%rbx)
jmp 0x3437d
testl %ecx, %ecx
je 0x3459a
andl $0x10, 0x14(%rsp)
jne 0x346e1
testb $0x10, %bpl
jne 0x345b4
movq %rbx, %rdi
callq 0x37d1e
leaq 0x39309(%rip), %r12     # 0x6d8b8
jmp 0x34388
movl 0x4(%rbx), %eax
cmpl $0x3c, %eax
je 0x345d6
cmpl $0x108, %eax            # imm = 0x108
je 0x345cf
cmpl $0x3e, %eax
jne 0x345dd
movl $0x11a, %ecx            # imm = 0x11A
jmp 0x345ea
movl $0x11b, %ecx            # imm = 0x11B
jmp 0x345ea
movl $0x119, %ecx            # imm = 0x119
jmp 0x345ea
cmpl $0x109, %eax            # imm = 0x109
movl $0x11c, %ecx            # imm = 0x11C
cmovnel %eax, %ecx
movl %ecx, 0x4(%rbx)
movq %r14, %rdi
callq 0x2bfd0
movq %rax, %rbp
movq %r15, %rdi
callq 0x2bfd0
movl 0x4(%rbx), %ecx
andl $-0x2, %ecx
cmpl $0x10a, %ecx            # imm = 0x10A
jne 0x34622
movq 0x80(%r14), %rcx
cmpq 0x80(%r15), %rcx
je 0x346c6
movq 0x60(%r15), %rax
movq 0x68(%r15), %rdx
andl $0x11000e00, %edx       # imm = 0x11000E00
testq %rax, %rax
je 0x3463e
xorl %ecx, %ecx
cmpb $0x6, (%rax)
cmoveq %rcx, %rdx
leaq 0x60(%r14), %rdi
leaq 0x60(%r15), %rsi
movq 0x60(%r14), %rax
movq 0x68(%r14), %rcx
andl $0x11000e00, %ecx       # imm = 0x11000E00
testq %rax, %rax
je 0x34663
xorl %r8d, %r8d
cmpb $0x6, (%rax)
cmoveq %r8, %rcx
callq 0x32020
testq %rax, %rax
je 0x3437d
leaq 0x16bbd(%rip), %rsi     # 0x4b235
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11abc
movq %r14, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
leaq 0x1527c(%rip), %r14     # 0x49917
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11744
movq %r15, %rdi
callq 0x2386c
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11744
jmp 0x34388
cmpq 0x2c86b(%rip), %rbp     # 0x60f38
je 0x346e1
cmpq 0x2c862(%rip), %rax     # 0x60f38
jne 0x34622
jmp 0x3455b
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x334cd
movq %rax, 0x28(%rbx)
jmp 0x3437d