// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_expr.c
// Function: parseBuiltinMakeCall
static void parseBuiltinMakeCall(Compiler *comp, const Type **type, Const *constant)
{
    if (constant)
        comp->error.handler(comp->error.context, "Function is not allowed in constant expressions");

    *type = parseType(comp, NULL);
    typeAssertCompatibleBuiltin(&comp->types, *type, BUILTIN_MAKE, (*type)->kind == TYPE_DYNARRAY || (*type)->kind == TYPE_MAP || (*type)->kind == TYPE_FIBER);

    if ((*type)->kind == TYPE_DYNARRAY)
    {
        lexEat(&comp->lex, TOK_COMMA);

        // Dynamic array length
        const Type *lenType = comp->intType;
        parseExpr(comp, &lenType, NULL);
        typeAssertCompatible(&comp->types, comp->intType, lenType);

        // Pointer to result (hidden parameter)
        int resultOffset = identAllocStack(&comp->idents, &comp->types, &comp->blocks, *type);
        genPushLocalPtr(&comp->gen, resultOffset);
    }
    else if ((*type)->kind == TYPE_MAP)
    {
        // Pointer to result (hidden parameter)
        int resultOffset = identAllocStack(&comp->idents, &comp->types, &comp->blocks, *type);
        genPushLocalPtr(&comp->gen, resultOffset);
    }
    else if ((*type)->kind == TYPE_FIBER)
    {
        lexEat(&comp->lex, TOK_COMMA);

        // Child fiber closure
        const Type *fiberClosureType = comp->fiberType->base;
        parseExpr(comp, &fiberClosureType, constant);
        doAssertImplicitTypeConv(comp, comp->fiberType->base, &fiberClosureType, NULL);
    }
    else
        comp->error.handler(comp->error.context, "Illegal type");

    genCallTypedBuiltin(&comp->gen, *type, BUILTIN_MAKE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x116bc
movq -0x8(%rbp), %rax
movq 0x50f8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x5118(%rax), %rdi
leaq 0x1c7623(%rip), %rsi    # 0x1d8cdb
movb $0x0, %al
callq *%rcx
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9b80
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
addq $0x4e18, %rax           # imm = 0x4E18
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movb $0x1, %al
cmpl $0x13, (%rcx)
movb %al, -0x31(%rbp)
je 0x1171e
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movb $0x1, %al
cmpl $0x15, (%rcx)
movb %al, -0x31(%rbp)
je 0x1171e
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x19, (%rax)
sete %al
movb %al, -0x31(%rbp)
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdi
movb -0x31(%rbp), %al
movzbl %al, %ecx
andl $0x1, %ecx
movl $0x16, %edx
callq 0x229e0
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x13, (%rax)
jne 0x117e5
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
movl $0x3f, %esi
callq 0x1b150
movq -0x8(%rbp), %rax
movq 0x5240(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xe8c0
movq -0x8(%rbp), %rdi
addq $0x4e18, %rdi           # imm = 0x4E18
movq -0x8(%rbp), %rax
movq 0x5240(%rax), %rsi
movq -0x20(%rbp), %rdx
callq 0x22870
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x4e18, %rsi           # imm = 0x4E18
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x10(%rbp), %rax
movq (%rax), %rcx
callq 0x1a320
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
movl -0x24(%rbp), %esi
callq 0x169a0
jmp 0x118c5
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x15, (%rax)
jne 0x11839
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x4e18, %rsi           # imm = 0x4E18
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x10(%rbp), %rax
movq (%rax), %rcx
callq 0x1a320
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
movl -0x28(%rbp), %esi
callq 0x169a0
jmp 0x118c3
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x19, (%rax)
jne 0x118a0
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
movl $0x3f, %esi
callq 0x1b150
movq -0x8(%rbp), %rax
movq 0x5290(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rsi
callq 0xe8c0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x5290(%rax), %rax
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0xd6e0
jmp 0x118c1
movq -0x8(%rbp), %rax
movq 0x50f8(%rax), %rcx
movq -0x8(%rbp), %rax
movq 0x5118(%rax), %rdi
leaq 0x1c6723(%rip), %rsi    # 0x1d7fe0
movb $0x0, %al
callq *%rcx
jmp 0x118c3
jmp 0x118c5
movq -0x8(%rbp), %rdi
addq $0x4e70, %rdi           # imm = 0x4E70
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x16, %edx
callq 0x182e0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)