// File: /workspace/github_c_makefile_star2_O2/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 0x51fb
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)
pushq $0x38
popq %rdi
callq 0x372f
movq %rax, %rbx
testq %rax, %rax
je 0x5359
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rbx)
andq $0x0, 0x30(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
cmpq $0x0, 0x18c96(%rip)     # 0x1dec0
jne 0x5238
callq 0x2924
movq %rax, 0x18c88(%rip)     # 0x1dec0
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 0x533f
cmpl $-0x2, %r14d
je 0x52ae
cmpl $-0x1, %r14d
jne 0x52db
movl -0x30(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x5316
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 0x5329
addq -0x20(%rbp), %rax
addl $0x10, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5335
movl -0x30(%rbp), %ecx
cmpq $0x29, %rcx
jae 0x52f3
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 0x5306
addq -0x20(%rbp), %rax
addl $0x10, %ecx
jmp 0x52ee
movl -0x30(%rbp), %ecx
cmpq $0x28, %rcx
ja 0x5306
movq %rcx, %rax
addq -0x20(%rbp), %rax
addl $0x8, %ecx
movl %ecx, -0x30(%rbp)
jmp 0x5312
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)
pushq $0x18
jmp 0x5337
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)
pushq $0x28
popq %rcx
movq (%rax), %rax
movq %rax, (%rbx,%rcx)
orl $-0x1, 0x8(%rbx)
movq 0x18b76(%rip), %rdi     # 0x1dec0
movq 0x10(%rdi), %rsi
movq %rsi, (%rbx)
movq %rbx, %rdx
callq 0x2a16
movq %rbx, %rax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq