// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/gen_dfa.c
// Function: gen_action_state
void
gen_action_state(int filde, char const* header, lexical_spec_t* spec) {
    size_t size_entry = SIZE_VECTOR(spec->entry_vect);
    size_t size_state = SIZE_VECTOR(spec->state_vect);

    gen_action_state_enum_macro(filde);
    dprintf(filde, NL STATIC SP "uint%u_t" NL, min_size_type(0x4000, true));

    gen_verbatim_file(filde, header);
    dprintf(filde, "_action_table[%s][%s] = "
                                BEG_BLOCK NL, MACRO_TOKEN, MACRO_STATE);

    for (size_t i = 0; i < size_entry; ++i) {
        spec_entry_t* crt_entry = (spec_entry_t*)AT_VECTOR(spec->entry_vect, i);
        if (crt_entry->kind != T_TERMINAL)
            { continue; }

        bool already_print = false;
        if (crt_entry->default_action != NONE_ACTION) {
            spec_entry_t* crt_state = (spec_entry_t*)
                            AT_VECTOR(spec->state_vect, spec->start_state);

            if (crt_entry->all_state) {
                for (size_t j = 0; j < size_state; ++j) {
                    crt_state = (spec_entry_t*)AT_VECTOR(spec->state_vect, j);
                    gen_action_entry(filde, spec, crt_entry,
                                    crt_entry->default_action, &already_print,
                                    crt_state->name);
                }
            }
            else {
                gen_action_entry(filde, spec, crt_entry,
                    crt_entry->default_action, &already_print, crt_state->name);
            }
        }
        else {
            trans_list_t* it_lst = crt_entry->state_lst;
            while (it_lst) {
                if (it_lst->state != NONE_STATE) {
                    spec_entry_t* in_state = ((spec_entry_t*)AT_VECTOR(
                            spec->state_vect, (size_t)it_lst->input));

                    gen_action_entry(filde, spec, crt_entry, it_lst->state, 
                                        &already_print, in_state->name);
                }
                it_lst = it_lst->next;
            }
        }
        if (already_print)
            { dprintf(filde, NL); }
    }
    dprintf(filde, END_BLOCK SEMI NL NL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r13
movq %rsi, %r15
movl %edi, %ebx
movq 0x8(%rdx), %rax
movq 0x10(%rdx), %rcx
movq 0x10(%rax), %r14
movq 0x10(%rcx), %rax
movq %rax, -0x48(%rbp)
leaq 0x28b6(%rip), %rsi      # 0xbe4c
xorl %eax, %eax
callq 0x2110
leaq 0x2adf(%rip), %rsi      # 0xc083
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2ae2(%rip), %rsi      # 0xc096
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2ae4(%rip), %rsi      # 0xc0a8
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2a81(%rip), %rsi      # 0xc055
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2ad4(%rip), %rsi      # 0xc0b8
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2ae3(%rip), %rsi      # 0xc0d7
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
movl $0x4000, %edi           # imm = 0x4000
movl $0x1, %esi
callq 0x3d5c
movzbl %al, %edx
leaq 0x29df(%rip), %rsi      # 0xbff5
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
movq %r15, %rsi
callq 0x3eea
leaq 0x29d7(%rip), %rsi      # 0xc007
leaq 0x2888(%rip), %rdx      # 0xbebf
leaq 0x283d(%rip), %rcx      # 0xbe7b
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
movq %r14, -0x50(%rbp)
testq %r14, %r14
je 0x99c4
xorl %ecx, %ecx
movq %r13, -0x40(%rbp)
movq 0x8(%r13), %rax
movq (%rax), %rax
movq %rcx, -0x58(%rbp)
movq (%rax,%rcx,8), %rdx
cmpl $0x2d, 0x8(%rdx)
jne 0x99b3
movl 0x30(%rdx), %r14d
cmpl $-0x1, %r14d
movq %rdx, -0x38(%rbp)
je 0x97a1
cmpb $0x1, 0x34(%rdx)
jne 0x98cc
cmpq $0x0, -0x48(%rbp)
je 0x99b3
xorl %r12d, %r12d
movq $0x0, -0x30(%rbp)
movq 0x10(%r13), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
movl 0x30(%rdx), %r14d
movq 0x10(%rax), %r15
testb $0x1, -0x30(%rbp)
jne 0x96d8
movl %ebx, %edi
leaq 0x2a2d(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movb $0x1, %al
movq %rax, -0x30(%rbp)
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x96e6
xorl %r13d, %r13d
jmp 0x970a
movq 0x10(%r13), %rax
movq (%rax), %rax
xorl %ecx, %ecx
btl $0xc, %r14d
setae %cl
shll $0xc, %ecx
addl $0x1000, %ecx           # imm = 0x1000
xorl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r13
movq 0x10(%rdx), %rdx
movl %ebx, %edi
leaq 0x29df(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x29d6(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x974c
movl %ebx, %edi
leaq 0x1580(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x9777
btl $0xc, %r14d
leaq 0x155e(%rip), %rdx      # 0xacb6
leaq 0x155e(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r13), %rcx
movl %ebx, %edi
leaq 0x2997(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movq -0x40(%rbp), %r13
movl %ebx, %edi
leaq 0x27e2(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
incq %r12
cmpq %r12, -0x48(%rbp)
movq -0x38(%rbp), %rdx
jne 0x96a5
jmp 0x98bd
movq 0x38(%rdx), %r12
testq %r12, %r12
je 0x99b3
movq $0x0, -0x30(%rbp)
movl 0xc(%r12), %r14d
cmpl $-0x1, %r14d
je 0x98b0
movq 0x10(%r13), %rax
movq (%rax), %rax
movslq 0x8(%r12), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r15
testb $0x1, -0x30(%rbp)
jne 0x97f9
movl %ebx, %edi
leaq 0x290c(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movb $0x1, %al
movq %rax, -0x30(%rbp)
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9807
xorl %r13d, %r13d
jmp 0x982b
movq 0x10(%r13), %rax
movq (%rax), %rax
xorl %ecx, %ecx
btl $0xc, %r14d
setae %cl
shll $0xc, %ecx
addl $0x1000, %ecx           # imm = 0x1000
xorl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r13
movq 0x10(%rdx), %rdx
movl %ebx, %edi
leaq 0x28be(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x28b5(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x986d
movl %ebx, %edi
leaq 0x145f(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x9898
btl $0xc, %r14d
leaq 0x143d(%rip), %rdx      # 0xacb6
leaq 0x143d(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r13), %rcx
movl %ebx, %edi
leaq 0x2876(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movq -0x40(%rbp), %r13
movl %ebx, %edi
leaq 0x26c1(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movq (%r12), %r12
testq %r12, %r12
jne 0x97b6
testb $0x1, -0x30(%rbp)
jne 0x99a3
jmp 0x99b3
movq 0x10(%r13), %rax
movq (%rax), %rax
movslq 0x18(%r13), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r15
movl %ebx, %edi
leaq 0x280c(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x98fd
xorl %r12d, %r12d
jmp 0x9921
movq 0x10(%r13), %rax
movq (%rax), %rax
xorl %ecx, %ecx
btl $0xc, %r14d
setae %cl
shll $0xc, %ecx
addl $0x1000, %ecx           # imm = 0x1000
xorl %r14d, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %r12
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdx
movl %ebx, %edi
leaq 0x27c4(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x27bb(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9967
movl %ebx, %edi
leaq 0x1365(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x9993
btl $0xc, %r14d
leaq 0x1343(%rip), %rdx      # 0xacb6
leaq 0x1343(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r12), %rcx
movl %ebx, %edi
leaq 0x277b(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x25ca(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x26cb(%rip), %rsi      # 0xc077
xorl %eax, %eax
callq 0x2110
movq -0x58(%rbp), %rcx
incq %rcx
cmpq -0x50(%rbp), %rcx
jne 0x965a
leaq 0x268a(%rip), %rsi      # 0xc055
movl %ebx, %edi
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2110