// File: 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:
subq $0x198, %rsp            # imm = 0x198
movq 0x1a0(%rsp), %rax
movq %rdi, 0x188(%rsp)
movq %rsi, 0x180(%rsp)
movq %rdx, 0x178(%rsp)
movq %rcx, 0x170(%rsp)
movq %r8, 0x168(%rsp)
movq %r9, 0x160(%rsp)
movq 0x188(%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x1a4a0
movq 0x170(%rsp), %rdi
callq 0x20d90
testb $0x1, %al
jne 0x20e40
movq 0xf8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x180(%rsp), %rsi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movb %al, 0xf7(%rsp)
jmp 0x20e33
movb 0xf7(%rsp), %al
testb $0x1, %al
jne 0x20e40
jmp 0x20e8d
movq 0x170(%rsp), %rdi
callq 0x22e90
jmp 0x20e4f
movb $0x1, 0x197(%rsp)
movl $0x1, 0x138(%rsp)
jmp 0x2152d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x140(%rsp)
movl %eax, 0x13c(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x1a510
jmp 0x2154b
movq 0x170(%rsp), %rdi
callq 0x22ea0
movb %al, 0xf6(%rsp)
jmp 0x20ea3
movb 0xf6(%rsp), %al
testb $0x1, %al
jne 0x20eb0
jmp 0x20ec8
movb $0x0, 0x197(%rsp)
movl $0x1, 0x138(%rsp)
jmp 0x2152d
jmp 0x20eca
movq 0x178(%rsp), %rdi
movq 0x180(%rsp), %rsi
callq 0x22eb0
movq %rax, 0xe8(%rsp)
jmp 0x20ee9
movq 0xe8(%rsp), %rax
movq %rax, 0x130(%rsp)
movss 0x134(%rsp), %xmm0
movss %xmm0, 0xe0(%rsp)
movq 0x170(%rsp), %rdi
callq 0x22fc0
movss %xmm0, 0xe4(%rsp)
jmp 0x20f23
movss 0xe4(%rsp), %xmm1
movss 0xe0(%rsp), %xmm0
subss %xmm1, %xmm0
callq 0x22fa0
movss %xmm0, 0xdc(%rsp)
jmp 0x20f49
movss 0xdc(%rsp), %xmm0
movq 0xf8(%rsp), %rax
ucomiss 0x1c(%rax), %xmm0
jbe 0x20f9f
movq 0x170(%rsp), %rdi
movss 0x134(%rsp), %xmm0
callq 0x22fd0
jmp 0x20f78
movq 0x178(%rsp), %rdi
callq 0x22ff0
jmp 0x20f87
movb $0x0, 0x197(%rsp)
movl $0x1, 0x138(%rsp)
jmp 0x2152d
movq 0x1a0(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x23010
jmp 0x20fb6
movq 0x160(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x23010
jmp 0x20fcd
movq 0x168(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
incq %rdx
movq %rdx, (%rcx)
movq %rax, 0x128(%rsp)
movq 0x170(%rsp), %rdi
movq 0x128(%rsp), %rsi
callq 0x23050
jmp 0x21000
movq 0x170(%rsp), %rdi
movq 0x128(%rsp), %rsi
callq 0x23070
jmp 0x21017
movq 0x170(%rsp), %rdi
callq 0x23090
jmp 0x21026
movq 0xf8(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x180(%rsp), %rsi
movl 0x130(%rsp), %edx
movq (%rdi), %rax
movq 0x60(%rax), %rax
leaq 0x148(%rsp), %rcx
callq *%rax
jmp 0x21054
leaq 0x148(%rsp), %rdi
callq 0x17030
movl %eax, 0x124(%rsp)
movb $0x1, 0x123(%rsp)
movl $0x0, 0x11c(%rsp)
movl 0x11c(%rsp), %eax
cmpl 0x124(%rsp), %eax
jae 0x212e1
movq 0x178(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl 0x11c(%rsp), %eax
movl %eax, %esi
leaq 0x148(%rsp), %rdi
callq 0x1a4b0
movq 0xc8(%rsp), %rdi
movq %rax, %rsi
callq 0x20ca0
movq %rax, 0xd0(%rsp)
jmp 0x210cf
movq 0xd0(%rsp), %rax
movq %rax, 0x110(%rsp)
movq 0x110(%rsp), %rdi
callq 0x215e0
movq %rax, 0xc0(%rsp)
jmp 0x210f6
callq 0x215d0
movl %eax, %ecx
movq 0xc0(%rsp), %rax
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x21248
movl 0x11c(%rsp), %eax
movl %eax, %esi
leaq 0x148(%rsp), %rdi
callq 0x1a4b0
movq 0xf8(%rsp), %rdi
movq %rax, %rsi
movq 0x178(%rsp), %rdx
movq 0x110(%rsp), %rcx
movq 0x168(%rsp), %r8
movq 0x160(%rsp), %r9
movq 0x1a0(%rsp), %r10
movq %rsp, %rax
movq %r10, (%rax)
callq 0x20da0
movb %al, 0xbf(%rsp)
jmp 0x2116d
movb 0xbf(%rsp), %al
andb $0x1, %al
movb %al, 0x10f(%rsp)
xorl %eax, %eax
testb $0x1, 0x123(%rsp)
movb %al, 0xbe(%rsp)
je 0x2119e
movb 0x10f(%rsp), %al
movb %al, 0xbe(%rsp)
movb 0xbe(%rsp), %al
andb $0x1, %al
movb %al, 0x123(%rsp)
movq 0x170(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x215c0
movq %rax, 0xb0(%rsp)
jmp 0x211cd
movq 0x178(%rsp), %rax
movq %rax, 0x98(%rsp)
movl 0x11c(%rsp), %eax
movl %eax, %esi
leaq 0x148(%rsp), %rdi
callq 0x1a4b0
movq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x230e0
movq %rax, 0xa0(%rsp)
jmp 0x2120d
movq 0xa0(%rsp), %rsi
movq 0xb0(%rsp), %rdi
callq 0x230a0
movq %rax, 0x90(%rsp)
jmp 0x2122c
movq 0x90(%rsp), %rsi
movq 0xa8(%rsp), %rdi
callq 0x23050
jmp 0x21243
jmp 0x212c9
movq 0x110(%rsp), %rdi
callq 0x22ea0
movb %al, 0x8f(%rsp)
jmp 0x2125e
movb 0x8f(%rsp), %al
testb $0x1, %al
jne 0x2126b
jmp 0x212c7
movq 0x170(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x215c0
movq %rax, 0x80(%rsp)
jmp 0x21287
movq 0x110(%rsp), %rdi
callq 0x215e0
movq %rax, 0x70(%rsp)
jmp 0x2129b
movq 0x70(%rsp), %rsi
movq 0x80(%rsp), %rdi
callq 0x230a0
movq %rax, 0x68(%rsp)
jmp 0x212b4
movq 0x68(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x23050
jmp 0x212c5
jmp 0x212c7
jmp 0x212c9
jmp 0x212cb
movl 0x11c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x11c(%rsp)
jmp 0x2107b
testb $0x1, 0x123(%rsp)
jne 0x21400
movq 0x178(%rsp), %rdi
movq 0x180(%rsp), %rsi
callq 0x22eb0
movq %rax, 0x60(%rsp)
jmp 0x2130b
movq 0x60(%rsp), %rax
movq %rax, 0x104(%rsp)
movq 0x170(%rsp), %rdi
movss 0x108(%rsp), %xmm0
callq 0x22fd0
jmp 0x21330
movq 0x178(%rsp), %rdi
callq 0x22ff0
jmp 0x2133f
jmp 0x21341
movq 0x160(%rsp), %rdi
callq 0x21560
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x5f(%rsp)
jne 0x2138b
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rdi
callq 0x215e0
movq %rax, 0x50(%rsp)
jmp 0x21377
movq 0x50(%rsp), %rax
cmpq 0x128(%rsp), %rax
setae %al
movb %al, 0x5f(%rsp)
movb 0x5f(%rsp), %al
testb $0x1, %al
jne 0x21395
jmp 0x213fb
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rax
movq %rax, 0x48(%rsp)
callq 0x215d0
movq 0x48(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x23050
jmp 0x213bf
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rax
movq %rax, 0x40(%rsp)
callq 0x215d0
movq 0x40(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x23070
jmp 0x213e9
movq 0x160(%rsp), %rdi
callq 0x215f0
jmp 0x21341
jmp 0x21512
movq 0x170(%rsp), %rdi
callq 0x215c0
movq %rax, 0x38(%rsp)
jmp 0x21414
movq 0x170(%rsp), %rdi
callq 0x215e0
movq %rax, 0x30(%rsp)
jmp 0x21428
movq 0x38(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpq %rcx, %rax
jne 0x21510
jmp 0x2143d
movq 0x160(%rsp), %rdi
callq 0x21560
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x2f(%rsp)
jne 0x21487
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rdi
callq 0x215e0
movq %rax, 0x20(%rsp)
jmp 0x21473
movq 0x20(%rsp), %rax
cmpq 0x128(%rsp), %rax
setae %al
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x21491
jmp 0x2150e
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rdi
callq 0x22e90
jmp 0x214a8
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x215d0
movq 0x18(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x23050
jmp 0x214d2
movq 0x160(%rsp), %rdi
callq 0x21580
movq (%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x215d0
movq 0x10(%rsp), %rdi
movl %eax, %eax
movl %eax, %esi
callq 0x23070
jmp 0x214fc
movq 0x160(%rsp), %rdi
callq 0x215f0
jmp 0x2143d
jmp 0x21510
jmp 0x21512
movb 0x123(%rsp), %al
andb $0x1, %al
movb %al, 0x197(%rsp)
movl $0x1, 0x138(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x1a510
movb 0x197(%rsp), %al
andb $0x1, %al
addq $0x198, %rsp            # imm = 0x198
retq
movq 0x140(%rsp), %rdi
callq 0x6520
nopl (%rax,%rax)