// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x62220
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x62220
movq %rax, -0x18(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rax
movl 0x50(%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x48(%rbp)
subl $0x3c, %eax
je 0x651ae
jmp 0x6511d
movl -0x48(%rbp), %eax
subl $0x3e, %eax
je 0x651be
jmp 0x6512b
movl -0x48(%rbp), %eax
subl $0x108, %eax            # imm = 0x108
je 0x651ce
jmp 0x6513b
movl -0x48(%rbp), %eax
subl $0x109, %eax            # imm = 0x109
je 0x651db
jmp 0x6514b
movl -0x48(%rbp), %eax
subl $0x10a, %eax            # imm = 0x10A
je 0x651e8
jmp 0x6515b
movl -0x48(%rbp), %eax
subl $0x10b, %eax            # imm = 0x10B
je 0x651f5
jmp 0x6516b
movl -0x48(%rbp), %eax
subl $0x119, %eax            # imm = 0x119
je 0x65202
jmp 0x6517b
movl -0x48(%rbp), %eax
subl $0x11a, %eax            # imm = 0x11A
je 0x6520f
jmp 0x6518b
movl -0x48(%rbp), %eax
subl $0x11b, %eax            # imm = 0x11B
je 0x6521c
jmp 0x6519b
movl -0x48(%rbp), %eax
subl $0x11c, %eax            # imm = 0x11C
je 0x65229
jmp 0x65236
leaq 0xdce8(%rip), %rax      # 0x72e9d
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xdcdd(%rip), %rax      # 0x72ea2
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb67e(%rip), %rax      # 0x70853
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb677(%rip), %rax      # 0x70859
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xdcb8(%rip), %rax      # 0x72ea7
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb67f(%rip), %rax      # 0x7087b
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb65c(%rip), %rax      # 0x70865
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb660(%rip), %rax      # 0x70876
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb642(%rip), %rax      # 0x70865
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0xb640(%rip), %rax      # 0x70870
movq %rax, -0x40(%rbp)
jmp 0x65255
leaq 0x663c(%rip), %rdi      # 0x6b879
leaq 0xd550(%rip), %rsi      # 0x72794
movl $0x4e8, %edx            # imm = 0x4E8
leaq 0xdc5c(%rip), %rcx      # 0x72eac
callq 0x11140
movl $0x4, %edi
callq 0x63490
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq $0x2, 0x8(%rax)
leaq 0x2dfe2(%rip), %rdi     # 0x93258
callq 0x64060
movq %rax, -0x20(%rbp)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x63640
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x65fb0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x63d20
movq %rax, -0x28(%rbp)
movl -0x44(%rbp), %esi
leaq 0x826d(%rip), %rdi      # 0x6d52f
callq 0x638d0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x63500
movq -0x28(%rbp), %rdi
callq 0x63df0
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $-0x300, %rsi           # imm = 0xFD00
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x63500
movl $0x4, %edi
callq 0x63a00
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0xdbbe(%rip), %rcx      # 0x72ede
callq 0x63640
movq -0x20(%rbp), %rdi
callq 0x63df0
movq -0x30(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)