// File: /workspace/github_c_makefile_star2_O2/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 0x55a4
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, 0x188f9(%rip)     # 0x1dec8
jne 0x55dd
callq 0x2924
movq %rax, 0x188eb(%rip)     # 0x1dec8
pushq $0x30
popq %rdi
callq 0x372f
movq %rax, %r14
testq %rax, %rax
je 0x57a3
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 0x56c8
movl %ebx, %eax
leaq 0x625f(%rip), %rcx      # 0xb894
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x30(%rbp), %eax
cmpq $0x29, %rax
jae 0x56ac
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 0x570d
addq -0x20(%rbp), %rdx
addl $0x10, %eax
movl %eax, -0x30(%rbp)
jmp 0x571b
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x56d0
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x56dc
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x56fd
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5709
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 0x570f
movl -0x30(%rbp), %eax
jmp 0x5760
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movq (%rcx), %rcx
movq %rcx, 0x10(%r14)
jmp 0x5760
movl -0x30(%rbp), %eax
cmpq $0x28, %rax
ja 0x574e
movq %rax, %rcx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x575a
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x28(%rbp)
pushq $0x10
jmp 0x5781
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 0x5760
cmpl $0x28, %eax
ja 0x573a
movl %eax, %edx
addq -0x20(%rbp), %rdx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x5746
movq -0x28(%rbp), %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, -0x28(%rbp)
movq (%rdx), %rdx
movq %rdx, (%rcx)
jmp 0x5760
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, -0x28(%rbp)
movl (%rcx), %ecx
movl %ecx, 0x10(%r14)
cmpl $0x28, %eax
ja 0x5773
movl %eax, %ecx
addq -0x20(%rbp), %rcx
addl $0x8, %eax
movl %eax, -0x30(%rbp)
jmp 0x577f
movq -0x28(%rbp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, -0x28(%rbp)
pushq $0x28
popq %rax
movq (%rcx), %rcx
movq %rcx, (%r14,%rax)
movl %ebx, 0x8(%r14)
movq 0x18734(%rip), %rdi     # 0x1dec8
movq 0x10(%rdi), %rsi
movq %rsi, (%r14)
movq %r14, %rdx
callq 0x2a16
movq %r14, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq