// File: /workspace/github_c_makefile_star2_O2/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:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x83f4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r15
cmpb $0x0, 0x15e9d(%rip)     # 0x1dee0
movq %rsi, -0x38(%rbp)
jne 0x80bc
leaq 0x15e70(%rip), %r14     # 0x1dec0
movq (%r14), %rax
xorl %r12d, %r12d
cmpq 0x10(%rax), %r12
jae 0x80b1
movq (%rax), %rcx
movq (%rcx,%r12,8), %r13
cmpq $0x0, 0x30(%r13)
jne 0x80ac
callq 0x230c
movq %rax, %rbx
movq (%r13), %rcx
movl 0x4(%rax), %eax
cmpq %rax, %rcx
jae 0x8092
pushq $0x1
popq %rax
shlq %cl, %rax
movq 0x8(%rbx), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x809d
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x23f9
movq %rbx, %rdi
callq 0x83f5
movq %rbx, 0x30(%r13)
movq (%r14), %rax
incq %r12
jmp 0x8056
movb $0x1, 0x15e28(%rip)     # 0x1dee0
movq -0x38(%rbp), %rbx
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x80da
leaq -0xe9(%rip), %rsi       # 0x7fe3
callq 0x2b98
movq 0x28(%rbx), %rdi
callq 0x29c6
callq 0x2924
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2a16
movq 0x30(%r15), %rdi
callq 0x237f
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7f70
movq %rbx, %rdx
leaq 0x15db2(%rip), %r14     # 0x1dec0
pushq $0x1
popq %rax
movq %rax, -0x30(%rbp)
movq %rax, %rcx
movq %rbx, -0x40(%rbp)
cmpq -0x30(%rbp), %rcx
ja 0x8259
movq (%rdx), %rax
movq %rcx, -0x50(%rbp)
movq (%rax,%rcx,8), %r15
xorl %r12d, %r12d
movq %r15, -0x58(%rbp)
cmpq $0x100, %r12            # imm = 0x100
je 0x824d
movq 0x8(%r15), %rbx
callq 0x230c
movq %rax, %r13
movq %rbx, %rdi
callq 0x273a
cmpl $-0x1, %eax
je 0x8177
movq (%r14), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0x852f
jmp 0x8151
testq %rbx, %rbx
je 0x818c
xorl %eax, %eax
cmpb $0x1, 0x54(%rbx)
jne 0x8189
movl 0x4(%rbx), %eax
decl %eax
movl %eax, 0x50(%rbx)
movq %r13, %rdi
callq 0x257c
testb %al, %al
je 0x81a5
movq %r13, %rdi
callq 0x2351
jmp 0x8241
movq %r13, %rdi
callq 0x83f5
testq %r13, %r13
je 0x8241
movq %r13, %rdi
callq 0x27a8
movq %rax, %r15
pushq $0x10
popq %rdi
callq 0x372f
movq %rax, -0x48(%rbp)
movl %r12d, 0x8(%rax)
pushq $0x1
popq %rbx
movq -0x40(%rbp), %rsi
cmpq -0x30(%rbp), %rbx
ja 0x8204
movq (%rsi), %rax
movq (%rax,%rbx,8), %rax
cmpq 0x10(%rax), %r15
jne 0x81ff
movq 0x8(%rax), %rsi
movq %r13, %rdi
callq 0x25a6
movq -0x40(%rbp), %rsi
testb %al, %al
jne 0x8220
incq %rbx
jmp 0x81d8
movq -0x30(%rbp), %rax
incq %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rbx
movl %eax, 0xc(%rbx)
movq %r13, %rdi
callq 0x7f70
jmp 0x8232
movq -0x48(%rbp), %rax
movl %ebx, 0xc(%rax)
movq %rax, %rbx
movq %r13, %rdi
callq 0x2351
movq -0x58(%rbp), %r15
movq 0x18(%r15), %rax
movq %rax, (%rbx)
movq %rbx, 0x18(%r15)
incq %r12
movq -0x40(%rbp), %rdx
jmp 0x8138
movq -0x50(%rbp), %rcx
incq %rcx
jmp 0x811c
movq -0x38(%rbp), %rax
movq %rdx, 0x28(%rax)
pushq $0x1
popq %rbx
cmpq 0x10(%rdx), %rbx
jae 0x82d7
movq (%rdx), %rax
movq (%rax,%rbx,8), %r15
xorl %r12d, %r12d
movq 0x8(%r15), %rdi
callq 0x273a
cmpl $-0x1, %eax
je 0x82a3
movq (%r14), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
cmpb $0x1, 0xd(%rax)
jne 0x8299
movb $0x1, 0x20(%r15)
movb 0xe(%rax), %al
xorb $0x1, %al
orb %al, %r12b
jmp 0x8274
movq 0x8(%r15), %rax
testq %rax, %rax
movq -0x40(%rbp), %rdx
je 0x82c0
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x82bd
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
testb $0x1, %r12b
je 0x82d2
cmpb $0x1, 0x20(%r15)
jne 0x82d2
movb $0x1, 0x21(%r15)
incq %rbx
jmp 0x8264
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
pushq $0x1
popq %r15
movq %rax, -0x30(%rbp)
cmpq 0x10(%rax), %r15
jae 0x8398
movq (%rax), %rax
movq (%rax,%r15,8), %r13
pushq $-0x1
popq %rbx
movl %ebx, %r12d
movq 0x8(%r13), %rdi
callq 0x273a
cmpl $-0x1, %eax
je 0x834c
movq (%r14), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rcx
movl 0x8(%rcx), %eax
cmpl $-0x1, %eax
je 0x82fe
cmpb $0x0, 0xc(%rcx)
jne 0x8337
cmpl %eax, %ebx
movl %eax, %ecx
cmovll %ebx, %ecx
cmpl $-0x1, %ebx
cmovel %eax, %ecx
movl %ecx, %ebx
jmp 0x82fe
cmpl %eax, %r12d
movl %eax, %ecx
cmovll %r12d, %ecx
cmpl $-0x1, %r12d
cmovel %eax, %ecx
movl %ecx, %r12d
jmp 0x82fe
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x8365
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x8362
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
movl %ebx, %eax
andl %r12d, %eax
cmpl $-0x1, %eax
je 0x838c
cmpl $-0x1, %ebx
setne %al
movl %ebx, 0x24(%r13)
cmpl %ebx, %r12d
setg %cl
testb %cl, %al
jne 0x8387
movl %r12d, 0x28(%r13)
movb $0x1, 0x22(%r13)
incq %r15
movq -0x30(%rbp), %rax
jmp 0x82e7
movq -0x38(%rbp), %r10
leaq 0x30(%r10), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r10)
movq 0x28(%r10), %rcx
movq 0x10(%rcx), %rdx
pushq $0x1
popq %rsi
xorl %edi, %edi
xorl %r8d, %r8d
cmpq %rdx, %rsi
jae 0x83e6
movq (%rcx), %r9
movq (%r9,%rsi,8), %r9
cmpb $0x1, 0x22(%r9)
jne 0x83e1
cmpl $-0x1, 0x24(%r9)
je 0x83da
incq %r8
movq %r8, (%rax)
jmp 0x83e1
incq %rdi
movq %rdi, 0x38(%r10)
incq %rsi
jmp 0x83b8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq