// File: Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::PUSH(S*)
RES PPS::PUSH(S* s) {
  Agent* aH = s->agents[0];
  Agent* aL = s->agents[1];
  Node* target = s->esv[0];

  if (inArray(aH, M)) return RES::PAUSE;
  if (inArray(aL, M)) return RES::PAUSE;

  // check which is the nearest
  if (s->agents.size() == 2) {
    if (pathDist(aH->getNode(), target) > pathDist(aL->getNode(), target)) {
      s->agents = { aL, aH };
      aH = s->agents[0];
      aL = s->agents[1];
    }
  }

  if (aH->getNode() == target) {
    return SWAP(s);
  }

  Nodes pi = SHORTEST_PATH(aH->getNode(), target);  // l.6

  RES attempt = FEASIBLE(s, pi);  // l.16

  if (attempt == RES::SUCCESS) {  // l.17
    move(s, pi);  // l.18
    for (auto a : s->agents) M.push_back(a);  // l.18
  }

  return attempt;  // l.19
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x53720
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x53720
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xda90
movq -0xa8(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
addq $0xe0, %rsi
callq 0x8f430
testb $0x1, %al
jne 0x90e44
jmp 0x90e50
movl $0x2, -0x4(%rbp)
jmp 0x91090
movq -0xa8(%rbp), %rsi
movq -0x28(%rbp), %rdi
addq $0xe0, %rsi
callq 0x8f430
testb $0x1, %al
jne 0x90e6d
jmp 0x90e79
movl $0x2, -0x4(%rbp)
jmp 0x91090
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x383b0
cmpq $0x2, %rax
jne 0x90f42
movq -0x20(%rbp), %rdi
callq 0x51cb0
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0x9d410
movl %eax, -0xac(%rbp)
movq -0x28(%rbp), %rdi
callq 0x51cb0
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
movq -0x30(%rbp), %rdx
callq 0x9d410
movl %eax, %ecx
movl -0xac(%rbp), %eax
cmpl %ecx, %eax
jle 0x90f40
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x2, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x96fb0
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x53720
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x53720
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x90f42
movq -0x20(%rbp), %rdi
callq 0x51cb0
cmpq -0x30(%rbp), %rax
jne 0x90f69
movq -0xa8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x8eda0
movl %eax, -0x4(%rbp)
jmp 0x91090
movq -0x20(%rbp), %rdi
callq 0x51cb0
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
movq -0x30(%rbp), %rcx
leaq -0x68(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x910b0
movq -0xa8(%rbp), %rdi
movq -0xb8(%rbp), %rdx
movq -0x18(%rbp), %rsi
callq 0x910f0
movl %eax, -0xb0(%rbp)
jmp 0x90faf
movl -0xb0(%rbp), %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jne 0x91081
movq -0xa8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x91300
jmp 0x90fd8
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0x39b60
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
callq 0x399f0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x51bd0
testb $0x1, %al
jne 0x91026
jmp 0x9107f
leaq -0x90(%rbp), %rdi
callq 0x51c10
movq -0xa8(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
addq $0xe0, %rdi
leaq -0xa0(%rbp), %rsi
callq 0xdab0
jmp 0x91058
jmp 0x9105a
leaq -0x90(%rbp), %rdi
callq 0x51c30
jmp 0x9100d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xd7d0
jmp 0x9109c
jmp 0x91081
movl -0x6c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0xd7d0
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x8880
nopw %cs:(%rax,%rax)