// 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>*) const
void recompute_delta(state_node_t<T> *root) const {
        assert(!root->is_goal_);
        assert(!root->is_dead_end_);

        std::deque<state_node_t<T>*> s_queue;
        bool expanding_from_s_queue = true;
        std::deque<action_node_t<T>*> a_queue;
        bool expanding_from_a_queue = false;

        root->delta_ = std::numeric_limits<float>::max();
        root->in_best_policy_ = true;
        s_queue.push_back(root);

        while( !s_queue.empty() || !a_queue.empty() ) {
            // expand from the state queue
            if( expanding_from_s_queue ) {
                while( !s_queue.empty() ) {
                    state_node_t<T> *s_node = s_queue.back();
                    s_queue.pop_back();
                    s_node->in_queue_ = false;
                    recompute_delta(s_node, a_queue);
                }
                expanding_from_s_queue = false;
                expanding_from_a_queue = true;
            }

            // expand from the action queue
            if( expanding_from_a_queue ) {
                while( !a_queue.empty() ) {
                    action_node_t<T> *a_node = a_queue.back();
                    a_queue.pop_back();
                    recompute_delta(a_node, s_queue);
                }
                expanding_from_a_queue = false;
                expanding_from_s_queue = true;
            }
        }
    }

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xe8(%rsp), %rax
movb 0x88(%rax), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x483ca
jmp 0x483cc
jmp 0x483eb
leaq 0x1726c(%rip), %rdi     # 0x5f63f
leaq 0x1659b(%rip), %rsi     # 0x5e975
movl $0x321, %edx            # imm = 0x321
leaq 0x17269(%rip), %rcx     # 0x5f64f
callq 0x6220
movq 0xe8(%rsp), %rax
movb 0x89(%rax), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x48401
jmp 0x48403
jmp 0x48422
leaq 0x172a6(%rip), %rdi     # 0x5f6b0
leaq 0x16564(%rip), %rsi     # 0x5e975
movl $0x322, %edx            # imm = 0x322
leaq 0x17232(%rip), %rcx     # 0x5f64f
callq 0x6220
leaq 0x98(%rsp), %rdi
callq 0x48e30
movb $0x1, 0x97(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x48e40
jmp 0x48443
movb $0x0, 0x33(%rsp)
callq 0x23160
movq 0xe8(%rsp), %rax
movss %xmm0, 0xc(%rax)
movq 0xe8(%rsp), %rax
movb $0x1, 0x14(%rax)
leaq 0x98(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x48e50
jmp 0x4847d
jmp 0x4847f
leaq 0x98(%rsp), %rdi
callq 0x48eb0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0x17(%rsp)
jne 0x4849b
jmp 0x484ab
leaq 0x40(%rsp), %rdi
callq 0x48ed0
xorb $-0x1, %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x484b8
jmp 0x485c6
testb $0x1, 0x97(%rsp)
je 0x4855f
jmp 0x484c8
leaq 0x98(%rsp), %rdi
callq 0x48eb0
xorb $-0x1, %al
testb $0x1, %al
jne 0x484dd
jmp 0x48552
leaq 0x98(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x48ef0
movq 0x8(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x48f20
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rax
movb $0x0, 0x15(%rax)
movq 0x28(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x48f90
jmp 0x48520
jmp 0x484c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
jmp 0x485e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x49720
jmp 0x485e5
movb $0x0, 0x97(%rsp)
movb $0x1, 0x33(%rsp)
testb $0x1, 0x33(%rsp)
je 0x485c1
jmp 0x48568
leaq 0x40(%rsp), %rdi
callq 0x48ed0
xorb $-0x1, %al
testb $0x1, %al
jne 0x4857a
jmp 0x485b4
leaq 0x40(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x493d0
movq (%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x20(%rsp)
callq 0x49400
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rsi
leaq 0x98(%rsp), %rdx
callq 0x49470
jmp 0x485b2
jmp 0x48568
movb $0x0, 0x33(%rsp)
movb $0x1, 0x97(%rsp)
jmp 0x4847f
leaq 0x40(%rsp), %rdi
callq 0x49720
leaq 0x98(%rsp), %rdi
callq 0x49790
addq $0xf8, %rsp
retq
leaq 0x98(%rsp), %rdi
callq 0x49790
movq 0x38(%rsp), %rdi
callq 0x6520
nopl (%rax)