// File: /workspace/github_c_makefile_star2_O1/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 0x8cb2
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r15
cmpb $0x0, 0x15628(%rip)     # 0x1ded0
movq %rsi, -0x38(%rbp)
jne 0x8928
leaq 0x155fb(%rip), %r14     # 0x1deb0
movq (%r14), %rax
cmpq $0x0, 0x10(%rax)
je 0x891d
xorl %r12d, %r12d
movq (%rax), %rax
movq (%rax,%r12,8), %r13
cmpq $0x0, 0x30(%r13)
jne 0x8911
callq 0x247c
movq %rax, %rbx
movq (%r13), %rcx
movl 0x4(%rax), %eax
cmpq %rax, %rcx
jae 0x88fa
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%rbx), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x8905
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x25a8
movq %rbx, %rdi
callq 0x8cb3
movq %rax, 0x30(%r13)
incq %r12
movq (%r14), %rax
cmpq 0x10(%rax), %r12
jb 0x88c2
movb $0x1, 0x155ac(%rip)     # 0x1ded0
movq -0x38(%rbp), %rbx
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x8946
leaq -0xf0(%rip), %rsi       # 0x8848
callq 0x2db5
movq 0x28(%rbx), %rdi
callq 0x2bde
callq 0x2b3c
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x2c31
movq 0x30(%r15), %rdi
callq 0x24f8
movq %rax, %rdi
movq %rbx, -0x30(%rbp)
movq %rbx, %rsi
callq 0x87d0
movl $0x1, %ecx
leaq 0x15530(%rip), %rbx     # 0x1deb0
movl $0x1, %r14d
movq -0x30(%rbp), %rax
movq (%rax), %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 0x292b
cmpl $-0x1, %eax
je 0x89d2
movq (%rbx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl %r15d, %esi
movq %r12, %rdx
callq 0x8def
jmp 0x89ac
testq %r13, %r13
je 0x89ea
xorl %eax, %eax
cmpb $0x1, 0x54(%r13)
jne 0x89e6
movl 0x4(%r13), %eax
decl %eax
movl %eax, 0x50(%r13)
movq %r12, %rdi
callq 0x2725
movq %r12, %rdi
testb %al, %al
je 0x8a03
callq 0x24ca
xorl %r12d, %r12d
jmp 0x8a0b
callq 0x8cb3
movq %rax, %r12
testq %r12, %r12
je 0x8aa4
movq %r12, %rdi
callq 0x29a4
movq %rax, %rbx
movl $0x10, %edi
callq 0x3b4a
movq %rax, -0x40(%rbp)
movl %r15d, 0x8(%rax)
testq %r14, %r14
movq -0x30(%rbp), %rsi
je 0x8a69
movl $0x1, %r13d
movq (%rsi), %rax
movq (%rax,%r13,8), %rax
cmpq 0x10(%rax), %rbx
jne 0x8a61
movq 0x8(%rax), %rsi
movq %r12, %rdi
callq 0x2766
movq -0x30(%rbp), %rsi
testb %al, %al
jne 0x8a7e
incq %r13
cmpq %r14, %r13
jbe 0x8a40
incq %r14
movq -0x40(%rbp), %rbx
movl %r14d, 0xc(%rbx)
movq %r12, %rdi
callq 0x87d0
jmp 0x8a8e
movq -0x40(%rbp), %rbx
movl %r13d, 0xc(%rbx)
movq %r12, %rdi
callq 0x24ca
movq -0x48(%rbp), %rcx
movq 0x18(%rcx), %rax
movq %rax, (%rbx)
movq %rbx, 0x18(%rcx)
leaq 0x1540c(%rip), %rbx     # 0x1deb0
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x899c
movq -0x50(%rbp), %rcx
incq %rcx
cmpq %r14, %rcx
jbe 0x8986
movq -0x38(%rbp), %r13
movq -0x30(%rbp), %rdx
movq %rdx, 0x28(%r13)
cmpq $0x2, 0x10(%rdx)
jb 0x8b6f
movl $0x1, %ebx
movl $0x1, %r14d
movq (%rdx), %rax
movq (%rax,%rbx,8), %r15
movq 0x8(%r15), %rdi
callq 0x292b
xorl %r12d, %r12d
cmpl $-0x1, %eax
je 0x8b33
leaq 0x153ab(%rip), %rcx     # 0x1deb0
movq (%rcx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rax
cmpb $0x1, 0xd(%rax)
jne 0x8b1c
movb $0x1, 0x20(%r15)
cmpb $0x0, 0xe(%rax)
movzbl %r12b, %r12d
cmovel %r14d, %r12d
movq 0x8(%r15), %rdi
callq 0x292b
jmp 0x8af9
movq 0x8(%r15), %rax
testq %rax, %rax
movq -0x30(%rbp), %rdx
je 0x8b50
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x8b4d
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
testb $0x1, %r12b
je 0x8b62
cmpb $0x1, 0x20(%r15)
jne 0x8b62
movb $0x1, 0x21(%r15)
incq %rbx
cmpq 0x10(%rdx), %rbx
jb 0x8ae6
movq 0x28(%r13), %rbx
cmpq $0x2, 0x10(%rbx)
jb 0x8c59
movl $0x1, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %r15
movq 0x8(%r15), %rdi
callq 0x292b
cmpl $-0x1, %eax
je 0x8bfe
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x15304(%rip), %rcx     # 0x1deb0
movq (%rcx), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rcx
movl 0x8(%rcx), %eax
cmpl $-0x1, %eax
je 0x8bee
cmpb $0x0, 0xc(%rcx)
je 0x8bdb
cmpl %eax, %r12d
movl %eax, %ecx
cmovll %r12d, %ecx
cmpl $-0x1, %r12d
cmovel %eax, %ecx
movl %ecx, %r12d
jmp 0x8bee
cmpl %eax, %r13d
movl %eax, %ecx
cmovll %r13d, %ecx
cmpl $-0x1, %r13d
cmovel %eax, %ecx
movl %ecx, %r13d
movq 0x8(%r15), %rdi
callq 0x292b
cmpl $-0x1, %eax
jne 0x8ba5
jmp 0x8c0a
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x8c23
xorl %ecx, %ecx
cmpb $0x1, 0x54(%rax)
jne 0x8c20
movl 0x4(%rax), %ecx
decl %ecx
movl %ecx, 0x50(%rax)
movl %r13d, %eax
andl %r12d, %eax
cmpl $-0x1, %eax
je 0x8c4c
cmpl $-0x1, %r13d
setne %al
movl %r13d, 0x24(%r15)
cmpl %r13d, %r12d
setg %cl
testb %cl, %al
jne 0x8c47
movl %r12d, 0x28(%r15)
movb $0x1, 0x22(%r15)
incq %r14
cmpq 0x10(%rbx), %r14
jb 0x8b84
xorps %xmm0, %xmm0
movq -0x38(%rbp), %r8
movups %xmm0, 0x30(%r8)
movq 0x28(%r8), %rdx
movq 0x10(%rdx), %rax
cmpq $0x2, %rax
jb 0x8ca4
leaq 0x38(%r8), %rcx
addq $0x30, %r8
movq (%rdx), %rdx
movl $0x1, %esi
movq (%rdx,%rsi,8), %rdi
cmpb $0x1, 0x22(%rdi)
jne 0x8c9c
cmpl $-0x1, 0x24(%rdi)
movq %rcx, %rdi
je 0x8c99
movq %r8, %rdi
incq (%rdi)
incq %rsi
cmpq %rsi, %rax
jne 0x8c83
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq