// File: /workspace/github_c_makefile_star2_O0/vtereshkov[P]umka-lang/src/umka_decl.c
// Function: parseTypeOrForwardType
static const Type *parseTypeOrForwardType(Compiler *comp)
{
    const Type *type = NULL;

    // Forward declaration?
    bool forward = false;
    if (comp->types.forwardTypesEnabled && comp->lex.tok.kind == TOK_IDENT)
    {
        const Ident *ident = NULL;

        Lexer lookaheadLex = comp->lex;
        lexNext(&lookaheadLex);
        if (lookaheadLex.tok.kind == TOK_COLONCOLON)
            ident = identFindModule(&comp->idents, &comp->modules, &comp->blocks, comp->blocks.module, comp->lex.tok.name, true);
        else
            ident = identFind(&comp->idents, &comp->modules, &comp->blocks, comp->blocks.module, comp->lex.tok.name, NULL, true);

        if (!ident)
        {
            Type *forwardType = typeAdd(&comp->types, &comp->blocks, TYPE_FORWARD);
            forwardType->typeIdent = identAddType(&comp->idents, &comp->modules, &comp->blocks, comp->lex.tok.name, forwardType, false);
            identSetUsed(forwardType->typeIdent);

            lexNext(&comp->lex);

            type = forwardType;
            forward = true;
        }
    }

    // Conventional declaration
    if (!forward)
        type = parseType(comp, NULL);

    return type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x4e20(%rax)
je 0xb30c
movq -0x8(%rbp), %rax
cmpl $0x45, 0x4bd0(%rax)
jne 0xb30c
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rsi
addq $0x4ba8, %rsi           # imm = 0x4BA8
leaq -0x290(%rbp), %rdi
movl $0x270, %edx            # imm = 0x270
callq 0x3270
leaq -0x290(%rbp), %rdi
callq 0x1ad90
cmpl $0x42, -0x268(%rbp)
jne 0xb205
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x8(%rbp), %rax
movl 0x4b88(%rax), %ecx
movq -0x8(%rbp), %r8
addq $0x4ba8, %r8            # imm = 0x4BA8
addq $0x28, %r8
addq $0x8, %r8
movl $0x1, %r9d
callq 0x19900
movq %rax, -0x20(%rbp)
jmp 0xb258
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x8(%rbp), %rax
movl 0x4b88(%rax), %ecx
movq -0x8(%rbp), %r8
addq $0x4ba8, %r8            # imm = 0x4BA8
addq $0x28, %r8
addq $0x8, %r8
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
callq 0x19580
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xb30a
movq -0x8(%rbp), %rdi
addq $0x4e18, %rdi           # imm = 0x4E18
movq -0x8(%rbp), %rsi
addq $0x4220, %rsi           # imm = 0x4220
movl $0x1, %edx
callq 0x21950
movq %rax, -0x298(%rbp)
movq -0x8(%rbp), %rdi
addq $0x4e38, %rdi           # imm = 0x4E38
movq -0x8(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x8(%rbp), %rdx
addq $0x4220, %rdx           # imm = 0x4220
movq -0x8(%rbp), %rcx
addq $0x4ba8, %rcx           # imm = 0x4BA8
addq $0x28, %rcx
addq $0x8, %rcx
movq -0x298(%rbp), %r8
xorl %r9d, %r9d
callq 0x1a1e0
movq %rax, %rcx
movq -0x298(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x298(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xb330
movq -0x8(%rbp), %rdi
addq $0x4ba8, %rdi           # imm = 0x4BA8
callq 0x1ad90
movq -0x298(%rbp), %rax
movq %rax, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
jmp 0xb30c
testb $0x1, -0x11(%rbp)
jne 0xb323
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9b80
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq