// File: /workspace/github_c_makefile_star2_O2/vtereshkov[P]umka-lang/src/umka_expr.c
// Function: doExplicitTypeConv
void doExplicitTypeConv(Compiler *comp, const Type *dest, const Type **src, Const *constant)
{
    doImplicitTypeConv(comp, dest, src, constant);

    // Type to same type (up to the type identifier)
    if (typeSameExceptMaybeIdent(dest, *src))
    {
        *src = dest;
    }

    // Ordinal to ordinal or real to real
    else if ((typeOrdinal(*src) && typeOrdinal(dest)) || (typeReal(*src) && typeReal(dest)))
    {
        doOrdinalToOrdinalOrRealToRealConv(comp, dest, src, constant);
    }

    // Pointer to pointer
    else if (dest->kind == TYPE_PTR && (*src)->kind == TYPE_PTR && typeExplicitlyConvertibleBaseTypes(&comp->types, dest->base, (*src)->base))
    {
        *src = dest;
    }

    // Interface to concrete (type assertion)
    else if ((*src)->kind == TYPE_INTERFACE && dest->kind != TYPE_INTERFACE)
    {
        if (dest->kind == TYPE_PTR)
        {
            // Interface to pointer
            doInterfaceToPtrConv(comp, dest, src, constant);
        }
        else
        {
            // Interface to value
            doInterfaceToValueConv(comp, dest, src, constant);
        }
    }

    // Dynamic array to string
    else if ((*src)->kind == TYPE_DYNARRAY && (*src)->base->kind == TYPE_UINT8 && dest->kind == TYPE_STR)
    {
        doDynArrayToStrConv(comp, dest, src, constant, false);
    }

    // String to dynamic array
    else if ((*src)->kind == TYPE_STR && dest->kind == TYPE_DYNARRAY && dest->base->kind == TYPE_UINT8)
    {
        doStrToDynArrayConv(comp, dest, src, constant);
    }

    // Dynamic array to dynamic array of another base type (covariant arrays)
    else if ((*src)->kind == TYPE_DYNARRAY && dest->kind == TYPE_DYNARRAY)
    {
        doDynArrayToDynArrayConv(comp, dest, src, constant);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x8d6a
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x1559f
testb %al, %al
je 0x9826
movq %r14, (%rbx)
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movl (%rax), %ecx
leal -0x4(%rcx), %edx
cmpl $0x9, %edx
ja 0x983e
movl (%r14), %edx
addl $-0x4, %edx
cmpl $0xa, %edx
jb 0x9857
movl %ecx, %esi
andl $-0x2, %esi
movl (%r14), %edx
cmpl $0xe, %esi
jne 0x9879
andl $-0x2, %edx
cmpl $0xe, %edx
jne 0x98df
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9cfb
xorl $0x10, %edx
xorl $0x10, %ecx
orl %edx, %ecx
jne 0x98df
leaq 0x4e18(%r15), %r13
movq 0x8(%r14), %rsi
movq %r15, (%rsp)
movq 0x8(%rax), %r15
movq %r13, %rdi
movq %rsi, 0x8(%rsp)
callq 0x15124
movl %eax, %ebp
movq %r13, %rdi
movq %r15, %r13
movq (%rsp), %r15
movq %r13, %rsi
callq 0x15124
cmpl %eax, %ebp
jg 0x98df
pushq $0x1
popq %rsi
movq 0x8(%rsp), %rdi
callq 0x151e4
testb %al, %al
jne 0x98df
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0x151e4
testb %al, %al
je 0x9811
movq (%rbx), %rcx
movl (%rcx), %eax
cmpl $0x13, %eax
je 0x997c
cmpl $0x14, %eax
je 0x9943
cmpl $0x17, %eax
jne 0x9814
movl (%r14), %eax
cmpl $0x17, %eax
je 0x9814
cmpl $0x10, %eax
jne 0x9ca7
testq %r12, %r12
je 0x992c
movq 0x5118(%r15), %rdi
leaq 0x610fc(%rip), %rsi     # 0x6aa1f
xorl %eax, %eax
callq *0x50f8(%r15)
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %r14, %rsi
callq 0xf542
jmp 0x9811
cmpl $0x13, (%r14)
jne 0x9814
movq 0x8(%r14), %rax
cmpl $0x8, (%rax)
jne 0x9814
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9eb9
movq 0x8(%rcx), %rax
movl (%rax), %ecx
xorl $0x8, %ecx
movl (%r14), %eax
movl %eax, %edx
xorl $0x14, %edx
orl %ecx, %edx
jne 0x99b6
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9e3f
cmpl $0x13, %eax
jne 0x9814
testq %r12, %r12
je 0x99db
movq 0x5118(%r15), %rdi
leaq 0x610ca(%rip), %rsi     # 0x6aa9c
xorl %eax, %eax
callq *0x50f8(%r15)
leaq 0x4e38(%r15), %rdi
movq %rdi, 0x8(%rsp)
leaq 0x4e18(%r15), %rsi
movq %rsi, 0x18(%rsp)
leaq 0x4220(%r15), %rdx
movq %rdx, (%rsp)
movq 0x5240(%r15), %rcx
callq 0x10996
movl %eax, %ebp
movl %eax, 0x10(%rsp)
leaq 0x4e70(%r15), %r13
movq %r13, %rdi
callq 0xedd1
movq (%rbx), %rax
movl (%rax), %esi
pushq $0x22
popq %rdx
movq %r13, %rdi
callq 0xf72f
movq %r13, %rdi
movl %ebp, %esi
callq 0xeb38
pushq $0x7
popq %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0xeee9
leaq 0x100(%r15), %rdx
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x10abb
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x124c6
movq %r13, %rdi
pushq $0x7
popq %rsi
movl 0x10(%rsp), %edx
callq 0xec15
movq %r15, %rdi
movq %rbp, 0x20(%rsp)
movq %rbp, %rsi
callq 0x8c92
pushq $0x16
popq %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0xf8f6
movq %r13, %rdi
callq 0xed28
movq 0x5240(%r15), %rcx
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rdx
callq 0x10996
movl %eax, %ebp
movq %r13, %rdi
pushq $0x7
popq %rsi
movl 0x10(%rsp), %edx
callq 0xec15
pushq $0x1
popq %rsi
movq %r13, %rdi
callq 0xea9e
movq 0x5240(%r15), %rdx
pushq $0x17
popq %rsi
movq %r13, %rdi
callq 0xf28f
movq %r13, %rdi
movl %ebp, %esi
callq 0xeb38
movq %r13, %rdi
pushq $0x7
popq %rsi
xorl %edx, %edx
callq 0xeee9
movq %r13, %rdi
callq 0xfba7
movq %r13, %rdi
pushq $0x7
popq %rsi
movl %ebp, %edx
callq 0xec15
movq %r13, %rdi
xorl %esi, %esi
callq 0xea9e
movq 0x5240(%r15), %rdx
pushq $0x36
popq %rsi
movq %r13, %rdi
callq 0xf28f
movq %r13, %rdi
callq 0xfbac
movq (%rsp), %rdi
callq 0x4b13
movq %r13, %rdi
callq 0xedd1
movq %r13, %rdi
pushq $0x7
popq %rsi
movl %ebp, 0x18(%rsp)
movl %ebp, %edx
callq 0xec15
movq %r13, %rdi
callq 0xf4a7
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0xee17
movq (%rbx), %rax
movq 0x8(%rax), %rax
leaq 0x28(%rsp), %rbp
movq %rax, (%rbp)
movq 0x8(%r14), %rsi
movq %r15, %rdi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x97e0
movq 0x8(%r14), %rdi
movq (%rbp), %rsi
callq 0x15262
testb %al, %al
jne 0x9bfd
movq 0x50f8(%r15), %rax
movq %rax, 0x10(%rsp)
movq 0x5118(%r15), %r12
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x130(%rsp), %rsi
callq 0x15180
movq %rax, %rbp
movq 0x8(%r14), %rdi
leaq 0x30(%rsp), %rsi
callq 0x15180
leaq 0x60ef3(%rip), %rsi     # 0x6aae1
movq %r12, %rdi
movq %rbp, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq *0x10(%rsp)
movq %r15, %rdi
movq 0x20(%rsp), %rbp
movq %rbp, %rsi
callq 0x8c92
movl (%r14), %esi
movq %r13, %rdi
callq 0xee17
pushq $0x7
popq %rsi
movq %r13, %rdi
movl 0x18(%rsp), %r12d
movl %r12d, %edx
callq 0xec15
movq %r13, %rdi
callq 0xf4a7
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0xf122
movq %r13, %rdi
movl %r12d, %esi
callq 0xeb38
movq 0x5240(%r15), %rdx
pushq $0x2d
popq %rsi
movq %r13, %rdi
callq 0xf1d3
movq %r15, %rdi
callq 0x12350
movq (%rsp), %r12
movq %r12, %rdi
callq 0x4bcc
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x10c75
movq %r12, %rdi
callq 0x4b91
movq %r13, %rdi
callq 0xfbb1
movq %r13, %rdi
callq 0xed28
movq %r15, %rdi
movq %rbp, %rsi
callq 0x8c92
movl (%r14), %esi
movq %r13, %rdi
jmp 0x9cf1
testq %r12, %r12
je 0x9cc3
movq 0x5118(%r15), %rdi
leaq 0x60d65(%rip), %rsi     # 0x6aa1f
xorl %eax, %eax
callq *0x50f8(%r15)
leaq 0x4e18(%r15), %rdi
leaq 0x4220(%r15), %rsi
movq %r14, %rdx
callq 0x15100
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %rax, %rsi
callq 0xf542
movl (%r14), %esi
movq %r15, %rdi
callq 0xee17
jmp 0x9811