// File: /workspace/github_cpp_makefile_star2_O2/JameyWoo[P]re2graph/algorithms.cpp
// Function: writeNfaData(NFA, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void writeNfaData(NFA nfa, string filename) {
    /**
     * 将dfa数据写入到filename文件中.
     * 按照输入的格式, 相当于将输入反了一遍. 
     */
    ofstream write;
    write.open(filename, ios::out | ios::trunc);  // ? 是否设置成没有则创建
    write << nfa.chars.size() << endl;
    for (auto c : nfa.chars) {
        write << c << ' ';
    }
    write << endl
          << nfa.state_cnt << endl;
    for (auto c : nfa.states) {
        write << c << ' ';
    }
    write << endl
          << nfa.start_state << endl
          << nfa.end_state_cnt << endl;
    for (auto c : nfa.end_states) {
        write << c << ' ';
    }
    write << endl;
    // 转换条件的写入
    vector<string> jumps;
    for (auto s : nfa.states) {
        for (auto m : nfa.jump[s]) {
            for (auto v : m.second) {
                jumps.push_back(to_string(s) + " " + m.first + " " + to_string(v) + "\n");
            }
        }
    }
    write << jumps.size() << endl;
    for (auto s : jumps) {
        write << s;
    }
    // cout << "NFA write over!" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x368, %rsp            # imm = 0x368
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x168(%rsp), %r14
movq %r14, %rdi
callq 0x2350
pushq $0x30
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x20e0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
subq 0x10(%rax), %rsi
leaq 0x168(%rsp), %rdi
callq 0x2160
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r14
movq 0x18(%rax), %r15
leaq 0x168(%rsp), %rbx
pushq $0x20
popq %rbp
cmpq %r15, %r14
je 0x7cb2
movsbl (%r14), %esi
movq %rbx, %rdi
callq 0x2270
movq %rax, %rdi
movl %ebp, %esi
callq 0x2270
incq %r14
jmp 0x7c92
leaq 0x168(%rsp), %rdi
callq 0x20f0
movq 0x8(%rsp), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x2360
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rax
movq 0x28(%rax), %r14
movq 0x30(%rax), %r15
leaq 0x168(%rsp), %rbx
pushq $0x20
popq %rbp
cmpq %r15, %r14
je 0x7d0f
movl (%r14), %esi
movq %rbx, %rdi
callq 0x2360
movq %rax, %rdi
movl %ebp, %esi
callq 0x2270
addq $0x4, %r14
jmp 0x7cef
leaq 0x168(%rsp), %rdi
callq 0x20f0
movq 0x8(%rsp), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
callq 0x2360
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rcx
movl 0xc(%rcx), %esi
movq %rax, %rdi
callq 0x2360
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rax
movq 0x40(%rax), %r14
movq 0x48(%rax), %r15
leaq 0x168(%rsp), %rbx
pushq $0x20
popq %rbp
cmpq %r15, %r14
je 0x7d84
movl (%r14), %esi
movq %rbx, %rdi
callq 0x2360
movq %rax, %rdi
movl %ebp, %esi
callq 0x2270
addq $0x4, %r14
jmp 0x7d64
leaq 0x168(%rsp), %rdi
callq 0x20f0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x30(%rax), %rax
movq %rax, 0x30(%rsp)
leaq 0x72e4(%rip), %r12      # 0xf09e
leaq 0x108(%rsp), %rbp
leaq 0xe8(%rsp), %rbx
leaq 0x128(%rsp), %r15
cmpq 0x30(%rsp), %rcx
je 0x7f62
movq %rcx, 0x38(%rsp)
movslq (%rcx), %rcx
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rax
movq %rcx, 0x50(%rsp)
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
movq 0x10(%rax), %rax
cmpq 0x40(%rsp), %rax
je 0x7f54
movq %rax, 0x48(%rsp)
leaq 0x20(%rax), %rsi
leaq 0x68(%rsp), %rdi
callq 0x3698
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
movq %rcx, 0x58(%rsp)
cmpq 0x58(%rsp), %rax
je 0x7f3b
movq %r15, %r14
movq %r12, %r13
movq %rax, 0x60(%rsp)
movl (%rax), %r15d
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
movq 0x50(%rsp), %rsi
callq 0x9591
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %r12
movq %r13, %rdx
callq 0x9371
movsbl 0x68(%rsp), %edx
leaq 0xc8(%rsp), %r13
movq %r13, %rdi
movq %rbp, %rsi
callq 0x956f
leaq 0x88(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x9371
movq %rbx, %rdi
movl %r15d, %esi
callq 0x9591
movq %r14, %r15
movq %r14, %rdi
leaq 0x88(%rsp), %rsi
movq %rbx, %rdx
callq 0x9508
leaq 0x148(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
leaq 0x7293(%rip), %rdx      # 0xf167
callq 0x9371
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0xd362
movq %r14, %rdi
callq 0x20d0
movq %r15, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x20d0
leaq 0x88(%rsp), %rdi
callq 0x20d0
leaq 0xc8(%rsp), %rdi
callq 0x20d0
movq %rbp, %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x20d0
movq 0x60(%rsp), %rax
addq $0x4, %rax
jmp 0x7e34
leaq 0x70(%rsp), %rdi
callq 0x329e
movq 0x48(%rsp), %rdi
callq 0x2170
jmp 0x7e07
movq 0x38(%rsp), %rcx
addq $0x4, %rcx
jmp 0x7dd2
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x168(%rsp), %rdi
callq 0x2160
movq %rax, %rdi
callq 0x20f0
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r12
leaq 0x68(%rsp), %r14
leaq 0x168(%rsp), %r15
cmpq %r12, %rbx
je 0x7fc5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22d0
movq %r15, %rdi
movq %r14, %rsi
callq 0x21e0
movq %r14, %rdi
callq 0x20d0
addq $0x20, %rbx
jmp 0x7f9c
leaq 0x10(%rsp), %rdi
callq 0x95ea
leaq 0x168(%rsp), %rdi
callq 0x22f0
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8012
jmp 0x800a
jmp 0x8012
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20d0
jmp 0x80a5
jmp 0x800a
jmp 0x800a
movq %rax, %rbx
jmp 0x80af
movq %rax, %rbx
jmp 0x80a5
movq %rax, %rbx
jmp 0x8053
movq %rax, %rbx
jmp 0x8046
movq %rax, %rbx
jmp 0x8039
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x20d0
leaq 0x128(%rsp), %rdi
callq 0x20d0
leaq 0xe8(%rsp), %rdi
callq 0x20d0
leaq 0x88(%rsp), %rdi
callq 0x20d0
jmp 0x8074
movq %rax, %rbx
jmp 0x809b
movq %rax, %rbx
jmp 0x808e
movq %rax, %rbx
jmp 0x8081
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x20d0
leaq 0x108(%rsp), %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x20d0
leaq 0x70(%rsp), %rdi
callq 0x329e
leaq 0x10(%rsp), %rdi
callq 0x95ea
leaq 0x168(%rsp), %rdi
callq 0x22f0
movq %rbx, %rdi
callq 0x2370