// File: /workspace/github_c_makefile_star2_O1/MaoKo[P]FGFX/fgfl/src/nfa.c
// Function: new_nfa_state
nfa_state_t*
new_nfa_state(int symbol_edge, ...) {
    nfa_state_t* state = NEW(nfa_state_t, 1);

    if (!state)
        { return (NULL_NFA_STATE); }
    memset(state, 0, sizeof(*state));

    if (!record_nfa_state)
        { record_nfa_state = new_vector(); }

    va_list args;
    va_start(args, symbol_edge);

    state->symbol_edge = symbol_edge;
    switch (symbol_edge) {
        case EDGE_AUTOMATA:
            state->edge = va_arg(args, nfa_automaton_t*);
            state->edge2 = va_arg(args, nfa_automaton_t*);
            break;

        case EDGE_CLASS:
            state->class = va_arg(args, bitset_t*);            
            state->out_state = va_arg(args, nfa_state_t*);
            break;

        case NO_EDGE:
            break;

        default:
            state->out_state = va_arg(args, nfa_state_t*);
    }

    state->final_type = NO_FINAL;

    state->index = SIZE_VECTOR(record_nfa_state);
    PUSH_BACK_VECTOR(record_nfa_state, state);

    va_end(args);
    return (state);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movl %edi, %r14d
movq %rsi, -0xd8(%rbp)
movq %rdx, -0xd0(%rbp)
movq %rcx, -0xc8(%rbp)
movq %r8, -0xc0(%rbp)
movq %r9, -0xb8(%rbp)
testb %al, %al
je 0x568f
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)
movl $0x38, %edi
callq 0x3b4a
testq %rax, %rax
je 0x5724
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x30(%rax)
cmpq $0x0, 0x187ed(%rip)     # 0x1deb0
jne 0x56d1
callq 0x2b3c
movq %rax, 0x187df(%rip)     # 0x1deb0
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)
movl %r14d, 0x10(%rbx)
cmpl $-0x4, %r14d
je 0x57c4
cmpl $-0x2, %r14d
je 0x572b
cmpl $-0x1, %r14d
jne 0x5756
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5781
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x578d
xorl %ebx, %ebx
jmp 0x57e1
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5743
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x574f
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x28(%rbx)
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x576e
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x577a
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movl $0x18, %ecx
jmp 0x57bd
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x20(%rbx)
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x57ac
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x57b8
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movl $0x28, %ecx
movq (%rax), %rax
movq %rax, (%rbx,%rcx)
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
movq 0x186de(%rip), %rdi     # 0x1deb0
movq 0x10(%rdi), %rsi
movq %rsi, (%rbx)
movq %rbx, %rdx
callq 0x2c31
movq %rbx, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq