// File: /workspace/github_c_makefile_star2_O3/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 0x16329
leaq 0x4bd8(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x30a0
movq %r12, %rdi
callq 0x15914
movl 0x4bd0(%rbx), %ebp
cmpl $0x18, %ebp
jne 0xc1f7
movq %r12, %rdi
callq 0x162fb
movq (%r15), %rax
testq %rax, %rax
je 0xc218
movl (%rax), %ecx
addl $-0x4, %ecx
cmpl $0x7, %ecx
ja 0xc218
cmpb $0x0, 0x16(%rax)
jne 0xc218
cmpl $0x31, 0x4bd0(%rbx)
jne 0xc279
movq %r12, %rdi
movl $0x31, %esi
callq 0x1637d
movq $0x0, (%r15)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x111c3
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 0xc2cd
cmpl $0x14, %eax
je 0xc2cd
cmpl $0x18, %eax
je 0xc2cd
movq 0x5118(%rbx), %rdi
leaq 0x6a1b5(%rip), %rsi     # 0x76424
xorl %eax, %eax
callq *0x50f8(%rbx)
jmp 0xc2cd
movq (%r14), %rcx
leaq 0x1(%rcx), %rax
movq %rax, (%r14)
movq (%r15), %rdx
movl (%rdx), %edi
leal -0x4(%rdi), %edx
cmpl $0x16, %edx
ja 0xc2a8
leaq 0x69ecd(%rip), %rsi     # 0x76164
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
cmpq $0xff, %rax
jbe 0xc2cd
movq 0x50f8(%rbx), %r13
movq 0x5118(%rbx), %r12
callq 0x1adb4
leaq 0x69f76(%rip), %rsi     # 0x76238
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 0x14d61
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $-0x7fffffff, %rcx      # imm = 0x80000001
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %rcx
jb 0xc2a8
jmp 0xc2cd
addq $-0x7f, %rcx
cmpq $-0x101, %rcx           # imm = 0xFEFF
jbe 0xc2a8
jmp 0xc2cd
cmpq $0x1, %rax
ja 0xc2a8
jmp 0xc2cd
btrq $0x3f, %rax
movq %rax, %xmm0
ucomisd 0x69c93(%rip), %xmm0    # 0x75ff8
ja 0xc2a8
jmp 0xc2cd
cmpq $0xffff, %rax           # imm = 0xFFFF
ja 0xc2a8
jmp 0xc2cd
btrq $0x3f, %rax
movq %rax, %xmm0
ucomisd 0x69c5d(%rip), %xmm0    # 0x75ff0
ja 0xc2a8
jmp 0xc2cd
addq $-0x7fff, %rcx          # imm = 0x8001
cmpq $-0x10000, %rcx         # imm = 0xFFFF0000
jb 0xc2a8
jmp 0xc2cd
shrq $0x20, %rax
jne 0xc2a8
jmp 0xc2cd