// File: /workspace/github_c_makefile_star2_O3/lucvoo[P]sparse-dev/compile-i386.c
// Function: emit_compare
static struct storage *emit_compare(struct expression *expr)
{
	struct storage *left = x86_expression(expr->left);
	struct storage *right = x86_expression(expr->right);
	struct storage *reg1, *reg2;
	struct storage *new, *val;
	const char *opname = NULL;
	unsigned int right_bits = expr->right->ctype->bit_size;

	switch(expr->op) {
	case '<': 		opname = "setl";	break;
	case '>':		opname = "setg";	break;
	case SPECIAL_LTE:
				opname = "setle";	break;
	case SPECIAL_GTE:
				opname = "setge";	break;
	case SPECIAL_EQUAL:	opname = "sete";	break;
	case SPECIAL_NOTEQUAL:	opname = "setne";	break;
	case SPECIAL_UNSIGNED_LT:
				opname = "setb";	break;
	case SPECIAL_UNSIGNED_GT:
				opname = "seta";	break;
	case SPECIAL_UNSIGNED_LTE:
				opname = "setb";	break;
	case SPECIAL_UNSIGNED_GTE:
				opname = "setae";	break;
	default:
		assert(0);
		break;
	}

	/* init EDX to 0 */
	val = new_storage(STOR_VALUE);
	val->flags = STOR_WANTS_FREE;

	reg1 = get_reg(&regclass_32_8);
	emit_move(val, reg1, NULL, NULL);

	/* move op1 into EAX */
	reg2 = get_reg_value(left, get_regclass(expr->left));

	/* perform comparison, RHS (op1, right) and LHS (op2, EAX) */
	insn(opbits("cmp", right_bits), right, reg2, NULL);
	put_reg(reg2);

	/* store result of operation, 0 or 1, in DL using SETcc */
	insn(opname, byte_reg(reg1), NULL, NULL);

	/* finally, store the result (DL) in a new pseudo / stack slot */
	new = stack_alloc(4);
	emit_move(reg1, new, NULL, "end EXPR_COMPARE");
	put_reg(reg1);

	return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq 0x20(%rdi), %rdi
callq 0x40caf
movq %rax, %rbp
movq 0x28(%r15), %rdi
callq 0x40caf
movq %rax, %r14
movq 0x28(%r15), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %r12d
movl 0x4(%r15), %eax
cmpl $0x118, %eax            # imm = 0x118
movq %r14, (%rsp)
jg 0x41f6b
leal -0x108(%rax), %ecx
cmpl $0x3, %ecx
ja 0x41f92
leaq 0xc9e3(%rip), %rax      # 0x4e93c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xafe0(%rip), %r14      # 0x4cf49
jmp 0x41fdd
addl $0xfffffee7, %eax       # imm = 0xFFFFFEE7
cmpl $0x3, %eax
ja 0x420dc
leaq 0xc9cc(%rip), %rcx      # 0x4e94c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xafcb(%rip), %r14      # 0x4cf5b
jmp 0x41fdd
cmpl $0x3c, %eax
je 0x41fcd
cmpl $0x3e, %eax
jne 0x420dc
leaq 0xd0e1(%rip), %r14      # 0x4f088
jmp 0x41fdd
leaq 0xafbc(%rip), %r14      # 0x4cf6c
jmp 0x41fdd
leaq 0xafad(%rip), %r14      # 0x4cf66
jmp 0x41fdd
leaq 0xd0cb(%rip), %r14      # 0x4f08d
jmp 0x41fdd
leaq 0xafa6(%rip), %r14      # 0x4cf71
jmp 0x41fdd
leaq 0xd0af(%rip), %r14      # 0x4f083
jmp 0x41fdd
leaq 0xaf72(%rip), %r14      # 0x4cf4f
movl $0x4, %edi
callq 0x414f4
movq %rax, %rbx
movq $0x2, 0x8(%rax)
leaq 0x27e6f(%rip), %rdi     # 0x69e68
callq 0x41af8
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x415bd
movq 0x20(%r15), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %eax
cmpl $0x8, %eax
je 0x4203c
cmpl $0x40, %eax
je 0x42033
cmpl $0x10, %eax
jne 0x42045
leaq 0x27de7(%rip), %rsi     # 0x69e18
jmp 0x4204c
leaq 0x27e06(%rip), %rsi     # 0x69e40
jmp 0x4204c
leaq 0x27dad(%rip), %rsi     # 0x69df0
jmp 0x4204c
leaq 0x27d7c(%rip), %rsi     # 0x69dc8
movq %rbp, %rdi
callq 0x41958
movq %rax, %rbx
leaq 0x7c65(%rip), %rdi      # 0x49cc3
movl %r12d, %esi
callq 0x416f7
leaq 0x54983(%rip), %rdi     # 0x969f0
movq (%rsp), %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4151d
movq 0x10(%rbx), %rax
movl 0x10(%rax), %edi
callq 0x419d9
movq %r13, %rsi
addq $-0x300, %rsi           # imm = 0xFD00
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4151d
movl $0x4, %edi
callq 0x41736
movq %rax, %rbx
leaq 0xd013(%rip), %rcx      # 0x4f0c4
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x415bd
movq 0x10(%r13), %rax
movl 0x10(%rax), %edi
callq 0x419d9
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d62(%rip), %rdi      # 0x47e45
leaq 0xc8e2(%rip), %rsi      # 0x4e9cc
leaq 0xcfa1(%rip), %rcx      # 0x4f092
movl $0x4e8, %edx            # imm = 0x4E8
callq 0xe140