// File: /workspace/github_c_makefile_star2_O1/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 0x2b3c
testq %rax, %rax
je 0x9c61
movq %rax, %rbx
movq %r12, -0x30(%rbp)
movq 0x8(%r13), %rax
cmpq $0x0, 0x10(%rax)
je 0x9bc2
xorl %r12d, %r12d
movq (%rax), %rax
movq (%rax,%r12,8), %rdx
cmpl $0x2d, 0x8(%rdx)
jne 0x9bb5
cmpb $0x0, 0x18(%rdx)
jne 0x9bb5
testq %r15, %r15
je 0x9ba3
cmpq $0x1, %r15
jne 0x9bb5
cmpb $0x0, 0x1b(%rdx)
jne 0x9ba9
testq %r15, %r15
jne 0x9bb5
cmpb $0x1, 0x1a(%rdx)
jne 0x9bb5
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
callq 0x2c31
incq %r12
movq 0x8(%r13), %rax
cmpq 0x10(%rax), %r12
jb 0x9b7a
movq 0x10(%rbx), %r13
testq %r13, %r13
je 0x9c70
movq %r13, %rdi
xorl %esi, %esi
callq 0x3e58
movzbl %al, %edx
leaq 0x243f(%rip), %rsi      # 0xc022
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
movl %r14d, %edi
movq -0x30(%rbp), %rsi
callq 0x3fe6
cmpq $0x1, %r15
leaq 0x2442(%rip), %rax      # 0xc046
leaq 0x2440(%rip), %rdx      # 0xc04b
cmoveq %rax, %rdx
leaq 0x1(%r13), %rcx
leaq 0x2418(%rip), %rsi      # 0xc032
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x227b(%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 0x9c2e
leaq 0x23fb(%rip), %rsi      # 0xc050
movl %r14d, %edi
xorl %eax, %eax
callq 0x2110
jmp 0x9c97
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x1, %r15
leaq 0x101e(%rip), %rax      # 0xac99
leaq 0x23f7(%rip), %rdx      # 0xc079
cmoveq %rax, %rdx
leaq 0x23cd(%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 0x2bde