// File: /workspace/github_cpp_makefile_star2_O2/Kei18[P]pibt/./src/solver/winpibt.cpp
// Function: winPIBT::solve()
bool winPIBT::solve() {
  solveStart();

  int t = 0;
  int t_sup = 0;
  int i, _w;

  while (!P->isSolved()) {
    allocate();
    updatePriority();
    std::vector<int> U(A.size());
    std::iota(U.begin(), U.end(), 0);
    std::sort(U.begin(), U.end(),
              [this] (int i, int j)
              {return this->priority[i] > this->priority[j];} );

    for (int j = 0; j < U.size(); ++j) {
      i = U[j];
      if (ell(i) <= t) {

        if (A[i]->hasTask()) {
          _w = w;
        } else {
          _w = 1;
        }

        if (j == 0) {
          winpibt(A[i], t + _w, softmode);
        } else {
          winpibt(A[i], std::min(t + _w, t_sup), softmode);
        }
      }

      if (j == 0) {
        t_sup = ell(i);
      } else {
        t_sup = std::min(t_sup, ell(i));
      }
    }

    // update path
    for (int i = 0; i < A.size(); ++i) A[i]->setNode(PATHS[i][t+1]);

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

    ++t;
  }

  solveEnd();
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
callq *(%rax)
xorl %r15d, %r15d
leaq 0x10(%rsp), %r13
xorl %r14d, %r14d
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testb %al, %al
jne 0x37bdb
movq %rbx, %rdi
callq 0x37c10
movq %rbx, %rdi
callq 0x37dac
movq 0x28(%rbx), %rsi
subq 0x20(%rbx), %rsi
sarq $0x3, %rsi
movq %r13, %rdi
leaq 0xf(%rsp), %rdx
callq 0x390a0
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
xorl %eax, %eax
movq %r13, %rcx
cmpq %r12, %rcx
je 0x37a60
movl %eax, (%rcx)
incl %eax
addq $0x4, %rcx
jmp 0x37a51
cmpq %r12, %r13
je 0x37ac9
movq %r12, %rbp
subq %r13, %rbp
movq %rbp, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rcx
callq 0x38d8a
cmpq $0x41, %rbp
jl 0x37abb
leaq 0x40(%r13), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x38fca
cmpq %r12, %rbp
je 0x37ac9
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x39047
addq $0x4, %rbp
jmp 0x37aa5
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x38fca
xorl %r12d, %r12d
pushq $0x1
popq %rbp
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x37b74
movslq (%rax,%r12,4), %r13
movq 0x88(%rbx), %rax
movslq (%rax,%r13,4), %rax
cmpq %rax, %r15
jge 0x37b04
testq %r12, %r12
jne 0x37b45
jmp 0x37b69
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rsi
cmpq $0x0, 0x18(%rsi)
movl %ebp, %edx
je 0x37b18
movl 0x68(%rbx), %edx
addl %r15d, %edx
testq %r12, %r12
je 0x37b51
movl %r14d, %eax
cmpl %edx, %r14d
jl 0x37b2a
movl %edx, %eax
movzbl 0x6c(%rbx), %ecx
movq (%rbx), %r8
movq %rbx, %rdi
movl %eax, %edx
callq *0x20(%r8)
movq 0x88(%rbx), %rax
movl (%rax,%r13,4), %eax
cmpl %r14d, %eax
cmovll %eax, %r14d
movl %r14d, %eax
jmp 0x37b69
movzbl 0x6c(%rbx), %ecx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq 0x88(%rbx), %rax
movl (%rax,%r13,4), %eax
incq %r12
movl %eax, %r14d
jmp 0x37acf
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x37bad
movq (%rax,%r13,8), %rdi
movq 0x70(%rbx), %rax
movq (%rax,%r12), %rax
movq 0x8(%rax,%r15,8), %rsi
callq 0x158b4
incq %r13
addq $0x18, %r12
jmp 0x37b7a
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x10(%rbx), %rax
movl 0x8(%rax), %ebp
movl 0xc(%rax), %r12d
incq %r15
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x1c0a0
cmpl %r12d, %ebp
jl 0x37a07
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x37bfb
jmp 0x37bfb
jmp 0x37bfb
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1c0a0
movq %rbx, %rdi
callq 0x6650