// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/graph/graph.cpp
// Function: Graph::getPath(Node*, Node*, std::vector<Node*, std::allocator<Node*>>&, int (*)(Node*, Node*))
Nodes Graph::getPath(Node* _s, Node* _g,
                     Nodes &prohibitedNodes, int (*dist) (Node*, Node*))
{
  bool prohibited = !prohibitedNodes.empty();
  Nodes path, C;
  std::string key;

  // ==== fast implementation ====
  if (regFlg && !prohibited) {
    key = getKey(_s, _g);
    auto itrK = knownPaths.find(key);
    if (itrK != knownPaths.end()) {  // known
      path = itrK->second->path;
      return path;
    }
  }
  // =============================

  int f;
  bool invalid = true;

  // prepare node open hashtable
  boost::heap::fibonacci_heap<Fib_AN> OPEN;
  std::unordered_map<int, boost::heap::fibonacci_heap<Fib_AN>::handle_type> SEARCHED;
  std::unordered_set<int> CLOSE;
  AN* n = new AN { _s, 0, dist(_s, _g), nullptr };
  auto handle = OPEN.push(Fib_AN(n));
  SEARCHED.emplace(n->v->getId(), handle);

  while (!OPEN.empty()) {
    // argmin
    n = OPEN.top().node;

    // check goal condition
    if (n->v == _g) {
      invalid = false;
      break;
    }

    // ==== fast implementation ====
    key = getKey(n->v, _g);
    auto itrK = knownPaths.find(key);
    if (itrK != knownPaths.end()) {  // known
      Nodes kPath = itrK->second->path;
      bool valid = true;
      if (prohibited) {
        for (auto v : kPath) {
          if (inArray(v, prohibitedNodes)) {
            valid = false;
            break;
          }
        }
      }
      if (valid) {
        for (int i = 1; i < kPath.size(); ++i) {
          n = new AN { kPath[i], 0, 0, n };
        }
        invalid = false;
        break;
      }
    }
    // =============================

    // update list
    OPEN.pop();
    CLOSE.emplace(n->v->getId());

    // search neighbor
    C = neighbor(n->v);

    for (auto m : C) {
      if (prohibited && inArray(m, prohibitedNodes)) continue;
      if (CLOSE.find(m->getId()) != CLOSE.end()) continue;
      f = n->g + 1 + dist(m, _g);

      // ==== fast implementation ====
      if (regFlg) {
        key = getKey(m, _g);
        auto itrK = knownPaths.find(key);
        if (itrK != knownPaths.end()) {
          f = n->g + 1 + itrK->second->path.size() - 1;
        }
      }
      // =============================

      auto itrS = SEARCHED.find(m->getId());
      if (itrS == SEARCHED.end()) {  // new node
        AN* l = new AN { m, n->g + 1, f, n };
        auto handle = OPEN.push(Fib_AN(l));
        SEARCHED.emplace(l->v->getId(), handle);
      } else {
        auto handle = itrS->second;
        AN* l = (*handle).node;
        if (l->f > f) {
          l->g = n->g + 1;
          l->f = f;
          l->p = n;
          OPEN.increase(handle);
        }
      }
    }
  }

  if (invalid) return path;

  // back tracking
  while (n != nullptr) {
    path.push_back(n->v);
    n = n->p;
  }
  std::reverse(path.begin(), path.end());

  // register path
  if (regFlg && !prohibited) registerPath(path);

  return path;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %r9, 0xa0(%rsp)
movq %r8, %r12
movq %rcx, 0x68(%rsp)
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r13
movq (%r8), %rcx
movq 0x8(%r8), %rdx
xorl %eax, %eax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
movq %rax, -0x8(%r15)
movb $0x0, (%r15)
movq %rcx, 0x88(%rsp)
movq %rdx, 0x80(%rsp)
cmpq %rdx, %rcx
jne 0x1a4c7
cmpb $0x0, 0x9(%rbp)
je 0x1a4c7
leaq 0xe0(%rsp), %rdi
movq %rbx, %rdx
movq 0x68(%rsp), %rcx
callq 0x1ac8a
leaq 0x48(%rsp), %rdi
leaq 0xe0(%rsp), %r14
movq %r14, %rsi
callq 0x6460
movq (%r14), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x1a489
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x6380
leaq 0x28(%rbp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1b9cc
testq %rax, %rax
je 0x1a4c7
movq 0x28(%rax), %rsi
addq $0x10, %rsi
movq %r13, %rdi
callq 0x1b2e0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1ab3d
movq 0x58(%rsp), %rsi
incq %rsi
jmp 0x1ab38
leaq 0xc8(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x18(%rax)
movq $0x0, -0x8(%rax)
movq %rax, (%rax)
movq %rax, 0x8(%rax)
leaq 0x110(%rsp), %rax
movq %rax, -0x30(%rax)
movl $0x1, %ecx
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
leaq 0x150(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
movl $0x18, %edi
callq 0x6370
movq %rax, %r14
movq %rbx, (%rax)
movl $0x0, 0x8(%rax)
movq %rbx, %rdi
movq 0x68(%rsp), %rsi
callq *0xa0(%rsp)
movl %eax, 0xc(%r14)
movq $0x0, 0x10(%r14)
leaq 0x20(%rsp), %rsi
movq %r14, (%rsi)
leaq 0xb0(%rsp), %rdi
movq %r13, 0x78(%rsp)
callq 0x1b3c4
leaq 0x118(%rsp), %rdx
movq %rax, (%rdx)
movq (%r14), %rax
movl (%rax), %eax
leaq 0x20(%rsp), %rsi
movl %eax, (%rsi)
leaq 0xe0(%rsp), %rdi
callq 0x1bce0
cmpq $0x0, 0xb0(%rsp)
je 0x1a9f0
movq %rbp, 0x98(%rsp)
leaq 0x28(%rbp), %rax
movq %rax, 0x90(%rsp)
movb $0x1, %al
movl %eax, 0x74(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r15
movq $0x0, 0x8(%rsp)
movq 0xb8(%rsp), %rax
movq 0x10(%rax), %rbp
movq (%rbp), %rdx
movq 0x68(%rsp), %rcx
cmpq %rcx, %rdx
je 0x1aa4b
movq %rbx, %rdi
callq 0x1ac8a
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x6460
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1a629
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6380
movq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1b9cc
testq %rax, %rax
je 0x1a70b
movq 0x28(%rax), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x19aae
movq 0x80(%rsp), %rax
cmpq %rax, 0x88(%rsp)
je 0x1a6a1
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
je 0x1a6a1
movq 0x8(%r12), %rsi
movq (%rbx), %rax
movq %rax, 0x40(%rsp)
movq (%r12), %rdi
movq %r15, %rdx
callq 0x19b2e
movq 0x8(%r12), %rsi
cmpq %rsi, %rax
jne 0x1a6cb
addq $0x8, %rbx
cmpq %r14, %rbx
jne 0x1a67a
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r14
subq %r15, %r14
sarq $0x3, %r14
cmpq $0x2, %r14
jae 0x1aa07
movb $0x1, %r14b
movl $0x0, 0x74(%rsp)
xorl %ebx, %ebx
jmp 0x1a6d5
movb $0x1, %bl
movq 0x20(%rsp), %r15
xorl %r14d, %r14d
testq %r15, %r15
je 0x1a6ea
movq 0x30(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x6380
testb %r14b, %r14b
leaq 0x40(%rsp), %r15
je 0x1a706
testb %bl, %bl
leaq 0x20(%rsp), %rbx
jne 0x1a9d5
jmp 0x1a9e4
leaq 0x20(%rsp), %rbx
leaq 0xb0(%rsp), %rdi
callq 0x1b446
movq (%rbp), %rax
movl (%rax), %eax
movl %eax, 0x20(%rsp)
leaq 0x120(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c2ca
movq (%rbp), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x19aae
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1a79d
movq 0x8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1a79d
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %r14, %rbx
movq %r14, 0x10(%rsp)
cmpq 0xa8(%rsp), %r14
je 0x1a9bc
movq (%rbx), %r15
movq 0x80(%rsp), %rax
cmpq %rax, 0x88(%rsp)
je 0x1a7eb
movq %r15, 0x20(%rsp)
movq (%r12), %rdi
movq 0x8(%r12), %rsi
leaq 0x20(%rsp), %rdx
callq 0x19b2e
cmpq 0x8(%r12), %rax
jne 0x1a9aa
movslq (%r15), %rcx
movq 0x120(%rsp), %rdi
movq 0x128(%rsp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x1a841
movq %rdx, %rsi
movq (%rax), %r9
cmpl 0x8(%r9), %ecx
je 0x1a9aa
movq (%r9), %r9
testq %r9, %r9
je 0x1a841
movslq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rsi, %rdx
jne 0x1a841
cmpl %edi, %ecx
jne 0x1a81f
jmp 0x1a9aa
movl 0x8(%rbp), %r14d
movq %r15, %rdi
movq 0x68(%rsp), %rsi
callq *0xa0(%rsp)
leal (%r14,%rax), %r13d
incl %r13d
movq 0x98(%rsp), %rax
cmpb $0x1, 0x9(%rax)
jne 0x1a8d2
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
movq 0x68(%rsp), %rcx
callq 0x1ac8a
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq 0x6460
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1a8a7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6380
movq 0x90(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x1b9cc
testq %rax, %rax
je 0x1a8d2
movq 0x28(%rax), %rax
movq 0x18(%rax), %r13
subq 0x10(%rax), %r13
shrq $0x3, %r13
addl 0x8(%rbp), %r13d
movslq (%r15), %rcx
movq 0xe0(%rsp), %rdi
movq 0xe8(%rsp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x1a94c
movq %rdx, %rsi
movq (%rax), %r9
cmpl 0x8(%r9), %ecx
je 0x1a91f
movq (%r9), %r9
testq %r9, %r9
je 0x1a94c
movslq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rsi, %rdx
jne 0x1a94c
cmpl %edi, %ecx
jne 0x1a902
movq 0x10(%r9), %rsi
movq 0x10(%rsi), %rax
cmpl %r13d, 0xc(%rax)
jle 0x1a9aa
movl 0x8(%rbp), %ecx
incl %ecx
movl %ecx, 0x8(%rax)
movl %r13d, 0xc(%rax)
movq %rbp, 0x10(%rax)
leaq 0xb0(%rsp), %rdi
callq 0x1b4b2
jmp 0x1a9aa
movl $0x18, %edi
callq 0x6370
movq %rax, %r14
movq %r15, (%rax)
movl 0x8(%rbp), %eax
incl %eax
movl %eax, 0x8(%r14)
movl %r13d, 0xc(%r14)
movq %rbp, 0x10(%r14)
movq %r14, 0x40(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x40(%rsp), %r15
movq %r15, %rsi
callq 0x1b3c4
movq %rax, 0x20(%rsp)
movq (%r14), %rax
movl (%rax), %eax
movl %eax, 0x40(%rsp)
leaq 0xe0(%rsp), %rdi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1bce0
addq $0x8, %rbx
cmpq 0xa8(%rsp), %rbx
jne 0x1a7b3
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x78(%rsp), %r13
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r15
cmpq $0x0, 0xb0(%rsp)
jne 0x1a5da
testb $0x1, 0x74(%rsp)
je 0x1aa4b
jmp 0x1aae3
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
jmp 0x1aae3
movl $0x1, %r12d
movl $0x18, %edi
callq 0x6370
movq %rax, %rbx
movq (%r15,%r12,8), %rax
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
incq %r12
movq %rbx, %rbp
cmpq %r12, %r14
jne 0x1aa0d
movq 0x30(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x6380
movq %rbx, %rbp
movq 0x8(%r13), %rsi
cmpq 0x10(%r13), %rsi
je 0x1aa63
movq (%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r13)
jmp 0x1aa6e
movq %r13, %rdi
movq %rbp, %rdx
callq 0x1c5cc
movq 0x10(%rbp), %rbp
testq %rbp, %rbp
jne 0x1aa4b
movq (%r13), %rax
movq 0x8(%r13), %rcx
cmpq %rcx, %rax
setne %dl
addq $-0x8, %rcx
cmpq %rax, %rcx
seta %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x1aabb
addq $0x8, %rax
movq -0x8(%rax), %rdx
movq (%rcx), %rsi
movq %rsi, -0x8(%rax)
movq %rdx, (%rcx)
addq $-0x8, %rcx
leaq 0x8(%rax), %rdx
cmpq %rcx, %rax
movq %rdx, %rax
jb 0x1aa9d
movq 0x80(%rsp), %rax
cmpq %rax, 0x88(%rsp)
movq 0x98(%rsp), %rdi
jne 0x1aae3
cmpb $0x0, 0x9(%rdi)
je 0x1aae3
movq %r13, %rsi
callq 0x1ae86
leaq 0x120(%rsp), %rdi
callq 0x1b8ec
leaq 0xe0(%rsp), %rdi
callq 0x1b95c
leaq 0xb0(%rsp), %rdi
callq 0x1b54e
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x1ab26
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1ab3d
movq 0x8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %r13, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1abc6
jmp 0x1aba1
movq %rax, %rbx
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
jmp 0x1ac10
movq %rax, %rbx
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
jmp 0x1ac15
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
callq 0x6380
jmp 0x1ab93
movq %rax, %rbx
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
jmp 0x1ac1a
movq %rax, %rbx
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
jmp 0x1ac41
movq %rax, %rbx
jmp 0x1abdd
jmp 0x1abc6
jmp 0x1abc6
jmp 0x1abc6
jmp 0x1abc6
jmp 0x1abc6
jmp 0x1abfe
movq %rax, %rbx
jmp 0x1abf2
jmp 0x1abfe
jmp 0x1abfe
jmp 0x1abfe
jmp 0x1abfe
jmp 0x1abfe
movq %rax, %rbx
movq 0x20(%rsp), %r15
testq %r15, %r15
je 0x1abf2
movq 0x30(%rsp), %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x6380
leaq 0x58(%rsp), %r15
movq 0x10(%rsp), %r14
jmp 0x1ac15
movq %rax, %rbx
movq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %r14
leaq 0x58(%rsp), %r15
movq 0x78(%rsp), %r13
leaq 0x120(%rsp), %rdi
callq 0x1b8ec
leaq 0xe0(%rsp), %rdi
callq 0x1b95c
leaq 0xb0(%rsp), %rdi
callq 0x1b54e
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x1ac58
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6380
testq %r14, %r14
je 0x1ac6d
movq 0x8(%rsp), %rsi
subq %r14, %rsi
movq %r14, %rdi
callq 0x6380
movq (%r13), %rdi
testq %rdi, %rdi
je 0x1ac82
movq 0x10(%r13), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620