// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/solver/pps.cpp
// Function: PPS::SETUP_SWAP(Agent*, Agent*)
void PPS::SETUP_SWAP(Agent* c, Agent* a) {
  // error check
  if (deg3nodes.size() == 0) {
    std::cout << "error@PPS::SETUP_SWAP, graph does not have esv" << "\n";
    std::exit(1);
  }

  Nodes sorted_esv = getSortedEsv(c);  // l.14
  Node* v = sorted_esv[0];
  Agents agents;
  if (pathDist(c->getNode(), v) <= pathDist(a->getNode(), v)) {
    agents = {c, a};
  } else {
    agents = {a, c};
  }

  S* s = new S { s_uuid,
                 agents,  // [near (high), far (low)]
                 a->getNode(),  // [low] original pos
                 sorted_esv,
                 nullptr,  // target
                 nullptr,  // origin
                 nullptr,  // evacH
                 nullptr,  // evacL
                 {},       // area
                 SWAPPHASE::GO_TARGET };
  ++s_uuid;

  pusherToSwaper.push_back(c);
  pusherToSwaper.push_back(a);
  swapers.push_back(s);

  SWAP(s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq 0x190(%rdi), %rax
cmpq 0x188(%rdi), %rax
je 0x3b641
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3cd26
movq (%r15), %rax
movq (%rax), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x8(%r12), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x3efbe
movl %eax, %ebp
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x3efbe
leaq 0x10(%rsp), %rdx
cmpl %eax, %ebp
jle 0x3b4ee
movq %r14, -0x10(%rdx)
movq %r12, -0x8(%rdx)
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0x3db02
jmp 0x3b503
movq %r12, -0x10(%rdx)
movq %r14, -0x8(%rdx)
leaq 0x10(%rsp), %rdi
movq %rsp, %rsi
callq 0x3db02
movl $0x80, %edi
callq 0x6370
movq %rax, %r15
movl 0x272da(%rip), %eax     # 0x627f0
movl %eax, (%r15)
leaq 0x8(%r15), %r13
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb55c
movq 0x8(%r14), %rax
movq %rax, 0x20(%r15)
movq %r15, %rdi
addq $0x28, %rdi
leaq 0x30(%rsp), %rsi
callq 0x19aae
xorps %xmm0, %xmm0
movups %xmm0, 0x6c(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movq %r15, (%rsp)
incl 0x2728c(%rip)           # 0x627f0
leaq 0x98(%rbx), %r13
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x3b592
movq %r12, (%rsi)
movq 0xa0(%rbx), %rsi
addq $0x8, %rsi
movq %rsi, 0xa0(%rbx)
jmp 0x3b5a6
leaq 0x50(%rsp), %rdx
movq %r13, %rdi
callq 0x18f28
movq 0xa0(%rbx), %rsi
cmpq 0xa8(%rbx), %rsi
je 0x3b5bc
movq %r14, (%rsi)
addq $0x8, 0xa0(%rbx)
jmp 0x3b5c9
leaq 0x48(%rsp), %rdx
movq %r13, %rdi
callq 0x18f28
movq 0x88(%rbx), %rsi
cmpq 0x90(%rbx), %rsi
je 0x3b5e6
movq %r15, (%rsi)
addq $0x8, 0x88(%rbx)
jmp 0x3b5f9
leaq 0x80(%rbx), %rdi
movq %rsp, %rdx
callq 0x3dc04
movq (%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3978e
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3b61b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3b632
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x26960(%rip), %rdi     # 0x61fa8
leaq 0xfffe(%rip), %rsi      # 0x4b64d
callq 0x6360
leaq 0xcf08(%rip), %rsi      # 0x48563
movq %rax, %rdi
callq 0x6360
movl $0x1, %edi
callq 0x6440
jmp 0x3b69f
jmp 0x3b69f
movq %rax, %rbx
movq (%r13), %rdi
testq %rdi, %rdi
je 0x3b68e
movq 0x18(%r15), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x3b68e
movq %rax, %rbx
movl $0x80, %esi
movq %r15, %rdi
callq 0x6380
jmp 0x3b6a2
jmp 0x3b69f
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3b6b9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3b6d0
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620