// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/linearize.c
// Function: cast_pseudo
static pseudo_t cast_pseudo(struct entrypoint *ep, pseudo_t src, struct symbol *from, struct symbol *to)
{
	const struct position pos = current_pos;
	pseudo_t result;
	struct instruction *insn;
	int opcode;

	if (src == VOID)
		return VOID;
	if (!from || !to)
		return VOID;
	if (from->bit_size < 0 || to->bit_size < 0)
		return VOID;
	opcode = get_cast_opcode(to, from);
	switch (opcode) {
	case OP_NOP:
		return src;
	case OP_UTPTR:
		if (from->bit_size == to->bit_size)
			break;
		if (src == value_pseudo(0))
			break;
		if (Wint_to_pointer_cast)
			warning(pos, "non size-preserving integer to pointer cast");
		src = cast_pseudo(ep, src, from, size_t_ctype);
		from = size_t_ctype;
		break;
	case OP_PTRTU:
		if (from->bit_size == to->bit_size)
			break;
		if (Wpointer_to_int_cast)
			warning(pos, "non size-preserving pointer to integer cast");
		src = cast_pseudo(ep, src, from, size_t_ctype);
		return cast_pseudo(ep, src, size_t_ctype, to);
	case OP_BADOP:
		return VOID;
	default:
		break;
	}
	insn = alloc_typed_instruction(opcode, to);
	result = alloc_pseudo(insn);
	insn->target = result;
	insn->orig_type = from;
	use_pseudo(insn, src, &insn->src);
	add_one_insn(ep, insn);
	return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rsi, %rax
movq %rdi, 0x20(%rsp)
leaq 0x4a033(%rip), %r15     # 0x5f9d0
movq %rcx, 0x10(%rsp)
cmpq %r15, %rax
je 0x15c17
testq %r14, %r14
je 0x15c17
testq %rdx, %rdx
je 0x15c17
movl 0x50(%rdx), %ebx
testl %ebx, %ebx
js 0x15c17
movl 0x50(%r14), %r13d
testl %r13d, %r13d
js 0x15c17
movq %rax, 0x8(%rsp)
movq 0x4b387(%rip), %r12     # 0x60d68
movq %rdx, 0x18(%rsp)
movq %rdx, %rdi
callq 0x15c29
movl %eax, %ebp
movq %r14, %rdi
callq 0x15c29
cmpl $0x4, %eax
ja 0x15afa
movl %eax, %ecx
leaq 0x240e6(%rip), %rsi     # 0x39af0
movslq (%rsi,%rcx,4), %rdx
addq %rsi, %rdx
movl %ebp, %ecx
jmpq *%rdx
cmpl $0x4, %ebp
ja 0x15c17
leaq 0x240df(%rip), %rdx     # 0x39b04
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl %r13d, %ebx
je 0x15abb
leaq 0x44b96(%rip), %rax     # 0x5a5d4
cmpl $0x0, (%rax)
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
je 0x15a5e
movq %r12, %rdi
leaq 0x2510a(%rip), %rsi     # 0x3ab61
xorl %eax, %eax
callq 0x1108a
leaq 0x48bbb(%rip), %r12     # 0x5e620
movq (%r12), %rcx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
callq 0x1597d
movq (%r12), %rdx
jmp 0x159a2
xorl %edi, %edi
cmpl $0x1, %ebp
sete %dil
addl $0x35, %edi
cmpl %ebx, %r13d
movq 0x8(%rsp), %rbx
jne 0x15aa2
movq %rbx, %r15
jmp 0x15c17
pushq $0x34
popq %rax
cmovbl %eax, %edi
jmp 0x15bd3
cmpl $0x1, %eax
pushq $0x38
popq %rdi
sbbl $0x0, %edi
jmp 0x15bce
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
pushq $0x3d
popq %rdi
jmp 0x15bd8
testl %ebp, %ebp
je 0x15bc7
cmpl $0x1, %ebp
je 0x15bc3
cmpl $0x4, %ebp
jne 0x15c17
cmpl %ebx, %r13d
jne 0x15bcb
movq 0x8(%rsp), %r15
jmp 0x15c17
movq 0x18(%rsp), %rcx
cmpb $0x3, (%rcx)
jne 0x15b08
movq 0x60(%rcx), %rcx
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %rax
cmpb $0x3, (%rax)
jne 0x15b1b
movq 0x60(%rax), %rax
cmpq %rax, %rcx
leaq 0x49eab(%rip), %r15     # 0x5f9d0
cmoveq %r14, %r15
jmp 0x15c17
cmpl $0x4, %ebp
jae 0x15c17
leaq 0x24aa2(%rip), %rax     # 0x3a5e0
movl (%rax,%rcx,4), %edi
jmp 0x15a90
cmpl $0x2, %ebp
jb 0x15b5b
addl $-0x2, %ebp
cmpl $0x2, %ebp
jae 0x15c17
pushq $0x3e
jmp 0x15bcd
pushq $0x3c
popq %rdi
cmpl %r13d, %ebx
je 0x15bce
movl %edi, %ebp
xorl %edi, %edi
callq 0x12c98
movq 0x8(%rsp), %rbx
cmpq %rbx, %rax
movq 0x10(%rsp), %r14
je 0x15bbf
leaq 0x44a32(%rip), %rax     # 0x5a5b4
cmpl $0x0, (%rax)
je 0x15b98
leaq 0x24fa7(%rip), %rsi     # 0x3ab35
movq %r12, %rdi
xorl %eax, %eax
callq 0x1108a
leaq 0x48a81(%rip), %r15     # 0x5e620
movq (%r15), %rcx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rdx
callq 0x1597d
movq %rax, %rbx
movq (%r15), %rax
movq %rax, 0x18(%rsp)
movl %ebp, %edi
jmp 0x15bd8
pushq $0x3a
jmp 0x15bcd
pushq $0x39
jmp 0x15bcd
pushq $0x3b
popq %rdi
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x12bbd
movq %rax, %r14
movq %rax, %rdi
callq 0x12c70
movq %rax, %r15
movq %rax, 0x20(%r14)
leaq 0x30(%r14), %rdx
movq 0x18(%rsp), %rax
movq %rax, 0x40(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12bdf
movq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x13783
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq