// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_vm.c
// Function: doGetMapKeyBytes
static void doGetMapKeyBytes(Slot key, const Type *keyType, Error *error, char **keyBytes, int *keySize)
{
    switch (keyType->kind)
    {
        case TYPE_INT8:
        case TYPE_INT16:
        case TYPE_INT32:
        case TYPE_INT:
        case TYPE_UINT8:
        case TYPE_UINT16:
        case TYPE_UINT32:
        case TYPE_UINT:
        case TYPE_BOOL:
        case TYPE_CHAR:
        case TYPE_REAL32:
        case TYPE_REAL:
        case TYPE_PTR:
        case TYPE_WEAKPTR:
        {
            // keyBytes must point to a pre-allocated 8-byte buffer
            doAssignImpl(*keyBytes, key, keyType->kind, 0, error);
            *keySize = keyType->size;
            break;
        }
        case TYPE_STR:
        {
            doCheckStr((char *)key.ptrVal, error);
            *keyBytes = key.ptrVal ? (char *)key.ptrVal : doGetEmptyStr();
            *keySize = getStrDims(*keyBytes)->len + 1;
            break;
        }
        case TYPE_ARRAY:
        case TYPE_STRUCT:
        {
            *keyBytes = (char *)key.ptrVal;
            *keySize = keyType->size;
            break;
        }
        default:
        {
            *keyBytes = NULL;
            *keySize = 0;
            break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x68(%rbp)
movq %rsi, -0x70(%rbp)
movq %rdx, -0x78(%rbp)
movq %rcx, -0x80(%rbp)
movq %r8, -0x88(%rbp)
movq -0x70(%rbp), %rax
movl (%rax), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0x90(%rbp)
subl $0x12, %eax
ja 0x1d3aea
movq -0x90(%rbp), %rax
leaq 0xa4a5(%rip), %rcx      # 0x1ddc30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x80(%rbp), %rax
movq (%rax), %rdx
movq -0x70(%rbp), %rax
movl (%rax), %ecx
movq -0x78(%rbp), %rax
movq -0x68(%rbp), %rsi
movq %rsi, -0x30(%rbp)
movq %rdx, -0x38(%rbp)
movl %ecx, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x38(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d37cf
jmp 0x1d37ef
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x47e5(%rip), %rdx      # 0x1d7fd0
movb $0x0, %al
callq *%rcx
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x3c(%rbp), %edi
movq -0x50(%rbp), %rsi
callq 0xf3d80
testb $0x1, %al
jne 0x1d3809
jmp 0x1d3851
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
movl -0x3c(%rbp), %edi
callq 0x23b40
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %r8
movq %rax, %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x4a34(%rip), %rdx      # 0x1d8280
movb $0x0, %al
callq *%r8
movl -0x3c(%rbp), %eax
addl $-0x4, %eax
movl %eax, %ecx
movq %rcx, -0xa8(%rbp)
subl $0x16, %eax
ja 0x1d39f3
movq -0xa8(%rbp), %rax
leaq 0xa405(%rip), %rcx      # 0x1ddc7c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movw %ax, %cx
movq -0x38(%rbp), %rax
movw %cx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
cmpq $0x0, -0x30(%rbp)
setne %cl
movq -0x38(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
jmp 0x1d3a13
movsd -0x30(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x38(%rbp), %rax
movss %xmm0, (%rax)
jmp 0x1d3a13
movsd -0x30(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, -0x20(%rbp)
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
cmpq $0x0, -0x30(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d39a6
jmp 0x1d39c6
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x460e(%rip), %rdx      # 0x1d7fd0
movb $0x0, %al
callq *%rcx
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
movslq -0x40(%rbp), %rdx
callq 0x3270
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1d3a13
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
leaq 0x45d1(%rip), %rdx      # 0x1d7fe0
movb $0x0, %al
callq *%rcx
movq -0x70(%rbp), %rax
movl 0xc0(%rax), %ecx
movq -0x88(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1d3b02
movq -0x68(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x58(%rbp)
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x1d3a4f
movq -0x68(%rbp), %rax
movq %rax, -0xb0(%rbp)
jmp 0x1d3a9c
movq 0x656a(%rip), %rax      # 0x1d9fc0
movq %rax, -0x10(%rbp)
movq 0x6567(%rip), %rax      # 0x1d9fc8
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x12ef0(%rip)     # 0x1e6960
movq -0x8(%rbp), %rax
movq %rax, 0x12eed(%rip)     # 0x1e6968
leaq 0x12ede(%rip), %rax     # 0x1e6960
addq $0x10, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq (%rax), %rdi
callq 0xf4060
movq (%rax), %rax
addq $0x1, %rax
movl %eax, %ecx
movq -0x88(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1d3b02
movq -0x68(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movl 0xc0(%rax), %ecx
movq -0x88(%rbp), %rax
movl %ecx, (%rax)
jmp 0x1d3b02
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x88(%rbp), %rax
movl $0x0, (%rax)
addq $0xb0, %rsp
popq %rbp
retq