// File: 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
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
addq $0x188, %rdi            # imm = 0x188
callq 0x3b0e0
cmpq $0x0, %rax
jne 0x91610
movq 0x6f9ad(%rip), %rdi     # 0x100f98
leaq 0x2571e(%rip), %rsi     # 0xb6d10
callq 0x84d0
movq %rax, %rdi
leaq 0x21fb6(%rip), %rsi     # 0xb35b7
callq 0x84d0
movl $0x1, %edi
callq 0x85d0
movq -0xb0(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x93a70
movq -0xc0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xda90
movq (%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xd9a0
movq -0x10(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xb8(%rbp)
jmp 0x9165d
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdi
movq -0x38(%rbp), %rdx
callq 0x9d410
movl %eax, -0xc4(%rbp)
jmp 0x9167c
movq -0x18(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xd0(%rbp)
jmp 0x9168e
movq -0xd0(%rbp), %rsi
movq -0xb0(%rbp), %rdi
movq -0x38(%rbp), %rdx
callq 0x9d410
movl %eax, -0xd4(%rbp)
jmp 0x916ad
movl -0xc4(%rbp), %eax
movl -0xd4(%rbp), %ecx
cmpl %ecx, %eax
jg 0x91703
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $0x2, -0x68(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x96fb0
jmp 0x916f0
jmp 0x9174d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x918e7
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq $0x2, -0x88(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x96fb0
jmp 0x9174b
jmp 0x9174d
movl $0x80, %edi
callq 0x84e0
movq %rax, -0xe0(%rbp)
jmp 0x91760
movq -0xe0(%rbp), %rdi
movl 0x701d7(%rip), %eax     # 0x101944
movl %eax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0xe8(%rbp)
leaq -0x50(%rbp), %rsi
callq 0xdbb0
jmp 0x91785
movq -0xe0(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xf8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xf0(%rbp)
jmp 0x917a9
movq -0xe0(%rbp), %rdi
movq -0xf8(%rbp), %rax
movq -0xf0(%rbp), %rcx
movq %rcx, (%rax)
addq $0x28, %rdi
leaq -0x30(%rbp), %rsi
callq 0x3aff0
jmp 0x917d0
movq -0xe0(%rbp), %rax
movq $0x0, 0x40(%rax)
movq $0x0, 0x48(%rax)
movq $0x0, 0x50(%rax)
movq $0x0, 0x58(%rax)
movq %rax, %rdi
addq $0x60, %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rax)
movq $0x0, 0x70(%rax)
callq 0x3e880
movq -0xe0(%rbp), %rax
movq -0xb0(%rbp), %rdi
movl $0x0, 0x78(%rax)
movq %rax, -0xa8(%rbp)
movl 0x70110(%rip), %eax     # 0x101944
incl %eax
movl %eax, 0x70108(%rip)     # 0x101944
addq $0x98, %rdi
leaq -0x10(%rbp), %rsi
callq 0xdab0
jmp 0x9184e
movq -0xb0(%rbp), %rdi
addq $0x98, %rdi
leaq -0x18(%rbp), %rsi
callq 0xdab0
jmp 0x91867
movq -0xb0(%rbp), %rdi
subq $-0x80, %rdi
leaq -0xa8(%rbp), %rsi
callq 0x97000
jmp 0x91880
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
callq 0x8eda0
jmp 0x91895
leaq -0x50(%rbp), %rdi
callq 0xddf0
leaq -0x30(%rbp), %rdi
callq 0xd7d0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x918d6
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0xddf0
movq -0xe0(%rbp), %rdi
movl $0x80, %esi
callq 0x84f0
leaq -0x50(%rbp), %rdi
callq 0xddf0
leaq -0x30(%rbp), %rdi
callq 0xd7d0
movq -0x58(%rbp), %rdi
callq 0x8880
nopw %cs:(%rax,%rax)