// File: /workspace/github_cpp_makefile_star2_O1/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 0x240d8
andb %cl, %al
jne 0x240d8
movq %rsi, %r14
movq %rdi, %rbx
incl 0x20(%rdi)
addq $0x58, %rdi
callq 0x2721a
movl $0x0, 0x50(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x26cec
movq %rax, %r15
movq 0x168(%rbx), %rax
movq 0x170(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
movq %r14, (%rsp)
je 0x23e10
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 0x23f3c
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x23e53
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x23f3c
movq %r14, 0x8(%rsp)
xorl %r14d, %r14d
cmpl 0x30(%rbx), %ebp
jae 0x23f0a
cmpl $0x0, 0x40(%rbx)
je 0x23f0a
xorl %r14d, %r14d
movq 0x188(%rbx), %rax
movq 0x190(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x23e98
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
testb %al, %al
je 0x23f0a
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x2707a
movq 0x18(%rsp), %r12
subq 0x10(%rsp), %r12
shrq $0x3, %r12
testl %r12d, %r12d
jle 0x23ee5
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 0x23ecb
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x23ef6
movq %rax, 0x18(%rsp)
incl %r14d
incl %ebp
cmpl 0x30(%rbx), %ebp
jae 0x23f0a
cmpl 0x40(%rbx), %r14d
jb 0x23e7b
movq 0x178(%rbx), %rax
movq 0x180(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x23f27
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq 0x8(%rsp), %rcx
addl %r14d, %ecx
movq %rcx, %r14
movq %r15, %rsi
callq *%rax
jmp 0x23e2d
movq 0x1a8(%rbx), %rax
movq 0x1b0(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x23f59
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
movq (%rsp), %rbp
callq *%rax
cmpl $0x0, 0x30(%rbx)
je 0x23f95
testq %r15, %r15
je 0x240b9
movq 0x8(%rbx), %r12
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x270d0
movq (%r12), %rcx
movq %r12, %rdi
movq %rbp, %rsi
movl %eax, %edx
callq *0x30(%rcx)
testb %al, %al
je 0x240b9
movl 0x30(%rbx), %eax
cmpl %eax, %r14d
ja 0x24158
testl %eax, %eax
je 0x23fb8
movzbl 0x3c(%rbx), %esi
movq %r15, %rdi
callq 0x270d0
movl %eax, %ebp
jmp 0x24096
leaq 0x28(%rsp), %r15
xorl %edi, %edi
movq %r15, %rsi
callq 0x6190
movq (%r15), %r12
movq 0x8(%r15), %r14
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
callq 0x6190
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 0x6190
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 0x6190
xorps %xmm0, %xmm0
cvtsi2ssq (%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssq 0x8(%r14), %xmm1
addss 0x8(%rsp), %xmm0
addss (%rsp), %xmm1
mulss 0x8f7c(%rip), %xmm1     # 0x2d004
addss 0x18(%rbx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, 0x18(%rbx)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x240a5
callq 0x6260
movl %ebp, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb9ad(%rip), %rdi      # 0x2fa6d
leaq 0xa91e(%rip), %rsi      # 0x2e9e5
leaq 0xb9f9(%rip), %rcx      # 0x2fac7
movl $0x1e1, %edx            # imm = 0x1E1
callq 0x61c0
movb 0x1b17a(%rip), %al      # 0x3f258
testb %al, %al
leaq 0x9912(%rip), %rcx      # 0x2d9f9
leaq 0x9e79(%rip), %rsi      # 0x2df67
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 0xe5ba
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x1aeb8(%rip), %rdi     # 0x3efd8
callq 0x62e0
movq %rax, %rbx
leaq 0xb8ff(%rip), %rsi      # 0x2fa2e
movl $0x3e, %edx
movq %rax, %rdi
callq 0x62e0
movq %rbx, %rdi
callq 0x6150
leaq 0x28(%rsp), %rdi
callq 0x6140
movl $0x1, %edi
callq 0x6310
leaq 0xb9d1(%rip), %rdi      # 0x2fb30
leaq 0xa87f(%rip), %rsi      # 0x2e9e5
leaq 0xb95a(%rip), %rcx      # 0x2fac7
movl $0x1e2, %edx            # imm = 0x1E2
callq 0x61c0
jmp 0x24190
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
jne 0x2419d
jmp 0x241a2
jmp 0x24190
jmp 0x24190
jmp 0x24190
jmp 0x24190
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x241a2
callq 0x6260
movq %rbx, %rdi
callq 0x6410