// File: /workspace/github_cpp_makefile_star2_O3/bonetblai[P]mdp-engine/ctp3/../engine/hdp.h
// Function: Algorithm::hdp_t<state_t>::hdp(state_t const&, Problem::hash_t<state_t>&, Hash::data_t*, unsigned long&, std::__cxx11::list<Hash::data_t*, std::allocator<Hash::data_t*>>&, std::__cxx11::list<Hash::data_t*, std::allocator<Hash::data_t*>>&) const
bool hdp(const T &s,
             Problem::hash_t<T> &hash,
             Hash::data_t* dptr,
             size_t &index,
             std::list<Hash::data_t*> &stack,
             std::list<Hash::data_t*> &visited) const {
        std::vector<std::pair<T, float> > outcomes;

        // base cases
        if( dptr->solved() || problem_.terminal(s) ) {
            dptr->solve();
            return true;
        } else if( dptr->marked() ) {
            return false;
        }

        // if residual > epsilon, update and return
        std::pair<Problem::action_t, float> p = hash.best_q_value(s);
        if( fabs(p.second - dptr->value()) > epsilon_ ) {
            dptr->update(p.second);
            hash.inc_updates();
            return false;
        }

        // Tarjan's
        visited.push_front(dptr);
        stack.push_front(dptr);
        size_t idx = index++;
        dptr->set_scc_low(idx);
        dptr->set_scc_idx(idx);
        dptr->mark();

        // expansion
        problem_.next(s, p.first, outcomes);
        unsigned osize = outcomes.size();

        bool flag = true;
        for( unsigned i = 0; i < osize; ++i ) {
            Hash::data_t *ptr = hash.data_ptr(outcomes[i].first);
            if( ptr->scc_idx() == std::numeric_limits<unsigned>::max() ) {
                bool rv = hdp(outcomes[i].first, hash, ptr, index, stack, visited);
                flag = flag && rv;
                dptr->set_scc_low(Utils::min(dptr->scc_low(), hash.scc_low(outcomes[i].first)));
            } else if( ptr->marked() ) {
                dptr->set_scc_low(Utils::min(dptr->scc_low(), ptr->scc_idx()));
            }
        }

        // update
        if( !flag ) {
            std::pair<Problem::action_t, float> p = hash.best_q_value(s);
            dptr->update(p.second);
            hash.inc_updates();
            while( !stack.empty() && (stack.front()->scc_idx() >= idx) ) {
                stack.front()->set_scc_low(std::numeric_limits<unsigned>::max());
                stack.front()->set_scc_idx(std::numeric_limits<unsigned>::max());
                stack.pop_front();
            }
        } else if( dptr->scc_low() == dptr->scc_idx() ) {
            while( !stack.empty() && (stack.front()->scc_idx() >= idx) ) {
                stack.front()->solve();
                stack.front()->set_scc_low(std::numeric_limits<unsigned>::max());
                stack.front()->set_scc_idx(std::numeric_limits<unsigned>::max());
                stack.pop_front();
            }
        }
        return flag;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
cmpb $0x0, 0x4(%rcx)
jne 0xf08d
movq %r9, %rbx
movq %r8, %rbp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r12
movq 0x8(%rdi), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
testb %al, %al
je 0xf097
movb $0x1, 0x4(%r14)
movb $0x1, %bpl
jmp 0xf0e0
cmpb $0x0, 0x5(%r14)
jne 0xf0de
movq %r12, 0x18(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xf8b0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
shrq $0x20, %rax
movd %eax, %xmm0
subss (%r14), %xmm0
andps 0x1bfe4(%rip), %xmm0    # 0x2b0b0
movq 0x18(%rsp), %rcx
ucomiss 0x1c(%rcx), %xmm0
jbe 0xf0fb
movl %eax, (%r14)
incl 0x50(%r15)
xorl %ebp, %ebp
leaq 0x20(%rsp), %rdi
callq 0xd12e
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x90(%rsp), %rax
movq (%rax), %r12
movl $0x18, %edi
callq 0x5290
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x5060
movq 0x90(%rsp), %rax
incq 0x10(%rax)
movq (%rbx), %r12
movl $0x18, %edi
callq 0x5290
movq %r14, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
callq 0x5060
incq 0x10(%rbx)
movq (%rbp), %rcx
leaq 0x1(%rcx), %rax
movq %rax, (%rbp)
movq %rcx, 0x18(%r14)
movq %rcx, 0x38(%rsp)
movq %rcx, 0x20(%r14)
movb $0x1, 0x5(%r14)
movq 0x18(%rsp), %r12
movq 0x8(%r12), %rdi
movq (%rdi), %rax
leaq 0x20(%rsp), %rcx
movq %r13, %rsi
movq 0x10(%rsp), %rdx
callq *0x60(%rax)
movq 0x28(%rsp), %rcx
subq 0x20(%rsp), %rcx
sarq $0x3, %rcx
movabsq $-0x1111111111111111, %rax # imm = 0xEEEEEEEEEEEEEEEF
imulq %rcx, %rax
testl %eax, %eax
je 0xf28d
movq %rbp, 0x50(%rsp)
movq %r13, 0x40(%rsp)
leaq 0x8(%r15), %rcx
movq %rcx, 0x48(%rsp)
movl %eax, %eax
imulq $0x78, %rax, %rax
movq %rax, 0x10(%rsp)
movb $0x1, 0xf(%rsp)
xorl %ebp, %ebp
movq 0x90(%rsp), %r13
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r15, %rdi
callq 0xefb2
movq 0x20(%rax), %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rcx
jne 0xf25d
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r13, (%rsp)
movq %r12, %rdi
movq %r15, %rdx
movq %rax, %rcx
movq 0x50(%rsp), %r8
movq %rbx, %r9
callq 0xf048
movl %eax, %r12d
movq 0x18(%r14), %r13
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq 0x48(%rsp), %rdi
callq 0xf446
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0xf242
movq 0x78(%rax), %rax
movq 0x18(%rax), %rcx
andb %r12b, 0xf(%rsp)
cmpq %rcx, %r13
cmovbq %r13, %rcx
movq 0x18(%rsp), %r12
movq 0x90(%rsp), %r13
jmp 0xf26e
cmpb $0x1, 0x5(%rax)
jne 0xf272
movq 0x18(%r14), %rax
cmpq %rcx, %rax
cmovbq %rax, %rcx
movq %rcx, 0x18(%r14)
addq $0x78, %rbp
cmpq %rbp, 0x10(%rsp)
jne 0xf1d7
testb $0x1, 0xf(%rsp)
movq 0x40(%rsp), %rsi
je 0xf2fc
movq 0x18(%r14), %rax
cmpq 0x20(%r14), %rax
setne %cl
movq (%rbx), %rax
cmpq %rbx, %rax
sete %dl
orb %cl, %dl
movb $0x1, %bpl
jne 0xf0e0
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq 0x38(%rsp), %r12
movq 0x10(%rax), %rax
cmpq %r12, 0x20(%rax)
jb 0xf0e0
movb $0x1, 0x4(%rax)
movq %r15, 0x18(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rax
movq %r15, 0x20(%rax)
movq (%rbx), %r14
decq 0x10(%rbx)
movq %r14, %rdi
callq 0x53d0
movq %r14, %rdi
callq 0x5260
movq (%rbx), %rax
cmpq %rbx, %rax
jne 0xf2b7
jmp 0xf0e0
movq %r15, %rdi
callq 0xf8b0
shrq $0x20, %rax
movl %eax, (%r14)
incl 0x50(%r15)
movq (%rbx), %rax
cmpq %rbx, %rax
movq 0x38(%rsp), %r15
je 0xf0de
xorl %ebp, %ebp
movq 0x10(%rax), %rax
cmpq %r15, 0x20(%rax)
jb 0xf0de
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0x18(%rax)
movq (%rbx), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x20(%rax)
movq (%rbx), %r14
decq 0x10(%rbx)
movq %r14, %rdi
callq 0x53d0
movq %r14, %rdi
callq 0x5260
movq (%rbx), %rax
cmpq %rbx, %rax
jne 0xf322
jmp 0xf0e0
jmp 0xf372
jmp 0xf372
jmp 0xf372
jmp 0xf372
jmp 0xf372
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xd12e
movq %rbx, %rdi
callq 0x5410
nop