// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/cse.c
// Function: insn_compare
static int insn_compare(const void *_i1, const void *_i2)
{
	const struct instruction *i1 = _i1;
	const struct instruction *i2 = _i2;
	int size1, size2;
	int diff;

	if (i1->opcode != i2->opcode)
		return i1->opcode < i2->opcode ? -1 : 1;

	switch (i1->opcode) {

	/* commutative binop */
	case OP_ADD:
	case OP_MUL:
	case OP_AND: case OP_OR:
	case OP_XOR:
	case OP_SET_EQ: case OP_SET_NE:
		if (i1->src1 == i2->src2 && i1->src2 == i2->src1)
			return 0;
		goto case_binops;

	case OP_SEL:
		if (i1->src3 != i2->src3)
			return i1->src3 < i2->src3 ? -1 : 1;
		/* Fall-through to binops */

	/* Binary arithmetic */
	case OP_SUB:
	case OP_DIVU: case OP_DIVS:
	case OP_MODU: case OP_MODS:
	case OP_SHL:
	case OP_LSR: case OP_ASR:

	/* Binary comparison */
	case OP_SET_LE: case OP_SET_GE:
	case OP_SET_LT: case OP_SET_GT:
	case OP_SET_B:  case OP_SET_A:
	case OP_SET_BE: case OP_SET_AE:

	/* floating-point arithmetic */
	case OP_FPCMP ... OP_FPCMP_END:
	case OP_FADD:
	case OP_FSUB:
	case OP_FMUL:
	case OP_FDIV:
	case_binops:
		if (i1->src2 != i2->src2)
			return i1->src2 < i2->src2 ? -1 : 1;
		/* Fall through to unops */

	/* Unary */
	case OP_NOT: case OP_NEG:
	case OP_FNEG:
	case OP_SYMADDR:
		if (i1->src1 != i2->src1)
			return i1->src1 < i2->src1 ? -1 : 1;
		break;

	case OP_LABEL:
		if (i1->bb_true != i2->bb_true)
			return i1->bb_true < i2->bb_true ? -1 : 1;
		break;

	case OP_SETVAL:
		if (i1->val != i2->val)
			return i1->val < i2->val ? -1 : 1;
		break;

	case OP_SETFVAL:
		diff = memcmp(&i1->fvalue, &i2->fvalue, sizeof(i1->fvalue));
		if (diff)
			return diff;
		break;

	/* Other */
	case OP_PHI:
		return phi_list_compare(i1->phi_list, i2->phi_list);

	case OP_SEXT: case OP_ZEXT:
	case OP_TRUNC:
	case OP_PTRCAST:
	case OP_UTPTR: case OP_PTRTU:
		if (i1->src != i2->src)
			return i1->src < i2->src ? -1 : 1;

		// Note: if it can be guaranted that identical ->src
		// implies identical orig_type->bit_size, then this
		// test and the hashing of the original size in
		// cse_collect() are not needed.
		// It must be generaly true but it isn't guaranted (yet).
		size1 = i1->orig_type->bit_size;
		size2 = i2->orig_type->bit_size;
		if (size1 != size2)
			return size1 < size2 ? -1 : 1;
		break;

	default:
		warning(i1->pos, "bad instruction on hash chain");
	}
	if (i1->size != i2->size)
		return i1->size < i2->size ? -1 : 1;
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl (%rdi), %ebp
movl %ebp, %ecx
andl $0x7f, %ecx
movl (%rsi), %r15d
movl %r15d, %edx
andl $0x7f, %edx
cmpl %edx, %ecx
jne 0x2c20a
movq %rsi, %rbx
movq %rdi, %r14
addl $-0x8, %ecx
cmpl $0x41, %ecx
ja 0x2c2d5
leaq 0x16895(%rip), %rax     # 0x42a6c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x38(%r14), %rcx
movq 0x38(%rbx), %rdx
cmpq %rdx, %rcx
jne 0x2c233
movq 0x30(%r14), %rcx
movq 0x30(%rbx), %rdx
cmpq %rdx, %rcx
jne 0x2c233
shrl $0x8, %ebp
shrl $0x8, %r15d
cmpl %r15d, %ebp
jne 0x2c248
xorl %eax, %eax
jmp 0x2c23d
xorl %eax, %eax
cmpl %edx, %ecx
jmp 0x2c238
movq 0x30(%r14), %rax
cmpq 0x38(%rbx), %rax
jne 0x2c1e0
movq 0x38(%r14), %rax
cmpq 0x30(%rbx), %rax
jne 0x2c1e0
jmp 0x2c206
movq 0x30(%r14), %rcx
movq 0x30(%rbx), %rdx
cmpq %rdx, %rcx
je 0x2c24f
xorl %eax, %eax
cmpq %rdx, %rcx
sbbl %eax, %eax
orl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
cmpl %r15d, %ebp
jmp 0x2c238
movq 0x40(%r14), %rax
movq 0x40(%rbx), %rcx
movl 0x50(%rcx), %ecx
cmpl %ecx, 0x50(%rax)
je 0x2c1fa
setge %al
movzbl %al, %eax
leal -0x1(,%rax,2), %eax
jmp 0x2c23d
movq 0x38(%r14), %rax
movq 0x38(%rbx), %rcx
xorl %edi, %edi
testq %rax, %rax
je 0x2c2f2
pushq $0x1
popq %rsi
movq %rax, %rdx
cmpb $0x0, (%rdx)
jg 0x2c2fb
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0x2c283
jmp 0x2c2f4
movq 0x38(%r14), %rcx
movq 0x38(%rbx), %rdx
jmp 0x2c1f5
addq $0x30, %r14
addq $0x30, %rbx
pushq $0x10
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe190
testl %eax, %eax
jne 0x2c23d
jmp 0x2c1fa
movq 0x40(%r14), %rcx
movq 0x40(%rbx), %rdx
cmpq %rdx, %rcx
jne 0x2c233
jmp 0x2c1e0
movq 0x10(%r14), %rdi
leaq 0x16894(%rip), %rsi     # 0x42b74
xorl %eax, %eax
callq 0x1108a
movl (%r14), %ebp
movl (%rbx), %r15d
jmp 0x2c1fa
xorl %edx, %edx
xorl %esi, %esi
xorl %r10d, %r10d
jmp 0x2c303
movq 0x18(%rdx), %r10
andq $-0x4, %r10
testq %rcx, %rcx
je 0x2c321
movq %rcx, %r8
cmpb $0x0, (%r8)
jg 0x2c329
movq 0x10(%r8), %r8
cmpq %rcx, %r8
jne 0x2c30b
xorl %r11d, %r11d
xorl %edi, %edi
jmp 0x2c334
xorl %r11d, %r11d
xorl %r8d, %r8d
jmp 0x2c334
movq 0x18(%r8), %r11
andq $-0x4, %r11
pushq $0x1
popq %rdi
leaq 0x33695(%rip), %r9      # 0x5f9d0
testq %r10, %r10
je 0x2c390
cmpq %r9, %r10
je 0x2c34c
cmpq $0x0, 0x18(%r10)
jne 0x2c390
movsbl (%rdx), %r10d
cmpl %r10d, %esi
jl 0x2c3ef
movq 0x10(%rdx), %rdx
xorl %esi, %esi
cmpq %rax, %rdx
jne 0x2c34c
xorl %r10d, %r10d
jmp 0x2c33b
movsbl (%r8), %r11d
cmpl %r11d, %edi
jl 0x2c382
movq 0x10(%r8), %r8
xorl %edi, %edi
cmpq %rcx, %r8
jne 0x2c369
xorl %r11d, %r11d
jmp 0x2c390
movslq %edi, %r11
movq 0x18(%r8,%r11,8), %r11
andq $-0x4, %r11
incl %edi
testq %r11, %r11
je 0x2c43f
cmpq %r9, %r11
je 0x2c369
movq 0x18(%r11), %rbx
testq %rbx, %rbx
je 0x2c369
testq %r10, %r10
je 0x2c44c
movq 0x18(%r10), %r10
movq 0x30(%r10), %r11
movq 0x30(%rbx), %r14
cmpq %r14, %r11
jne 0x2c458
movq 0x8(%r10), %r10
movq 0x8(%rbx), %r11
cmpq %r11, %r10
jne 0x2c462
movsbl (%rdx), %r10d
cmpl %r10d, %esi
jl 0x2c402
movq 0x10(%rdx), %rdx
xorl %esi, %esi
cmpq %rax, %rdx
jne 0x2c3d6
xorl %r10d, %r10d
jmp 0x2c410
movslq %esi, %r10
movq 0x18(%rdx,%r10,8), %r10
andq $-0x4, %r10
incl %esi
jmp 0x2c33b
movslq %esi, %r10
movq 0x18(%rdx,%r10,8), %r10
andq $-0x4, %r10
incl %esi
movsbl (%r8), %r11d
cmpl %r11d, %edi
jl 0x2c42c
movq 0x10(%r8), %r8
xorl %edi, %edi
cmpq %rcx, %r8
jne 0x2c410
xorl %r11d, %r11d
jmp 0x2c33b
movslq %edi, %r11
movq 0x18(%r8,%r11,8), %r11
andq $-0x4, %r11
incl %edi
jmp 0x2c33b
testq %r10, %r10
je 0x2c44c
pushq $0x1
popq %rax
jmp 0x2c23d
xorl %eax, %eax
negq %r11
sbbl %eax, %eax
jmp 0x2c23d
xorl %eax, %eax
cmpq %r14, %r11
jmp 0x2c238
xorl %eax, %eax
cmpq %r11, %r10
jmp 0x2c238