// File: /workspace/github_c_makefile_star2_O1/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 0x2768(%rip), %rsi      # 0xbe4c
xorl %eax, %eax
callq 0x2110
leaq 0x2991(%rip), %rsi      # 0xc083
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2994(%rip), %rsi      # 0xc096
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2996(%rip), %rsi      # 0xc0a8
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2933(%rip), %rsi      # 0xc055
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2986(%rip), %rsi      # 0xc0b8
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
leaq 0x2995(%rip), %rsi      # 0xc0d7
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
movl $0x4000, %edi           # imm = 0x4000
movl $0x1, %esi
callq 0x3e58
movzbl %al, %edx
leaq 0x2891(%rip), %rsi      # 0xbff5
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
movq %r15, %rsi
callq 0x3fe6
leaq 0x2889(%rip), %rsi      # 0xc007
leaq 0x273a(%rip), %rdx      # 0xbebf
leaq 0x26ef(%rip), %rcx      # 0xbe7b
movl %ebx, %edi
xorl %eax, %eax
callq 0x2110
testq %r14, %r14
je 0x9b1f
xorl %r15d, %r15d
movq %r13, -0x40(%rbp)
movq %r14, -0x50(%rbp)
movq 0x8(%r13), %rax
movq (%rax), %rax
movq (%rax,%r15,8), %rdx
cmpl $0x2d, 0x8(%rdx)
jne 0x9b13
movl 0x30(%rdx), %r14d
cmpl $-0x1, %r14d
movq %rdx, -0x38(%rbp)
movq %r15, -0x58(%rbp)
je 0x98ee
cmpb $0x1, 0x34(%rdx)
jne 0x9a0d
cmpq $0x0, -0x48(%rbp)
je 0x9a3e
xorl %r12d, %r12d
movl $0x0, -0x2c(%rbp)
movq 0x10(%r13), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %rax
movl 0x30(%rdx), %r14d
movq 0x10(%rax), %r15
testb $0x1, -0x2c(%rbp)
jne 0x9825
movl %ebx, %edi
leaq 0x28df(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movb $0x1, %al
movl %eax, -0x2c(%rbp)
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9833
xorl %r13d, %r13d
jmp 0x9857
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 0x2892(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x2889(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9899
movl %ebx, %edi
leaq 0x1433(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x98c4
btl $0xc, %r14d
leaq 0x1411(%rip), %rdx      # 0xacb6
leaq 0x1411(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r13), %rcx
movl %ebx, %edi
leaq 0x284a(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movq -0x40(%rbp), %r13
movl %ebx, %edi
leaq 0x2695(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
incq %r12
cmpq %r12, -0x48(%rbp)
movq -0x38(%rbp), %rdx
jne 0x97f3
jmp 0x9af5
movq 0x38(%rdx), %r12
testq %r12, %r12
je 0x9a3e
movl $0x0, -0x2c(%rbp)
movl 0xc(%r12), %r14d
cmpl $-0x1, %r14d
je 0x99fb
movq 0x10(%r13), %rax
movq (%rax), %rax
movslq 0x8(%r12), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r15
testb $0x1, -0x2c(%rbp)
jne 0x9944
movl %ebx, %edi
leaq 0x27c0(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movb $0x1, %al
movl %eax, -0x2c(%rbp)
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9952
xorl %r13d, %r13d
jmp 0x9976
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 0x2773(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x276a(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x99b8
movl %ebx, %edi
leaq 0x1314(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x99e3
btl $0xc, %r14d
leaq 0x12f2(%rip), %rdx      # 0xacb6
leaq 0x12f2(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r13), %rcx
movl %ebx, %edi
leaq 0x272b(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movq -0x40(%rbp), %r13
movl %ebx, %edi
leaq 0x2576(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
movq -0x38(%rbp), %rdx
movq (%r12), %r12
testq %r12, %r12
jne 0x9902
jmp 0x9af5
movq 0x10(%r13), %rax
movq (%rax), %rax
movslq 0x18(%r13), %rcx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r15
movl %ebx, %edi
leaq 0x26cb(%rip), %rsi      # 0xc0f4
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9a4a
xorl %r12d, %r12d
jmp 0x9a6e
movl $0x0, -0x2c(%rbp)
jmp 0x9af5
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 0x2677(%rip), %rsi      # 0xc0f6
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x266e(%rip), %rsi      # 0xc0fd
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x4000, %r14d          # imm = 0x4000
jne 0x9ab4
movl %ebx, %edi
leaq 0x1218(%rip), %rsi      # 0xacc3
xorl %eax, %eax
callq 0x2110
jmp 0x9ae0
btl $0xc, %r14d
leaq 0x11f6(%rip), %rdx      # 0xacb6
leaq 0x11f6(%rip), %rax      # 0xacbd
cmovaeq %rax, %rdx
movq 0x10(%r12), %rcx
movl %ebx, %edi
leaq 0x262e(%rip), %rsi      # 0xc107
xorl %eax, %eax
callq 0x2110
movl %ebx, %edi
leaq 0x247d(%rip), %rsi      # 0xbf66
xorl %eax, %eax
callq 0x2110
movb $0x1, %al
movl %eax, -0x2c(%rbp)
testb $0x1, -0x2c(%rbp)
movq -0x50(%rbp), %r14
movq -0x58(%rbp), %r15
je 0x9b13
movl %ebx, %edi
leaq 0x256b(%rip), %rsi      # 0xc077
xorl %eax, %eax
callq 0x2110
incq %r15
cmpq %r14, %r15
jne 0x97a9
leaq 0x252f(%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