// File: /workspace/github_cpp_makefile_star2_O1/Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::PUSH(Agent*, std::vector<Node*, std::allocator<Node*>>&, bool)
RES PPS::PUSH(Agent* c, Nodes &T, bool swap) {
  if (inArray(c, H)) return RES::FAIL;   // l.1
  if (inArray(c, M)) return RES::PAUSE;  // l.2
  if (swap == false && inArray(c, U)) return PAUSE;  // l.3

  auto itrU = std::find(U.begin(), U.end(), c);
  if (itrU != U.end()) U.erase(itrU);  // l.4

  Nodes pi;
  RES attempt;
  if (isTmpGoals[c->getId()]) {  // l.5, used when swapping, case 3
    S* s = getS(c);
    // error check
    if (!inArray(s, doneSwapers) && s->phase != SWAPPHASE::CLEARING) {
      std::cout << "error@PPS::PUSH, invalid swap phase, s : "
                << s->id << ", phase : " << s->phase << "\n";
      std::exit(1);
    }
    pi = SHORTEST_PATH(c->getNode(), c->getGoal(), T);  // l.6
    attempt = FEASIBLE(c, pi, T, swap);     // l.16

  } else {

    pi = SHORTEST_PATH(c, c->getGoal(), T); // l.8
    attempt = FEASIBLE(c, pi, T, swap);     // l.9

    // exclude swap detected agents
    if (attempt == RES::FAIL && !inArray(c, pusherToSwaper)) {  // l.12
      Nodes Y = CLOSEST_EMPTY_VERTICLES(c);

      if (!Y.empty()) {
        Node* g = c->getGoal();
        Node* e = *std::min_element(Y.begin(), Y.end(),
                                   [this, g] (Node* e1, Node* e2)
                                   { return this->pathDist(e1, g)
                                       < this->pathDist(e2, g); });  // l.14
        pi = SHORTEST_PATH(c, e, T);  // l.15
        attempt = FEASIBLE(c, pi, T, swap);  // l.16
      }
    }
  }

  if (attempt == RES::SUCCESS) {  // l.17
    move(c, pi);  // l.18
    M.push_back(c);  // l.18
  }

  return attempt;  // l.19
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rdi, %rbx
movq %rsi, 0x8(%rsp)
leaq 0x30(%rsp), %rdx
movq %rsi, (%rdx)
movq 0x128(%rdi), %rdi
movq 0x130(%rbx), %rsi
callq 0x38b4d
movl $0x1, %r12d
cmpq 0x130(%rbx), %rax
jne 0x3a35f
movq 0x8(%rsp), %rax
leaq 0x30(%rsp), %rdx
movq %rax, (%rdx)
movq 0xe0(%rbx), %rdi
movq 0xe8(%rbx), %rsi
callq 0x38b4d
movl $0x2, %r12d
cmpq 0xe8(%rbx), %rax
jne 0x3a35f
testb %bpl, %bpl
jne 0x39fbf
movq 0x8(%rsp), %rax
leaq 0x30(%rsp), %rdx
movq %rax, (%rdx)
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rsi
callq 0x38b4d
cmpq 0x100(%rbx), %rax
jne 0x3a35f
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rsi
leaq 0x8(%rsp), %rdx
callq 0x38b4d
movq 0x100(%rbx), %rdx
cmpq %rdx, %rax
je 0x39fff
leaq 0x8(%rax), %rsi
cmpq %rdx, %rsi
je 0x39ff7
subq %rsi, %rdx
movq %rax, %rdi
callq 0x65b0
addq $-0x8, 0x100(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x8(%rsp), %rdx
movslq (%rdx), %rax
leaq 0x3f(%rax), %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq 0x160(%rbx), %rcx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
leaq 0x3f(%rsi), %rdi
andq %rax, %rdi
xorl %r8d, %r8d
cmpq %rsi, %rdi
setbe %r8b
movq -0x8(%rcx,%r8,8), %rcx
btq %rax, %rcx
jae 0x3a15b
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x3a438
movq %rax, %r15
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq 0xc8(%rbx), %rdi
movq 0xd0(%rbx), %rsi
callq 0x3dd58
cmpq 0xd0(%rbx), %rax
jne 0x3a099
cmpl $0x1, 0x78(%r15)
jne 0x3a374
movq 0x8(%rsp), %rax
movq 0x8(%rax), %r15
movq 0x10(%rax), %r12
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x19a68
movq 0x38(%rbx), %rsi
movq (%rsi), %rax
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %r8
movq %r15, %rdx
movq %r12, %rcx
callq *0x20(%rax)
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3a109
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a120
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3a13a
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x8(%rsp), %rsi
movzbl %bpl, %r8d
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x3a62a
movl %eax, %r12d
jmp 0x3a2fe
movq 0x10(%rdx), %rcx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %r8
callq 0x3aac4
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %r15
movq 0x18(%rsp), %rax
movq %r15, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %r13
movq %r13, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x3a1b5
subq %rdi, %rsi
callq 0x6380
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a1cc
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x8(%rsp), %rsi
movzbl %bpl, %ebp
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rcx
movl %ebp, %r8d
callq 0x3a62a
movl %eax, %r12d
cmpl $0x1, %eax
jne 0x3a2fe
movq 0x8(%rsp), %rax
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq 0x98(%rbx), %rdi
movq 0xa0(%rbx), %rsi
callq 0x38b4d
movl $0x1, %r12d
cmpq 0xa0(%rbx), %rax
jne 0x3a2fe
movq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x3abc8
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
cmpq %rsi, %rdi
je 0x3a2e1
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rbx, %rdx
callq 0x3b085
movq (%rax), %rcx
movq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %r8
callq 0x3aac4
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
testq %r15, %r15
je 0x3a2ad
subq %r15, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x6380
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x3a2c4
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rcx
movl %ebp, %r8d
callq 0x3a62a
movl %eax, %r12d
jmp 0x3a2e7
movl $0x1, %r12d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a2fe
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
testl %r12d, %r12d
jne 0x3a348
movq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x3b100
movq 0xe8(%rbx), %rsi
cmpq 0xf0(%rbx), %rsi
je 0x3a334
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0xe8(%rbx)
jmp 0x3a348
addq $0xe0, %rbx
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x18edc
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3a35f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27c2d(%rip), %rdi     # 0x61fa8
leaq 0x11069(%rip), %rsi     # 0x4b3eb
movl $0x29, %edx
callq 0x63f0
movl (%r15), %esi
movq 0x27c12(%rip), %rdi     # 0x61fa8
callq 0x6610
movq %rax, %rbx
leaq 0x11070(%rip), %rsi     # 0x4b415
movl $0xa, %edx
movq %rax, %rdi
callq 0x63f0
movl 0x78(%r15), %esi
movq %rbx, %rdi
callq 0x6610
leaq 0xe19e(%rip), %rsi      # 0x48563
movq %rax, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
jmp 0x3a3db
jmp 0x3a3db
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3a419
movq 0x20(%rsp), %rsi
jmp 0x3a408
jmp 0x3a416
jmp 0x3a416
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x3a419
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x3a419
jmp 0x3a416
jmp 0x3a416
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3a430
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620