// File: /workspace/github_cpp_makefile_star2_O3/Kei18[P]pibt/./src/solver/cbs.cpp
// Function: CBS::solve()
bool CBS::solve() {
  solveStart();

  Paths PATHS;
  std::vector<Agents> WHOLE;

  // initialize
  for (int i = 0; i < A.size(); ++i) PATHS.push_back({});

  if (!ID) {  // normal CBS
    solvePart(PATHS, A);
    formalizePath(PATHS);

  } else {  // with ID framework
    for (auto a : A) WHOLE.push_back({ a });

    // solve with independent detection
    while (true) {
      for (auto BLOCK : WHOLE) {
        if (!solvePart(PATHS, BLOCK)) {
          solveEnd();
          return false;  // failed
        }
      }
      formalizePath(PATHS);
      if (checkAgents(PATHS, WHOLE)) break;

      // initialize
      PATHS.clear();
      for (int i = 0; i < A.size(); ++i) PATHS.push_back({});
    }
  }

  int maxLength = getMaxLengthPaths(PATHS);
  for (int t = 1; t < maxLength; ++t) {
    for (int i = 0; i < A.size(); ++i) A[i]->setNode(PATHS[i][t]);
    P->update();

    if (P->getTimestep() >= P->getTimestepLimit()) break;
  }

  solveEnd();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *(%rax)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rax, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq 0x20(%rbx), %rbp
movq 0x28(%rbx), %r12
cmpq %rbp, %r12
je 0x25cfe
xorl %r13d, %r13d
leaq 0x20(%rsp), %r14
movq %rsp, %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x18c56
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25ce4
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
incq %r13
movq 0x20(%rbx), %rbp
movq 0x28(%rbx), %r12
movq %r12, %rax
subq %rbp, %rax
sarq $0x3, %rax
cmpq %r13, %rax
ja 0x25cb3
cmpb $0x1, 0x68(%rbx)
jne 0x25e6b
cmpq %r12, %rbp
je 0x25df3
movq %rsp, %r14
leaq 0x1f(%rsp), %r15
leaq 0x40(%rsp), %r13
movq (%rbp), %rax
movq %rax, 0x60(%rsp)
movl $0x1, %edx
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
movq %r15, %rcx
callq 0x2a7ea
movq %r13, %rdi
movq %r14, %rsi
callq 0x2b022
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25d5d
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
addq $0x8, %rbp
cmpq %r12, %rbp
jne 0x25d1e
jmp 0x25df3
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r15
cmpq %r14, %r15
je 0x25da1
movq %r14, %r12
movq (%r12), %rdi
testq %rdi, %rdi
je 0x25d93
movq 0x10(%r12), %rsi
subq %rdi, %rsi
callq 0x6380
addq $0x18, %r12
cmpq %r15, %r12
jne 0x25d7d
movq %r14, 0x28(%rsp)
movq 0x28(%rbx), %rax
cmpq 0x20(%rbx), %rax
je 0x25df3
xorl %r14d, %r14d
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
leaq 0x20(%rsp), %rdi
callq 0x18c56
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25ddf
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
incq %r14
movq 0x28(%rbx), %rax
subq 0x20(%rbx), %rax
sarq $0x3, %rax
cmpq %r14, %rax
ja 0x25dae
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r15
cmpq %r15, %r14
je 0x25e42
movq %rsp, %rdi
movq %r14, %rsi
callq 0xb55c
movq (%rbx), %rax
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq *0x30(%rax)
testb %al, %al
je 0x25f12
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25e3c
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
addq $0x18, %r14
jmp 0x25dfd
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x3eeec
leaq 0x20(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x25fa6
testb %al, %al
je 0x25d6b
jmp 0x25e8a
leaq 0x20(%rbx), %rdx
movq (%rbx), %rax
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq *0x30(%rax)
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x3eeec
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x3ee0c
cmpl $0x2, %eax
jl 0x25f04
movl %eax, %r14d
movl $0x1, %r15d
movq 0x20(%rbx), %rax
cmpq %rax, 0x28(%rbx)
je 0x25ee6
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rax,%r13,8), %rdi
movq 0x20(%rsp), %rax
movq (%rax,%r12), %rax
movq (%rax,%r15,8), %rsi
callq 0x191f2
incq %r13
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq $0x18, %r12
cmpq %r13, %rcx
ja 0x25eb5
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x10(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl 0xc(%rax), %ecx
jge 0x25f04
incq %r15
cmpq %r14, %r15
jne 0x25ea5
movq (%rbx), %rax
movb $0x1, %bpl
movq %rbx, %rdi
callq *0x8(%rax)
jmp 0x25f33
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25f31
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
xorl %ebp, %ebp
leaq 0x40(%rsp), %rdi
callq 0x2a830
leaq 0x20(%rsp), %rdi
callq 0xb508
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25f6c
jmp 0x25f87
jmp 0x25f87
jmp 0x25f87
jmp 0x25f87
jmp 0x25f87
jmp 0x25f6c
jmp 0x25f6c
jmp 0x25f87
jmp 0x25f6c
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x25f8a
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
jmp 0x25f8a
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2a830
leaq 0x20(%rsp), %rdi
callq 0xb508
movq %rbx, %rdi
callq 0x6620