// File: /workspace/github_c_makefile_star2_O1/MaoKo[P]FGFX/fgfl/src/lexical_spec.c
// Function: add_entry_lexeme
static spec_entry_t*
add_entry_lexeme(lexical_spec_t* spec, int kind) {
    if ((kind != T_STATE) && ((!strcmp(C_LEXEME(spec->lex), "ERROR"))
                            || (!strcmp(C_LEXEME(spec->lex), "EOF")))) {
        errorf(CURRENT_LINE(spec->lex),
                    "Can't redefine %s. Name reserved for special use.",
                    C_LEXEME(spec->lex));
        return (NULL);
    }

    int index = get_index_vector(spec->entry_vect,
                            C_LEXEME(spec->lex), &cmp_token_entry);

    spec_entry_t* entry = NULL;
    if (index != -1)
        { entry = (spec_entry_t*)AT_VECTOR(spec->entry_vect, index); }
    else {
        index = get_index_vector(spec->state_vect,
                            C_LEXEME(spec->lex), &cmp_token_entry);
        if (index != -1)
            { entry = (spec_entry_t*)AT_VECTOR(spec->state_vect, index); }
    }

    if (entry) {
        if (entry->kind != kind) {
            errorf(0, "Attempt to define %s into a %s but it is a %s.",
                entry->name, KIND_IN2_STR(kind), KIND_IN2_STR(entry->kind));
            return (NULL);
        }
        return (entry);
    }

    vector_t* src_vect = ((kind == T_STATE)
                        ? spec->state_vect : spec->entry_vect);

    entry = NEW(spec_entry_t, 1);
    if (!entry)
        { return (NULL); }
    memset(entry, 0, sizeof(*entry));

    entry->kind = kind;
    entry->name = strdup(C_LEXEME(spec->lex));

    if (!entry->name) {
        del_spec_entry(entry);
        return (NULL);
    }

    if (entry->kind == T_TERMINAL)
        { entry->default_action = NONE_ACTION; }

    entry->index = SIZE_VECTOR(src_vect);
    PUSH_BACK_VECTOR(src_vect, entry);

    return (entry);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
cmpl $0x43, %esi
je 0x4ea5
movq (%r14), %r15
movq 0x10(%r15), %rax
movq (%rax), %r12
leaq 0x610c(%rip), %rsi      # 0xaf92
movq %r12, %rdi
callq 0x2210
testl %eax, %eax
je 0x4eca
leaq 0x6381(%rip), %rsi      # 0xb21a
movq %r12, %rdi
callq 0x2210
testl %eax, %eax
je 0x4eca
movq (%r14), %rax
movq 0x8(%r14), %rdi
movq 0x10(%rax), %rax
movq (%rax), %rsi
leaq -0x9ec(%rip), %rdx      # 0x44ce
callq 0x2d4a
cmpl $-0x1, %eax
je 0x4ee7
leaq 0x8(%r14), %rcx
jmp 0x4f0e
movslq 0x28(%r15), %rdi
leaq 0x6349(%rip), %rsi      # 0xb21e
xorl %r15d, %r15d
movq %r12, %rdx
xorl %eax, %eax
callq 0x4060
jmp 0x4ffc
movq (%r14), %rax
movq 0x10(%r14), %rdi
movq 0x10(%rax), %rax
movq (%rax), %rsi
leaq -0xa2e(%rip), %rdx      # 0x44ce
callq 0x2d4a
cmpl $-0x1, %eax
je 0x4fe9
leaq 0x10(%r14), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0x4f7b
movl 0x8(%r15), %eax
cmpl %ebx, %eax
je 0x4ffc
cmpl $0x42, %ebx
leaq 0x5d71(%rip), %rdx      # 0xaca6
leaq 0x5d73(%rip), %r8       # 0xacaf
movq %r8, %rcx
cmoveq %rdx, %rcx
cmpl $0x2d, %ebx
leaq 0x6332(%rip), %rsi      # 0xb27f
cmoveq %rsi, %rcx
cmpl $0x42, %eax
cmoveq %rdx, %r8
movq 0x10(%r15), %rdx
cmpl $0x2d, %eax
cmoveq %rsi, %r8
leaq 0x62e6(%rip), %rsi      # 0xb250
xorl %r15d, %r15d
xorl %edi, %edi
xorl %eax, %eax
callq 0x4060
jmp 0x4ffc
xorl %eax, %eax
cmpl $0x43, %ebx
sete %al
movq 0x8(%r14,%rax,8), %r12
movl $0x40, %edi
callq 0x3b4a
testq %rax, %rax
je 0x4ff9
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movl %ebx, 0x8(%rax)
movq (%r14), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
callq 0x21f0
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x4ff1
cmpl $0x2d, %ebx
jne 0x4fd4
movl $0xffffffff, 0x30(%r15) # imm = 0xFFFFFFFF
movq 0x10(%r12), %rsi
movq %rsi, (%r15)
movq %r12, %rdi
movq %r15, %rdx
callq 0x2c31
jmp 0x4ffc
xorl %r15d, %r15d
jmp 0x4f1a
movq %r15, %rdi
callq 0x4491
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq