// File: /workspace/github_c_makefile_star2_O3/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 %rdi, 0x20(%rsp)
leaq 0x4e42d(%rip), %r13     # 0x659d0
cmpq %r13, %rsi
je 0x1780d
movq %rcx, %r15
testq %rcx, %rcx
je 0x1780d
movq %rsi, %rax
leaq 0x4e40e(%rip), %r13     # 0x659d0
movq %rdx, %rdi
movq %r15, 0x8(%rsp)
testq %rdi, %rdi
je 0x1780d
movl 0x50(%rdi), %r12d
testl %r12d, %r12d
js 0x1780d
movl 0x50(%r15), %ebx
testl %ebx, %ebx
js 0x1780d
movq %rax, 0x10(%rsp)
movq 0x4f770(%rip), %rbp     # 0x66d68
movq %rdi, 0x18(%rsp)
callq 0x1791c
movl %eax, %r14d
movq %r15, %rdi
callq 0x1791c
cmpl $0x2, %eax
jae 0x176c7
cmpl $0x2, %r14d
jne 0x17676
cmpl %ebx, %r12d
je 0x17727
leaq 0x48fa8(%rip), %rax     # 0x605d4
cmpl $0x0, (%rax)
je 0x17642
movq %rbp, %rdi
leaq 0x2a4c6(%rip), %rsi     # 0x41b01
xorl %eax, %eax
callq 0x118fc
leaq 0x4cfd7(%rip), %rbx     # 0x64620
movq (%rbx), %rcx
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
callq 0x17589
movq (%rbx), %rdi
cmpq %r13, %rax
movq 0x8(%rsp), %r15
jne 0x175ca
jmp 0x1780d
jb 0x176a4
cmpl $0x3, %r14d
je 0x176a4
cmpl $0x4, %r14d
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
jne 0x1780d
cmpl $0x1, %eax
movl $0x38, %r12d
sbbl $0x0, %r12d
jmp 0x17737
xorl %ecx, %ecx
cmpl $0x1, %r14d
sete %cl
addl $0x35, %ecx
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
cmpl %r12d, %ebx
jne 0x17719
movq %rbp, %r13
jmp 0x1780d
je 0x1783c
cmpl $0x3, %eax
movq 0x10(%rsp), %rbp
je 0x1781f
cmpl $0x4, %eax
movq 0x8(%rsp), %r15
jne 0x17862
testl %r14d, %r14d
je 0x17911
cmpl $0x1, %r14d
je 0x17906
cmpl $0x4, %r14d
jne 0x1780d
movq %rbp, %r13
cmpl %r12d, %ebx
movl $0x3b, %r12d
jne 0x17737
jmp 0x1780d
movl $0x34, %eax
movl %ecx, %r12d
cmovbl %eax, %r12d
jmp 0x17737
movl $0x3d, %r12d
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
movl 0x50(%r15), %ebx
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
shll $0x8, %ebx
xorl %edi, %edi
callq 0x2fca9
movq %rbp, %r14
movq %rax, %rbp
movl $0x80, %eax
andl (%rbp), %eax
addl %r12d, %eax
addl %ebx, %eax
movl %eax, (%rbp)
movq 0x4f5ff(%rip), %rax     # 0x66d68
movq %rax, 0x10(%rbp)
movq %r15, 0x18(%rbp)
xorl %edi, %edi
callq 0x2fd6f
movq %rax, %r13
movl $0x3, 0x4(%rax)
movl 0x4f3c8(%rip), %eax     # 0x66b50
incl %eax
movl %eax, 0x4f3c0(%rip)     # 0x66b50
movl %eax, (%r13)
movq %rbp, 0x18(%r13)
movq %r13, 0x20(%rbp)
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rbp)
movq %r14, 0x30(%rbp)
testq %r14, %r14
je 0x177ef
movl 0x4(%r14), %eax
cmpl $0x6, %eax
ja 0x177c1
movl $0x43, %ecx
btl %eax, %ecx
jb 0x177ef
movq %rbp, %rbx
addq $0x30, %rbx
leaq 0x489e1(%rip), %rdi     # 0x601b0
movl $0x10, %esi
callq 0x2f700
movq %rbx, 0x8(%rax)
movq %rbp, (%rax)
addq $0x8, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x227b4
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rdi
testq %rdi, %rdi
je 0x1780d
movq %rdi, 0x8(%rbp)
addq $0x28, %rdi
movq %rbp, %rsi
callq 0x227b4
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x4, %r14d
movq 0x8(%rsp), %r15
jae 0x1780d
movl %r14d, %eax
leaq 0x29d4c(%rip), %rcx     # 0x41580
movl (%rcx,%rax,4), %ecx
jmp 0x176ba
cmpl $0x2, %r14d
jb 0x1788a
movl $0x3e, %r12d
addl $-0x2, %r14d
cmpl $0x2, %r14d
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
jb 0x17737
jmp 0x1780d
movq 0x18(%rsp), %rax
cmpb $0x3, (%rax)
jne 0x17870
movq 0x60(%rax), %rax
cmpb $0x3, (%r15)
jne 0x1787a
movq 0x60(%r15), %r15
cmpq %r15, %rax
leaq 0x4e14c(%rip), %r13     # 0x659d0
cmoveq %rbp, %r13
jmp 0x1780d
cmpl %ebx, %r12d
je 0x178f1
xorl %edi, %edi
callq 0x13745
cmpq 0x10(%rsp), %rax
movq 0x18(%rsp), %rbx
je 0x178f1
leaq 0x48d0b(%rip), %rax     # 0x605b4
cmpl $0x0, (%rax)
movl $0x3c, %r12d
je 0x178c5
leaq 0x2a21a(%rip), %rsi     # 0x41ad5
movq %rbp, %rdi
xorl %eax, %eax
callq 0x118fc
leaq 0x4cd54(%rip), %r14     # 0x64620
movq (%r14), %rcx
movq 0x20(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x17589
movq %rax, %rbp
movq (%r14), %rax
movq %rax, 0x18(%rsp)
jmp 0x17732
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r15
movl $0x3c, %r12d
jmp 0x17737
movl $0x3a, %r12d
jmp 0x17737
movl $0x39, %r12d
jmp 0x17737