// File: /workspace/github_cpp_makefile_star2_O2/Kei18[P]pibt/./src/solver/solver.cpp
// Function: Solver::pathDist(Node*, Node*)
int Solver::pathDist(Node* s, Node* g) {
  // same place?
  if (s == g) return 0;

  // has already explored?
  int s_index = G->getNodeIndex(s);
  int g_index = G->getNodeIndex(g);
  int dist = dists(s_index, g_index);
  if (dist != 0) return dist;

  // new
  Nodes path = G->getPath(s, g);

  dist = path.size() - 1;  // without start node
  int index, d, cost;
  bool directed = G->isDirected();

  cost = dist;
  for (auto v : path) {
    index = G->getNodeIndex(v);
    d = dists(index, g_index);
    if ((index != g_index) && (d == 0)) {
      dists(index, g_index) = cost;
      // if not directed graph
      if (!directed) dists(g_index, index) = cost;
      --cost;
    } else if (d == cost) {
      break;
    } else {
      std::cout << "error@Solver::pathDist, "
                << s->getId() << " -> " << g->getId() << ", "
                << s->getPos() << " -> " << g->getPos() << ", "
                << "not optimal path is obtained" << "\n";
      std::exit(1);
    }
  }

  return dist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpq %rdx, %rsi
je 0x32dfb
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbp
movq 0x38(%rdi), %rdi
callq 0x164c6
movl %eax, %ebx
movq 0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x164c6
leaq 0x40(%rbp), %r12
movslq %ebx, %rsi
movl %eax, %ebx
movslq %eax, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x33276
movl (%rax), %eax
testl %eax, %eax
jne 0x32e11
movq %r12, 0x10(%rsp)
movl %ebx, 0x1c(%rsp)
movq 0x38(%rbp), %rsi
movq (%rsi), %rax
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r15, 0x28(%rsp)
movq %r15, %rdx
movq %r14, 0x20(%rsp)
movq %r14, %rcx
callq *0x18(%rax)
movq %rbp, %rax
movq (%rbx), %rbp
movq 0x8(%rbx), %rcx
movq %rcx, 0x38(%rsp)
subq %rbp, %rcx
shrq $0x3, %rcx
decl %ecx
movq %rax, 0x30(%rsp)
movq 0x38(%rax), %rax
movb 0x8(%rax), %al
movb %al, 0xf(%rsp)
movl %ecx, %r15d
movq %rcx, %r12
cmpq 0x38(%rsp), %rbp
je 0x32e04
movq (%rbp), %rsi
movq 0x30(%rsp), %rax
movq 0x38(%rax), %rdi
callq 0x164c6
movl %eax, %ebx
movslq %eax, %r14
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x33276
movl (%rax), %eax
cmpl 0x1c(%rsp), %ebx
je 0x32dff
testl %eax, %eax
jne 0x32dff
movq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x33276
movl %r15d, (%rax)
cmpb $0x0, 0xf(%rsp)
movq %r12, %rcx
jne 0x32df2
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x33276
movl %r15d, (%rax)
movq %r12, %rcx
decl %r15d
addq $0x8, %rbp
jmp 0x32d82
xorl %eax, %eax
jmp 0x32e11
cmpl %eax, %r15d
jne 0x32e20
leaq 0x50(%rsp), %rdi
callq 0x990e
movq %r12, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27171(%rip), %rdi     # 0x59f98
leaq 0xab98(%rip), %rsi      # 0x3d9c6
callq 0x63a0
movq 0x28(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x6630
leaq 0x9a95(%rip), %rsi      # 0x3c8de
movq %rax, %rdi
callq 0x63a0
movq 0x20(%rsp), %rcx
movl (%rcx), %esi
movq %rax, %rdi
callq 0x6630
leaq 0x921f(%rip), %rsi      # 0x3c086
movq %rax, %rdi
callq 0x63a0
movq 0x28(%rsp), %rcx
movsd 0x20(%rcx), %xmm0
leaq 0x48(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %rax, %rdi
callq 0x332bf
leaq 0x9a4d(%rip), %rsi      # 0x3c8de
movq %rax, %rdi
callq 0x63a0
movq 0x20(%rsp), %rcx
movsd 0x20(%rcx), %xmm0
leaq 0x40(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %rax, %rdi
callq 0x332bf
leaq 0x91cb(%rip), %rsi      # 0x3c086
movq %rax, %rdi
callq 0x63a0
leaq 0xab15(%rip), %rsi      # 0x3d9df
movq %rax, %rdi
callq 0x63a0
leaq 0x768a(%rip), %rsi      # 0x3a563
movq %rax, %rdi
callq 0x63a0
pushq $0x1
popq %rdi
callq 0x6450
jmp 0x32eef
jmp 0x32eef
jmp 0x32eef
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x990e
movq %rbx, %rdi
callq 0x6650