// File: bonetblai[P]mdp-engine/ctp3/../engine/online_rtdp.h
// Function: Online::Policy::RTDP::finite_horizon_lrtdp_t<state_t>::lrtdp_trial(Online::Policy::RTDP::node_t<state_t> const&, Online::Policy::RTDP::data_t*) const
void lrtdp_trial(const node_t<T> &root, data_t *root_dptr) const {
        // set up queue of visited nodes (for labeling)
        std::vector<std::pair<T, data_t*> > visited;
        if( labeling_ ) {
            visited.reserve(horizon_);
            visited.push_back(std::make_pair(root.state(), root_dptr));
        }

#ifdef DEBUG
        std::cout << "lrtdp_trial: new trial" << std::endl;
#endif

        // lrtdp trial
        node_t<T> node(root);
        data_t *dptr = root_dptr;
        bool node_is_dead_end = dead_end(node);
        while( !labeled(dptr) && !terminal(node) && !node_is_dead_end ) {
#ifdef DEBUG
            std::cout << "lrtdp_trial: state=" << node.state()
                      << ", depth=" << node.depth()
                      << ", dptr=" << dptr << std::endl;
#endif
            std::pair<float, Problem::action_t> p = best_q_value(node).first;
            Problem::action_t best_action = p.second;
            update_value(node, p.first);
            node.set_state(problem_.sample(node.state(), best_action).first);
            node.set_depth(1 + node.depth());
            node_is_dead_end = dead_end(node);
            dptr = table_.get_data_ptr(node);
            if( labeling_ ) visited.push_back(std::make_pair(node.state(), dptr));
        }

#ifdef DEBUG
        std::cout << "lrtdp_trial: end state=" << node.state()
                  << ", depth=" << node.depth()
                  << ", dptr=" << dptr << std::endl;
#endif

        if( !labeled(dptr) ) {
            dptr->value_ = node_is_dead_end ? problem_.dead_end_value() : 0;
            if( labeling_ ) dptr->labeled_ = true;
        }

        // try labeling nodes in reverse visited order
        for( unsigned depth = visited.size(); depth > 0; --depth ) {
            node_t<T> node(visited[depth - 1].first, depth - 1);
            data_t *dptr = visited[depth - 1].second;
            bool has_label = labeled(dptr) || try_label(node, dptr);
#ifdef DEBUG
            std::cout << "lrtdp_trial: labeling: state=" << node.state()
                      << ", dptr=" << dptr
                      << std::endl;
#endif
            if( !has_label ) break;
        }
    }

