// File: /workspace/github_cpp_makefile_star2_O1/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 0x431b(%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 0x4308(%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 0x42e8(%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 0x42c7(%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
cmpq %rax, 0x8(%rcx)
je 0x31e1
xorl %edx, %edx
leaq -0xe0(%rbp), %rbx
movabsq $0x346dc5d63886594b, %r12 # imm = 0x346DC5D63886594B
movq %rdx, -0xa0(%rbp)
movq (%rax,%rdx,8), %rax
movq %rax, -0x98(%rbp)
movq (%rax), %r13
movq 0x8(%rax), %rax
movq %rax, -0xa8(%rbp)
cmpq %rax, %r13
je 0x31b9
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 0x3f4c
movq -0xc8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
callq 0x3f4c
movq %rbx, %r15
movq %rbx, %rdi
leaq -0x98(%rbp), %rsi
callq 0x423a
movq (%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
leaq -0x38(%rbp), %rdi
jb 0x2ec0
movl $0x4, %esi
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x2eb9
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x2ebe
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x2ec0
movq %rcx, %rax
mulq %r12
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x2e83
addl $-0x3, %esi
jmp 0x2ec0
addl $-0x2, %esi
jmp 0x2ec0
decl %esi
movl %esi, %esi
movq %rdi, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
xorl %edx, %edx
callq 0x2140
movq -0x48(%rbp), %rdi
movl -0x40(%rbp), %esi
movq %rbx, %rdx
callq 0x38e6
movl $0x1, %r8d
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x4165(%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 0x2f24
movq %rdx, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x2f2a
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 0x2f5a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq %r15, %rdi
movq %r13, %rsi
callq 0x423a
movq (%rax), %rbx
movl $0x1, %esi
cmpq $0xa, %rbx
jb 0x2fb8
movl $0x4, %esi
movq %rbx, %rcx
cmpq $0x63, %rcx
jbe 0x2fb1
cmpq $0x3e7, %rcx            # imm = 0x3E7
jbe 0x2fb6
cmpq $0x2710, %rcx           # imm = 0x2710
jb 0x2fb8
movq %rcx, %rax
mulq %r12
shrq $0xb, %rdx
addl $0x4, %esi
cmpq $0x1869f, %rcx          # imm = 0x1869F
movq %rdx, %rcx
ja 0x2f7b
addl $-0x3, %esi
jmp 0x2fb8
addl $-0x2, %esi
jmp 0x2fb8
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 0x38e6
movl $0x1, %r8d
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x4069(%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 0x301a
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x3020
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 0x3050
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x20f0
movb 0x8(%r13), %r14b
movq (%r13), %rax
cmpb $0x1, 0x18(%rax)
jne 0x3091
movl $0x1c, %edx
leaq -0x2e0(%rbp), %rdi
leaq 0x3feb(%rip), %rsi      # 0x705c
callq 0x2130
movb $0xa, -0x68(%rbp)
movl $0x1, %edx
leaq -0x2e0(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x2130
jmp 0x30c2
movl $0x16, %edx
leaq -0x2e0(%rbp), %rdi
leaq 0x3fd5(%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 0x3fbb(%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 0x3f90(%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 0x3f6e(%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 0x3f4f(%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 0x3189
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x31a5
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x20f0
addq $0x10, %r13
cmpq -0xa8(%rbp), %r13
movq %r15, %rbx
jne 0x2e10
movq -0xa0(%rbp), %rdx
incq %rdx
movq -0x90(%rbp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rdx
jb 0x2de7
leaq 0x3ec2(%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 0x3966
movq 0x6da1(%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 0x32a4
movq %rax, %rbx
jmp 0x32ed
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x32e1
movq -0x38(%rbp), %rsi
jmp 0x32d9
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x32c5
movq -0x58(%rbp), %rsi
jmp 0x32bd
jmp 0x32a4
jmp 0x32a4
movq %rax, %rbx
jmp 0x32c5
movq %rax, %rbx
jmp 0x32e1
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x32c5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x20f0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x32e1
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x20f0
leaq -0xe0(%rbp), %rdi
callq 0x3966
leaq -0x2e0(%rbp), %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x21c0
nop