// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
cmpq %rdx, %rsi
je 0x3f111
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x38(%rdi), %rdi
callq 0x1a386
movl %eax, %r12d
movq 0x38(%r15), %rdi
movq %rbx, %rsi
callq 0x1a386
testl %r12d, %r12d
js 0x3f144
movl %eax, %ebp
testl %eax, %eax
js 0x3f144
movslq %r12d, %rax
movq 0x48(%r15), %rcx
cmpq %rax, %rcx
jle 0x3f144
movslq %ebp, %r13
cmpq %r13, 0x50(%r15)
jle 0x3f144
imulq %r13, %rcx
shlq $0x2, %rcx
addq 0x40(%r15), %rcx
movl (%rcx,%rax,4), %r12d
testl %r12d, %r12d
jne 0x3f132
movq 0x38(%r15), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, 0x10(%rsp)
movq %r14, %rdx
movq %rbx, 0x8(%rsp)
movq %rbx, %rcx
callq *0x18(%rax)
movq (%r12), %rbx
movq 0x8(%r12), %rax
movq %rax, %r12
subq %rbx, %r12
shrq $0x3, %r12
decl %r12d
movq %rax, 0x18(%rsp)
cmpq %rbx, %rax
je 0x3f11b
movq 0x38(%r15), %rax
movb 0x8(%rax), %al
movb %al, 0x7(%rsp)
movl %r12d, %r14d
movq (%rbx), %rsi
movq 0x38(%r15), %rdi
callq 0x1a386
testl %eax, %eax
js 0x3f144
movslq %eax, %rcx
movq 0x48(%r15), %rdx
cmpq %rcx, %rdx
jle 0x3f144
movq 0x50(%r15), %rdi
cmpq %r13, %rdi
jle 0x3f144
movq 0x40(%r15), %rsi
movq %rdx, %r8
imulq %r13, %r8
leaq (%rsi,%r8,4), %r8
movl (%r8,%rcx,4), %r9d
cmpl %ebp, %eax
je 0x3f116
testl %r9d, %r9d
jne 0x3f116
movl %r14d, (%r8,%rcx,4)
cmpb $0x0, 0x7(%rsp)
jne 0x3f101
cmpq %r13, %rdx
jle 0x3f144
cmpq %rcx, %rdi
jle 0x3f144
imulq %rcx, %rdx
leaq (%rsi,%rdx,4), %rax
movl %r14d, (%rax,%r13,4)
decl %r14d
addq $0x8, %rbx
cmpq 0x18(%rsp), %rbx
jne 0x3f093
jmp 0x3f11b
xorl %r12d, %r12d
jmp 0x3f132
cmpl %r9d, %r14d
jne 0x3f163
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3f132
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movl %r12d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc063(%rip), %rdi      # 0x4b1ae
leaq 0xc091(%rip), %rsi      # 0x4b1e3
leaq 0xcba6(%rip), %rcx      # 0x4bcff
movl $0x16f, %edx            # imm = 0x16F
callq 0x6260
movq 0x22e3e(%rip), %rdi     # 0x61fa8
leaq 0xc6f4(%rip), %rsi      # 0x4b865
movl $0x18, %edx
callq 0x63f0
movq 0x10(%rsp), %rax
movl (%rax), %esi
movq 0x22e1f(%rip), %rdi     # 0x61fa8
callq 0x6610
movq %rax, %r15
leaq 0xb6cd(%rip), %rsi      # 0x4a865
movl $0x4, %edx
movq %rax, %rdi
callq 0x63f0
movq 0x8(%rsp), %rax
movl (%rax), %esi
movq %r15, %rdi
callq 0x6610
movq %rax, %r15
leaq 0xae20(%rip), %rsi      # 0x49fde
movl $0x2, %edx
movq %rax, %rdi
callq 0x63f0
movq 0x10(%rsp), %rax
movsd 0x20(%rax), %xmm0
leaq 0x40(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r15, %rdi
callq 0x3fb19
movq %rax, %r14
leaq 0xb675(%rip), %rsi      # 0x4a865
movl $0x4, %edx
movq %rax, %rdi
callq 0x63f0
movq 0x8(%rsp), %rax
movsd 0x20(%rax), %xmm0
leaq 0x38(%rsp), %rsi
movsd %xmm0, (%rsi)
movq %r14, %rdi
callq 0x3fb19
movq %rax, %rbx
leaq 0xadbc(%rip), %rsi      # 0x49fde
movl $0x2, %edx
movq %rax, %rdi
callq 0x63f0
leaq 0xc648(%rip), %rsi      # 0x4b87e
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x63f0
leaq 0x9319(%rip), %rsi      # 0x48563
movq %rbx, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
jmp 0x3f262
jmp 0x3f262
jmp 0x3f262
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x3f27c
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620