// File: bonetblai[P]mdp-engine/ctp3/../engine/aot.h
// Function: Online::Policy::AOT::aot_t<state_t>::recompute_delta(Online::Policy::AOT::action_node_t<state_t>*, std::deque<Online::Policy::AOT::state_node_t<state_t>*, std::allocator<Online::Policy::AOT::state_node_t<state_t>*>>&) const
void recompute_delta(action_node_t<T> *a_node,
                         std::deque<state_node_t<T>*> &s_queue) const {
        if( a_node->is_leaf() ) {
            // insert tip node into priority queue
            if( a_node->parent_->depth_ < horizon_ ) {
                insert_into_priority_queue(a_node);
            }
        } else {
            for( int i = 0, isz = a_node->children_.size(); i < isz; ++i ) {
                state_node_t<T> *s_node = a_node->children_[i].second;
                if( !s_node->in_queue_ && !s_node->is_goal_ && !s_node->is_dead_end_ ) {
                    float delta = std::numeric_limits<float>::max();
                    bool in_best_policy = false;
                    for( int j = 0, jsz = s_node->parents_.size(); j < jsz; ++j ) {
                        int child_index = s_node->parents_[j].first;
                        action_node_t<T> *parent = s_node->parents_[j].second;
                        assert(parent->children_[child_index].second == s_node);
                        float d = parent->delta_ /
                                  (problem_.discount() * parent->children_[child_index].first);
                        delta = Utils::min(delta, fabsf(d));
                        in_best_policy = in_best_policy || parent->in_best_policy_;
                    }
                    s_node->delta_ = in_best_policy ? delta : -delta;
                    s_node->in_best_policy_ = in_best_policy;
                    s_queue.push_back(s_node);
                    s_node->in_queue_ = true;
                }
            }
        }
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rdi
callq 0x4bce0
testb $0x1, %al
jne 0x4949d
jmp 0x494ca
movq 0x10(%rsp), %rcx
movq 0x58(%rsp), %rax
movq 0x20(%rax), %rax
movl 0x8c(%rax), %eax
cmpl 0x34(%rcx), %eax
jae 0x494c5
movq 0x10(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x47300
jmp 0x49712
movl $0x0, 0x4c(%rsp)
movq 0x58(%rsp), %rdi
addq $0x28, %rdi
callq 0x47000
movl %eax, 0x48(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x48(%rsp), %eax
jge 0x49710
movq 0x58(%rsp), %rdi
addq $0x28, %rdi
movslq 0x4c(%rsp), %rsi
callq 0x47020
movq 0x8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
testb $0x1, 0x15(%rax)
jne 0x496fe
movq 0x40(%rsp), %rax
testb $0x1, 0x88(%rax)
jne 0x496fe
movq 0x40(%rsp), %rax
testb $0x1, 0x89(%rax)
jne 0x496fe
callq 0x23160
movss %xmm0, 0x3c(%rsp)
movb $0x0, 0x3b(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x40(%rsp), %rdi
addq $0x90, %rdi
callq 0x4bd00
movl %eax, 0x30(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x30(%rsp), %eax
jge 0x4969c
movq 0x40(%rsp), %rdi
addq $0x90, %rdi
movslq 0x34(%rsp), %rsi
callq 0x4bd20
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movq 0x40(%rsp), %rdi
addq $0x90, %rdi
movslq 0x34(%rsp), %rsi
callq 0x4bd20
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
addq $0x28, %rdi
movslq 0x2c(%rsp), %rsi
callq 0x47020
movq 0x8(%rax), %rax
cmpq 0x40(%rsp), %rax
jne 0x495d7
jmp 0x495f6
leaq 0x1622c(%rip), %rdi     # 0x5f80a
leaq 0x15390(%rip), %rsi     # 0x5e975
movl $0x389, %edx            # imm = 0x389
leaq 0x16249(%rip), %rcx     # 0x5f83a
callq 0x6220
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
movss 0xc(%rcx), %xmm0
movss %xmm0, 0x8(%rsp)
movq 0x8(%rax), %rdi
callq 0x28980
movss %xmm0, 0x4(%rsp)
movq 0x20(%rsp), %rdi
addq $0x28, %rdi
movslq 0x2c(%rsp), %rsi
callq 0x47020
movss 0x4(%rsp), %xmm1
movss 0x8(%rsp), %xmm0
mulss (%rax), %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x1c(%rsp)
movss 0x3c(%rsp), %xmm0
movss 0x1c(%rsp), %xmm1
movaps 0x139c6(%rip), %xmm2    # 0x5d020
pand %xmm2, %xmm1
callq 0x28990
movss %xmm0, 0x3c(%rsp)
movb $0x1, %al
testb $0x1, 0x3b(%rsp)
movb %al, 0xf(%rsp)
jne 0x49682
movq 0x20(%rsp), %rax
movb 0x14(%rax), %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x3b(%rsp)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x4956e
testb $0x1, 0x3b(%rsp)
je 0x496b0
movss 0x3c(%rsp), %xmm0
movss %xmm0, (%rsp)
jmp 0x496c8
movss 0x3c(%rsp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, (%rsp)
movss (%rsp), %xmm0
movq 0x40(%rsp), %rax
movss %xmm0, 0xc(%rax)
movb 0x3b(%rsp), %cl
movq 0x40(%rsp), %rax
andb $0x1, %cl
movb %cl, 0x14(%rax)
movq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x48e50
movq 0x40(%rsp), %rax
movb $0x1, 0x15(%rax)
jmp 0x49700
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x494e4
jmp 0x49712
addq $0x68, %rsp
retq
nopw (%rax,%rax)