// File: /workspace/github_cpp_makefile_star2_O3/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 0xc2dd
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 0xc2a8
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 0xc394
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 0xc36a
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 0xc470
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 0xc446
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 0xc9e1
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 0xc9b1
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 0xc583
movl $0x4, %r14d
movl %r13d, %esi
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %esi
jbe 0xc57a
cmpl $0x3e7, %esi            # imm = 0x3E7
jbe 0xc580
cmpl $0x2710, %esi           # imm = 0x2710
jb 0xc583
movl %esi, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %esi          # imm = 0x1869F
movl %ecx, %esi
ja 0xc547
addl $-0x3, %r14d
jmp 0xc583
addl $-0x2, %r14d
jmp 0xc583
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 0xea32
movq %r12, %rdi
leaq 0x6ada(%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 0xc618
movq %rdx, 0x90(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa0(%rsp)
jmp 0xc61f
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 0xc68e
movq %rdx, 0xd0(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe0(%rsp)
jmp 0xc695
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 0x40(%rsp), %rsi
movq %rsi, 0x30(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc6e8
movq %rdx, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
jmp 0xc6ee
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%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 0xc75e
movl $0x4, %r14d
movl %ebp, %eax
movl $0xd1b71759, %edx       # imm = 0xD1B71759
cmpl $0x63, %eax
jbe 0xc755
cmpl $0x3e7, %eax            # imm = 0x3E7
jbe 0xc75b
cmpl $0x2710, %eax           # imm = 0x2710
jb 0xc75e
movl %eax, %ecx
imulq %rdx, %rcx
shrq $0x2d, %rcx
addl $0x4, %r14d
cmpl $0x1869f, %eax          # imm = 0x1869F
movl %ecx, %eax
ja 0xc725
addl $-0x3, %r14d
jmp 0xc75e
addl $-0x2, %r14d
jmp 0xc75e
decl %r14d
shrl $0x1f, %ebx
leal (%r14,%rbx), %esi
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %rdi
movl $0x2d, %edx
callq 0x2260
addq 0x50(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0xea32
movq 0x30(%rsp), %rcx
movl $0xf, %edi
leaq 0x40(%rsp), %rax
cmpq %rax, %rcx
je 0xc7a9
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %r8
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rdi, %rax
leaq 0xa0(%rsp), %r14
leaq 0xe0(%rsp), %rbp
leaq 0x80(%rsp), %r15
leaq 0x20(%rsp), %r12
jbe 0xc7f7
movl $0xf, %edi
leaq 0x60(%rsp), %r9
cmpq %r9, %rsi
je 0xc7f2
movq 0x60(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xc803
leaq 0x30(%rsp), %rdi
callq 0x2090
jmp 0xc811
leaq 0x50(%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 0xc834
movq %rdx, 0x70(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x80(%rsp)
jmp 0xc83b
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 0x691b(%rip), %rsi      # 0x1317f
callq 0x2380
movq %r12, 0x10(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc88c
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0xc894
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 0x115d8
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xc8d5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xc8ef
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xc90b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xc927
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %rbp, %rdi
je 0xc944
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xc961
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xc986
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 0xc52d
movq 0x118(%rsp), %rcx
addq $0x4, %rcx
cmpq 0x110(%rsp), %rcx
jne 0xc4de
movq 0xb8(%rsp), %rsi
subq 0xb0(%rsp), %rsi
sarq $0x5, %rsi
jmp 0xc9e3
xorl %esi, %esi
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 0xca8a
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 0x44cc
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r14, %rdi
callq 0x2240
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xca81
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
addq $0x20, %r15
cmpq %r13, %r15
jne 0xca41
leaq 0xb0(%rsp), %rdi
callq 0xded4
movq 0xc522(%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 0xcb30
jmp 0xcb30
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xcc15
movq 0x20(%rsp), %rsi
jmp 0xcc0d
jmp 0xcb06
jmp 0xcb06
jmp 0xcb06
movq %rax, %rbx
jmp 0xcc22
movq %rax, %rbx
leaq 0xa0(%rsp), %r14
leaq 0xe0(%rsp), %rbp
jmp 0xcb9a
movq %rax, %rbx
jmp 0xcbd3
movq %rax, %rbx
jmp 0xcb64
movq %rax, %rbx
jmp 0xcc15
movq %rax, %rbx
jmp 0xcbb6
movq %rax, %rbx
jmp 0xcb7e
movq %rax, %rbx
jmp 0xcbf0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xcb64
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0xcb7e
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xcb9a
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xcbb6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xd0(%rsp), %rdi
cmpq %rbp, %rdi
je 0xcbd3
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xcbf0
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0xcc15
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0xb0(%rsp), %rdi
callq 0xded4
leaq 0x138(%rsp), %rdi
callq 0x22c0
movq %rbx, %rdi
callq 0x2350