// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x28(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x2c(%rsp)
movups %xmm0, 0x3c(%rsp)
movups %xmm0, 0x4c(%rsp)
movups %xmm0, 0x5c(%rsp)
movq %rcx, 0x6c(%rsp)
movb $0x1, 0x84(%rsp)
movq %rcx, 0x88(%rsp)
movl %eax, 0x90(%rsp)
movups %xmm0, 0x74(%rsp)
movb $0x0, 0x98(%rsp)
movq %rdx, %rdi
callq 0xefb2
movq %rax, %rbp
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x145d8
leaq 0x8(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x5060
incq 0x10(%r12)
incq 0x8(%rbp)
xorl %eax, %eax
leaq 0x118(%rsp), %rdi
movq %rax, 0x44(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x34(%rdi)
movups %xmm0, 0x24(%rdi)
movups %xmm0, 0x14(%rdi)
movups %xmm0, 0x4(%rdi)
movb $0x1, 0x5c(%rdi)
movq %rax, 0x60(%rdi)
movq %r15, %rsi
callq 0xc30a
movl $0x1, %eax
movq %rax, 0x20(%rsp)
leaq 0x118(%rsp), %r13
leaq 0x8(%rsp), %r12
movq 0x8(%r14), %rdi
movq (%rdi), %rax
movq %r13, %rsi
callq *0x20(%rax)
testb %al, %al
jne 0x13cb2
cmpb $0x0, 0x4(%rbp)
jne 0x13cb2
movl 0x24(%r14), %eax
cmpq %rax, 0x8(%rbp)
ja 0x13cb2
movq %rbx, %rdi
movq %r13, %rsi
callq 0xf8b0
movq %rax, %r15
shrq $0x20, %rax
movl %eax, (%rbp)
incl 0x50(%rbx)
callq 0x5250
cvtsd2ss %xmm0, %xmm0
ucomiss 0x28(%r14), %xmm0
jae 0x13bc6
movq 0x8(%r14), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movl %r15d, %ecx
callq 0x13e3c
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xc30a
movb 0x110(%rsp), %al
movb %al, 0x98(%rsp)
cmpb $0x0, 0xfc(%rsp)
jne 0x13c05
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x13c05
callq 0x5340
jmp 0x13c05
movl 0x1c(%r14), %eax
cmpl $0x2, %eax
je 0x13c83
cmpl $0x1, %eax
je 0x13c57
testl %eax, %eax
jne 0x13c05
movq 0x8(%r14), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movl %r15d, %ecx
callq 0xcea2
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xc30a
jmp 0x13b9a
cmpb $0x1, 0x98(%rsp)
jne 0x13cb2
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
callq 0xc30a
movq %rbx, %rdi
movq %r13, %rsi
callq 0xefb2
movq %rax, %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x145d8
movq %rax, %rdi
movq %r12, %rsi
callq 0x5060
incq 0x18(%rsp)
incq 0x8(%rbp)
incq 0x20(%rsp)
jmp 0x13b1e
movq 0x8(%r14), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movl %r15d, %ecx
callq 0x13e3c
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xc30a
jmp 0x13b9a
movq 0x8(%r14), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
movq %r13, %rdx
movl %r15d, %ecx
movq %rbx, %r8
callq 0x13f12
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xc30a
jmp 0x13b9a
cmpq %r12, 0x8(%rsp)
je 0x13d58
leaq 0x8(%rbx), %r13
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %r13, %rdi
callq 0xf446
testq %rax, %rax
je 0x13ce3
movq 0x78(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x8(%r14), %rdi
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movss 0x20(%r14), %xmm0
movq %rbx, %rdx
callq 0x141a5
movl %eax, %ebp
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x14766
movq 0x8(%rsp), %rax
cmpq %r12, %rax
setne %cl
testb %cl, %bpl
jne 0x13cc1
cmpq %r12, %rax
je 0x13d58
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %r13, %rdi
callq 0xf446
testq %rax, %rax
je 0x13d44
movq 0x78(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x14766
cmpq %r12, 0x8(%rsp)
jne 0x13d22
cmpb $0x0, 0x174(%rsp)
jne 0x13d74
movq 0x178(%rsp), %rdi
testq %rdi, %rdi
je 0x13d74
callq 0x5340
cmpb $0x0, 0x84(%rsp)
jne 0x13d90
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13d90
callq 0x5340
leaq 0x8(%rsp), %rdi
callq 0x14794
movq 0x20(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13dc4
jmp 0x13def
jmp 0x13dc4
jmp 0x13def
jmp 0x13dc4
jmp 0x13def
jmp 0x13dbf
movq %rax, %rbx
jmp 0x13e0e
movq %rax, %rbx
cmpb $0x0, 0xfc(%rsp)
jne 0x13df2
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x13df2
callq 0x5340
jmp 0x13df2
jmp 0x13def
jmp 0x13def
jmp 0x13def
jmp 0x13def
jmp 0x13def
movq %rax, %rbx
cmpb $0x0, 0x174(%rsp)
jne 0x13e0e
movq 0x178(%rsp), %rdi
testq %rdi, %rdi
je 0x13e0e
callq 0x5340
cmpb $0x0, 0x84(%rsp)
jne 0x13e2a
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x13e2a
callq 0x5340
leaq 0x8(%rsp), %rdi
callq 0x14794
movq %rbx, %rdi
callq 0x5410