// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/../engine/aot.h
// Function: Online::Policy::AOT::aot_t<state_t>::expand(Online::Policy::AOT::action_node_t<state_t>*, std::vector<Online::Policy::AOT::node_t<state_t>*, std::allocator<Online::Policy::AOT::node_t<state_t>*>>&, bool) const
void expand(action_node_t<T> *a_node,
                std::vector<node_t<T>*> &nodes_to_propagate,
                bool picked_from_queue = true) const {
        assert(a_node->is_leaf());
        assert(!a_node->parent_->is_goal_);
        assert(!a_node->parent_->is_dead_end_);
        a_node->value_ = 0;
        std::vector<std::pair<T, float> > outcomes;
        problem_.next(a_node->parent_->state_, a_node->action_, outcomes);
        a_node->children_.reserve(outcomes.size());
        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 + a_node->parent_->depth_);
            if( p.second ) {
                assert(p.first->is_leaf());
                nodes_to_propagate.push_back(p.first);
            }
            p.first->parents_.push_back(std::make_pair(i, a_node));
            a_node->children_.push_back(std::make_pair(prob, p.first));
            a_node->value_ += prob * p.first->value_;
        }
        a_node->value_ = a_node->action_cost_ + problem_.discount() * a_node->value_;
        nodes_to_propagate.push_back(a_node);

        // re-sample sibling action nodes that are still leaves.
        if( picked_from_queue && (heuristic_ == 0)) {
            state_node_t<T> *parent = a_node->parent_;
            const T &state = parent->state_;
            unsigned depth = 1 + parent->depth_;
            for( int i = 0, isz = parent->children_.size(); i < isz; ++i ) {
                action_node_t<T> *sibling = parent->children_[i];
                if( sibling->is_leaf() ) {
                    float old_val = (sibling->value_ - sibling->action_cost_) / problem_.discount();
                    float eval = evaluate(state, sibling->action_, depth);
                    float new_val = old_val * sibling->nsamples_ + eval;
                    sibling->nsamples_ +=
                      delayed_evaluation_nsamples_ * leaf_nsamples_;
                    sibling->value_ = sibling->action_cost_ +
                      problem_.discount() * new_val/sibling->nsamples_;

#ifdef DEBUG
                    std::cout << "sibling re-sampled: "
                              << "num=" << sibling->nsamples_
                              << std::endl;
#endif
                }
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, 0x18(%rsp)
movq 0x28(%rsi), %rax
cmpq 0x30(%rsi), %rax
jne 0x1c245
movq %rsi, %r14
movq 0x20(%rsi), %rsi
cmpb $0x1, 0x88(%rsi)
je 0x1c264
cmpb $0x1, 0x89(%rsi)
je 0x1c283
movl %ecx, 0x2c(%rsp)
andl $0x0, 0x8(%r14)
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rcx
movaps %xmm0, (%rcx)
andq $0x0, 0x10(%rcx)
movq %rdi, 0x10(%rsp)
movq 0x8(%rdi), %rdi
addq $0x18, %rsi
movl 0x18(%r14), %edx
movq (%rdi), %rax
callq *0x60(%rax)
leaq 0x28(%r14), %rdi
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
pushq $0x78
popq %rbx
cqto
idivq %rbx
movq %rdi, 0x20(%rsp)
movq %rax, %rsi
callq 0x1c896
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
cqto
idivq %rbx
movq %rax, %r13
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
leaq 0x30(%rsp), %rbp
xorl %ebx, %ebx
movq 0x10(%rsp), %rdi
cmpq %rbx, %r13
je 0x1c0d7
movq 0x40(%rsp), %rsi
movss 0x70(%rsi,%r12), %xmm0
movss %xmm0, 0xc(%rsp)
addq %r12, %rsi
movq 0x20(%r14), %rax
movl 0x8c(%rax), %edx
incl %edx
xorl %ecx, %ecx
callq 0x1b552
movq %rax, %r15
testb $0x1, %dl
je 0x1c07a
cmpb $0x0, 0x89(%r15)
jne 0x1c068
cmpb $0x0, 0x88(%r15)
jne 0x1c068
movq 0xa8(%r15), %rax
cmpq 0xb0(%r15), %rax
jne 0x1c226
movq %r15, 0x30(%rsp)
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x1cbe8
movq %r15, %rdi
addq $0x90, %rdi
movl %ebx, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %rbp, %rsi
callq 0x1c96c
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x30(%rsp)
movq %r15, 0x38(%rsp)
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x1cac8
movss 0xc(%rsp), %xmm0
mulss 0x8(%r15), %xmm0
addss 0x8(%r14), %xmm0
movss %xmm0, 0x8(%r14)
incq %rbx
addq $0x78, %r12
jmp 0x1c002
movq 0x8(%rdi), %rax
movss 0x8(%r14), %xmm0
mulss 0x8(%rax), %xmm0
addss 0x1c(%r14), %xmm0
movss %xmm0, 0x8(%r14)
leaq 0x30(%rsp), %rsi
movq %r14, (%rsi)
movq 0x18(%rsp), %rdi
callq 0x1cbe8
cmpb $0x0, 0x2c(%rsp)
movq 0x10(%rsp), %rcx
je 0x1c20d
cmpq $0x0, 0x98(%rcx)
jne 0x1c20d
movq 0x20(%r14), %rbx
leaq 0x18(%rbx), %rax
movq %rax, 0x18(%rsp)
movl 0x8c(%rbx), %ebp
incl %ebp
movq 0xb0(%rbx), %r15
subq 0xa8(%rbx), %r15
shrq $0x3, %r15
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
cmpq %r12, %r15
je 0x1c20d
movq 0xa8(%rbx), %rax
movq (%rax,%r12,8), %r13
movq 0x28(%r13), %rax
cmpq 0x30(%r13), %rax
jne 0x1c205
movss 0x8(%r13), %xmm0
movss %xmm0, 0xc(%rsp)
movss 0x1c(%r13), %xmm0
movss %xmm0, 0x20(%rsp)
movq 0x8(%rcx), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, 0x10(%rsp)
movl 0x18(%r13), %edx
movq %rcx, %r14
movq %rcx, %rdi
movq 0x18(%rsp), %rsi
movl %ebp, %ecx
callq 0x1c2c4
movl 0x10(%r13), %eax
cvtsi2ss %rax, %xmm1
movss 0xc(%rsp), %xmm2
subss 0x20(%rsp), %xmm2
mulss %xmm2, %xmm1
divss 0x10(%rsp), %xmm1
addss %xmm0, %xmm1
movl 0x44(%r14), %ecx
imull 0x48(%r14), %ecx
addl %eax, %ecx
movl %ecx, 0x10(%r13)
movq 0x8(%r14), %rax
mulss 0x8(%rax), %xmm1
cvtsi2ss %rcx, %xmm0
divss %xmm0, %xmm1
addss 0x1c(%r13), %xmm1
movss %xmm1, 0x8(%r13)
movq %r14, %rcx
incq %r12
jmp 0x1c153
leaq 0x40(%rsp), %rdi
callq 0xb53c
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6be5(%rip), %rdi      # 0x22e12
leaq 0x5715(%rip), %rsi      # 0x21949
leaq 0x6b22(%rip), %rcx      # 0x22d5d
movl $0x278, %edx            # imm = 0x278
callq 0x51b0
leaq 0x6aff(%rip), %rdi      # 0x22d4b
leaq 0x56f6(%rip), %rsi      # 0x21949
leaq 0x6b03(%rip), %rcx      # 0x22d5d
movl $0x26c, %edx            # imm = 0x26C
callq 0x51b0
leaq 0x6b6d(%rip), %rdi      # 0x22dd8
leaq 0x56d7(%rip), %rsi      # 0x21949
leaq 0x6ae4(%rip), %rcx      # 0x22d5d
movl $0x26d, %edx            # imm = 0x26D
callq 0x51b0
leaq 0x6b69(%rip), %rdi      # 0x22df3
leaq 0x56b8(%rip), %rsi      # 0x21949
leaq 0x6ac5(%rip), %rcx      # 0x22d5d
movl $0x26e, %edx            # imm = 0x26E
callq 0x51b0
jmp 0x1c2ae
jmp 0x1c2ae
jmp 0x1c2ae
jmp 0x1c2ae
jmp 0x1c2ae
jmp 0x1c2ae
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xb53c
movq %rbx, %rdi
callq 0x5410
nop