// File: /workspace/github_c_makefile_star2_O1/vtereshkov[P]umka-lang/src/umka_decl.c
// Function: parseConstDeclItem
static void parseConstDeclItem(Compiler *comp, const Type **type, Const *constant)
{
    lexCheck(&comp->lex, TOK_IDENT);
    IdentName name;
    strcpy(name, comp->lex.tok.name);

    lexNext(&comp->lex);
    bool exported = parseExportMark(comp);

    if (*type && typeInteger(*type) && comp->lex.tok.kind != TOK_EQ)
    {
        constant->intVal++;

        if (typeOverflow((*type)->kind, *constant))
            comp->error.handler(comp->error.context, "Overflow of %s", typeKindSpelling((*type)->kind));
    }
    else
    {
        lexEat(&comp->lex, TOK_EQ);
        *type = NULL;
        parseExpr(comp, type, constant);

        if (!typeOrdinal(*type) && !typeReal(*type) && (*type)->kind != TYPE_STR && (*type)->kind != TYPE_CLOSURE)
            comp->error.handler(comp->error.context, "Constant must be ordinal, or real, or string, or closure");
    }

    identAddConst(&comp->idents, &comp->modules, &comp->blocks, name, *type, exported, *constant);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x4ba8(%rdi), %r12
movq %r12, %rdi
movl $0x45, %esi
callq 0x1b3c8
leaq 0x4bd8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x30a0
movq %r12, %rdi
callq 0x1a984
movl 0x4bd0(%rbx), %ebp
cmpl $0x18, %ebp
jne 0x113af
movq %r12, %rdi
callq 0x1b39a
movq (%r15), %rax
testq %rax, %rax
je 0x113d0
movl (%rax), %ecx
addl $-0x4, %ecx
cmpl $0x7, %ecx
ja 0x113d0
cmpb $0x0, 0x16(%rax)
jne 0x113d0
cmpl $0x31, 0x4bd0(%rbx)
jne 0x11440
movq %r12, %rdi
movl $0x31, %esi
callq 0x1b41f
movq $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1617b
movq (%r15), %rax
movl (%rax), %eax
leal -0x4(%rax), %ecx
cmpl $0xa, %ecx
setb %cl
movl %eax, %edx
andl $-0x2, %edx
cmpl $0xe, %edx
sete %dl
orb %cl, %dl
jne 0x11515
cmpl $0x14, %eax
je 0x11515
cmpl $0x18, %eax
je 0x11515
movq 0x5118(%rbx), %rdi
leaq 0x65ff1(%rip), %rsi     # 0x77424
xorl %eax, %eax
callq *0x50f8(%rbx)
jmp 0x11515
movq (%r14), %rcx
leaq 0x1(%rcx), %rax
movq %rax, (%r14)
movq (%r15), %rdx
movl (%rdx), %edi
leal -0x4(%rdi), %edx
cmpl $0x16, %edx
ja 0x114f0
leaq 0x65d02(%rip), %rsi     # 0x77164
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
cmpq $0x100, %rax            # imm = 0x100
jmp 0x114b6
addq $-0x7fffffff, %rcx      # imm = 0x80000001
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %rcx
jmp 0x114e0
addq $-0x7f, %rcx
cmpq $-0x100, %rcx
jmp 0x114e0
cmpq $0x2, %rax
jmp 0x114b6
btrq $0x3f, %rax
movq %rax, %xmm0
ucomisd 0x65b02(%rip), %xmm0    # 0x76fb0
jmp 0x114cd
cmpq $0x10000, %rax          # imm = 0x10000
setae %al
jmp 0x114ec
btrq $0x3f, %rax
movq %rax, %xmm0
ucomisd 0x65adb(%rip), %xmm0    # 0x76fa8
seta %al
jmp 0x114ec
addq $-0x7fff, %rcx          # imm = 0x8001
cmpq $-0x10000, %rcx         # imm = 0xFFFF0000
setb %al
jmp 0x114ec
shrq $0x20, %rax
setne %al
testb %al, %al
je 0x11515
movq 0x50f8(%rbx), %r13
movq 0x5118(%rbx), %r12
callq 0x1fe46
leaq 0x65d2e(%rip), %rsi     # 0x77238
movq %r12, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq *%r13
xorl %r9d, %r9d
cmpl $0x18, %ebp
sete %r9b
leaq 0x4e38(%rbx), %rdi
leaq 0x100(%rbx), %rsi
addq $0x4220, %rbx           # imm = 0x4220
movq (%r15), %r8
movq (%r14), %rax
movq %rax, (%rsp)
leaq 0x10(%rsp), %rcx
movq %rbx, %rdx
callq 0x19dcf
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq