// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::CHECK_SWAPER(S*)
CHECK PPS::CHECK_SWAPER(S* s) {
  // error check
  int num = s->agents.size();
  if (num < 2 || 3 < num) {
    std::cout << "error@PPS::CHECK_SWAPER, swaper "
              << s->id << " has invalid agents" << "\n";
    std::exit(1);
  }

  // check temporaly resolved by other swapers
  if (inArray(s, doneSwapers)) {
    return CHECK::INVALID;
  }

  if ((int)s->phase >= (int)SWAPPHASE::EVAC_H) {
    return CHECK::VALID;
  }

  Agent* aH = s->agents[0];  // center
  Agent* aL = s->agents[1];
  Nodes neighbor = G->neighbor(aH->getNode());
  bool aL2aH = inArray(aL->getNode(), neighbor);

  bool aE2aH = true;
  if (num == 3) {
    Agent* aE = s->agents[2];
    aE2aH = inArray(aE->getNode(), neighbor);
  }

  Nodes piH = SHORTEST_PATH(aH->getNode(), aH->getGoal());
  Nodes piL = SHORTEST_PATH(aL->getNode(), aL->getGoal());
  bool depend = DEPEND(piH, piL) || DEPEND(piL, piH);

  if (aL2aH && aE2aH && depend) return CHECK::VALID;

  // if separated
  ADD_DONE_SWAPERS(s);
  return CHECK::INVALID;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbx
movq 0x10(%rsi), %r13
subq 0x8(%rsi), %r13
shrq $0x3, %r13
leal -0x4(%r13), %eax
cmpl $-0x3, %eax
jbe 0x3966c
movq %rdi, %r14
leaq 0x20(%rsp), %rdx
movq %rbx, (%rdx)
movq 0xc8(%rdi), %rdi
movq 0xd0(%r14), %rsi
callq 0x3da56
movl $0x1, %r15d
cmpq 0xd0(%r14), %rax
jne 0x39657
xorl %r15d, %r15d
cmpl $0x1, 0x78(%rbx)
jg 0x39657
movq 0x8(%rbx), %rax
movq (%rax), %r12
movq 0x8(%rax), %rbp
movq 0x38(%r14), %rsi
movq 0x8(%r12), %rdx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x1a38a
movq 0x8(%rbp), %rax
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq (%r15), %rdi
movq 0x8(%r15), %rsi
callq 0x19b2e
movq %rax, 0x50(%rsp)
movq 0x28(%rsp), %r15
cmpl $0x3, %r13d
jne 0x394de
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
movq 0x20(%rsp), %rdi
movq %r15, %rsi
callq 0x19b2e
cmpq 0x28(%rsp), %rax
sete %r13b
jmp 0x394e1
xorl %r13d, %r13d
movq 0x8(%r12), %rdx
movq 0x10(%r12), %rcx
movq 0x38(%r14), %rsi
movq (%rsi), %rax
leaq 0x8(%rsp), %rdi
callq *0x18(%rax)
movq 0x8(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq 0x38(%r14), %rsi
movq (%rsi), %rax
leaq 0x38(%rsp), %rdi
callq *0x18(%rax)
leaq 0xa0(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x19aae
leaq 0x88(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x19aae
leaq 0xa0(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x3b3b8
movb $0x1, %bpl
testb %al, %al
jne 0x395b1
leaq 0x70(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x19aae
leaq 0x58(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x19aae
leaq 0x70(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x3b3b8
movl %eax, %ebp
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x39597
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x395b1
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x395ce
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x395eb
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
cmpq %r15, 0x50(%rsp)
sete %al
orb %r13b, %al
jne 0x39601
xorl %r15d, %r15d
xorb $0x1, %bpl
je 0x39612
movl $0x1, %r15d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3b73a
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x39629
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x39640
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x39657
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movl %r15d, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28935(%rip), %rdi     # 0x61fa8
leaq 0x11e1d(%rip), %rsi     # 0x4b497
callq 0x6360
movl (%rbx), %esi
movq %rax, %rdi
callq 0x6610
leaq 0x11e28(%rip), %rsi     # 0x4b4b8
movq %rax, %rdi
callq 0x6360
leaq 0xeec4(%rip), %rsi      # 0x48563
movq %rax, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x396d0
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x396d0
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x39702
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x39702
jmp 0x396fa
movq %rax, %rbx
jmp 0x3971f
movq %rax, %rbx
jmp 0x39758
jmp 0x396fa
movq %rax, %rbx
jmp 0x3976f
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3971f
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x39741
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x39741
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x39758
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3976f
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x39786
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620