// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdi, %r15
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 0x1020a
movq %rax, %r13
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x159bc
leaq 0x8(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x6060
incq 0x10(%r12)
incq 0x8(%r13)
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 %r14, %rsi
callq 0xd546
movl $0x1, %eax
movq %rax, 0x20(%rsp)
leaq 0x118(%rsp), %r14
leaq 0x8(%rsp), %r12
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
testb %al, %al
jne 0x15044
cmpb $0x0, 0x4(%r13)
jne 0x15044
movl 0x24(%r15), %eax
cmpq %rax, 0x8(%r13)
ja 0x15044
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10b16
movq %rax, %r14
shrq $0x20, %rax
movl %eax, (%r13)
incl 0x50(%rbx)
callq 0x6250
cvtsd2ss %xmm0, %xmm0
ucomiss 0x28(%r15), %xmm0
jae 0x14f2f
movq 0x8(%r15), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x118(%rsp), %rdx
movl %r14d, %ecx
callq 0x151ce
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xd546
movb 0x110(%rsp), %al
movb %al, 0x98(%rsp)
cmpb $0x0, 0xfc(%rsp)
jne 0x14f77
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x14f77
callq 0x6340
jmp 0x14f77
movl 0x1c(%r15), %eax
cmpl $0x2, %eax
je 0x15010
cmpl $0x1, %eax
je 0x14fdf
testl %eax, %eax
jne 0x14f77
movq 0x8(%r15), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x118(%rsp), %rdx
movl %r14d, %ecx
callq 0xe0cc
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xd546
jmp 0x14f03
movb 0x98(%rsp), %r14b
cmpb $0x1, %r14b
jne 0x14fcc
leaq 0x118(%rsp), %rbp
movq %rbp, %rdi
leaq 0x28(%rsp), %rsi
callq 0xd546
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1020a
movq %rax, %r13
movq %r12, %rdi
movq %rbp, %rsi
callq 0x159bc
movq %rax, %rdi
movq %r12, %rsi
callq 0x6060
incq 0x18(%rsp)
incq 0x8(%r13)
incq 0x20(%rsp)
testb %r14b, %r14b
leaq 0x118(%rsp), %r14
jne 0x14e80
jmp 0x15044
movq 0x8(%r15), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x118(%rsp), %rdx
movl %r14d, %ecx
callq 0x151ce
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xd546
jmp 0x14f03
movq 0x8(%r15), %rsi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rdi
leaq 0x118(%rsp), %rdx
movl %r14d, %ecx
movq %rbx, %r8
callq 0x1529e
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0xd546
jmp 0x14f03
cmpq %r12, 0x8(%rsp)
je 0x150a8
leaq 0x8(%rbx), %r14
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %r14, %rdi
callq 0x1069e
testq %rax, %rax
je 0x15071
movq 0x78(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x8(%r15), %rdi
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movss 0x20(%r15), %xmm0
movq %rbx, %rdx
callq 0x15583
movl %eax, %ebp
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x15b4a
cmpq %r12, 0x8(%rsp)
setne %al
testb %al, %bpl
jne 0x1504f
cmpq %r12, 0x8(%rsp)
je 0x150e9
addq $0x8, %rbx
movq 0x10(%rsp), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
callq 0x1069e
testq %rax, %rax
je 0x150d5
movq 0x78(%rax), %rax
movq $0x0, 0x8(%rax)
movq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x15b4a
cmpq %r12, 0x8(%rsp)
jne 0x150b3
cmpb $0x0, 0x174(%rsp)
jne 0x15105
movq 0x178(%rsp), %rdi
testq %rdi, %rdi
je 0x15105
callq 0x6340
cmpb $0x0, 0x84(%rsp)
jne 0x15121
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x15121
callq 0x6340
leaq 0x8(%rsp), %rdi
callq 0x15b78
movq 0x20(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15155
jmp 0x15180
jmp 0x15155
jmp 0x15180
jmp 0x15155
jmp 0x15180
jmp 0x15150
movq %rax, %rbx
jmp 0x1519f
movq %rax, %rbx
cmpb $0x0, 0xfc(%rsp)
jne 0x15183
movq 0x100(%rsp), %rdi
testq %rdi, %rdi
je 0x15183
callq 0x6340
jmp 0x15183
jmp 0x15180
jmp 0x15180
jmp 0x15180
jmp 0x15180
jmp 0x15180
movq %rax, %rbx
cmpb $0x0, 0x174(%rsp)
jne 0x1519f
movq 0x178(%rsp), %rdi
testq %rdi, %rdi
je 0x1519f
callq 0x6340
cmpb $0x0, 0x84(%rsp)
jne 0x151bb
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x151bb
callq 0x6340
leaq 0x8(%rsp), %rdi
callq 0x15b78
movq %rbx, %rdi
callq 0x6410
nop