// File: 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:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rax
movb 0x88(%rax), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x48fc0
jmp 0x48fc2
jmp 0x48fe1
leaq 0x1672b(%rip), %rdi     # 0x5f6f4
leaq 0x159a5(%rip), %rsi     # 0x5e975
movl $0x348, %edx            # imm = 0x348
leaq 0x1672a(%rip), %rcx     # 0x5f706
callq 0x6220
movq 0x58(%rsp), %rax
movb 0x89(%rax), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x48ff4
jmp 0x48ff6
jmp 0x49015
leaq 0x1678c(%rip), %rdi     # 0x5f789
leaq 0x15971(%rip), %rsi     # 0x5e975
movl $0x349, %edx            # imm = 0x349
leaq 0x166f6(%rip), %rcx     # 0x5f706
callq 0x6220
movq 0x58(%rsp), %rdi
callq 0x46ec0
testb $0x1, %al
jne 0x49025
jmp 0x4906a
movq 0x58(%rsp), %rax
testb $0x1, 0x89(%rax)
jne 0x49065
movq 0x58(%rsp), %rax
testb $0x1, 0x88(%rax)
jne 0x49065
movq 0x8(%rsp), %rcx
movq 0x58(%rsp), %rax
movl 0x8c(%rax), %eax
cmpl 0x34(%rcx), %eax
jae 0x49065
movq 0x8(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x47300
jmp 0x493bf
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
callq 0x46f20
xorb $-0x1, %al
testb $0x1, %al
jne 0x49083
jmp 0x49085
jmp 0x490a4
leaq 0x16713(%rip), %rdi     # 0x5f79f
leaq 0x158e2(%rip), %rsi     # 0x5e975
movl $0x350, %edx            # imm = 0x350
leaq 0x16667(%rip), %rcx     # 0x5f706
callq 0x6220
movq 0x58(%rsp), %rax
movss 0x8(%rax), %xmm0
movss %xmm0, 0x4c(%rsp)
movq 0x58(%rsp), %rax
testb $0x1, 0x14(%rax)
je 0x492c8
movq 0x58(%rsp), %rax
movss 0xc(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x490d7
jmp 0x490f6
leaq 0x166dc(%rip), %rdi     # 0x5f7ba
leaq 0x15890(%rip), %rsi     # 0x5e975
movl $0x353, %edx            # imm = 0x353
leaq 0x16615(%rip), %rcx     # 0x5f706
callq 0x6220
callq 0x23160
movss %xmm0, 0x48(%rsp)
movl $0x0, 0x44(%rsp)
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
callq 0x46f70
movl %eax, 0x40(%rsp)
movl 0x44(%rsp), %eax
cmpl 0x40(%rsp), %eax
jge 0x49197
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
movslq 0x44(%rsp), %rsi
callq 0x46f90
movq (%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm0
ucomiss 0x4c(%rsp), %xmm0
jne 0x4915b
jp 0x4915b
jmp 0x49188
movq 0x38(%rsp), %rax
movss 0x8(%rax), %xmm0
subss 0x4c(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
movss 0x48(%rsp), %xmm0
movss 0x34(%rsp), %xmm1
callq 0x28990
movss %xmm0, 0x48(%rsp)
jmp 0x4918a
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x4911e
movl $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
callq 0x46f70
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x492c3
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
movslq 0x30(%rsp), %rsi
callq 0x46f90
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movss 0x8(%rax), %xmm0
ucomiss 0x4c(%rsp), %xmm0
jne 0x49250
jp 0x49250
movq 0x58(%rsp), %rax
movss 0xc(%rax), %xmm0
movss 0x48(%rsp), %xmm1
callq 0x28990
movq 0x20(%rsp), %rax
movss %xmm0, 0xc(%rax)
movq 0x20(%rsp), %rax
movb $0x1, 0x14(%rax)
movq 0x20(%rsp), %rax
movss 0xc(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x4922f
jmp 0x4924e
leaq 0x16598(%rip), %rdi     # 0x5f7ce
leaq 0x15738(%rip), %rsi     # 0x5e975
movl $0x365, %edx            # imm = 0x365
leaq 0x164bd(%rip), %rcx     # 0x5f706
callq 0x6220
jmp 0x492a4
movss 0x4c(%rsp), %xmm0
movq 0x20(%rsp), %rax
subss 0x8(%rax), %xmm0
movq 0x20(%rsp), %rax
movss %xmm0, 0xc(%rax)
movq 0x20(%rsp), %rax
movb $0x0, 0x14(%rax)
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
ucomiss 0xc(%rax), %xmm0
jb 0x49283
jmp 0x492a2
leaq 0x16558(%rip), %rdi     # 0x5f7e2
leaq 0x156e4(%rip), %rsi     # 0x5e975
movl $0x369, %edx            # imm = 0x369
leaq 0x16469(%rip), %rcx     # 0x5f706
callq 0x6220
jmp 0x492a4
movq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x4b320
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x491b4
jmp 0x493bd
movq 0x58(%rsp), %rax
xorps %xmm0, %xmm0
ucomiss 0xc(%rax), %xmm0
jb 0x492d8
jmp 0x492f7
leaq 0x16517(%rip), %rdi     # 0x5f7f6
leaq 0x1568f(%rip), %rsi     # 0x5e975
movl $0x36e, %edx            # imm = 0x36E
leaq 0x16414(%rip), %rcx     # 0x5f706
callq 0x6220
movl $0x0, 0x1c(%rsp)
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
callq 0x46f70
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x493bb
movq 0x58(%rsp), %rdi
addq $0xa8, %rdi
movslq 0x1c(%rsp), %rsi
callq 0x46f90
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rax
movss 0xc(%rax), %xmm0
addss 0x4c(%rsp), %xmm0
movq 0x10(%rsp), %rax
subss 0x8(%rax), %xmm0
movq 0x10(%rsp), %rax
movss %xmm0, 0xc(%rax)
movq 0x10(%rsp), %rax
movb $0x0, 0x14(%rax)
movq 0x10(%rsp), %rax
xorps %xmm0, %xmm0
ucomiss 0xc(%rax), %xmm0
jb 0x4937d
jmp 0x4939c
leaq 0x1645e(%rip), %rdi     # 0x5f7e2
leaq 0x155ea(%rip), %rsi     # 0x5e975
movl $0x373, %edx            # imm = 0x373
leaq 0x1636f(%rip), %rcx     # 0x5f706
callq 0x6220
movq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x4b320
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x49314
jmp 0x493bd
jmp 0x493bf
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
nop