// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/nfa.c
// Function: new_nfa_automaton
static nfa_automaton_t*
new_nfa_automaton(int kind, ...) {
    if (!record_nfa_automata)
        { record_nfa_automata = new_vector(); }

    nfa_automaton_t* nfa_m = NEW(nfa_automaton_t, 1);
    if (!nfa_m)
        { return (NULL_AUTOMATON); }
    memset(nfa_m, 0, sizeof(*nfa_m)); 

    va_list args;
    va_start(args, kind);

    switch (kind) {
        case NFA_CLASS:
                nfa_m->tail_state = va_arg(args, nfa_state_t*);
                break;

        case NFA_SYMBOL:
                nfa_m->out_symbol = va_arg(args, int);
                break;

        case NFA_EPSILON:
                break;

        case NFA_UNION:
        case NFA_CONCAT:
                nfa_m->left = va_arg(args, nfa_automaton_t*);
                nfa_m->right = va_arg(args, nfa_automaton_t*);
                if (kind == NFA_UNION)
                    { nfa_m->tail_state = va_arg(args, nfa_state_t*); }
                break;

        case NFA_CLOSURE:
                nfa_m->middle = va_arg(args, nfa_automaton_t*);
                break;

        case NFA_MASTER:
                nfa_m->out_automata = va_arg(args, bitset_t*);
                break;
    }

    if (kind != NFA_MASTER)
        { nfa_m->head_state = va_arg(args, nfa_state_t*); }

    nfa_m->kind_nfa = kind;

    nfa_m->index = SIZE_VECTOR(record_nfa_automata);
    PUSH_BACK_VECTOR(record_nfa_automata, nfa_m);

    va_end(args);
    return (nfa_m);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movl %edi, %ebx
testb %al, %al
je 0x5911
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %rsi, -0xd8(%rbp)
movq %rdx, -0xd0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %r8, -0xc0(%rbp)
movq %r9, -0xb8(%rbp)
cmpq $0x0, 0x1857c(%rip)     # 0x1deb8
jne 0x594a
callq 0x2b2c
movq %rax, 0x1856e(%rip)     # 0x1deb8
movl $0x30, %edi
callq 0x3a4e
movq %rax, %r14
testq %rax, %rax
je 0x5b17
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
leaq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, -0x30(%rbp)
cmpl $0x6, %ebx
ja 0x5a37
movl %ebx, %eax
leaq 0x5f08(%rip), %rcx      # 0xb8ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x30(%rbp), %eax
cmpq $0x29, %rax
jae 0x5a1b
movq -0x20(%rbp), %rcx
movq %rax, %rdx
addq $0x8, %rdx
movl %edx, -0x30(%rbp)
movq (%rcx,%rax), %rsi
movq %r14, %rcx
addq $0x10, %rcx
movq %rsi, 0x18(%r14)
cmpl $0x20, %eax
ja 0x5a7f
addq -0x20(%rbp), %rdx
addl $0x10, %eax
movl %eax, -0x30(%rbp)
jmp 0x5a8d
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x5a3f
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5a4b
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x5a6c
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5a78
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movq (%rcx), %rdx
movq %r14, %rcx
addq $0x10, %rcx
movq %rdx, 0x18(%r14)
jmp 0x5a81
movl -0x30(%rbp), %eax
jmp 0x5ad2
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movq (%rcx), %rcx
movq %rcx, 0x10(%r14)
jmp 0x5ad2
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x5ac0
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5acc
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x28(%rbp)
movl $0x10, %eax
jmp 0x5af6
movl %edx, %eax
movq -0x28(%rbp), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, -0x28(%rbp)
movq (%rdx), %rdx
movq %rdx, 0x20(%r14)
cmpl $0x3, %ebx
jne 0x5ad2
cmpl $0x28, %eax
ja 0x5aac
movl %eax, %edx
addq -0x20(%rbp), %rdx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5ab8
movq -0x28(%rbp), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, -0x28(%rbp)
movq (%rdx), %rdx
movq %rdx, (%rcx)
jmp 0x5ad2
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movl (%rcx), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x28, %eax
ja 0x5ae5
movl %eax, %ecx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5af1
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x28(%rbp)
movl $0x28, %eax
movq (%rcx), %rcx
movq %rcx, (%r14,%rax)
movl %ebx, 0x8(%r14)
movq 0x183b0(%rip), %rdi     # 0x1deb8
movq 0x10(%rdi), %rsi
movq %rsi, (%r14)
movq %r14, %rdx
callq 0x2c21
movq %r14, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq