// File: Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::FEASIBLE(S*, std::vector<Node*, std::allocator<Node*>>&)
RES PPS::FEASIBLE(S* s, Nodes &pi) {
  if (pi.size() < 2) return RES::FAIL;  // l.1
  Node* v = pi[1];  // l.2

  if (reserved(v, M)) return RES::PAUSE;  // l.3, 4
  if (inArray(v, L))  return RES::PAUSE;  // l.5, 6

  auto itrA = std::find_if(A.begin(), A.end(),
                           [v](Agent* a) { return a->getNode() == v; });
  Agent* a;
  if (itrA != A.end()) {  // l.19
    a = *itrA;
    if (inS(a)) {  // l.20
      if (CHECK_PRIORITY(s, a) == CHECK::INVALID) {  // l.21
        return RES::FAIL;  // l.22
      }
    }
  } else if (itrA == A.end()) {
    return RES::SUCCESS;  // l.23
  }

  a = *itrA;
  H.push_back(s->agents[0]);
  H.push_back(s->agents[1]);
  return PUSH(a, true);  // l.24, recursive push
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3b0e0
cmpq $0x2, %rax
jae 0x9112a
movl $0x1, -0x4(%rbp)
jmp 0x912eb
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0xda90
movq -0x68(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
movq %rdi, %rdx
addq $0xe0, %rdx
callq 0x913c0
testb $0x1, %al
jne 0x9115c
jmp 0x91168
movl $0x2, -0x4(%rbp)
jmp 0x912eb
movq -0x68(%rbp), %rsi
movq -0x28(%rbp), %rdi
addq $0x110, %rsi            # imm = 0x110
callq 0x91410
testb $0x1, %al
jne 0x91182
jmp 0x9118e
movl $0x2, -0x4(%rbp)
jmp 0x912eb
movq -0x68(%rbp), %rdi
addq $0x20, %rdi
callq 0x39b60
movq -0x68(%rbp), %rdi
movq %rax, -0x38(%rbp)
addq $0x20, %rdi
callq 0x399f0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x91970
movq -0x68(%rbp), %rdi
movq %rax, -0x30(%rbp)
addq $0x20, %rdi
callq 0x399f0
movq %rax, -0x58(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x51bd0
testb $0x1, %al
jne 0x911f1
jmp 0x9123a
leaq -0x30(%rbp), %rdi
callq 0x51c10
movq -0x68(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rsi
callq 0x8f510
testb $0x1, %al
jne 0x91214
jmp 0x91238
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x919d0
cmpl $0x1, %eax
jne 0x91236
movl $0x1, -0x4(%rbp)
jmp 0x912eb
jmp 0x91238
jmp 0x9126c
movq -0x68(%rbp), %rdi
addq $0x20, %rdi
callq 0x399f0
movq %rax, -0x60(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x55800
testb $0x1, %al
jne 0x9125e
jmp 0x9126a
movl $0x0, -0x4(%rbp)
jmp 0x912eb
jmp 0x9126c
leaq -0x30(%rbp), %rdi
callq 0x51c10
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x50(%rbp)
addq $0x128, %rax            # imm = 0x128
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x53720
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0xdab0
movq -0x68(%rbp), %rax
addq $0x128, %rax            # imm = 0x128
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x53720
movq -0x70(%rbp), %rdi
movq %rax, %rsi
callq 0xdab0
movq -0x68(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x1, %edx
callq 0x8f3a0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)