// File: /workspace/github_cpp_makefile_star2_O3/bonetblai[P]mdp-engine/ctp3/../engine/aot.h
// Function: Online::Policy::AOT::aot_t<state_t>::operator()(state_t const&) const
virtual Problem::action_t operator()(const T &s) const {
        if( ((base_policy_ == 0) && (heuristic_ == 0) && (width_ > 0)) || ((base_policy_ == 0) && (width_ == 0)) ) {
            std::cout << Utils::error() << "(base) policy or heuristic must be specified for aot() policy!" << std::endl;
            exit(1);
        }

        // initialize tree and setup expansion loop for selection strategy
        ++policy_t<T>::decisions_;
        clear();
        state_node_t<T> *root = fetch_node(s, 0).first;
        (this->*setup_expansion_loop_ptr_)(root);

        // expand leaves and propagate values
        unsigned expanded = 0;
        std::vector<node_t<T>*> nodes_to_propagate;
        for( unsigned i = 0; (i < width_) && (this->*exist_nodes_to_expand_ptr_)(); ) {
            unsigned expanded_in_iteration = 0;
            while( (i < width_) &&
                   (expanded_in_iteration < expansions_per_iteration_) &&
                   (this->*exist_nodes_to_expand_ptr_)() ) {
                select_and_expand(root, nodes_to_propagate);
                for( int j = 0, jsz = nodes_to_propagate.size(); j < jsz; ++j )
                    propagate(nodes_to_propagate[j]);
                nodes_to_propagate.clear();
                ++expanded_in_iteration;
                ++i;
            }
            expanded += expanded_in_iteration;
            (this->*prepare_next_expansion_iteration_ptr_)(root);
        }
        (this->*clear_internal_state_ptr_)();

#if 0
        std::cout << "[1] value at root = " << root->value_ << std::endl;
        for( Problem::action_t a = 0; a < problem_.number_actions(root->state_); ++a ) {
            if( problem_.applicable(root->state_, a) ) {
                double value = 0;
                std::vector<std::pair<T, float> > outcomes;
                problem_.next(root->state_, a, outcomes, true);
                for( int i = 0, isz = outcomes.size(); i < isz; ++i ) {
                    const T &state = outcomes[i].first;
                    float prob = outcomes[i].second;
                    std::pair<state_node_t<T>*, bool> p = fetch_node(state, 1);
                    value += prob * p.first->value_;
                    std::cout << "    outcome " << i << ": prob = " << prob << ", value = " << p.first->value_ << std::endl;
                    p.first->print(std::cout); std::cout << std::endl;
                }
                value = problem_.cost(root->state_, a) + problem_.discount() * value;
                std::cout << "    ACTION " << a << ": value = " << value << std::endl;
            }
        }
#endif

        assert((width_ == 0) || ((root != 0) && problem_.applicable(s, root->best_action(random_ties_))));
        assert(expanded <= width_);

        // select best action
        if( width_ == 0 ) {
            float start_time = Utils::read_time_in_seconds();
            Problem::action_t action = (*base_policy_)(s);
            policy_t<T>::base_policy_time_ += Utils::read_time_in_seconds() - start_time;
            return action;
        } else {
            return root->best_action(random_ties_);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq 0x28(%rdi), %rcx
testq %rcx, %rcx
sete %al
orq 0x98(%rdi), %rcx
setne %dl
cmpl $0x0, 0x30(%rdi)
sete %cl
orb %cl, %dl
je 0x22456
andb %cl, %al
jne 0x22456
movq %rsi, %r14
movq %rdi, %rbx
incl 0x20(%rdi)
addq $0x58, %rdi
callq 0x25428
movl $0x0, 0x50(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x24f1e
movq %rax, %r15
movq 0x168(%rbx), %rax
movq 0x170(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
movq %r14, (%rsp)
je 0x2217c
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq %r15, %rsi
callq *%rax
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
xorl %r14d, %r14d
xorl %ebp, %ebp
cmpl 0x30(%rbx), %ebp
jae 0x222b1
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x221bf
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x222b1
movq %r14, 0x8(%rsp)
xorl %r14d, %r14d
cmpl 0x30(%rbx), %ebp
jae 0x2227f
cmpl $0x0, 0x40(%rbx)
je 0x2227f
xorl %r14d, %r14d
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x22204
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x2227f
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x25290
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %r12
subq %rax, %r12
shrq $0x3, %r12
testl %r12d, %r12d
jle 0x22261
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x20(%rax)
incq %r13
cmpq %r13, %r12
jne 0x2223d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
je 0x2226b
movq %rax, 0x18(%rsp)
incl %r14d
incl %ebp
cmpl 0x30(%rbx), %ebp
jae 0x2227f
cmpl 0x40(%rbx), %r14d
jb 0x221e7
movq 0x178(%rbx), %rax
movq 0x180(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x2229c
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq 0x8(%rsp), %rcx
addl %r14d, %ecx
movq %rcx, %r14
movq %r15, %rsi
callq *%rax
jmp 0x22199
movq 0x1a8(%rbx), %rax
movq 0x1b0(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x222ce
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq (%rsp), %rbp
callq *%rax
cmpl $0x0, 0x30(%rbx)
je 0x2232d
testq %r15, %r15
je 0x22437
movq 0x8(%rbx), %r12
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x252e6
movq (%r12), %rcx
movq %r12, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq *0x30(%rcx)
testb %al, %al
je 0x22437
movl 0x30(%rbx), %eax
cmpl %eax, %r14d
ja 0x224d6
testl %eax, %eax
je 0x22336
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x252e6
movl %eax, %ebp
jmp 0x22414
testl %r14d, %r14d
jne 0x224d6
leaq 0x28(%rsp), %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x5190
movq (%r15), %r12
movq 0x8(%r15), %r14
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
callq 0x5190
movq (%r15), %r13
movq 0x8(%r15), %r15
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %rbp, %rsi
callq *0x20(%rax)
movl %eax, %ebp
xorps %xmm0, %xmm0
cvtsi2ss %r13, %xmm0
cvtsi2ss %r12, %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2ss %r15, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %r14, %xmm1
addss %xmm0, %xmm1
movss %xmm1, (%rsp)
leaq 0x28(%rsp), %r14
xorl %edi, %edi
movq %r14, %rsi
callq 0x5190
xorps %xmm0, %xmm0
cvtsi2ssq (%r14), %xmm0
subss 0x8(%rsp), %xmm0
movss %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2ssq 0x8(%r14), %xmm0
subss (%rsp), %xmm0
movss %xmm0, (%rsp)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r14, %rsi
callq 0x5190
xorps %xmm0, %xmm0
cvtsi2ssq (%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssq 0x8(%r14), %xmm1
addss 0x8(%rsp), %xmm0
addss (%rsp), %xmm1
mulss 0x8bfe(%rip), %xmm1     # 0x2b004
addss 0x18(%rbx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x18(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x22423
callq 0x5260
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb5b8(%rip), %rdi      # 0x2d9f6
leaq 0xa544(%rip), %rsi      # 0x2c989
leaq 0xb604(%rip), %rcx      # 0x2da50
movl $0x1e1, %edx            # imm = 0x1E1
callq 0x51c0
movb 0x1adfc(%rip), %al      # 0x3d258
testb %al, %al
leaq 0x958f(%rip), %rcx      # 0x2b9f4
leaq 0x9af6(%rip), %rsi      # 0x2bf62
cmovneq %rcx, %rsi
leaq 0x12(%rsi), %rdx
testb %al, %al
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
cmoveq %rsi, %rdx
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0xd386
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x1ab3a(%rip), %rdi     # 0x3cfd8
callq 0x52e0
movq %rax, %rbx
leaq 0xb50a(%rip), %rsi      # 0x2d9b7
movl $0x3e, %edx
movq %rax, %rdi
callq 0x52e0
movq %rbx, %rdi
callq 0x5150
leaq 0x28(%rsp), %rdi
callq 0x5140
movl $0x1, %edi
callq 0x5310
leaq 0xb5dc(%rip), %rdi      # 0x2dab9
leaq 0xa4a5(%rip), %rsi      # 0x2c989
leaq 0xb565(%rip), %rcx      # 0x2da50
movl $0x1e2, %edx            # imm = 0x1E2
callq 0x51c0
jmp 0x2250e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
jne 0x2251b
jmp 0x22520
jmp 0x2250e
jmp 0x2250e
jmp 0x2250e
jmp 0x2250e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x22520
callq 0x5260
movq %rbx, %rdi
callq 0x5410