// File: /workspace/github_cpp_makefile_star2_O3/bonetblai[P]mdp-engine/ctp3/../engine/policy.h
// Function: float Online::Evaluation::evaluation_trial<state_t>(Online::Policy::policy_t<state_t> const&, state_t const&, unsigned int)
inline float evaluation_trial(const Policy::policy_t<T> &policy, const T &s, unsigned max_depth) {
    T state = s;
    size_t steps = 0;
    float cost = 0;
    float discount = 1;
    if( policy.problem().dead_end(state) ) return policy.problem().dead_end_value();
    while( (steps < max_depth) && !policy.problem().terminal(state) ) {
        //std::cout << "evaluation_trial: " << state << std::flush;
        Problem::action_t action = policy(state);
        //std::cout << ", a=" << action << std::endl;
        if( action == Problem::noop ) {
            //std::cout << "no applicable action" << std::endl;
            return cost + policy.problem().dead_end_value();
        }
        assert(policy.problem().applicable(state, action));
        std::pair<T, bool> p = policy.problem().sample(state, action);
        cost += discount * policy.problem().cost(state, action);
        discount *= policy.problem().discount();
        state = p.first;
        ++steps;
        if( policy.problem().dead_end(state) ) {
            return cost + policy.problem().dead_end_value();
        }
    }
    return cost;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movl %edx, %ebp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x18(%rsp), %r14
movups %xmm0, 0x34(%r14)
movups %xmm0, 0x24(%r14)
movups %xmm0, 0x14(%r14)
movups %xmm0, 0x4(%r14)
xorl %eax, %eax
movq %rax, 0x44(%r14)
movb $0x1, 0x5c(%r14)
movq %rax, 0x60(%r14)
movq %r14, %rdi
callq 0xc30a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x28(%rax)
testb %al, %al
je 0x1db35
movq 0x8(%rbx), %rax
movss 0xc(%rax), %xmm0
jmp 0x1dc7e
movl %ebp, %r12d
incq %r12
movss 0xd4c5(%rip), %xmm0     # 0x2b008
movss %xmm0, 0x10(%rsp)
xorps %xmm1, %xmm1
leaq 0x18(%rsp), %r14
leaq 0x88(%rsp), %r15
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x14(%rsp)
movaps %xmm1, %xmm0
decq %r12
je 0x1dc7e
movss %xmm0, 0x8(%rsp)
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
testb %al, %al
jne 0x1dc6b
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x20(%rax)
movl %eax, %ebp
movq 0x8(%rbx), %rdi
cmpl $-0x1, %eax
je 0x1dc73
movq (%rdi), %rax
movq %r14, %rsi
movl %ebp, %edx
callq *0x30(%rax)
testb %al, %al
je 0x1dcb0
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movq %r14, %rdx
movl %ebp, %ecx
callq 0xcea2
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movl %ebp, %edx
callq *0x48(%rax)
movss %xmm0, 0xc(%rsp)
movq 0x8(%rbx), %rax
movss 0x8(%rax), %xmm0
mulss 0x14(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xc30a
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x28(%rax)
movl %eax, %ebp
movss 0xc(%rsp), %xmm1
mulss 0x14(%rsp), %xmm1
addss 0x8(%rsp), %xmm1
testb %al, %al
je 0x1dc38
movq 0x8(%rbx), %rax
movss 0xc(%rax), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
cmpb $0x0, 0xe4(%rsp)
jne 0x1dc60
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1dc60
movss %xmm1, 0xc(%rsp)
callq 0x5340
movss 0xc(%rsp), %xmm1
testb %bpl, %bpl
je 0x1db59
jmp 0x1dc84
movss 0x8(%rsp), %xmm0
jmp 0x1dc7e
movss 0x8(%rsp), %xmm0
addss 0xc(%rdi), %xmm0
movss %xmm0, 0x4(%rsp)
cmpb $0x0, 0x74(%rsp)
jne 0x1dc9a
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1dc9a
callq 0x5340
movss 0x4(%rsp), %xmm0
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe63c(%rip), %rdi      # 0x2c2f3
leaq 0xe660(%rip), %rsi      # 0x2c31e
leaq 0xe66c(%rip), %rcx      # 0x2c331
movl $0x75, %edx
callq 0x51c0
jmp 0x1dcd5
jmp 0x1dcd5
jmp 0x1dcd5
movq %rax, %rbx
jmp 0x1dcf9
movq %rax, %rbx
cmpb $0x0, 0xe4(%rsp)
jne 0x1dcf9
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x1dcf9
callq 0x5340
cmpb $0x0, 0x74(%rsp)
jne 0x1dd0f
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x1dd0f
callq 0x5340
movq %rbx, %rdi
callq 0x5410
nop