// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/cse.c
// Function: cse_collect
void cse_collect(struct instruction *insn)
{
	unsigned long hash;

	hash = (insn->opcode << 3) + (insn->size >> 3);
	switch (insn->opcode) {
	case OP_SEL:
		hash += hashval(insn->src3);
		/* Fall through */	

	/* Binary arithmetic */
	case OP_ADD: case OP_SUB:
	case OP_MUL:
	case OP_DIVU: case OP_DIVS:
	case OP_MODU: case OP_MODS:
	case OP_SHL:
	case OP_LSR: case OP_ASR:
	case OP_AND: case OP_OR:

	/* Binary logical */
	case OP_XOR:

	/* Binary comparison */
	case OP_SET_EQ: case OP_SET_NE:
	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 & comparison */
	case OP_FPCMP ... OP_FPCMP_END:
	case OP_FADD:
	case OP_FSUB:
	case OP_FMUL:
	case OP_FDIV:
		hash += hashval(insn->src2);
		/* Fall through */
	
	/* Unary */
	case OP_NOT: case OP_NEG:
	case OP_FNEG:
	case OP_SYMADDR:
		hash += hashval(insn->src1);
		break;

	case OP_LABEL:
		hash += hashval(insn->bb_true);
		break;

	case OP_SETVAL:
		hash += hashval(insn->val);
		break;

	case OP_SETFVAL:
		hash += hashval(insn->fvalue);
		break;

	case OP_SEXT: case OP_ZEXT:
	case OP_TRUNC:
	case OP_PTRCAST:
	case OP_UTPTR: case OP_PTRTU:
		if (!insn->orig_type || insn->orig_type->bit_size < 0)
			return;
		hash += hashval(insn->src);

		// Note: see corresponding line in insn_compare()
		hash += hashval(insn->orig_type->bit_size);
		break;

	/* Other */
	case OP_PHI: {
		pseudo_t phi;
		FOR_EACH_PTR(insn->phi_list, phi) {
			struct instruction *def;
			if (phi == VOID || !phi->def)
				continue;
			def = phi->def;
			hash += hashval(def->src1);
			hash += hashval(def->bb);
		} END_FOR_EACH_PTR(phi);
		break;
	}

	default:
		/*
		 * Nothing to do, don't even bother hashing them,
		 * we're not going to try to CSE them
		 */
		return;
	}
	hash += hash >> 16;
	hash &= INSN_HASH_SIZE-1;
	add_instruction(insn_hash_table + hash, insn);
}

// Assembly:
pushq %rbp
pushq %rbx
movq %rdi, %rsi
movl (%rdi), %eax
movl %eax, %ecx
andl $0x7f, %ecx
shrl $0xb, %eax
leal (%rax,%rcx,8), %eax
leal -0x8(%rcx), %edx
cmpl $0x29, %edx
jae 0x314ca
addq 0x38(%rsi), %rax
addq 0x30(%rsi), %rax
movl %eax, %ecx
shrl $0x10, %ecx
addl %eax, %ecx
movzbl %cl, %eax
leaq 0x5f241(%rip), %rcx     # 0x90700
leaq (%rcx,%rax,8), %rdi
popq %rbx
popq %rbp
jmp 0x2285b
addl $-0x31, %ecx
cmpl $0x18, %ecx
ja 0x314fd
leaq 0x1936b(%rip), %rdx     # 0x4a844
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x40(%rsi), %rcx
testq %rcx, %rcx
je 0x314fd
movl 0x50(%rcx), %ecx
testl %ecx, %ecx
js 0x314fd
addl %eax, %ecx
addq 0x30(%rsi), %rcx
movq %rcx, %rax
jmp 0x314ae
popq %rbx
popq %rbp
retq
movq 0x38(%rsi), %rcx
testq %rcx, %rcx
je 0x314ae
leaq 0x354c0(%rip), %rdx     # 0x669d0
movq %rcx, %rdi
movzwl (%rdi), %r9d
movsbl %r9b, %r8d
testw %r8w, %r8w
jle 0x31565
movzwl %r8w, %r8d
movzwl %r9w, %r9d
xorl %r10d, %r10d
cmpl $0x100, %r9d            # imm = 0x100
setae %bl
movq 0x18(%rdi,%r10,8), %r11
testq %r11, %r11
sete %bpl
testb %bpl, %bl
jne 0x3155d
cmpq %rdx, %r11
je 0x3155d
movq 0x18(%r11), %r11
testq %r11, %r11
je 0x3155d
addq 0x30(%r11), %rax
addq 0x8(%r11), %rax
incq %r10
cmpq %r10, %r8
jne 0x3152c
movq 0x10(%rdi), %rdi
cmpq %rcx, %rdi
jne 0x31513
jmp 0x314ae
addq 0x40(%rsi), %rax
jmp 0x314a6
addq 0x38(%rsi), %rax
jmp 0x314ae
fldt 0x30(%rsi)
flds 0x192b2(%rip)           # 0x4a840
xorl %ecx, %ecx
fucomi %st(1), %st
setbe %cl
fldz
fcmovbe %st(1), %st
fstp %st(1)
fsubrp %st, %st(1)
fnstcw -0xc(%rsp)
movzwl -0xc(%rsp), %edx
orl $0xc00, %edx            # imm = 0xC00
movw %dx, -0xa(%rsp)
fldcw -0xa(%rsp)
fistpll -0x8(%rsp)
fldcw -0xc(%rsp)
shlq $0x3f, %rcx
xorq -0x8(%rsp), %rcx
addq %rcx, %rax
jmp 0x314ae