// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/linearize.c
// Function: get_cast_opcode
static int get_cast_opcode(struct symbol *dst, struct symbol *src)
{
	enum mtype stype = get_mtype(src);
	enum mtype dtype = get_mtype(dst);

	switch (dtype) {
	case MTYPE_FLOAT:
		switch (stype) {
		case MTYPE_FLOAT:
			if (dst->bit_size == src->bit_size)
				return OP_NOP;
			return OP_FCVTF;
		case MTYPE_UINT:
			return OP_UCVTF;
		case MTYPE_SINT:
			return OP_SCVTF;
		default:
			return OP_BADOP;
		}
	case MTYPE_PTR:
		switch (stype) {
		case MTYPE_UINT:
		case MTYPE_SINT:
			return OP_UTPTR;
		case MTYPE_PTR:
		case MTYPE_VPTR:
			return OP_PTRCAST;
		default:
			return OP_BADOP;
		}
	case MTYPE_VPTR:
		switch (stype) {
		case MTYPE_PTR:
		case MTYPE_VPTR:
		case MTYPE_UINT:
			stype = MTYPE_UINT;
			/* fall through */
		case MTYPE_SINT:
			break;
		default:
			return OP_BADOP;
		}
		/* fall through */
	case MTYPE_UINT:
	case MTYPE_SINT:
		switch (stype) {
		case MTYPE_FLOAT:
			return dtype == MTYPE_UINT ? OP_FCVTU : OP_FCVTS;
		case MTYPE_PTR:
			return OP_PTRTU;
		case MTYPE_VPTR:
		case MTYPE_UINT:
		case MTYPE_SINT:
			if (dst->bit_size ==src->bit_size)
				return OP_NOP;
			if (dst->bit_size  < src->bit_size)
				return OP_TRUNC;
			return stype == MTYPE_SINT ? OP_SEXT : OP_ZEXT;
		default:
			return OP_BADOP;
		}
		/* fall through */
	default:
		if (src->type == SYM_NODE)
			src = src->ctype.base_type;
		if (dst->type == SYM_NODE)
			dst = dst->ctype.base_type;
		if (src == dst)
			return OP_NOP;
		return OP_BADOP;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1fa70
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1fa70
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0x4, %rax
ja 0x1fa13
movq -0x28(%rbp), %rax
leaq 0x432b0(%rip), %rcx     # 0x62b34
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x1c(%rbp), %eax
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x1f8d5
jmp 0x1f899
movl -0x2c(%rbp), %eax
subl $0x1, %eax
je 0x1f8e1
jmp 0x1f8a3
movl -0x2c(%rbp), %eax
subl $0x4, %eax
jne 0x1f8ed
jmp 0x1f8ad
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x1f8c9
movl $0x4c, -0x4(%rbp)
jmp 0x1fa65
movl $0x3b, -0x4(%rbp)
jmp 0x1fa65
movl $0x39, -0x4(%rbp)
jmp 0x1fa65
movl $0x3a, -0x4(%rbp)
jmp 0x1fa65
movl $0x0, -0x4(%rbp)
jmp 0x1fa65
movl -0x1c(%rbp), %eax
movl %eax, -0x30(%rbp)
subl $0x2, %eax
jb 0x1f913
jmp 0x1f906
movl -0x30(%rbp), %eax
addl $-0x2, %eax
subl $0x2, %eax
jb 0x1f91f
jmp 0x1f92b
movl $0x3c, -0x4(%rbp)
jmp 0x1fa65
movl $0x3e, -0x4(%rbp)
jmp 0x1fa65
movl $0x0, -0x4(%rbp)
jmp 0x1fa65
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
testl %eax, %eax
je 0x1f95a
jmp 0x1f943
movl -0x34(%rbp), %eax
subl $0x1, %eax
je 0x1f961
jmp 0x1f94d
movl -0x34(%rbp), %eax
addl $-0x2, %eax
subl $0x1, %eax
ja 0x1f963
jmp 0x1f95a
movl $0x0, -0x1c(%rbp)
jmp 0x1f96f
movl $0x0, -0x4(%rbp)
jmp 0x1fa65
jmp 0x1f971
movl -0x1c(%rbp), %eax
movq %rax, -0x40(%rbp)
subq $0x4, %rax
ja 0x1fa0a
movq -0x40(%rbp), %rax
leaq 0x431bb(%rip), %rcx     # 0x62b48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x20(%rbp), %edx
movl $0x38, %eax
movl $0x37, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x1fa65
movl $0x3d, -0x4(%rbp)
jmp 0x1fa65
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jne 0x1f9d9
movl $0x4c, -0x4(%rbp)
jmp 0x1fa65
movq -0x10(%rbp), %rax
movl 0x50(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x50(%rcx), %eax
jge 0x1f9f2
movl $0x34, -0x4(%rbp)
jmp 0x1fa65
movl -0x1c(%rbp), %edx
movl $0x35, %eax
movl $0x36, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x1fa65
movl $0x0, -0x4(%rbp)
jmp 0x1fa65
movq -0x18(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x1fa2f
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xff, %eax
cmpl $0x3, %eax
jne 0x1fa4b
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x1fa5e
movl $0x4c, -0x4(%rbp)
jmp 0x1fa65
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop