// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x1f00
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xd30c
jmp 0xd4c8
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jae 0xd3ba
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x2d, 0x8(%rax)
jne 0xd3a7
movq -0x38(%rbp), %rax
testb $0x1, 0x18(%rax)
jne 0xd3a7
cmpq $0x1, -0x20(%rbp)
jne 0xd37d
movq -0x38(%rbp), %rax
testb $0x1, 0x1b(%rax)
je 0xd37d
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x2090
jmp 0xd3a5
cmpq $0x0, -0x20(%rbp)
jne 0xd3a3
movq -0x38(%rbp), %rax
testb $0x1, 0x1a(%rax)
je 0xd3a3
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x2090
jmp 0xd3a5
jmp 0xd3a7
jmp 0xd3a9
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xd314
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xd494
movl -0x4(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x3f70
movl -0x54(%rbp), %edi
movzbl %al, %edx
leaq 0x1fff(%rip), %rsi      # 0xf3ee
movb $0x0, %al
callq 0x10d0
movl -0x4(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x4170
movl -0x4(%rbp), %edi
movq -0x20(%rbp), %rcx
leaq 0x2007(%rip), %rdx      # 0xf417
leaq 0x1ffb(%rip), %rax      # 0xf412
cmpq $0x1, %rcx
cmoveq %rax, %rdx
movq -0x40(%rbp), %rcx
addq $0x1, %rcx
leaq 0x1fd0(%rip), %rsi      # 0xf3fe
movb $0x0, %al
callq 0x10d0
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0xd481
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movl -0x4(%rbp), %edi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x1e06(%rip), %rsi      # 0xf272
movb $0x0, %al
callq 0x10d0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xd43d
movl -0x4(%rbp), %edi
leaq 0x1f91(%rip), %rsi      # 0xf41c
movb $0x0, %al
callq 0x10d0
jmp 0xd4bf
movl -0x4(%rbp), %edi
movq -0x20(%rbp), %rcx
leaq 0x1fa3(%rip), %rdx      # 0xf445
leaq 0xba0(%rip), %rax       # 0xe049
cmpq $0x1, %rcx
cmoveq %rax, %rdx
leaq 0x1f6e(%rip), %rsi      # 0xf426
movb $0x0, %al
callq 0x10d0
movq -0x28(%rbp), %rdi
callq 0x2010
addq $0x60, %rsp
popq %rbp
retq