// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
leaq 0x4f400(%rip), %rax     # 0x669d0
movq %rax, 0x10(%rsp)
leaq 0x4f3f4(%rip), %rax     # 0x669d0
cmpq %rax, %r14
je 0x178e1
testq %r15, %r15
je 0x178e1
testq %r12, %r12
je 0x178e1
movl 0x50(%r15), %r13d
testl %r13d, %r13d
js 0x178e1
movl 0x50(%r12), %ebp
testl %ebp, %ebp
js 0x178e1
movq 0x50750(%rip), %rax     # 0x67d68
movq %rax, 0x20(%rsp)
movq %r15, %rdi
callq 0x178f5
movl %eax, %ebx
movq %r12, %rdi
callq 0x178f5
cmpl $0x4, %eax
movq %r14, 0x8(%rsp)
ja 0x176e8
movl %eax, %ecx
leaq 0x2a4aa(%rip), %rdx     # 0x41af0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x4, %ebx
ja 0x176e3
movl %ebx, %ecx
leaq 0x2a4a3(%rip), %rdx     # 0x41b04
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x4c, %r14d
cmpl %r13d, %ebp
je 0x1773d
movl $0x34, %r14d
jl 0x1773d
xorl %r14d, %r14d
cmpl $0x1, %ebx
sete %r14b
addl $0x35, %r14d
jmp 0x1773d
testl %ebx, %ebx
je 0x17737
cmpl $0x1, %ebx
je 0x1772f
cmpl $0x4, %ebx
jne 0x176e3
cmpl %r13d, %ebp
movl $0x3b, %r14d
jmp 0x1770d
cmpl $0x4, %ebx
jae 0x176e3
movl %ebx, %eax
leaq 0x2aed9(%rip), %rcx     # 0x425a0
movl (%rcx,%rax,4), %r14d
jmp 0x1773d
cmpl $0x3, %ebx
ja 0x176e3
movl %ebx, %ecx
leaq 0x2aed5(%rip), %rdx     # 0x425b0
movl (%rdx,%rcx,4), %ebx
jmp 0x1764f
xorl %r14d, %r14d
jmp 0x1773d
cmpb $0x3, (%r15)
movq %r15, %rax
jne 0x176f5
movq 0x60(%r15), %rax
cmpb $0x3, (%r12)
movq %r12, %rcx
jne 0x17704
movq 0x60(%r12), %rcx
cmpq %rcx, %rax
movl $0x0, %r14d
movl $0x4c, %eax
cmovel %eax, %r14d
jmp 0x1773d
cmpl $0x1, %eax
movl $0x38, %r14d
sbbl $0x0, %r14d
jmp 0x1773d
movl $0x3d, %r14d
jmp 0x1773d
movl $0x3a, %r14d
jmp 0x1773d
movl $0x39, %r14d
cmpl $0x3d, %r14d
jne 0x17792
cmpl %ebp, %r13d
je 0x17801
leaq 0x49e81(%rip), %rax     # 0x615d4
cmpl $0x0, (%rax)
je 0x1776b
movq 0x20(%rsp), %rdi
leaq 0x2b3cd(%rip), %rsi     # 0x42b31
xorl %eax, %eax
callq 0x118b4
leaq 0x4deae(%rip), %rbx     # 0x65620
movq (%rbx), %rcx
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x175ad
movq %rax, %r14
movq (%rbx), %r15
jmp 0x175d5
testl %r14d, %r14d
je 0x178e1
cmpl $0x4c, %r14d
je 0x178d7
cmpl $0x3c, %r14d
jne 0x17801
cmpl %ebp, %r13d
je 0x17801
xorl %edi, %edi
callq 0x136d3
cmpq 0x8(%rsp), %rax
je 0x17801
leaq 0x49def(%rip), %rax     # 0x615b4
cmpl $0x0, (%rax)
je 0x177dd
leaq 0x2b334(%rip), %rsi     # 0x42b05
movq 0x20(%rsp), %rdi
xorl %eax, %eax
callq 0x118b4
leaq 0x4de3c(%rip), %rbx     # 0x65620
movq (%rbx), %rcx
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x175ad
movq %rax, 0x8(%rsp)
movq (%rbx), %r15
movl 0x50(%r12), %ebx
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
shll $0x8, %ebx
xorl %edi, %edi
callq 0x302dd
movq %rax, %rbp
movl $0x80, %eax
andl (%rbp), %eax
orl %ebx, %eax
orl %r14d, %eax
movl %eax, (%rbp)
movq 0x50537(%rip), %rax     # 0x67d68
movq %rax, 0x10(%rbp)
movq %r12, 0x18(%rbp)
xorl %edi, %edi
callq 0x303a3
movl $0x3, 0x4(%rax)
movl 0x50303(%rip), %ecx     # 0x67b50
incl %ecx
movl %ecx, 0x502fb(%rip)     # 0x67b50
movl %ecx, (%rax)
movq %rbp, 0x18(%rax)
movq %rax, 0x10(%rsp)
movq %rax, 0x20(%rbp)
movq %r15, 0x40(%rbp)
movq 0x8(%rsp), %r14
movq %r14, 0x30(%rbp)
testq %r14, %r14
je 0x178b7
movl 0x4(%r14), %eax
cmpl $0x6, %eax
ja 0x17889
movl $0x43, %ecx
btl %eax, %ecx
jb 0x178b7
movq %rbp, %rbx
addq $0x30, %rbx
leaq 0x49919(%rip), %rdi     # 0x611b0
movl $0x10, %esi
callq 0x2fd3c
movq %rbx, 0x8(%rax)
movq %rbp, (%rax)
addq $0x8, %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x2285b
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
testq %rdi, %rdi
je 0x178e1
movq %rdi, 0x8(%rbp)
addq $0x28, %rdi
movq %rbp, %rsi
callq 0x2285b
jmp 0x178e1
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq