// File: JameyWoo[P]re2graph/algorithms.cpp
// Function: nfa2png(NFA, 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 nfa2png(NFA nfa, string png_file, string pattern) {
    string raw_png_file = png_file;
    string dot_file     = "./tmp/" + png_file.replace(png_file.find(".png"), 4, ".dot");
    nfa2dot(nfa, 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);
    // cout << "nfa cmd: " << cmd << endl;
    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 0x1f89e(%rip), %rsi     # 0x2d1f1
xorl %eax, %eax
movl %eax, %edx
callq 0x3540
movq -0x190(%rbp), %rdi
movq %rax, %rsi
leaq 0x1f8dd(%rip), %rcx     # 0x2d24a
movl $0x4, %edx
callq 0x31a0
movq %rax, -0x188(%rbp)
jmp 0xd980
movq -0x188(%rbp), %rdx
leaq 0x1f8b5(%rip), %rsi     # 0x2d243
leaq -0x58(%rbp), %rdi
callq 0x140a0
jmp 0xd999
movq -0x1a0(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x47a0
jmp 0xd9ae
leaq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x3120
jmp 0xd9c0
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0xdc90
jmp 0xd9d5
leaq -0xf8(%rbp), %rdi
callq 0x31c0
leaq -0xd8(%rbp), %rdi
callq 0x4880
leaq -0x119(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x34f0
movq -0x1a8(%rbp), %rdx
leaq 0x1fca2(%rip), %rsi     # 0x2d6b0
leaq -0x118(%rbp), %rdi
callq 0x46f0
jmp 0xda1c
leaq -0x119(%rbp), %rdi
callq 0x3330
leaq 0x1f820(%rip), %rdx     # 0x2d24f
leaq -0x180(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x14250
jmp 0xda44
leaq -0x160(%rbp), %rdi
leaq -0x180(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x14200
jmp 0xda5d
leaq 0x1f7f3(%rip), %rdx     # 0x2d257
leaq -0x140(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x141b0
jmp 0xda79
leaq -0x160(%rbp), %rdi
callq 0x31c0
leaq -0x180(%rbp), %rdi
callq 0x31c0
movq -0x198(%rbp), %rdi
callq 0x3210
cmpq $0x0, %rax
je 0xdbde
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 0xdafe
jmp 0xdbde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xdc74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xdc6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xdb4b
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 0x4880
jmp 0xdc6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x119(%rbp), %rdi
callq 0x3330
jmp 0xdc6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xdc5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xdbb0
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 0xdc5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x31c0
jmp 0xdc5f
leaq 0x1f67e(%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 0xdc16
leaq -0x140(%rbp), %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3270
jmp 0xdc2c
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)