// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/../engine/policy.h
// Function: std::pair<float, float> Online::Evaluation::evaluation_with_stdev<state_t>(Online::Policy::policy_t<state_t> const&, state_t const&, unsigned int, unsigned int, bool)
inline std::pair<float, float>
  evaluation_with_stdev(const Policy::policy_t<T> &policy,
                        const T &s,
                        unsigned number_trials,
                        unsigned max_depth,
                        bool verbose = false) {
    float sum = 0;
    std::vector<float> values;
    values.reserve(number_trials);
    if( verbose ) std::cout << "#trials=" << number_trials << ":";
    for( unsigned trial = 0; trial < number_trials; ++trial ) {
        if( verbose ) std::cout << " " << trial << std::flush;
        values.push_back(evaluation_trial(policy, s, max_depth));
        sum += values.back();
        if( verbose ) {
            std::cout << "(" << std::setprecision(1) << sum/(1+trial) << ")"
                      << std::flush;
        }
    }
    if( verbose ) std::cout << std::endl;

    // compute average
    float avg = 0;
    for( unsigned i = 0; i < number_trials; ++i ) {
        avg += values[i];
    }
    avg /= number_trials;

    // compute stdev
    float stdev = 0;
    for( unsigned i = 0; i < number_trials; ++i ) {
        stdev += (avg - values[i]) * (avg - values[i]);
    }
    stdev = sqrt(stdev) / (number_trials - 1);
    return std::make_pair(avg, stdev);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebp
movl %ecx, %r15d
movq %rsi, %r12
movq %rdi, %r13
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rdx, 0x20(%rsp)
movl %edx, %r14d
movq %r14, %rsi
callq 0x1f78c
testb %bpl, %bpl
je 0x1f5ff
movq 0x159ff(%rip), %rdi     # 0x34fd8
leaq 0x1cca(%rip), %rsi      # 0x212aa
callq 0x5290
movq %rax, %rdi
movq %r14, %rsi
callq 0x51c0
leaq 0x1826(%rip), %rsi      # 0x20e1d
movq %rax, %rdi
callq 0x5290
xorps %xmm0, %xmm0
movss %xmm0, 0x10(%rsp)
xorl %ebx, %ebx
cmpq %r14, %rbx
je 0x1f6df
testb %bpl, %bpl
je 0x1f63e
movq 0x159b9(%rip), %rdi     # 0x34fd8
leaq 0x18fb(%rip), %rsi      # 0x20f21
callq 0x5290
movq %rax, %rdi
movq %rbx, %rsi
callq 0x51c0
movq %rax, %rdi
callq 0x51d0
movq %r13, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x16425
movss %xmm0, 0xc(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x1f81c
movq 0x38(%rsp), %rax
movss 0x10(%rsp), %xmm0
addss -0x4(%rax), %xmm0
movss %xmm0, 0x10(%rsp)
testb %bpl, %bpl
je 0x1f6d7
movq 0x15955(%rip), %rdi     # 0x34fd8
leaq 0x19a5(%rip), %rsi      # 0x2102f
callq 0x5290
incq %rbx
movl %ebx, %ecx
cvtsi2ss %rcx, %xmm1
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x1, 0x8(%rax,%rcx)
movss 0x10(%rsp), %xmm0
divss %xmm1, %xmm0
movq %rax, %rdi
callq 0x51f0
movq %rax, %rdi
leaq 0xd68(%rip), %rsi       # 0x2042d
callq 0x5290
movq %rax, %rdi
callq 0x51d0
jmp 0x1f60a
incq %rbx
jmp 0x1f60a
testb %bpl, %bpl
je 0x1f6f0
movq 0x158ed(%rip), %rdi     # 0x34fd8
callq 0x5130
xorps %xmm2, %xmm2
movq 0x30(%rsp), %rax
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x1f709
addss (%rax,%rcx,4), %xmm2
incq %rcx
jmp 0x1f6fa
cvtsi2ss %r14, %xmm0
divss %xmm0, %xmm2
xorps %xmm0, %xmm0
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x1f731
movaps %xmm2, %xmm1
subss (%rax,%rcx,4), %xmm1
mulss %xmm1, %xmm1
addss %xmm1, %xmm0
incq %rcx
jmp 0x1f717
sqrtss %xmm0, %xmm1
movq 0x20(%rsp), %rax
decl %eax
cvtsi2ss %rax, %xmm0
divss %xmm0, %xmm1
movaps %xmm1, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
movaps %xmm2, 0x20(%rsp)
callq 0x17132
movaps 0x20(%rsp), %xmm0
unpcklps 0x10(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f776
jmp 0x1f776
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x17132
movq %rbx, %rdi
callq 0x5410
nop