// Assembly:
subq $0x338, %rsp            # imm = 0x338
movq %rdi, 0x330(%rsp)
movq %rsi, 0x328(%rsp)
movq %rdx, 0x320(%rsp)
movq 0x330(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x308(%rsp), %rdi
callq 0x55f40
movq 0x40(%rsp), %rax
testb $0x1, 0x38(%rax)
je 0x541ad
movq 0x40(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, %esi
leaq 0x308(%rsp), %rdi
callq 0x55f50
jmp 0x54121
movq 0x328(%rsp), %rdi
callq 0x54f00
movq %rax, %rsi
leaq 0x280(%rsp), %rdi
leaq 0x320(%rsp), %rdx
callq 0x560c0
jmp 0x54148
leaq 0x308(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x56090
jmp 0x5415f
leaq 0x280(%rsp), %rdi
callq 0x56100
jmp 0x541ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x54645
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x280(%rsp), %rdi
callq 0x56100
jmp 0x54645
movq 0x328(%rsp), %rsi
leaq 0x208(%rsp), %rdi
callq 0x55a40
jmp 0x541c4
movq 0x40(%rsp), %rdi
movq 0x320(%rsp), %rax
movq %rax, 0x200(%rsp)
leaq 0x208(%rsp), %rsi
callq 0x56110
movb %al, 0x3f(%rsp)
jmp 0x541ec
movb 0x3f(%rsp), %al
andb $0x1, %al
movb %al, 0x1ff(%rsp)
movq 0x40(%rsp), %rdi
movq 0x200(%rsp), %rsi
callq 0x54070
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x3e(%rsp)
jne 0x5424e
movq 0x40(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56150
movb %al, 0x3d(%rsp)
jmp 0x54230
movb 0x3d(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x3e(%rsp)
jne 0x5424e
jmp 0x54241
movb 0x1ff(%rsp), %al
xorb $-0x1, %al
movb %al, 0x3e(%rsp)
movb 0x3e(%rsp), %al
testb $0x1, %al
jne 0x5425b
jmp 0x54483
movq 0x40(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x561c0
movb %dl, 0x2f(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x54278
movq 0x40(%rsp), %rdi
movb 0x2f(%rsp), %al
movq 0x30(%rsp), %rcx
movq %rcx, 0x1d0(%rsp)
movb %al, 0x1d8(%rsp)
movb 0x1d8(%rsp), %al
movb %al, 0x1e8(%rsp)
movq 0x1d0(%rsp), %rax
movq %rax, 0x1e0(%rsp)
movq 0x1e0(%rsp), %rax
movq %rax, 0x1f0(%rsp)
movl 0x1f4(%rsp), %eax
movl %eax, 0x1cc(%rsp)
movss 0x1f0(%rsp), %xmm0
leaq 0x208(%rsp), %rsi
callq 0x56360
jmp 0x542e9
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
leaq 0x208(%rsp), %rdi
callq 0x54f00
movq 0x20(%rsp), %rsi
movq %rax, %rdx
movl 0x1cc(%rsp), %ecx
leaq 0x150(%rsp), %rdi
callq 0x19da0
jmp 0x54322
leaq 0x208(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x563d0
jmp 0x54339
leaq 0x150(%rsp), %rdi
callq 0x19f70
leaq 0x208(%rsp), %rdi
callq 0x56420
movl %eax, 0x1c(%rsp)
jmp 0x54359
movl 0x1c(%rsp), %esi
incl %esi
leaq 0x208(%rsp), %rdi
callq 0x56400
jmp 0x5436e
movq 0x40(%rsp), %rdi
leaq 0x208(%rsp), %rsi
callq 0x56110
movb %al, 0x1b(%rsp)
jmp 0x54386
movq 0x40(%rsp), %rdi
movb 0x1b(%rsp), %al
andb $0x1, %al
movb %al, 0x1ff(%rsp)
addq $0x40, %rdi
leaq 0x208(%rsp), %rsi
callq 0x54010
movq %rax, 0x10(%rsp)
jmp 0x543b0
movq 0x40(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rcx, 0x200(%rsp)
testb $0x1, 0x38(%rax)
je 0x5447e
leaq 0x208(%rsp), %rdi
callq 0x54f00
movq %rax, %rsi
leaq 0xd8(%rsp), %rdi
leaq 0x200(%rsp), %rdx
callq 0x560c0
jmp 0x543f3
leaq 0x308(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x56090
jmp 0x5440a
leaq 0xd8(%rsp), %rdi
callq 0x56100
jmp 0x5447e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
jmp 0x54638
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x19f70
jmp 0x54638
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x56100
jmp 0x54638
jmp 0x541f9
movq 0x40(%rsp), %rdi
movq 0x200(%rsp), %rsi
callq 0x54070
testb $0x1, %al
jne 0x544ef
testb $0x1, 0x1ff(%rsp)
je 0x544b9
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x3cbe0
movss %xmm0, 0xc(%rsp)
jmp 0x544c4
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
jmp 0x544c4
movq 0x40(%rsp), %rax
movss 0xc(%rsp), %xmm0
movq 0x200(%rsp), %rcx
movss %xmm0, (%rcx)
testb $0x1, 0x38(%rax)
je 0x544ed
movq 0x200(%rsp), %rax
movb $0x1, 0x4(%rax)
jmp 0x544ef
leaq 0x308(%rsp), %rdi
callq 0x56430
movl %eax, 0xd4(%rsp)
cmpl $0x0, 0xd4(%rsp)
jbe 0x54616
movl 0xd4(%rsp), %eax
decl %eax
movl %eax, %esi
leaq 0x308(%rsp), %rdi
callq 0x56450
movq %rax, %rsi
movl 0xd4(%rsp), %edx
decl %edx
leaq 0x58(%rsp), %rdi
callq 0x53fe0
jmp 0x54541
movl 0xd4(%rsp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x308(%rsp), %rdi
callq 0x56450
movq 0x40(%rsp), %rdi
movq 0x70(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rsi
callq 0x54070
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0xb(%rsp)
jne 0x545a5
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0x58(%rsp), %rsi
callq 0x56470
movb %al, 0xa(%rsp)
jmp 0x5459b
movb 0xa(%rsp), %al
movb %al, 0xb(%rsp)
jmp 0x545a5
movb 0xb(%rsp), %al
andb $0x1, %al
movb %al, 0x4f(%rsp)
testb $0x1, 0x4f(%rsp)
jne 0x545e0
movl $0x4, 0x48(%rsp)
jmp 0x545e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x300(%rsp)
movl %eax, 0x2fc(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x53c50
jmp 0x54638
movl $0x0, 0x48(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x53c50
movl 0x48(%rsp), %eax
testl %eax, %eax
je 0x545fe
jmp 0x545fc
jmp 0x54616
jmp 0x54600
movl 0xd4(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xd4(%rsp)
jmp 0x54503
leaq 0x208(%rsp), %rdi
callq 0x53c50
leaq 0x308(%rsp), %rdi
callq 0x56570
addq $0x338, %rsp            # imm = 0x338
retq
leaq 0x208(%rsp), %rdi
callq 0x53c50
leaq 0x308(%rsp), %rdi
callq 0x56570
movq 0x300(%rsp), %rdi
callq 0x6520
nop