// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::CLOSEST_EMPTY_VERTICLES(Agent*)
Nodes PPS::CLOSEST_EMPTY_VERTICLES(Agent* c) {
  Nodes empties;
  Nodes occupied;
  Nodes Y;
  Nodes C;

  // create occupied lists
  for (auto a : A) occupied.push_back(a->getNode());
  std::unordered_map<int, VD*> table;
  VD* n = new VD { c->getNode(), 0 };
  int id = n->v->getId();
  int d;

  std::unordered_set<int> OPEN = { id };
  table.emplace(id, n);

  while (!OPEN.empty()) {
    auto itr = std::min_element(OPEN.begin(), OPEN.end(),
                                [&table] (int a, int b)
                                { return table.at(a)->d < table.at(b)->d; });
    id = *itr;
    n = table.at(id);

    // check empty or not
    if (!inArray(n->v, occupied)) {
      if (Y.empty()) {
        d = n->d;
      } else if (d < n->d) {
        break;
      }
      // same distance
      Y.push_back(n->v);
    }

    // update list
    OPEN.erase(itr);

    C = G->neighbor(n->v);
    for (auto m : C) {
      id = m->getId();
      auto itr = table.find(id);
      if (itr == table.end()) {
        VD* l = new VD { m, n->d + 1 };
        table.emplace(id, l);
        OPEN.insert(id);
        continue;
      }
    }
  }

  return Y;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %rbx
xorl %eax, %eax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %rax, 0x10(%rdi)
movq %rdi, 0x28(%rsp)
movups %xmm0, (%rdi)
movq 0x20(%rsi), %r12
movq %rsi, 0xb8(%rsp)
movq 0x28(%rsi), %r13
cmpq %r13, %r12
je 0x3a91f
leaq 0x50(%rsp), %r14
leaq 0x80(%rsp), %r15
movq (%r12), %rax
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1fb6e
addq $0x8, %r12
cmpq %r13, %r12
jne 0x3a8fb
leaq 0xb0(%rsp), %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)
movl $0x10, %edi
callq 0x6370
movq 0x8(%rbx), %rcx
movq %rcx, (%rax)
movl $0x0, 0x8(%rax)
movq %rax, 0x20(%rsp)
movl (%rcx), %eax
movl %eax, 0x10(%rsp)
leaq 0x34(%rsp), %rdx
movl %eax, -0x4(%rdx)
leaq 0x16(%rsp), %rax
movq %rax, (%rsp)
leaq 0xc0(%rsp), %r15
leaq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %r8
leaq 0x17(%rsp), %r9
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x3de42
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x3df42
cmpq $0x0, 0xd8(%rsp)
je 0x3acc5
xorl %r14d, %r14d
leaq 0x10(%rsp), %rbp
xorl %r12d, %r12d
movq 0xd0(%rsp), %rbx
testq %rbx, %rbx
movq %r14, 0x18(%rsp)
je 0x3aaae
movq (%rbx), %r11
movq 0x80(%rsp), %r10
movq 0x88(%rsp), %r9
testq %r11, %r11
je 0x3aac0
movslq 0x8(%r11), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %r9
movq (%r10,%rdx,8), %rax
testq %rax, %rax
je 0x3ad2d
movq %rdx, %rdi
movslq 0x8(%rbx), %rcx
movq (%rax), %r14
cmpl 0x8(%r14), %esi
je 0x3aa4c
movq (%r14), %r14
testq %r14, %r14
je 0x3ad2d
movslq 0x8(%r14), %r8
movq %r8, %rax
xorl %edx, %edx
divq %r9
cmpq %rdi, %rdx
jne 0x3ad2d
cmpl %r8d, %esi
jne 0x3aa26
movq %rcx, %rax
xorl %edx, %edx
divq %r9
movq (%r10,%rdx,8), %rax
testq %rax, %rax
je 0x3ad2d
movq %rdx, %rsi
movq 0x10(%r14), %rdx
movl 0x8(%rdx), %r8d
movq (%rax), %r14
cmpl 0x8(%r14), %ecx
je 0x3aa9a
movq (%r14), %r14
testq %r14, %r14
je 0x3ad2d
movslq 0x8(%r14), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r9
cmpq %rsi, %rdx
jne 0x3ad2d
cmpl %edi, %ecx
jne 0x3aa75
movq 0x10(%r14), %rax
cmpl 0x8(%rax), %r8d
cmovlq %r11, %rbx
movq (%r11), %r11
jmp 0x3a9f4
movq 0x80(%rsp), %r10
movq 0x88(%rsp), %r9
xorl %ebx, %ebx
movslq 0x8(%rbx), %rcx
movl %ecx, 0x10(%rsp)
movq %rcx, %rax
xorl %edx, %edx
divq %r9
movq (%r10,%rdx,8), %rax
testq %rax, %rax
je 0x3ad2d
movq %rdx, %rsi
movq (%rax), %r8
cmpl 0x8(%r8), %ecx
je 0x3ab0e
movq (%r8), %r8
testq %r8, %r8
je 0x3ad2d
movslq 0x8(%r8), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r9
cmpq %rsi, %rdx
jne 0x3ad2d
cmpl %edi, %ecx
jne 0x3aae9
movq 0x10(%r8), %rax
movq %rax, 0x20(%rsp)
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x19b2e
cmpq 0x58(%rsp), %rax
jne 0x3ab7c
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rsi
movq 0x20(%rsp), %rdx
movl 0x8(%rdx), %eax
cmpq %rsi, (%rcx)
je 0x3ab5b
cmpl %eax, 0x4c(%rsp)
jge 0x3ab5f
jmp 0x3accd
movl %eax, 0x4c(%rsp)
movq 0x28(%rsp), %rdi
cmpq 0x10(%rdi), %rsi
je 0x3ab77
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x3ab7c
callq 0x1c5cc
movq %r15, %rdi
movq %rbx, %rsi
callq 0x30182
movq 0xb8(%rsp), %rax
movq 0x38(%rax), %rsi
movq 0x20(%rsp), %rax
movq (%rax), %rdx
leaq 0x30(%rsp), %rdi
callq 0x1a38a
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %rax
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3abf6
subq %rdi, %r12
movq %r12, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3abf6
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %r14, %rbx
cmpq %r13, %r14
je 0x3acaf
movq (%rbx), %r12
movslq (%r12), %rcx
movl %ecx, 0x10(%rsp)
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x3ac59
movq %rdx, %rsi
movq (%rax), %r9
cmpl 0x8(%r9), %ecx
je 0x3aca2
movq (%r9), %r9
testq %r9, %r9
je 0x3ac59
movslq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
cmpq %rsi, %rdx
jne 0x3ac59
cmpl %edi, %ecx
jne 0x3ac3a
jmp 0x3aca2
movl $0x10, %edi
callq 0x6370
movq %r12, (%rax)
movq 0x20(%rsp), %rcx
movl 0x8(%rcx), %ecx
incl %ecx
movl %ecx, 0x8(%rax)
movq %rax, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
movq %rbp, %rsi
leaq 0x78(%rsp), %rdx
callq 0x3df42
movq %r15, 0x30(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
leaq 0x30(%rsp), %rdx
callq 0x300d0
addq $0x8, %rbx
cmpq %r13, %rbx
jne 0x3ac02
cmpq $0x0, 0xd8(%rsp)
movq 0x70(%rsp), %r12
jne 0x3a9cb
jmp 0x3acd2
xorl %r12d, %r12d
xorl %r14d, %r14d
jmp 0x3acd2
movq 0x18(%rsp), %r14
leaq 0xc0(%rsp), %rdi
callq 0x1b8ec
leaq 0x80(%rsp), %rdi
callq 0x3d648
testq %r14, %r14
je 0x3acff
subq %r14, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x6380
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3ad16
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x28(%rsp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf7e7(%rip), %rdi      # 0x4a51b
callq 0x6520
movq %rax, %rbx
xorl %r12d, %r12d
movq $0x0, 0x18(%rsp)
jmp 0x3ad79
jmp 0x3ad4c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3d648
jmp 0x3ada8
jmp 0x3ad76
movq %rax, %rbx
jmp 0x3ada8
jmp 0x3ad76
movq %rax, %rbx
movq 0x70(%rsp), %r12
movq %r14, 0x18(%rsp)
jmp 0x3ad79
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x1b8ec
leaq 0x80(%rsp), %rdi
callq 0x3d648
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x3ada8
subq %rdi, %r12
movq %r12, %rsi
callq 0x6380
movq 0x28(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3adc1
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3add8
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620