// File: /workspace/github_c_makefile_star2_O1/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
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x11c15
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x1f243
testb %al, %al
je 0x12312
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 0x1232a
movl (%r14), %edx
addl $-0x4, %edx
cmpl $0xa, %edx
jb 0x1233f
movl %ecx, %edx
andl $-0x2, %edx
cmpl $0xe, %edx
jne 0x12361
movl (%r14), %edx
andl $-0x2, %edx
cmpl $0xe, %edx
jne 0x12361
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 0x12802
cmpl $0x10, %ecx
jne 0x123d7
cmpl $0x10, (%r14)
jne 0x123d7
leaq 0x4e18(%r15), %r13
movq 0x8(%r14), %rsi
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
movq %rsi, (%rsp)
callq 0x1ede7
movq %r15, %rbp
movq %r12, %r15
movl %eax, %r12d
movq %r13, %rdi
movq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0x1ede7
cmpl %eax, %r12d
movq %r15, %r12
movq %rbp, %r15
jg 0x123d7
movq (%rsp), %rdi
movl $0x1, %esi
callq 0x1eeaf
testb %al, %al
jne 0x123d7
movq %r13, %rdi
movl $0x1, %esi
callq 0x1eeaf
testb %al, %al
je 0x122fd
movq (%rbx), %rcx
movl (%rcx), %eax
cmpl $0x17, %eax
jne 0x12425
movl (%r14), %edx
cmpl $0x17, %edx
je 0x12425
cmpl $0x10, %edx
jne 0x127ae
testq %r12, %r12
je 0x1240e
movq 0x5118(%r15), %rdi
leaq 0x65676(%rip), %rsi     # 0x77a7b
xorl %eax, %eax
callq *0x50f8(%r15)
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %r14, %rsi
callq 0x18ac3
jmp 0x122fd
cmpl $0x13, %eax
jne 0x1245e
movq 0x8(%rcx), %rcx
cmpl $0x8, (%rcx)
jne 0x1245e
cmpl $0x14, (%r14)
jne 0x1245e
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 0x12919
cmpl $0x14, %eax
jne 0x12494
cmpl $0x13, (%r14)
jne 0x12494
movq 0x8(%r14), %rcx
cmpl $0x8, (%rcx)
jne 0x12494
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 0x129c8
cmpl $0x13, %eax
jne 0x12300
cmpl $0x13, (%r14)
jne 0x12300
movq %r12, 0x18(%rsp)
testq %r12, %r12
je 0x124c8
movq 0x5118(%r15), %rdi
leaq 0x65639(%rip), %rsi     # 0x77af8
xorl %eax, %eax
callq *0x50f8(%r15)
leaq 0x4e38(%r15), %rdi
movq %rdi, (%rsp)
leaq 0x4e18(%r15), %rsi
movq %rsi, 0x10(%rsp)
leaq 0x4220(%r15), %rbp
movq 0x5240(%r15), %rcx
movq %rbp, %rdx
movq %rbp, 0x8(%rsp)
callq 0x1a2d1
movl %eax, %r12d
leaq 0x4e70(%r15), %r13
movq %r13, %rdi
callq 0x18271
movq (%rbx), %rax
movl (%rax), %esi
movq %r13, %rdi
movl $0x22, %edx
callq 0x18cbb
movq %r13, %rdi
movl %r12d, %esi
callq 0x17f78
movq %r13, %rdi
movl $0x7, %esi
xorl %edx, %edx
callq 0x183d5
leaq 0x100(%r15), %rdx
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x1a429
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x1c086
movq %r13, %rdi
movl $0x7, %esi
movl %r12d, %edx
callq 0x1807e
movq %r15, %rdi
movq %rbp, 0x20(%rsp)
movq %rbp, %rsi
callq 0x11b32
movq %r13, %rdi
movq %r14, %rsi
movl $0x16, %edx
callq 0x18ec4
movq %r13, %rdi
callq 0x181b1
movq 0x5240(%r15), %rcx
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x1a2d1
movl %eax, %ebp
movq %r13, %rdi
movl $0x7, %esi
movl %r12d, %edx
callq 0x1807e
movl $0x1, %esi
movq %r13, %rdi
callq 0x17eca
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x17, %esi
callq 0x187fc
movq %r13, %rdi
movl %ebp, %esi
callq 0x17f78
movq %r13, %rdi
movl $0x7, %esi
xorl %edx, %edx
callq 0x183d5
movq %r13, %rdi
callq 0x192c3
movq %r13, %rdi
movl $0x7, %esi
movl %ebp, %edx
callq 0x1807e
movq %r13, %rdi
xorl %esi, %esi
callq 0x17eca
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x36, %esi
callq 0x187fc
movq %r13, %rdi
callq 0x192ea
movq 0x8(%rsp), %rdi
callq 0xd774
movq %r13, %rdi
callq 0x18271
movq %r13, %rdi
movl $0x7, %esi
movl %ebp, 0x10(%rsp)
movl %ebp, %edx
callq 0x1807e
movq %r13, %rdi
callq 0x18a16
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0x182ba
movq (%rbx), %rax
movq 0x8(%rax), %rax
leaq 0x28(%rsp), %r12
movq %rax, (%r12)
movq 0x8(%r14), %rsi
movq %r15, %rdi
movq %r12, %rdx
movq 0x18(%rsp), %rcx
callq 0x122c6
movq 0x8(%r14), %rdi
movq (%r12), %rsi
callq 0x1ef64
testb %al, %al
jne 0x12700
movq 0x50f8(%r15), %rbp
movq 0x5118(%r15), %rax
movq %rax, 0x18(%rsp)
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x130(%rsp), %rsi
callq 0x1ee46
movq %rax, %r12
movq 0x8(%r14), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1ee46
leaq 0x6544c(%rip), %rsi     # 0x77b3d
movq 0x18(%rsp), %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq *%rbp
movq %r15, %rdi
movq 0x20(%rsp), %rbp
movq %rbp, %rsi
callq 0x11b32
movl (%r14), %esi
movq %r13, %rdi
callq 0x182ba
movq %r13, %rdi
movl $0x7, %esi
movl 0x10(%rsp), %r12d
movl %r12d, %edx
callq 0x1807e
movq %r13, %rdi
callq 0x18a16
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0x18659
movq %r13, %rdi
movl %r12d, %esi
callq 0x17f78
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x2d, %esi
callq 0x1872d
movq %r15, %rdi
callq 0x1bef8
movq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xd824
movq (%rsp), %rdi
movl %eax, %esi
callq 0x1a60e
movq %r12, %rdi
callq 0xd7f2
movq %r13, %rdi
callq 0x192ef
movq %r13, %rdi
callq 0x181b1
movq %r15, %rdi
movq %rbp, %rsi
callq 0x11b32
movl (%r14), %esi
movq %r13, %rdi
jmp 0x127f8
testq %r12, %r12
je 0x127ca
movq 0x5118(%r15), %rdi
leaq 0x652ba(%rip), %rsi     # 0x77a7b
xorl %eax, %eax
callq *0x50f8(%r15)
leaq 0x4e18(%r15), %rdi
leaq 0x4220(%r15), %rsi
movq %r14, %rdx
callq 0x1edd3
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %rax, %rsi
callq 0x18ac3
movl (%r14), %esi
movq %r15, %rdi
callq 0x182ba
jmp 0x122fd