// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/lexical_spec.c
// Function: spec_state_token_list
int
spec_state_token_list(lexical_spec_t* spec, int kind_section) {
    if (peek_token(spec->lex) == T_RBRACE)
        { return (DONE); }
    else if (advance_token(spec->lex) == T_TERMINAL) {
        spec_entry_t* entry = add_entry_lexeme(spec, kind_section);
        if (!entry)
            { return (ERROR); }

        ++(entry->count);
        if (kind_section == T_STATE)
            { entry->is_defined = true; }

        if (peek_token(spec->lex) == T_BARROW) {
            if (kind_section == T_KEYWORD) {
                errorf(CURRENT_LINE(spec->lex),
                            "A '=>' can't appear in the $KEYWORD section.");
                return (ERROR);
            }

            advance_token(spec->lex);
            if (advance_token(spec->lex) != T_INITIAL) {
                errorf(CURRENT_LINE(spec->lex),
                            "Missing $INITIAL after the '=>' in the $STATE.");
                return (ERROR);
            }
            else if (spec->start_state != -1)
                { warnf(CURRENT_LINE(spec->lex), "Override initial state."); }
            spec->start_state = GET_INDEX(entry);
        }

        if (peek_token(spec->lex) == T_COMMA) {
            advance_token(spec->lex);
            return (spec_state_token_list(spec, kind_section));
        }
    }
    else {
        errorf(CURRENT_LINE(spec->lex),
                            "Expected identifier in the %s section.",
                            STATE_TYPE_LST_SECT(kind_section));
        return (ERROR);
    }
    return (DONE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x38ba
xorl %r12d, %r12d
cmpl $0x33, %eax
jne 0x4c41
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6aa0(%rip), %r15      # 0xb6e8
movq (%rbx), %rdi
callq 0x330e
cmpq $0x2d, %rax
jne 0x4d03
movq %rbx, %rdi
movl %r14d, %esi
callq 0x4d60
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x4c2f
movq %rax, %r13
incq 0x28(%rax)
cmpl $0x43, %r14d
jne 0x4c82
movb $0x1, 0x20(%r13)
movq (%rbx), %rdi
callq 0x38ba
cmpl $0x2f, %eax
jne 0x4cd1
movq (%rbx), %rdi
cmpl $0x42, %r14d
je 0x4d39
callq 0x330e
movq (%rbx), %rdi
callq 0x330e
cmpq $0x45, %rax
jne 0x4d46
cmpl $-0x1, 0x18(%rbx)
je 0x4cca
movq (%rbx), %rax
movslq 0x28(%rax), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x22f9
movl (%r13), %eax
movl %eax, 0x18(%rbx)
movq (%rbx), %rdi
callq 0x38ba
xorl %r12d, %r12d
cmpl $0x31, %eax
jne 0x4c2f
movq (%rbx), %rdi
callq 0x330e
movq (%rbx), %rdi
callq 0x38ba
cmpl $0x33, %eax
jne 0x4c48
jmp 0x4c2f
cmpl $0x43, %r14d
movq (%rbx), %rax
movslq 0x28(%rax), %rdi
leaq 0x5f99(%rip), %rax      # 0xacae
leaq 0x5f89(%rip), %rdx      # 0xaca5
cmoveq %rax, %rdx
leaq 0x69d9(%rip), %rsi      # 0xb700
xorl %eax, %eax
callq 0x3f64
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x4c2f
movslq 0x28(%rdi), %rdi
leaq 0x6948(%rip), %rsi      # 0xb68c
jmp 0x4d54
movq (%rbx), %rax
movslq 0x28(%rax), %rdi
leaq 0x6965(%rip), %rsi      # 0xb6b9
xorl %eax, %eax
callq 0x3f64
jmp 0x4c2f