// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/../engine/aot.h
// Function: Online::Policy::AOT::aot_t<state_t>::recompute_delta(Online::Policy::AOT::state_node_t<state_t>*, std::deque<Online::Policy::AOT::action_node_t<state_t>*, std::allocator<Online::Policy::AOT::action_node_t<state_t>*>>&) const
void recompute_delta(state_node_t<T> *s_node,
                         std::deque<action_node_t<T>*> &a_queue) const {
        assert(!s_node->is_goal_);
        assert(!s_node->is_dead_end_);
        if( s_node->is_leaf() ) {
            // insert tip node into priority queue
            if( !s_node->is_dead_end_ && !s_node->is_goal_ && (s_node->depth_ < horizon_) ) {
                insert_into_priority_queue(s_node);
            }
        } else {
            assert(!s_node->children_.empty());
            float best_value = s_node->value_;
            if( s_node->in_best_policy_ ) {
                assert(s_node->delta_ >= 0);

                // compute Delta
                float Delta = std::numeric_limits<float>::max();
                for( int i = 0, isz = s_node->children_.size(); i < isz; ++i ) {
                    action_node_t<T> *a_node = s_node->children_[i];
                    if( a_node->value_ != best_value ) {
                        float d = a_node->value_ - best_value;
                        Delta = Utils::min(Delta, d);
                    }
                }

                // compute delta
                for( int i = 0, isz = s_node->children_.size(); i < isz; ++i ) {
                    action_node_t<T> *a_node = s_node->children_[i];
                    if( a_node->value_ == best_value ) {
                        a_node->delta_ = Utils::min(s_node->delta_, Delta);
                        a_node->in_best_policy_ = true;
                        assert(a_node->delta_ >= 0);
                    } else {
                        a_node->delta_ = best_value - a_node->value_;
                        a_node->in_best_policy_ = false;
                        assert(a_node->delta_ <= 0);
                    }
                    a_queue.push_back(a_node);
                }
            } else {
                assert(s_node->delta_ <= 0);
                for( int i = 0, isz = s_node->children_.size(); i < isz; ++i ) {
                    action_node_t<T> *a_node = s_node->children_[i];
                    a_node->delta_ = s_node->delta_ + best_value - a_node->value_;
                    a_node->in_best_policy_ = false;
                    assert(a_node->delta_ <= 0);
                    a_queue.push_back(a_node);
                }
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
cmpb $0x1, 0x88(%rsi)
je 0x1a6e6
movq %rsi, %rbx
cmpb $0x1, 0x89(%rsi)
je 0x1a705
movq 0xa8(%rbx), %rax
movq 0xb0(%rbx), %r12
cmpq %r12, %rax
je 0x1a56b
movq %rdx, %r14
movss 0x8(%rbx), %xmm2
movss 0xc(%rbx), %xmm0
cmpb $0x1, 0x14(%rbx)
movss %xmm2, 0x4(%rsp)
xorps %xmm1, %xmm1
jne 0x1a58f
ucomiss %xmm1, %xmm0
jb 0x1a724
subq %rax, %r12
shrq $0x3, %r12
xorl %ecx, %ecx
testl %r12d, %r12d
cmovlel %ecx, %r12d
movss 0x5adc(%rip), %xmm3     # 0x20014
cmpq %rcx, %r12
je 0x1a601
movq (%rax,%rcx,8), %rdx
movss 0x8(%rdx), %xmm0
movaps %xmm0, %xmm1
subss %xmm2, %xmm1
minss %xmm3, %xmm1
cmpneqss %xmm2, %xmm0
andps %xmm0, %xmm1
andnps %xmm3, %xmm0
orps %xmm1, %xmm0
incq %rcx
movaps %xmm0, %xmm3
jmp 0x1a538
movl 0x8c(%rbx), %eax
cmpl 0x34(%rdi), %eax
jae 0x1a67b
movq %rbx, %rsi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1991a
ucomiss %xmm1, %xmm0
ja 0x1a743
subq %rax, %r12
shrq $0x3, %r12
xorl %r13d, %r13d
testl %r12d, %r12d
cmovlel %r13d, %r12d
leaq 0x8(%rsp), %r15
cmpq %r13, %r12
je 0x1a67b
movq 0xa8(%rbx), %rax
movq (%rax,%r13,8), %rax
movq %rax, 0x8(%rsp)
movss 0xc(%rbx), %xmm0
addss %xmm2, %xmm0
subss 0x8(%rax), %xmm0
movss %xmm0, 0xc(%rax)
movb $0x0, 0x14(%rax)
ucomiss 0x5a2b(%rip), %xmm0     # 0x20010
ja 0x1a689
movq %r14, %rdi
movq %r15, %rsi
callq 0x1af40
incq %r13
movss 0x4(%rsp), %xmm2
jmp 0x1a5ae
movaps %xmm3, 0x10(%rsp)
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
cmpq %r13, %r12
je 0x1a67b
movq 0xa8(%rbx), %rax
movq (%rax,%r13,8), %rax
movq %rax, 0x8(%rsp)
movss 0x8(%rax), %xmm0
ucomiss %xmm0, %xmm2
jne 0x1a64c
movss 0xc(%rbx), %xmm0
minss 0x10(%rsp), %xmm0
movss %xmm0, 0xc(%rax)
movb $0x1, 0x14(%rax)
ucomiss 0x59c8(%rip), %xmm0     # 0x20010
jae 0x1a665
jmp 0x1a6a8
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0xc(%rax)
movb $0x0, 0x14(%rax)
ucomiss 0x59ad(%rip), %xmm1     # 0x20010
ja 0x1a6c7
movq %r14, %rdi
movq %r15, %rsi
callq 0x1af40
incq %r13
movss 0x4(%rsp), %xmm2
jmp 0x1a60e
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x810b(%rip), %rdi      # 0x2279b
leaq 0x72b2(%rip), %rsi      # 0x21949
leaq 0x803c(%rip), %rcx      # 0x226da
movl $0x373, %edx            # imm = 0x373
callq 0x51b0
leaq 0x80d8(%rip), %rdi      # 0x22787
leaq 0x7293(%rip), %rsi      # 0x21949
leaq 0x801d(%rip), %rcx      # 0x226da
movl $0x365, %edx            # imm = 0x365
callq 0x51b0
leaq 0x80cd(%rip), %rdi      # 0x2279b
leaq 0x7274(%rip), %rsi      # 0x21949
leaq 0x7ffe(%rip), %rcx      # 0x226da
movl $0x369, %edx            # imm = 0x369
callq 0x51b0
leaq 0x7fdb(%rip), %rdi      # 0x226c8
leaq 0x7255(%rip), %rsi      # 0x21949
leaq 0x7fdf(%rip), %rcx      # 0x226da
movl $0x348, %edx            # imm = 0x348
callq 0x51b0
leaq 0x8051(%rip), %rdi      # 0x2275d
leaq 0x7236(%rip), %rsi      # 0x21949
leaq 0x7fc0(%rip), %rcx      # 0x226da
movl $0x349, %edx            # imm = 0x349
callq 0x51b0
leaq 0x8048(%rip), %rdi      # 0x22773
leaq 0x7217(%rip), %rsi      # 0x21949
leaq 0x7fa1(%rip), %rcx      # 0x226da
movl $0x353, %edx            # imm = 0x353
callq 0x51b0
leaq 0x8065(%rip), %rdi      # 0x227af
leaq 0x71f8(%rip), %rsi      # 0x21949
leaq 0x7f82(%rip), %rcx      # 0x226da
movl $0x36e, %edx            # imm = 0x36E
callq 0x51b0