// File: /workspace/github_cpp_makefile_star2_O1/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 %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
testb %al, %al
jne 0x455e7
movq %rbx, %rdi
callq 0x4562a
movq %rbx, %rdi
callq 0x4581a
movq 0x28(%rbx), %rsi
subq 0x20(%rbx), %rsi
sarq $0x3, %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x47274
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %r12
cmpq %r12, %r13
je 0x454cf
xorl %eax, %eax
movq %r13, %rcx
movl %eax, (%rcx)
incl %eax
addq $0x4, %rcx
cmpq %r12, %rcx
jne 0x45429
cmpq %r12, %r13
je 0x454cf
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 0x46f20
cmpq $0x41, %rbp
jl 0x454c1
leaq 0x40(%r13), %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x471dc
cmpq %r12, %rbp
je 0x454cf
movq 0xd0(%rbx), %rax
movslq (%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movslq -0x4(%rbp), %rdx
ucomiss (%rax,%rdx,4), %xmm0
movq %rbp, %rsi
jbe 0x454b4
movq %rbp, %rsi
movl %edx, (%rsi)
movslq -0x8(%rsi), %rdx
addq $-0x4, %rsi
ucomiss (%rax,%rdx,4), %xmm0
ja 0x454a4
movl %ecx, (%rsi)
addq $0x4, %rbp
cmpq %r12, %rbp
jne 0x4548b
jmp 0x454cf
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x471dc
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x4556e
xorl %r12d, %r12d
movslq (%rax,%r12,4), %r13
movq 0x88(%rbx), %rax
movslq (%rax,%r13,4), %rax
cmpq %rax, %r14
jl 0x45538
movq 0x20(%rbx), %rax
movq (%rax,%r13,8), %rsi
cmpq $0x0, 0x18(%rsi)
movl $0x1, %edx
je 0x4550d
movl 0x68(%rbx), %edx
addl %r14d, %edx
testq %r12, %r12
je 0x4552b
cmpl %edx, %r15d
cmovll %r15d, %edx
movzbl 0x6c(%rbx), %ecx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
jmp 0x45538
movzbl 0x6c(%rbx), %ecx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq 0x88(%rbx), %rax
movl (%rax,%r13,4), %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
testq %r12, %r12
cmovel %eax, %r15d
incq %r12
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
ja 0x454e2
movq 0x20(%rbx), %rax
cmpq %rax, 0x28(%rbx)
je 0x455af
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%rax,%r13,8), %rdi
movq 0x70(%rbx), %rax
movq (%rax,%r12), %rax
movq 0x8(%rax,%r14,8), %rsi
callq 0x191a6
incq %r13
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq $0x18, %r12
cmpq %r13, %rcx
ja 0x4557e
movq 0x10(%rbx), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x10(%rbx), %rax
movl 0x8(%rax), %ebp
movl 0xc(%rax), %r12d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x455db
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
incq %r14
cmpl %r12d, %ebp
jl 0x453d4
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 0x45607
jmp 0x45607
jmp 0x45607
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x45621
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6380
movq %rbx, %rdi
callq 0x6620
nop