// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %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 0x18b44
andb %cl, %al
jne 0x18b44
movq %rsi, %r14
movq %rdi, %rbx
incl 0x20(%rdi)
callq 0x1b53e
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1b552
movq %rax, %r15
movq 0x168(%rbx), %rax
movq 0x170(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
movq %r14, 0x30(%rsp)
je 0x18949
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq %r15, %rsi
callq *%rax
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
xorl %ebp, %ebp
xorl %r14d, %r14d
cmpl 0x30(%rbx), %r14d
jae 0x18a5e
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x1898a
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x18a5e
movl %ebp, 0xc(%rsp)
xorl %ebp, %ebp
cmpl 0x30(%rbx), %r14d
jae 0x18a2f
cmpl 0x40(%rbx), %ebp
jae 0x18a2f
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x189ca
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x18a2f
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x1b786
movq 0x18(%rsp), %r12
subq 0x10(%rsp), %r12
shrq $0x3, %r12
testl %r12d, %r12d
movl $0x0, %eax
cmovlel %eax, %r12d
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
cmpq %r13, %r12
je 0x18a19
movq (%rax,%r13,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x20(%rax)
incq %r13
jmp 0x189fd
cmpq %rax, 0x18(%rsp)
je 0x18a25
movq %rax, 0x18(%rsp)
incl %ebp
incl %r14d
jmp 0x1899a
movq 0x178(%rbx), %rax
movq 0x180(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x18a4c
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movl 0xc(%rsp), %ecx
addl %ebp, %ecx
movl %ecx, %ebp
movq %r15, %rsi
callq *%rax
jmp 0x18963
movq 0x1a8(%rbx), %rax
movq 0x1b0(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x18a7b
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq 0x30(%rsp), %r14
callq *%rax
cmpl $0x0, 0x30(%rbx)
je 0x18ad3
testq %r15, %r15
je 0x18b25
movq 0x8(%rbx), %r12
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x1b7dc
movq (%r12), %rcx
movq %r12, %rdi
movq %r14, %rsi
movl %eax, %edx
callq *0x30(%rcx)
testb %al, %al
je 0x18b25
movl 0x30(%rbx), %eax
cmpl %eax, %ebp
ja 0x18b89
testl %eax, %eax
je 0x18adb
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x1b7dc
movl %eax, %ebp
jmp 0x18b0a
testl %ebp, %ebp
jne 0x18b89
callq 0x62f2
movss %xmm0, 0xc(%rsp)
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
movl %eax, %ebp
callq 0x62f2
subss 0xc(%rsp), %xmm0
addss 0x18(%rbx), %xmm0
movss %xmm0, 0x18(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x1d032
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9eb4(%rip), %rdi      # 0x229e0
leaq 0x8e16(%rip), %rsi      # 0x21949
leaq 0x9f00(%rip), %rcx      # 0x22a3a
movl $0x1e1, %edx            # imm = 0x1E1
callq 0x51b0
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xc1ab
movq 0x1c480(%rip), %rdi     # 0x34fd8
movq %rbx, %rsi
callq 0x5250
leaq 0x9e3a(%rip), %rsi      # 0x229a1
movq %rax, %rdi
callq 0x5290
movq %rax, %rdi
callq 0x5130
leaq 0x10(%rsp), %rdi
callq 0x5120
pushq $0x1
popq %rdi
callq 0x5300
leaq 0x9f13(%rip), %rdi      # 0x22aa3
leaq 0x8db2(%rip), %rsi      # 0x21949
leaq 0x9e9c(%rip), %rcx      # 0x22a3a
movl $0x1e2, %edx            # imm = 0x1E2
callq 0x51b0
jmp 0x18bc1
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x5120
jmp 0x18bce
jmp 0x18bc1
jmp 0x18bc1
jmp 0x18bc1
jmp 0x18bc1
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1d032
movq %rbx, %rdi
callq 0x5410