// File: JameyWoo[P]re2graph/algorithms.cpp
// Function: dfa2png(DFA, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void dfa2png(DFA dfa, string png_file, string pattern) {
    string raw_png_file = png_file;
    string dot_file     = "./tmp/" + png_file.replace(png_file.find(".png"), 4, ".dot");
    dfa2dot(dfa, dot_file);
    string his_pat = "dot";
    string cmd     = his_pat + " -Tpng " + dot_file + " -o ./image/{test.png}";
    if (pattern.size()) cmd.replace(cmd.find(his_pat), his_pat.size(), pattern);
    cmd.replace(cmd.find("{test.png}"), 10, raw_png_file);
    system(cmd.c_str());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x1a0(%rbp)
movq %rsi, -0x190(%rbp)
movq %rdx, -0x198(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3120
movq -0x190(%rbp), %rdi
leaq 0x1e7ee(%rip), %rsi     # 0x2d1f1
xorl %eax, %eax
movl %eax, %edx
callq 0x3540
movq -0x190(%rbp), %rdi
movq %rax, %rsi
leaq 0x1e82d(%rip), %rcx     # 0x2d24a
movl $0x4, %edx
callq 0x31a0
movq %rax, -0x188(%rbp)
jmp 0xea30
movq -0x188(%rbp), %rdx
leaq 0x1e805(%rip), %rsi     # 0x2d243
leaq -0x58(%rbp), %rdi
callq 0x140a0
jmp 0xea49
movq -0x1a0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x4920
jmp 0xea5e
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3120
jmp 0xea70
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xed40
jmp 0xea85
leaq -0xf8(%rbp), %rdi
callq 0x31c0
leaq -0xd8(%rbp), %rdi
callq 0x4a00
leaq -0x119(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x34f0
movq -0x1a8(%rbp), %rdx
leaq 0x1ebf2(%rip), %rsi     # 0x2d6b0
leaq -0x118(%rbp), %rdi
callq 0x46f0
jmp 0xeacc
leaq -0x119(%rbp), %rdi
callq 0x3330
leaq 0x1e770(%rip), %rdx     # 0x2d24f
leaq -0x180(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x14250
jmp 0xeaf4
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x14200
jmp 0xeb0d
leaq 0x1e743(%rip), %rdx     # 0x2d257
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x141b0
jmp 0xeb29
leaq -0x160(%rbp), %rdi
callq 0x31c0
leaq -0x180(%rbp), %rdi
callq 0x31c0
movq -0x198(%rbp), %rdi
callq 0x3210
cmpq $0x0, %rax
je 0xec8e
xorl %eax, %eax
movl %eax, %edx
leaq -0x140(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
leaq -0x118(%rbp), %rsi
movq %rsi, -0x1c0(%rbp)
callq 0x3560
movq -0x1c0(%rbp), %rdi
movq %rax, -0x1b0(%rbp)
callq 0x3210
movq -0x1b8(%rbp), %rdi
movq -0x1b0(%rbp), %rsi
movq -0x198(%rbp), %rcx
movq %rax, %rdx
callq 0x30e0
jmp 0xebae
jmp 0xec8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xed24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xed1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xebfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x31c0
leaq -0xd8(%rbp), %rdi
callq 0x4a00
jmp 0xed1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x119(%rbp), %rdi
callq 0x3330
jmp 0xed1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xed0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xec60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x31c0
leaq -0x180(%rbp), %rdi
callq 0x31c0
jmp 0xed0f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x31c0
jmp 0xed0f
leaq 0x1e5ce(%rip), %rsi     # 0x2d263
xorl %eax, %eax
movl %eax, %edx
leaq -0x140(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x3540
movq -0x1c8(%rbp), %rdi
movq %rax, %rsi
movl $0xa, %edx
leaq -0x38(%rbp), %rcx
callq 0x30e0
jmp 0xecc6
leaq -0x140(%rbp), %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3270
jmp 0xecdc
leaq -0x140(%rbp), %rdi
callq 0x31c0
leaq -0x118(%rbp), %rdi
callq 0x31c0
leaq -0x58(%rbp), %rdi
callq 0x31c0
leaq -0x38(%rbp), %rdi
callq 0x31c0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
leaq -0x118(%rbp), %rdi
callq 0x31c0
leaq -0x58(%rbp), %rdi
callq 0x31c0
leaq -0x38(%rbp), %rdi
callq 0x31c0
movq -0x60(%rbp), %rdi
callq 0x34e0
nopw %cs:(%rax,%rax)