// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/gen_dfa.c
// Function: gen_terminated_table
void
gen_terminated_table(int filde, lexical_spec_t const* spec,
                                            char const* header, size_t kind) {
    vector_t* dst_vect = new_vector();
    if (!dst_vect)
        { return; }

    for (size_t i = 0; i < SIZE_VECTOR(spec->entry_vect); ++i) {
        spec_entry_t* entry = (spec_entry_t*)AT_VECTOR(spec->entry_vect, i);
        if ((entry->kind == T_TERMINAL) && (!entry->fragment)) {
            if (kind == SKIP_TABLE && entry->must_skip)
                { PUSH_BACK_VECTOR(dst_vect, entry); }
            else if (kind == LOOK_TABLE && entry->use_look)
                { PUSH_BACK_VECTOR(dst_vect, entry); }
        }
    }

    size_t size_table = SIZE_VECTOR(dst_vect);
    if (size_table) {
        dprintf(filde, STATIC SP "int%u_t" NL,
                                min_size_type(size_table, false));

        gen_verbatim_file(filde, header);
        dprintf(filde, "_%s_table[%zu] = " BEG_BLOCK NL,
                ((kind == SKIP_TABLE) ? "skip" : "look"), size_table + 1);

        for (size_t i = 0; i < size_table; ++i) {
            spec_entry_t* entry = (spec_entry_t*)AT_VECTOR(dst_vect, i);
            dprintf(filde, TAB TOKEN_PREFIX SEP "%s" COMMA NL, entry->name);
        }
        dprintf(filde, TAB "-1" COMMA NL END_BLOCK SEMI NL NL);
    }
    else {
        dprintf(filde, DEFINE(%s_TABLE_NOT_DEFINE,) NL NL,
                                ((kind == SKIP_TABLE) ? "SKIP" : "LOOK"));
    }
    del_vector(dst_vect);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movl %edi, %r14d
callq 0x2b2c
testq %rax, %rax
je 0x9b05
movq %rax, %rbx
movq %r12, -0x30(%rbp)
movq 0x8(%r13), %rax
cmpq $0x0, 0x10(%rax)
je 0x9a66
xorl %r12d, %r12d
movq (%rax), %rax
movq (%rax,%r12,8), %rdx
cmpl $0x2d, 0x8(%rdx)
jne 0x9a4f
cmpb $0x0, 0x18(%rdx)
jne 0x9a4f
testq %r15, %r15
je 0x9a5e
cmpq $0x1, %r15
jne 0x9a4f
cmpb $0x0, 0x1b(%rdx)
je 0x9a4f
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x2c21
incq %r12
movq 0x8(%r13), %rax
cmpq 0x10(%rax), %r12
jb 0x9a1f
jmp 0x9a66
cmpb $0x1, 0x1a(%rdx)
je 0x9a43
jmp 0x9a4f
movq 0x10(%rbx), %r13
testq %r13, %r13
je 0x9b14
movq %r13, %rdi
xorl %esi, %esi
callq 0x3d5c
movzbl %al, %edx
leaq 0x259b(%rip), %rsi      # 0xc022
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
movl %r14d, %edi
movq -0x30(%rbp), %rsi
callq 0x3eea
cmpq $0x1, %r15
leaq 0x259e(%rip), %rax      # 0xc046
leaq 0x259c(%rip), %rdx      # 0xc04b
cmoveq %rax, %rdx
leaq 0x1(%r13), %rcx
leaq 0x2574(%rip), %rsi      # 0xc032
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x23d7(%rip), %r15      # 0xbea6
xorl %r12d, %r12d
movq (%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rax), %rdx
movl %r14d, %edi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2110
incq %r12
cmpq %r12, %r13
jne 0x9ad2
leaq 0x2557(%rip), %rsi      # 0xc050
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
jmp 0x9b3b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x1, %r15
leaq 0x117a(%rip), %rax      # 0xac99
leaq 0x2553(%rip), %rdx      # 0xc079
cmoveq %rax, %rdx
leaq 0x2529(%rip), %rsi      # 0xc05a
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2bce