// File: /workspace/github_c_makefile_star2_O1/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 0x5aad
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, 0x183e0(%rip)     # 0x1deb8
jne 0x5ae6
callq 0x2b3c
movq %rax, 0x183d2(%rip)     # 0x1deb8
movl $0x30, %edi
callq 0x3b4a
testq %rax, %rax
je 0x5b5a
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
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 0x5c0a
movl %ebx, %eax
leaq 0x5d73(%rip), %rcx      # 0xb8ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5b7a
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5b86
xorl %r14d, %r14d
jmp 0x5c4f
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5ba7
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5bb3
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x10(%r14)
jmp 0x5c06
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5bf4
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5c00
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x18(%r14)
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5bd2
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5bde
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x20(%r14)
testl %ebx, %ebx
je 0x5c35
cmpl $0x3, %ebx
je 0x5b42
jmp 0x5c0a
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movl (%rax), %eax
movl %eax, 0x10(%r14)
testl %ebx, %ebx
je 0x5c35
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5c22
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5c2e
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x28(%r14)
movl %ebx, 0x8(%r14)
movq 0x18278(%rip), %rdi     # 0x1deb8
movq 0x10(%rdi), %rsi
movq %rsi, (%r14)
movq %r14, %rdx
callq 0x2c31
movq %r14, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq