// File: /workspace/github_c_makefile_star2_O3/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 0x550b
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 0x3a4e
movq %rax, %rbx
testq %rax, %rax
je 0x5676
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq $0x0, 0x30(%rbx)
cmpq $0x0, 0x18971(%rip)     # 0x1deb0
jne 0x554d
callq 0x2b2c
movq %rax, 0x18963(%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 0x5659
cmpl $-0x2, %r14d
je 0x55c3
cmpl $-0x1, %r14d
jne 0x55f0
movl -0x30(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x562e
movq -0x20(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x30(%rbp)
movq (%rdx,%rcx), %rdx
movq %rdx, 0x20(%rbx)
cmpl $0x20, %ecx
ja 0x5641
addq -0x20(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x564d
movl -0x30(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x5608
movq -0x20(%rbp), %rdx
movq %rcx, %rax
addq $0x8, %rax
movl %eax, -0x30(%rbp)
movq (%rdx,%rcx), %rdx
movq %rdx, 0x28(%rbx)
cmpl $0x20, %ecx
ja 0x561b
addq -0x20(%rbp), %rax
addl $0x10, %ecx
jmp 0x5603
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x561b
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5627
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x28(%rbx)
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movl $0x18, %ecx
jmp 0x5652
movq -0x28(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movq %rax, 0x20(%rbx)
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 0x18849(%rip), %rdi     # 0x1deb0
movq 0x10(%rdi), %rsi
movq %rsi, (%rbx)
movq %rbx, %rdx
callq 0x2c21
movq %rbx, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq