// File: /workspace/github_cpp_makefile_star2_O3/ghallak[P]regex-to-dfa/src/DFA.cpp
// Function: DFA::CreateDotFile(std::basic_string_view<char, std::char_traits<char>>) const
void DFA::CreateDotFile(std::string_view filename) const {
  std::ofstream out(filename.data());
  out << "digraph finite_state_machine {" << '\n'
      << "  rankdir=LR;" << '\n'
      << "  size=\"8,5\"" << '\n'
      << "  node [shape = circle]; q0" << '\n';

  std::unordered_map<const State*, std::size_t> state_id;
  for (std::size_t i = 0; i < states.size(); ++i) {
    auto p = states[i].get();
    for (const auto& trans : p->Transitions()) {
      state_id.try_emplace(p, state_id.size());
      state_id.try_emplace(trans.state, state_id.size());
      auto start_state = "q" + std::to_string(state_id[p]);
      auto end_state = "q" + std::to_string(state_id[trans.state]);
      auto edge_label = trans.character;

      if (trans.state->IsAcceptState()) {
        out << "node [shape = doublecircle];" << '\n';
      } else {
        out << "node [shape = circle];" << '\n';
      }
      out << "  " << start_state << " -> " << end_state << " [ label = \""
          << edge_label << "\" ];" << '\n';
    }
  }
  out << "}" << '\n';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, -0x90(%rbp)
leaq -0x2e0(%rbp), %rbx
movq %rbx, %rdi
movq %rdx, %rsi
movl $0x10, %edx
callq 0x2100
leaq 0x438b(%rip), %rsi      # 0x7004
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x2130
leaq -0xe0(%rbp), %rsi
movb $0xa, (%rsi)
leaq -0x2e0(%rbp), %rdi
movl $0x1, %edx
callq 0x2130
movq %rax, %rbx
leaq 0x4378(%rip), %rsi      # 0x7023
movl $0xd, %edx
movq %rax, %rdi
callq 0x2130
leaq -0xe0(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x4358(%rip), %rsi      # 0x7031
movl $0xc, %edx
movq %rax, %rdi
callq 0x2130
leaq -0xe0(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x4337(%rip), %rsi      # 0x703e
movl $0x1b, %edx
movq %rax, %rdi
callq 0x2130
leaq -0xe0(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x2130
leaq -0xb0(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq -0x90(%rbp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
cmpq %rax, %rcx
je 0x3179
xorl %esi, %esi
leaq -0xe0(%rbp), %rbx
movabsq $0x346dc5d63886594b, %r12 # imm = 0x346DC5D63886594B
movq %rsi, -0xa0(%rbp)
movq (%rax,%rsi,8), %rdx
movq %rdx, -0x98(%rbp)
movq (%rdx), %r13
movq 0x8(%rdx), %rdx
movq %rdx, -0xa8(%rbp)
cmpq %rdx, %r13
je 0x315c
movq -0xc8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
leaq -0x98(%rbp), %rdx
leaq -0x88(%rbp), %r14
movq %r14, %rcx
callq 0x3e4e
movq -0xc8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
callq 0x3e4e
movq %rbx, %r15
movq %rbx, %rdi
leaq -0x98(%rbp), %rsi
callq 0x4106
leaq -0x48(%rbp), %r14
movq (%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
leaq -0x38(%rbp), %rdi
jb 0x2e57
movl $0x4, %esi
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x2e50
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x2e55
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x2e57
movq %rcx, %rax
mulq %r12
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x2e1a
addl $-0x3, %esi
jmp 0x2e57
addl $-0x2, %esi
jmp 0x2e57
decl %esi
movl %esi, %esi
movq %rdi, -0x48(%rbp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x2140
movq -0x48(%rbp), %rdi
movl -0x40(%rbp), %esi
movq %rbx, %rdx
callq 0x3818
movl $0x1, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x41d0(%rip), %rcx      # 0x705a
callq 0x2110
leaq -0x78(%rbp), %rsi
movq %rsi, -0x88(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2eb9
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x2ebf
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x80(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2eef
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq %r15, %rdi
movq %r13, %rsi
callq 0x4106
movq (%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x2f4d
movl $0x4, %esi
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x2f46
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x2f4b
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x2f4d
movq %rcx, %rax
mulq %r12
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x2f10
addl $-0x3, %esi
jmp 0x2f4d
addl $-0x2, %esi
jmp 0x2f4d
decl %esi
movl %esi, %esi
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
xorl %edx, %edx
callq 0x2140
movq -0x68(%rbp), %rdi
movl -0x60(%rbp), %esi
movq %rbx, %rdx
callq 0x3818
movl $0x1, %r8d
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x40d4(%rip), %rcx      # 0x705a
callq 0x2110
leaq -0x38(%rbp), %rsi
movq %rsi, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2faf
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x2fb5
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2fe5
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x20f0
movb 0x8(%r13), %r14b
movq (%r13), %rax
cmpb $0x1, 0x18(%rax)
jne 0x3026
movl $0x1c, %edx
leaq -0x2e0(%rbp), %rdi
leaq 0x4056(%rip), %rsi      # 0x705c
callq 0x2130
movb $0xa, -0x68(%rbp)
movl $0x1, %edx
leaq -0x2e0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2130
jmp 0x3057
movl $0x16, %edx
leaq -0x2e0(%rbp), %rdi
leaq 0x4040(%rip), %rsi      # 0x7079
callq 0x2130
movb $0xa, -0x68(%rbp)
movl $0x1, %edx
leaq -0x2e0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2130
movl $0x2, %edx
leaq -0x2e0(%rbp), %rdi
leaq 0x4026(%rip), %rsi      # 0x7090
callq 0x2130
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
leaq -0x2e0(%rbp), %rdi
callq 0x2130
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x3ffb(%rip), %rsi      # 0x7093
callq 0x2130
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2130
movq %rax, %rbx
movl $0xc, %edx
movq %rax, %rdi
leaq 0x3fd9(%rip), %rsi      # 0x7098
callq 0x2130
movb %r14b, -0x68(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
callq 0x2130
movq %rax, %rbx
movl $0x4, %edx
movq %rax, %rdi
leaq 0x3fba(%rip), %rsi      # 0x70a5
callq 0x2130
movb $0xa, -0x68(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
callq 0x2130
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x311e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x313a
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x20f0
addq $0x10, %r13
cmpq -0xa8(%rbp), %r13
movq %r15, %rbx
jne 0x2da3
movq -0x90(%rbp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
movq -0xa0(%rbp), %rsi
incq %rsi
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rdx, %rsi
jb 0x2d7a
leaq 0x3f2a(%rip), %rsi      # 0x70aa
leaq -0x2e0(%rbp), %rdi
movl $0x1, %edx
callq 0x2130
leaq -0x88(%rbp), %rsi
movb $0xa, (%rsi)
leaq -0x2e0(%rbp), %rdi
movl $0x1, %edx
callq 0x2130
leaq -0xe0(%rbp), %rdi
callq 0x3898
movq 0x6e09(%rip), %rax      # 0x9fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2d8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2e0(%rbp,%rcx)
callq 0x20c0
leaq -0x1e8(%rbp), %rdi
callq 0x2040
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x323c
movq %rax, %rbx
jmp 0x3285
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3279
movq -0x38(%rbp), %rsi
jmp 0x3271
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x325d
movq -0x58(%rbp), %rsi
jmp 0x3255
jmp 0x323c
jmp 0x323c
movq %rax, %rbx
jmp 0x325d
movq %rax, %rbx
jmp 0x3279
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x325d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x3279
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x20f0
leaq -0xe0(%rbp), %rdi
callq 0x3898
leaq -0x2e0(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x21c0
nop