// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/../engine/lrtdp.h
// Function: Algorithm::lrtdp_base_t<state_t>::lrtdp_trial(state_t const&, Problem::hash_t<state_t>&) const
size_t lrtdp_trial(const T &s, Problem::hash_t<T> &hash) const {
        std::list<T> states;
        std::pair<T, bool> n;

        Hash::data_t *dptr = hash.data_ptr(s);
        states.push_back(s);
        dptr->inc_count();
        T t = s;

#ifdef DEBUG
        std::cout << "debug: lrtdp-base(): trial: begin" << std::endl;
#endif

        size_t steps = 1;
        while( !problem_.terminal(t) && !dptr->solved() && (dptr->count() <= bound_) ) {

#ifdef DEBUG
            std::cout << "debug: lrtdp-base():   " << t << " = " << dptr->value() << std::endl;
#endif

            std::pair<Problem::action_t, float> p = hash.best_q_value(t);
            dptr->update(p.second);
            hash.inc_updates();

            if( Random::real() < epsilon_greedy_ ) {
                n = problem_.usample(t, p.first);
            } else {
                if( type_ == 0 ) {
                    n = problem_.sample(t, p.first);
                } else if( type_ == 1 ) {
                    n = problem_.usample(t, p.first);
                } else if( type_ == 2 ) {
                    n = problem_.nsample(t, p.first, hash);
                }
            }
            if( !n.second ) break;

            t = n.first;
            dptr = hash.data_ptr(t);
            states.push_back(t);
            dptr->inc_count();
            ++steps;
        }

#ifdef DEBUG
        std::cout << "debug: lrtdp-base(): trial: end" << std::endl;
#endif

        while( !states.empty() ) {
            hash.clear_count(states.back());
            bool solved = check_solved(problem_, states.back(), hash, epsilon_);
            states.pop_back();
            if( !solved ) break;
        }

        while( !states.empty() ) {
            hash.clear_count(states.back());
            states.pop_back();
        }
        return steps;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
leaq 0x8(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
orl $-0x1, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%rsp)
movups %xmm0, 0x3c(%rsp)
movups %xmm0, 0x4c(%rsp)
movups %xmm0, 0x5c(%rsp)
andq $0x0, 0x6c(%rsp)
movb $0x1, 0x84(%rsp)
andq $0x0, 0x88(%rsp)
movq %rdx, %rbx
orl $-0x1, 0x90(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movups %xmm0, 0x74(%rsp)
movb $0x0, 0x98(%rsp)
movq %rdx, %rdi
callq 0xcf18
movq %rax, %rbp
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x101e0
incq 0x8(%rbp)
leaq 0x118(%rsp), %rdi
movq %r14, %rsi
callq 0xa4d8
pushq $0x1
popq %rax
movq %rax, 0x20(%rsp)
leaq 0x118(%rsp), %r13
leaq 0x8(%rsp), %r12
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x20(%rax)
testb %al, %al
jne 0x100d3
cmpb $0x0, 0x4(%rbp)
jne 0x100d3
movl 0x24(%r15), %eax
cmpq %rax, 0x8(%rbp)
ja 0x100d3
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd74c
movq %rax, %r14
shrq $0x20, %rax
movl %eax, (%rbp)
incl 0x50(%rbx)
callq 0xb216
ucomiss 0x28(%r15), %xmm0
jae 0x1004a
movq 0x8(%r15), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movl %r14d, %ecx
callq 0x101ec
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x1026a
movq %rbp, %rdi
callq 0x8e90
cmpb $0x1, 0x98(%rsp)
jne 0x100d3
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
callq 0xa8c8
movq %rbx, %rdi
movq %r13, %rsi
callq 0xcf18
movq %rax, %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x101e0
incq 0x8(%rbp)
incq 0x20(%rsp)
jmp 0xff88
movl 0x1c(%r15), %eax
cmpl $0x2, %eax
leaq 0xa0(%rsp), %rbp
je 0x100ac
cmpl $0x1, %eax
je 0x10088
testl %eax, %eax
jne 0x10008
movq 0x8(%r15), %rsi
movq %rbp, %rdi
movq %r13, %rdx
movl %r14d, %ecx
callq 0xb318
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x1026a
jmp 0x10000
movq 0x8(%r15), %rsi
movq %rbp, %rdi
movq %r13, %rdx
movl %r14d, %ecx
callq 0x101ec
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x1026a
jmp 0x10000
movq 0x8(%r15), %rsi
movq %rbp, %rdi
movq %r13, %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0x1028c
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x1026a
jmp 0x10000
movq %r12, %rax
cmpq %r12, 0x8(%rsp)
je 0x10148
leaq 0x8(%rsp), %r14
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x104de
movq 0x8(%r15), %rdi
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movss 0x20(%r15), %xmm0
movq %rbx, %rdx
callq 0x104f8
movl %eax, %ebp
movq %r14, %rdi
callq 0x107c4
movq 0x8(%rsp), %rax
cmpq %r14, %rax
setne %cl
testb %cl, %bpl
jne 0x100e2
jmp 0x10148
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x104de
movq %r12, %rdi
callq 0x107c4
movq 0x8(%rsp), %rax
cmpq %r12, %rax
jne 0x1012a
leaq 0x118(%rsp), %rdi
callq 0x8e90
leaq 0x28(%rsp), %rdi
callq 0x8e90
leaq 0x8(%rsp), %rdi
callq 0x10a78
movq 0x20(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10198
jmp 0x101b4
jmp 0x10198
jmp 0x101b4
jmp 0x10198
jmp 0x101b4
jmp 0x10193
movq %rax, %rbx
jmp 0x101c4
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x8e90
jmp 0x101b7
jmp 0x101b4
jmp 0x101b4
jmp 0x101b4
jmp 0x101b4
jmp 0x101b4
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x8e90
leaq 0x28(%rsp), %rdi
callq 0x8e90
leaq 0x8(%rsp), %rdi
callq 0x10a78
movq %rbx, %rdi
callq 0x5410