// File: /workspace/github_c_makefile_star2_O1/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 0x41d4f
movq %rax, %rbp
movq 0x28(%r15), %rdi
callq 0x41d4f
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 0x42ff8
leal -0x108(%rax), %ecx
cmpl $0x3, %ecx
ja 0x4301f
leaq 0xc9c6(%rip), %rax      # 0x4f9ac
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xafc3(%rip), %r14      # 0x4dfb9
jmp 0x4306a
addl $0xfffffee7, %eax       # imm = 0xFFFFFEE7
cmpl $0x3, %eax
ja 0x43161
leaq 0xc9af(%rip), %rcx      # 0x4f9bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xafae(%rip), %r14      # 0x4dfcb
jmp 0x4306a
cmpl $0x3c, %eax
je 0x4305a
cmpl $0x3e, %eax
jne 0x43161
leaq 0xd0c4(%rip), %r14      # 0x500f8
jmp 0x4306a
leaq 0xaf9f(%rip), %r14      # 0x4dfdc
jmp 0x4306a
leaq 0xaf90(%rip), %r14      # 0x4dfd6
jmp 0x4306a
leaq 0xd0ae(%rip), %r14      # 0x500fd
jmp 0x4306a
leaq 0xaf89(%rip), %r14      # 0x4dfe1
jmp 0x4306a
leaq 0xd092(%rip), %r14      # 0x500f3
jmp 0x4306a
leaq 0xaf55(%rip), %r14      # 0x4dfbf
movl $0x4, %edi
callq 0x42575
movq %rax, %rbx
movq $0x2, 0x8(%rax)
leaq 0x28de2(%rip), %rdi     # 0x6be68
callq 0x42b78
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4263e
movq 0x20(%r15), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %eax
cmpl $0x8, %eax
je 0x430c9
cmpl $0x40, %eax
je 0x430c0
cmpl $0x10, %eax
jne 0x430d2
leaq 0x28d5a(%rip), %rsi     # 0x6be18
jmp 0x430d9
leaq 0x28d79(%rip), %rsi     # 0x6be40
jmp 0x430d9
leaq 0x28d20(%rip), %rsi     # 0x6bdf0
jmp 0x430d9
leaq 0x28cef(%rip), %rsi     # 0x6bdc8
movq %rbp, %rdi
callq 0x429d7
movq %rax, %rbx
leaq 0x7c18(%rip), %rdi      # 0x4ad03
movl %r12d, %esi
callq 0x4277e
leaq 0x558f6(%rip), %rdi     # 0x989f0
movq (%rsp), %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4259e
movq %rbx, %rdi
callq 0x42a58
movq %r13, %rsi
addq $-0x300, %rsi           # imm = 0xFD00
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x4259e
movl $0x4, %edi
callq 0x427bd
movq %rax, %rbx
leaq 0xcffa(%rip), %rcx      # 0x50134
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x4263e
movq %r13, %rdi
callq 0x42a58
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5d29(%rip), %rdi      # 0x48e91
leaq 0xc8cd(%rip), %rsi      # 0x4fa3c
leaq 0xcf8c(%rip), %rcx      # 0x50102
movl $0x4e8, %edx            # imm = 0x4E8
callq 0xe140