// File: LiuYinCarl[P]headerFileAnalysis/headerFileAnalysis.cpp
// Function: Graph::gen_dot_file()
bool Graph::gen_dot_file() {
  FILE* fp = fopen("include_graph.dot", "w");
  assert(fp != nullptr);
  // gen node define
  Node* tmp_node = nullptr;
  // ratio 图像高:宽
  // splines=false; 使用直线绘图
  fprintf(fp, "digraph {\n\n graph [ratio = 0.5];\n");
  fprintf(fp, "// node define\n");
  for (auto& item : node_map) {
    tmp_node = item.second;
    fprintf(fp, "%d[label=\"%s %d\"];\n",
            item.first,
            tmp_node->get_node_name().c_str(),
            tmp_node->get_child_node_count());
  }

  fprintf(fp, "\n\n");

  // gen line
  for (auto& item : node_map) {
    Node* node = item.second;
    uint32_t self_node_id = item.first;

    for (auto& child_id : node->get_child_nodes()) {
      fprintf(fp, "%d -> %d;\n", child_id, self_node_id);
    }
  }
  fprintf(fp, "\n}");
  fclose(fp);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq 0x3bb7e(%rip), %rdi     # 0x433ff
leaq 0x3bb89(%rip), %rsi     # 0x43411
callq 0x65b0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x789a
jmp 0x78b9
leaq 0x3bb72(%rip), %rdi     # 0x43413
leaq 0x3b933(%rip), %rsi     # 0x431db
movl $0xbd, %edx
leaq 0x3bb6d(%rip), %rcx     # 0x43421
callq 0x6370
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x3bb70(%rip), %rsi     # 0x4343c
movb $0x0, %al
callq 0x6690
movq -0x10(%rbp), %rdi
leaq 0x3bb80(%rip), %rsi     # 0x4345e
movb $0x0, %al
callq 0x6690
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9490
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8fa0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x94c0
testb $0x1, %al
jne 0x7924
jmp 0x79a8
leaq -0x28(%rbp), %rdi
callq 0x94f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6b90
movq %rax, %rdi
callq 0x61c0
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6c90
movq -0xa8(%rbp), %rdi
movl -0x9c(%rbp), %edx
movq -0x98(%rbp), %rcx
movl %eax, %r8d
leaq 0x3badb(%rip), %rsi     # 0x4346e
movb $0x0, %al
callq 0x6690
leaq -0x28(%rbp), %rdi
callq 0x9530
jmp 0x790e
movq -0x10(%rbp), %rdi
leaq 0x3bacf(%rip), %rsi     # 0x43482
movb $0x0, %al
callq 0x6690
movq -0x90(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x9490
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x8fa0
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x94c0
testb $0x1, %al
jne 0x79f9
jmp 0x7a9e
leaq -0x48(%rbp), %rdi
callq 0x94f0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x60(%rbp), %rdi
callq 0x6cb0
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x92f0
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
callq 0x9320
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x9350
testb $0x1, %al
jne 0x7a55
jmp 0x7a8e
leaq -0x78(%rbp), %rdi
callq 0x9390
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rdi
movq -0x88(%rbp), %rax
movl (%rax), %edx
movl -0x64(%rbp), %ecx
leaq 0x3ba09(%rip), %rsi     # 0x43485
movb $0x0, %al
callq 0x6690
leaq -0x78(%rbp), %rdi
callq 0x9470
jmp 0x7a42
jmp 0x7a90
leaq -0x48(%rbp), %rdi
callq 0x9530
jmp 0x79e3
movq -0x10(%rbp), %rdi
leaq 0x3b9e7(%rip), %rsi     # 0x43490
movb $0x0, %al
callq 0x6690
movq -0x10(%rbp), %rdi
callq 0x6480
movb $0x1, %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)