// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/dfa.c
// Function: build_dfa_table
void
build_dfa_table(nfa_state_t* master, lexical_spec_t* spec) {
    if (!master || !spec)
        { return; }

    precompute_epsilon_closure();
    if (spec->states) {
        foreach_vector(spec->states, &del_dfa_state);
        del_vector(spec->states);
    }

    spec->states = build_state_table(master);

    build_ahead_table(spec->states);
    build_final_table(spec->states);

//  minimizing_dfa(spec);
    spec->size_final = spec->size_final_anchor = 0;
    
    for (size_t i = 1; i < SIZE_VECTOR(spec->states); ++i) {
        dfa_state_t* crt_state =  DFA_STATE_AT(spec, i);
        if (!crt_state->is_final)
            { continue; }

        if (crt_state->final_entry != NO_FINAL)
            { ++(spec->size_final); }
        else
            { ++(spec->size_final_anchor); }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x8b2f
movq %rsi, %rbx
movq %rdi, %r15
cmpb $0x0, 0x157a8(%rip)     # 0x1ded0
movq %rsi, -0x38(%rbp)
jne 0x87a8
leaq 0x1577b(%rip), %r14     # 0x1deb0
movq (%r14), %rax
cmpq $0x0, 0x10(%rax)
je 0x879d
xorl %r12d, %r12d
movq (%rax), %rcx
movq (%rcx,%r12,8), %r13
cmpq $0x0, 0x30(%r13)
jne 0x8794
callq 0x247c
movq %rax, %rbx
movq (%r13), %rcx
movl 0x4(%rax), %eax
cmpq %rax, %rcx
jae 0x877a
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%rbx), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x8785
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x25b0
movq %rbx, %rdi
callq 0x8b3e
movq %rbx, 0x30(%r13)
movq (%r14), %rax
incq %r12
cmpq 0x10(%rax), %r12
jb 0x8742
movb $0x1, 0x1572c(%rip)     # 0x1ded0
movq -0x38(%rbp), %rbx
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x87c6
leaq -0xf0(%rip), %rsi       # 0x86c8
callq 0x2db5
movq 0x28(%rbx), %rdi
callq 0x2bce
callq 0x2b2c
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2c21
movq 0x30(%r15), %rdi
callq 0x24f4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x8654
movq %rbx, %rdx
movl $0x1, %ecx
leaq 0x156b1(%rip), %rbx     # 0x1deb0
movl $0x1, %r14d
movq %rdx, -0x30(%rbp)
movq (%rdx), %rax
movq %rcx, -0x50(%rbp)
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
xorl %r15d, %r15d
movq -0x48(%rbp), %rax
movq 0x8(%rax), %r13
callq 0x247c
movq %rax, %r12
movq %r13, %rdi
callq 0x291c
cmpl $-0x1, %eax
je 0x8851
movq (%rbx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl %r15d, %esi
movq %r12, %rdx
callq 0x8c7a
jmp 0x882b
testq %r13, %r13
je 0x8869
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x8865
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq %r12, %rdi
callq 0x273a
testb %al, %al
je 0x8882
movq %r12, %rdi
callq 0x24c6
jmp 0x8923
movq %r12, %rdi
callq 0x8b3e
testq %r12, %r12
je 0x8923
movq %r12, %rdi
callq 0x298f
movq %rax, %rbx
movl $0x10, %edi
callq 0x3a4e
movq %rax, -0x40(%rbp)
movl %r15d, 0x8(%rax)
testq %r14, %r14
movq -0x30(%rbp), %rsi
je 0x88e8
movl $0x1, %r13d
movq (%rsi), %rax
movq (%rax,%r13,8), %rax
cmpq 0x10(%rax), %rbx
jne 0x88e0
movq 0x8(%rax), %rsi
movq %r12, %rdi
callq 0x276e
movq -0x30(%rbp), %rsi
testb %al, %al
jne 0x88fd
incq %r13
cmpq %r14, %r13
jbe 0x88bf
incq %r14
movq -0x40(%rbp), %rbx
movl %r14d, 0xc(%rbx)
movq %r12, %rdi
callq 0x8654
jmp 0x890d
movq -0x40(%rbp), %rbx
movl %r13d, 0xc(%rbx)
movq %r12, %rdi
callq 0x24c6
movq -0x48(%rbp), %rcx
movq 0x18(%rcx), %rax
movq %rax, (%rbx)
movq %rbx, 0x18(%rcx)
leaq 0x1558d(%rip), %rbx     # 0x1deb0
movq -0x30(%rbp), %rdx
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x881b
movq -0x50(%rbp), %rcx
incq %rcx
cmpq %r14, %rcx
jbe 0x8809
movq -0x38(%rbp), %r12
movq %rdx, 0x28(%r12)
cmpq $0x2, 0x10(%rdx)
jb 0x8b26
movl $0x1, %ebx
movq (%rdx), %rax
movq (%rax,%rbx,8), %r14
movq 0x8(%r14), %rdi
callq 0x291c
xorl %r15d, %r15d
cmpl $-0x1, %eax
je 0x89a9
leaq 0x15531(%rip), %rcx     # 0x1deb0
movq (%rcx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
cmpb $0x1, 0xd(%rax)
jne 0x8996
movb $0x1, 0x20(%r14)
movb 0xe(%rax), %al
xorb $0x1, %al
orb %al, %r15b
movq 0x8(%r14), %rdi
callq 0x291c
jmp 0x8973
movq 0x8(%r14), %rax
testq %rax, %rax
movq -0x30(%rbp), %rdx
je 0x89c6
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x89c3
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
testb $0x1, %r15b
je 0x89d8
cmpb $0x1, 0x20(%r14)
jne 0x89d8
movb $0x1, 0x21(%r14)
incq %rbx
cmpq 0x10(%rdx), %rbx
jb 0x8960
movq 0x28(%r12), %rbx
cmpq $0x2, 0x10(%rbx)
jb 0x8b26
movl $0x1, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %r15
movq 0x8(%r15), %rdi
callq 0x291c
cmpl $-0x1, %eax
je 0x8a75
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x1548d(%rip), %rcx     # 0x1deb0
movq (%rcx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rcx
movl 0x8(%rcx), %eax
cmpl $-0x1, %eax
je 0x8a65
cmpb $0x0, 0xc(%rcx)
je 0x8a52
cmpl %eax, %r12d
movl %eax, %ecx
cmovll %r12d, %ecx
cmpl $-0x1, %r12d
cmovel %eax, %ecx
movl %ecx, %r12d
jmp 0x8a65
cmpl %eax, %r13d
movl %eax, %ecx
cmovll %r13d, %ecx
cmpl $-0x1, %r13d
cmovel %eax, %ecx
movl %ecx, %r13d
movq 0x8(%r15), %rdi
callq 0x291c
cmpl $-0x1, %eax
jne 0x8a1c
jmp 0x8a81
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x8a9a
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x8a97
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
movl %r13d, %eax
andl %r12d, %eax
cmpl $-0x1, %eax
je 0x8ac3
cmpl $-0x1, %r13d
setne %al
movl %r13d, 0x24(%r15)
cmpl %r13d, %r12d
setg %cl
testb %cl, %al
jne 0x8abe
movl %r12d, 0x28(%r15)
movb $0x1, 0x22(%r15)
incq %r14
cmpq 0x10(%rbx), %r14
jb 0x89fb
movq -0x38(%rbp), %r10
movq 0x28(%r10), %rdx
movq 0x10(%rdx), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r10)
cmpq $0x2, %rax
jb 0x8b2f
leaq 0x30(%r10), %rcx
movq (%rdx), %rdx
movl $0x1, %esi
xorl %edi, %edi
xorl %r8d, %r8d
movq (%rdx,%rsi,8), %r9
cmpb $0x1, 0x22(%r9)
jne 0x8b1c
cmpl $-0x1, 0x24(%r9)
je 0x8b15
incq %r8
movq %r8, (%rcx)
jmp 0x8b1c
incq %rdi
movq %rdi, 0x38(%r10)
incq %rsi
cmpq %rsi, %rax
jne 0x8afb
jmp 0x8b2f
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r12)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq