// File: /workspace/github_cpp_makefile_star2_O1/JameyWoo[P]re2graph/algorithms.cpp
// Function: writeDfaData(DFA, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void writeDfaData(DFA dfa, string filename) {
    /**
     * 将dfa数据写入到filename文件中.
     * 按照输入的格式, 相当于将输入反了一遍.
     * 和输入有一些差异的是, 由于我在保存dfa的时候, 将起始状态变成了0, 所以这个输出更正规
     */
    ofstream write;
    write.open(filename, ios::out | ios::trunc);  // ? 是否设置成没有则创建
    write << dfa.chars.size() << endl;
    for (auto c : dfa.chars) {
        write << c << ' ';
    }
    write << endl
          << dfa.state_cnt << endl;
    for (auto c : dfa.states) {
        write << c << ' ';
    }
    write << endl
          << dfa.start_state << '\n'
          << dfa.end_state_cnt << endl;
    for (auto c : dfa.end_states) {
        write << c << ' ';
    }
    write << endl;
    // todo: 添加转换条件的写入
    vector<string> jumps;
    for (auto s : dfa.states) {
        for (auto iter : dfa.jump_map[s]) {
            jumps.push_back(to_string(s) + " " + iter.first + " " + to_string(iter.second) + "\n");
        }
    }
    write << jumps.size() << endl;
    for (auto s : jumps) {
        write << s;
    }
    // cout << "DFA write over!" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x138(%rsp), %r14
movq %r14, %rdi
callq 0x2320
movq %r14, %rdi
movq %rbx, %rsi
movl $0x30, %edx
callq 0x20e0
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
subq 0x10(%rax), %rsi
leaq 0x138(%rsp), %rbx
movq %rbx, %rdi
callq 0x2140
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rax
movq 0x10(%rax), %r12
movq 0x18(%rax), %r13
cmpq %r13, %r12
je 0xc380
leaq 0x138(%rsp), %r14
leaq 0x10(%rsp), %r15
movb (%r12), %al
movb %al, 0x10(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2240
movb $0x20, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2240
incq %r12
cmpq %r13, %r12
jne 0xc34b
movq 0x138(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
leaq 0x138(%rsp), %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x2330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rax
movq 0x28(%rax), %r12
movq 0x30(%rax), %r13
cmpq %r13, %r12
je 0xc437
leaq 0x138(%rsp), %r14
leaq 0x10(%rsp), %r15
movl (%r12), %esi
movq %r14, %rdi
callq 0x2330
movb $0x20, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2240
addq $0x4, %r12
cmpq %r13, %r12
jne 0xc40d
movq 0x138(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
leaq 0x138(%rsp), %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rcx
movl 0x8(%rcx), %esi
movq %rax, %rdi
callq 0x2330
leaq 0x10(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x2240
movq 0x8(%rsp), %rcx
movl 0xc(%rcx), %esi
movq %rax, %rdi
callq 0x2330
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x8(%rsp), %rax
movq 0x40(%rax), %r12
movq 0x48(%rax), %r13
cmpq %r13, %r12
je 0xc513
leaq 0x138(%rsp), %r14
leaq 0x10(%rsp), %r15
movl (%r12), %esi
movq %r14, %rdi
callq 0x2330
movb $0x20, 0x10(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2240
addq $0x4, %r12
cmpq %r13, %r12
jne 0xc4e9
movq 0x138(%rsp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
leaq 0x138(%rsp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movq $0x0, 0xc0(%rsp)
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rcx
movq 0x30(%rax), %rax
movq %rax, 0x110(%rsp)
cmpq %rax, %rcx
je 0xca70
leaq 0xf0(%rsp), %r12
movq %rcx, 0x118(%rsp)
movslq (%rcx), %rsi
movq 0x8(%rsp), %rcx
movq 0x58(%rcx), %rcx
leaq (%rsi,%rsi,2), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
addq $0x8, %rcx
movq 0x10(%rcx), %rax
movq %rcx, 0x128(%rsp)
cmpq %rcx, %rax
je 0xca56
movl %esi, %edi
movl %edi, %r13d
negl %r13d
cmovsl %edi, %r13d
shrl $0x1f, %edi
movq %rdi, 0x120(%rsp)
movl $0x1, %r14d
cmpl $0xa, %r13d
jb 0xc626
movl $0x4, %r14d
movl %r13d, %esi
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %esi
jbe 0xc61d
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0xc623
cmpl $0x2710, %esi           # imm = 0x2710
jb 0xc626
movl %esi, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0xc5ea
addl $-0x3, %r14d
jmp 0xc626
addl $-0x2, %r14d
jmp 0xc626
decl %r14d
movl %r13d, %r15d
movb 0x20(%rax), %bpl
movq %rax, 0x130(%rsp)
movl 0x24(%rax), %ebx
leal (%r14,%rdi), %esi
leaq 0x100(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq %rdi, %r13
movq %r12, %rdi
movl $0x2d, %edx
callq 0x2260
movq 0xf0(%rsp), %rdi
addq %r13, %rdi
movl %r14d, %esi
movl %r15d, %r13d
movl %r15d, %edx
callq 0xea40
movq %r12, %rdi
leaq 0x6a37(%rip), %r12      # 0x130b6
movq %r12, %rsi
callq 0x2380
leaq 0xa0(%rsp), %r14
movq %r14, 0x90(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc6bb
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0xc6c2
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x98(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x98(%rsp), %rsi
movsbl %bpl, %r8d
movl $0x1, %ecx
leaq 0x90(%rsp), %rdi
xorl %edx, %edx
callq 0x2370
leaq 0xe0(%rsp), %rbp
movq %rbp, 0xd0(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc731
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0xc738
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0xd8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xd0(%rsp), %rdi
movq %r12, %rsi
callq 0x2380
leaq 0x60(%rsp), %rsi
movq %rsi, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc78b
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0xc791
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0xc801
movl $0x4, %r14d
movl %ebp, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0xc7f8
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0xc7fe
cmpl $0x2710, %eax           # imm = 0x2710
jb 0xc801
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0xc7c8
addl $-0x3, %r14d
jmp 0xc801
addl $-0x2, %r14d
jmp 0xc801
decl %r14d
shrl $0x1f, %ebx
leal (%r14,%rbx), %esi
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x30(%rsp), %rdi
movl $0x2d, %edx
callq 0x2260
addq 0x30(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xea40
movq 0x50(%rsp), %rcx
movl $0xf, %esi
leaq 0x60(%rsp), %rax
cmpq %rax, %rcx
je 0xc84c
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %r8
movq 0x38(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
leaq 0xa0(%rsp), %r14
leaq 0xe0(%rsp), %rbp
leaq 0x80(%rsp), %r15
leaq 0x20(%rsp), %r12
jbe 0xc897
movl $0xf, %esi
leaq 0x40(%rsp), %rdi
cmpq %rdi, 0x30(%rsp)
je 0xc892
movq 0x40(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xc8a8
movq 0x30(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0x2090
jmp 0xc8b6
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
movq %r15, 0x70(%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0xc8d9
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0xc8e0
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x78(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x70(%rsp), %rdi
leaq 0x6876(%rip), %rsi      # 0x1317f
callq 0x2380
movq %r12, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc931
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xc939
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x115f4
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xc97a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xc994
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xc9b0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xc9cc
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %rbp, %rdi
je 0xc9e9
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xca06
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xca2b
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x130(%rsp), %rdi
callq 0x2160
cmpq 0x128(%rsp), %rax
leaq 0xf0(%rsp), %r12
movq 0x120(%rsp), %rdi
jne 0xc5d0
movq 0x118(%rsp), %rcx
addq $0x4, %rcx
cmpq 0x110(%rsp), %rcx
jne 0xc581
movq 0xb8(%rsp), %rsi
subq 0xb0(%rsp), %rsi
sarq $0x5, %rsi
leaq 0x138(%rsp), %rdi
callq 0x2140
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0xb0(%rsp), %r15
movq 0xb8(%rsp), %r13
cmpq %r13, %r15
je 0xcb2b
leaq 0x20(%rsp), %r12
leaq 0x10(%rsp), %rbx
leaq 0x138(%rsp), %r14
movq %r12, 0x10(%rsp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x44e2
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x2240
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xcb22
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x20, %r15
cmpq %r13, %r15
jne 0xcae2
leaq 0xb0(%rsp), %rdi
callq 0xdf0e
movq 0xc481(%rip), %rax      # 0x18fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x140(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x138(%rsp,%rcx)
callq 0x21a0
leaq 0x230(%rsp), %rdi
callq 0x20a0
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcbd1
jmp 0xcbd1
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xccb6
movq 0x20(%rsp), %rsi
jmp 0xccae
jmp 0xcba7
jmp 0xcba7
jmp 0xcba7
movq %rax, %rbx
jmp 0xccc3
movq %rax, %rbx
leaq 0xa0(%rsp), %r14
leaq 0xe0(%rsp), %rbp
jmp 0xcc3b
movq %rax, %rbx
jmp 0xcc74
movq %rax, %rbx
jmp 0xcc05
movq %rax, %rbx
jmp 0xccb6
movq %rax, %rbx
jmp 0xcc57
movq %rax, %rbx
jmp 0xcc1f
movq %rax, %rbx
jmp 0xcc91
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xcc05
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xcc1f
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xcc3b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xcc57
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %rbp, %rdi
je 0xcc74
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xcc91
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xccb6
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0xb0(%rsp), %rdi
callq 0xdf0e
leaq 0x138(%rsp), %rdi
callq 0x22c0
movq %rbx, %rdi
callq 0x2350