// File: /workspace/github_c_makefile_star2_O3/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 0xcabc
movq (%rbx), %rsi
movq %r14, %rdi
callq 0x1a214
testb %al, %al
je 0xd1fa
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 0xd212
movl (%r14), %edx
addl $-0x4, %edx
cmpl $0xa, %edx
jb 0xd22b
movl %ecx, %esi
andl $-0x2, %esi
movl (%r14), %edx
cmpl $0xe, %esi
jne 0xd24d
andl $-0x2, %edx
cmpl $0xe, %edx
jne 0xd2b7
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 0xd6ed
xorl $0x10, %edx
xorl $0x10, %ecx
orl %edx, %ecx
jne 0xd2b7
leaq 0x4e18(%r15), %r13
movq 0x8(%r14), %rsi
movq %r15, (%rsp)
movq 0x8(%rax), %r15
movq %r13, %rdi
movq %rsi, 0x8(%rsp)
callq 0x19e29
movl %eax, %ebp
movq %r13, %rdi
movq %r15, %r13
movq (%rsp), %r15
movq %r13, %rsi
callq 0x19e29
cmpl %eax, %ebp
jg 0xd2b7
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x19ef5
testb %al, %al
jne 0xd2b7
movq %r13, %rdi
movl $0x1, %esi
callq 0x19ef5
testb %al, %al
je 0xd1e5
movq (%rbx), %rcx
movl (%rcx), %eax
cmpl $0x13, %eax
je 0xd354
cmpl $0x14, %eax
je 0xd31b
cmpl $0x17, %eax
jne 0xd1e8
movl (%r14), %eax
cmpl $0x17, %eax
je 0xd1e8
cmpl $0x10, %eax
jne 0xd699
testq %r12, %r12
je 0xd304
movq 0x5118(%r15), %rdi
leaq 0x69780(%rip), %rsi     # 0x76a7b
xorl %eax, %eax
callq *0x50f8(%r15)
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %r14, %rsi
callq 0x13a94
jmp 0xd1e5
cmpl $0x13, (%r14)
jne 0xd1e8
movq 0x8(%r14), %rax
cmpl $0x8, (%rax)
jne 0xd1e8
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 0xd8e0
movq 0x8(%rcx), %rax
movl (%rax), %ecx
xorl $0x8, %ecx
movl (%r14), %eax
movl %eax, %edx
xorl $0x14, %edx
orl %ecx, %edx
jne 0xd38e
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 0xd831
cmpl $0x13, %eax
jne 0xd1e8
testq %r12, %r12
je 0xd3b3
movq 0x5118(%r15), %rdi
leaq 0x6974e(%rip), %rsi     # 0x76af8
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 0x15267
movl %eax, %ebp
movl %eax, 0x10(%rsp)
leaq 0x4e70(%r15), %r13
movq %r13, %rdi
callq 0x13273
movq (%rbx), %rax
movl (%rax), %esi
movq %r13, %rdi
movl $0x22, %edx
callq 0x13c9c
movq %r13, %rdi
movl %ebp, %esi
callq 0x12f97
movq %r13, %rdi
movl $0x7, %esi
xorl %edx, %edx
callq 0x133bf
leaq 0x100(%r15), %rdx
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x153ba
movq %rax, %rbp
movq %r15, %rdi
movq %rax, %rsi
callq 0x17011
movq %r13, %rdi
movl $0x7, %esi
movl 0x10(%rsp), %edx
callq 0x1309c
movq %r15, %rdi
movq %rbp, 0x20(%rsp)
movq %rbp, %rsi
callq 0xc9da
movq %r13, %rdi
movq %r14, %rsi
movl $0x16, %edx
callq 0x13e7c
movq %r13, %rdi
callq 0x131c1
movq 0x5240(%r15), %rcx
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq (%rsp), %rdx
callq 0x15267
movl %eax, %ebp
movq %r13, %rdi
movl $0x7, %esi
movl 0x10(%rsp), %edx
callq 0x1309c
movl $0x1, %esi
movq %r13, %rdi
callq 0x12ef1
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x17, %esi
callq 0x137c1
movq %r13, %rdi
movl %ebp, %esi
callq 0x12f97
movq %r13, %rdi
movl $0x7, %esi
xorl %edx, %edx
callq 0x133bf
movq %r13, %rdi
callq 0x14287
movq %r13, %rdi
movl $0x7, %esi
movl %ebp, %edx
callq 0x1309c
movq %r13, %rdi
xorl %esi, %esi
callq 0x12ef1
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x36, %esi
callq 0x137c1
movq %r13, %rdi
callq 0x142ae
movq (%rsp), %rdi
callq 0x8503
movq %r13, %rdi
callq 0x13273
movq %r13, %rdi
movl $0x7, %esi
movl %ebp, 0x18(%rsp)
movl %ebp, %edx
callq 0x1309c
movq %r13, %rdi
callq 0x139f0
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl (%rax), %esi
movq %r13, %rdi
callq 0x132bc
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 0xd1ae
movq 0x8(%r14), %rdi
movq (%rbp), %rsi
callq 0x19f7d
testb %al, %al
jne 0xd5eb
movq 0x50f8(%r15), %rax
movq %rax, 0x10(%rsp)
movq 0x5118(%r15), %r12
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x130(%rsp), %rsi
callq 0x19e8a
movq %rax, %rbp
movq 0x8(%r14), %rdi
leaq 0x30(%rsp), %rsi
callq 0x19e8a
leaq 0x69561(%rip), %rsi     # 0x76b3d
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 0xc9da
movl (%r14), %esi
movq %r13, %rdi
callq 0x132bc
movq %r13, %rdi
movl $0x7, %esi
movl 0x18(%rsp), %r12d
movl %r12d, %edx
callq 0x1309c
movq %r13, %rdi
callq 0x139f0
movq 0x8(%r14), %rsi
movq %r13, %rdi
callq 0x1362e
movq %r13, %rdi
movl %r12d, %esi
callq 0x12f97
movq 0x5240(%r15), %rdx
movq %r13, %rdi
movl $0x2d, %esi
callq 0x136fc
movq %r15, %rdi
callq 0x16e84
movq (%rsp), %r12
movq %r12, %rdi
callq 0x85bf
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x1559f
movq %r12, %rdi
callq 0x8584
movq %r13, %rdi
callq 0x142b3
movq %r13, %rdi
callq 0x131c1
movq %r15, %rdi
movq %rbp, %rsi
callq 0xc9da
movl (%r14), %esi
movq %r13, %rdi
jmp 0xd6e3
testq %r12, %r12
je 0xd6b5
movq 0x5118(%r15), %rdi
leaq 0x693cf(%rip), %rsi     # 0x76a7b
xorl %eax, %eax
callq *0x50f8(%r15)
leaq 0x4e18(%r15), %rdi
leaq 0x4220(%r15), %rsi
movq %r14, %rdx
callq 0x19e01
addq $0x4e70, %r15           # imm = 0x4E70
movq %r15, %rdi
movq %rax, %rsi
callq 0x13a94
movl (%r14), %esi
movq %r15, %rdi
callq 0x132bc
jmp 0xd1e5