// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfl/src/gen_dfa.c
// Function: gen_state_table
void
gen_state_table(int filde, lexical_spec_t const* spec,
                            char const* header, spec_entry_t const* state) {
    size_t size_states = SIZE_VECTOR(spec->states);

    dprintf(filde, STATIC SP "uint%u_t" NL, min_size_type(size_states, true));
    gen_verbatim_file(filde, header);

    dprintf(filde, SEP);
    gen_state_name(filde, state);

    dprintf(filde, "state_table[%zu][%d] = "
                                    BEG_BLOCK NL, size_states, MAX_ASCII);

    for (size_t i = 0; i < size_states; ++i) {
        dfa_state_t* crt_state = (dfa_state_t*)AT_VECTOR(spec->states, i);
        trans_list_t const* list = ((crt_state)
                                ? crt_state->trans : NULL_TRANS_LST);

        dprintf(filde, "/* %3zu */" TAB BEG_BLOCK, i);
        while (list) {
            trans_list_t const* next = list->next;
            trans_list_t const* min_range = contiguous_range(list);
            if (min_range != list) {
                dprintf(filde, "[%u ... %u]=%u",
                            min_range->input, list->input, list->state);
                next = min_range->next;
            }
            else
                { dprintf(filde, "[%u]=%u", list->input, list->state); }
            if (next)
                { dprintf(filde, COMMA SP); }
            list = next;
        }
        dprintf(filde, END_BLOCK COMMA NL);
    }
    dprintf(filde, END_BLOCK SEMI NL NL);
}

// 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)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x3f70
movl -0x54(%rbp), %edi
movzbl %al, %edx
leaq 0x2a0a(%rip), %rsi      # 0xf3c2
movb $0x0, %al
callq 0x10d0
movl -0x4(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x4170
movl -0x4(%rbp), %edi
leaq 0x1921(%rip), %rsi      # 0xe2f6
movb $0x0, %al
callq 0x10d0
movl -0x4(%rbp), %edi
movq -0x20(%rbp), %rsi
callq 0xcb50
movl -0x4(%rbp), %edi
movq -0x28(%rbp), %rdx
leaq 0x28fe(%rip), %rsi      # 0xf2f4
movl $0x100, %ecx            # imm = 0x100
movb $0x0, %al
callq 0x10d0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0xcb30
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0xca44
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0xca4c
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0xca4c
movq -0x60(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x4(%rbp), %edi
movq -0x30(%rbp), %rdx
leaq 0x28ac(%rip), %rsi      # 0xf30e
movb $0x0, %al
callq 0x10d0
cmpq $0x0, -0x40(%rbp)
je 0xcb0e
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x3db0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0xcaca
movl -0x4(%rbp), %edi
movq -0x50(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x40(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x40(%rbp), %rax
movl 0xc(%rax), %r8d
leaq 0x2865(%rip), %rsi      # 0xf31b
movb $0x0, %al
callq 0x10d0
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xcae9
movl -0x4(%rbp), %edi
movq -0x40(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x40(%rbp), %rax
movl 0xc(%rax), %ecx
leaq 0x2848(%rip), %rsi      # 0xf32a
movb $0x0, %al
callq 0x10d0
cmpq $0x0, -0x48(%rbp)
je 0xcb01
movl -0x4(%rbp), %edi
leaq 0x2838(%rip), %rsi      # 0xf332
movb $0x0, %al
callq 0x10d0
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0xca69
movl -0x4(%rbp), %edi
leaq 0x285b(%rip), %rsi      # 0xf373
movb $0x0, %al
callq 0x10d0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xca0a
movl -0x4(%rbp), %edi
leaq 0x28e7(%rip), %rsi      # 0xf421
movb $0x0, %al
callq 0x10d0
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)