// File: 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
movq %rsp, %rbp
subq $0x4a0, %rsp            # imm = 0x4A0
movq %rdi, -0x440(%rbp)
movq %rsi, -0x438(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x34b0
movl $0x10, %edi
movl $0x20, %esi
callq 0x14600
movl %eax, -0x42c(%rbp)
jmp 0x10264
movl -0x42c(%rbp), %edx
movq -0x438(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0x3140
jmp 0x1027f
movq -0x440(%rbp), %rdi
addq $0x10, %rdi
callq 0x4e30
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
callq 0x3090
movq %rax, -0x448(%rbp)
jmp 0x102a7
movq -0x448(%rbp), %rdi
movq 0x32cfb(%rip), %rsi     # 0x42fb0
callq 0x3300
jmp 0x102bc
movq -0x440(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x228(%rbp)
movq -0x228(%rbp), %rdi
callq 0x131a0
movq %rax, -0x230(%rbp)
movq -0x228(%rbp), %rdi
callq 0x131d0
movq %rax, -0x238(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x13200
testb $0x1, %al
jne 0x1030d
jmp 0x10377
leaq -0x230(%rbp), %rdi
callq 0x13240
movb (%rax), %al
movb %al, -0x239(%rbp)
movsbl -0x239(%rbp), %esi
leaq -0x210(%rbp), %rdi
callq 0x3390
movq %rax, -0x450(%rbp)
jmp 0x1033d
movq -0x450(%rbp), %rdi
movl $0x20, %esi
callq 0x3390
jmp 0x10350
jmp 0x10352
leaq -0x230(%rbp), %rdi
callq 0x13420
jmp 0x102f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x10aa8
movq 0x32c32(%rip), %rsi     # 0x42fb0
leaq -0x210(%rbp), %rdi
callq 0x3300
movq %rax, -0x458(%rbp)
jmp 0x10393
movq -0x458(%rbp), %rdi
movq -0x440(%rbp), %rax
movl 0x4(%rax), %esi
callq 0x34d0
movq %rax, -0x460(%rbp)
jmp 0x103b2
movq -0x460(%rbp), %rdi
movq 0x32bf0(%rip), %rsi     # 0x42fb0
callq 0x3300
jmp 0x103c7
movq -0x440(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
callq 0x12900
movq %rax, -0x250(%rbp)
movq -0x248(%rbp), %rdi
callq 0x12930
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x12960
testb $0x1, %al
jne 0x10418
jmp 0x1046a
leaq -0x250(%rbp), %rdi
callq 0x129a0
movl (%rax), %eax
movl %eax, -0x25c(%rbp)
movl -0x25c(%rbp), %esi
leaq -0x210(%rbp), %rdi
callq 0x34d0
movq %rax, -0x468(%rbp)
jmp 0x10447
movq -0x468(%rbp), %rdi
movl $0x20, %esi
callq 0x3390
jmp 0x1045a
jmp 0x1045c
leaq -0x250(%rbp), %rdi
callq 0x12aa0
jmp 0x103ff
movq 0x32b3f(%rip), %rsi     # 0x42fb0
leaq -0x210(%rbp), %rdi
callq 0x3300
movq %rax, -0x470(%rbp)
jmp 0x10486
movq -0x470(%rbp), %rdi
movq -0x440(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x34d0
movq %rax, -0x478(%rbp)
jmp 0x104a5
movq -0x478(%rbp), %rdi
movq 0x32afd(%rip), %rsi     # 0x42fb0
callq 0x3300
movq %rax, -0x480(%rbp)
jmp 0x104c1
movq -0x480(%rbp), %rdi
movq -0x440(%rbp), %rax
movl 0xc(%rax), %esi
callq 0x34d0
movq %rax, -0x488(%rbp)
jmp 0x104e0
movq -0x488(%rbp), %rdi
movq 0x32ac2(%rip), %rsi     # 0x42fb0
callq 0x3300
jmp 0x104f5
movq -0x440(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rdi
callq 0x12900
movq %rax, -0x270(%rbp)
movq -0x268(%rbp), %rdi
callq 0x12930
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x12960
testb $0x1, %al
jne 0x10546
jmp 0x10598
leaq -0x270(%rbp), %rdi
callq 0x129a0
movl (%rax), %eax
movl %eax, -0x27c(%rbp)
movl -0x27c(%rbp), %esi
leaq -0x210(%rbp), %rdi
callq 0x34d0
movq %rax, -0x490(%rbp)
jmp 0x10575
movq -0x490(%rbp), %rdi
movl $0x20, %esi
callq 0x3390
jmp 0x10588
jmp 0x1058a
leaq -0x270(%rbp), %rdi
callq 0x12aa0
jmp 0x1052d
movq 0x32a11(%rip), %rsi     # 0x42fb0
leaq -0x210(%rbp), %rdi
callq 0x3300
jmp 0x105ad
leaq -0x298(%rbp), %rdi
callq 0x14620
movq -0x440(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rdi
callq 0x12900
movq %rax, -0x2a8(%rbp)
movq -0x2a0(%rbp), %rdi
callq 0x12930
movq %rax, -0x2b0(%rbp)
leaq -0x2a8(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x12960
testb $0x1, %al
jne 0x1060d
jmp 0x10989
leaq -0x2a8(%rbp), %rdi
callq 0x129a0
movq -0x440(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x2b4(%rbp)
addq $0x58, %rdi
movslq -0x2b4(%rbp), %rsi
callq 0x121f0
movq %rax, -0x2c0(%rbp)
movq -0x2c0(%rbp), %rdi
callq 0x12850
movq %rax, -0x2c8(%rbp)
movq -0x2c0(%rbp), %rdi
callq 0x12880
movq %rax, -0x2d0(%rbp)
leaq -0x2c8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x128b0
testb $0x1, %al
jne 0x10681
jmp 0x10976
leaq -0x2c8(%rbp), %rdi
callq 0x128e0
movq %rax, %rsi
leaq -0x2f0(%rbp), %rdi
callq 0x6ce0
jmp 0x1069e
leaq -0x2f0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2f8(%rbp)
movq -0x2f8(%rbp), %rdi
callq 0x12900
movq %rax, -0x300(%rbp)
movq -0x2f8(%rbp), %rdi
callq 0x12930
movq %rax, -0x308(%rbp)
leaq -0x300(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x12960
testb $0x1, %al
jne 0x106f2
jmp 0x10948
leaq -0x300(%rbp), %rdi
callq 0x129a0
movl (%rax), %eax
movl %eax, -0x30c(%rbp)
movl -0x2b4(%rbp), %esi
leaq -0x3d0(%rbp), %rdi
callq 0x14790
jmp 0x1071a
leaq 0x1ca1d(%rip), %rdx     # 0x2d13e
leaq -0x3b0(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x141b0
jmp 0x10736
movsbl -0x2f0(%rbp), %edx
leaq -0x390(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
callq 0x14740
jmp 0x10752
leaq 0x1c9e5(%rip), %rdx     # 0x2d13e
leaq -0x370(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x141b0
jmp 0x1076e
movl -0x30c(%rbp), %esi
leaq -0x3f0(%rbp), %rdi
callq 0x14790
jmp 0x10782
leaq -0x350(%rbp), %rdi
leaq -0x370(%rbp), %rsi
leaq -0x3f0(%rbp), %rdx
callq 0x14670
jmp 0x1079e
leaq 0x1ca62(%rip), %rdx     # 0x2d207
leaq -0x330(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x141b0
jmp 0x107ba
leaq -0x298(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x14640
jmp 0x107cf
leaq -0x330(%rbp), %rdi
callq 0x31c0
leaq -0x350(%rbp), %rdi
callq 0x31c0
leaq -0x3f0(%rbp), %rdi
callq 0x31c0
leaq -0x370(%rbp), %rdi
callq 0x31c0
leaq -0x390(%rbp), %rdi
callq 0x31c0
leaq -0x3b0(%rbp), %rdi
callq 0x31c0
leaq -0x3d0(%rbp), %rdi
callq 0x31c0
leaq -0x300(%rbp), %rdi
callq 0x12aa0
jmp 0x106d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x10a9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x10965
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x1093a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x1092e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x10922
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x10916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x1090a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x108fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x31c0
leaq -0x350(%rbp), %rdi
callq 0x31c0
leaq -0x3f0(%rbp), %rdi
callq 0x31c0
leaq -0x370(%rbp), %rdi
callq 0x31c0
leaq -0x390(%rbp), %rdi
callq 0x31c0
leaq -0x3b0(%rbp), %rdi
callq 0x31c0
leaq -0x3d0(%rbp), %rdi
callq 0x31c0
jmp 0x10965
leaq -0x2f0(%rbp), %rdi
callq 0x6e80
leaq -0x2c8(%rbp), %rdi
callq 0x12ac0
jmp 0x10665
leaq -0x2f0(%rbp), %rdi
callq 0x6e80
jmp 0x10a9c
jmp 0x10978
leaq -0x2a8(%rbp), %rdi
callq 0x12aa0
jmp 0x105f1
leaq -0x298(%rbp), %rdi
callq 0x148b0
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
callq 0x3090
movq %rax, -0x498(%rbp)
jmp 0x109ad
movq -0x498(%rbp), %rdi
movq 0x325f5(%rip), %rsi     # 0x42fb0
callq 0x3300
jmp 0x109c2
leaq -0x298(%rbp), %rax
movq %rax, -0x3f8(%rbp)
movq -0x3f8(%rbp), %rdi
callq 0x148d0
movq %rax, -0x400(%rbp)
movq -0x3f8(%rbp), %rdi
callq 0x14900
movq %rax, -0x408(%rbp)
leaq -0x400(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x14930
testb $0x1, %al
jne 0x10a0f
jmp 0x10a7b
leaq -0x400(%rbp), %rdi
callq 0x14970
movq %rax, %rsi
leaq -0x428(%rbp), %rdi
callq 0x3120
jmp 0x10a2c
leaq -0x210(%rbp), %rdi
leaq -0x428(%rbp), %rsi
callq 0x32b0
jmp 0x10a41
leaq -0x428(%rbp), %rdi
callq 0x31c0
leaq -0x400(%rbp), %rdi
callq 0x14990
jmp 0x109f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x428(%rbp), %rdi
callq 0x31c0
jmp 0x10a9c
leaq -0x298(%rbp), %rdi
callq 0x149b0
leaq -0x210(%rbp), %rdi
callq 0x3440
addq $0x4a0, %rsp            # imm = 0x4A0
popq %rbp
retq
leaq -0x298(%rbp), %rdi
callq 0x149b0
leaq -0x210(%rbp), %rdi
callq 0x3440
movq -0x218(%rbp), %rdi
callq 0x34e0