// File: /workspace/github_cpp_makefile_star2_O1/bonetblai[P]mdp-engine/ctp3/../engine/aot.h
// Function: Online::Policy::AOT::aot_t<state_t>::fetch_node(state_t const&, unsigned int, bool) const
std::pair<state_node_t<T>*, bool> fetch_node(const T &state, unsigned depth, bool debug = false) const {
        typename hash_t<T>::iterator it = table_.find(std::make_pair(&state, depth));
        if( it == table_.end() ) {
            if( debug ) std::cout << "fetch_node: node was NOT-FOUND" << std::endl;
            ++num_nodes_;
            state_node_t<T> *node = new state_node_t<T>(state, depth);
            table_.insert(std::make_pair(std::make_pair(&node->state_, depth),
                                         node));
            if( problem_.terminal(state) ) {
                if( debug ) std::cout << "fetch_node: node is TERMINAL" << std::endl;
                node->value_ = 0;
                node->is_goal_ = true;
            } else if( problem_.dead_end(state) ) {
                if( debug ) std::cout << "fetch_node: node is DEAD-END" << std::endl;
                node->value_ = problem_.dead_end_value();
                node->is_dead_end_ = true;
            } else {
                if( debug ) std::cout << "fetch_node: node is REGULAR" << std::endl;
                node->value_ = evaluate(state, depth);
                node->nsamples_ = leaf_nsamples_;
            }
            return std::make_pair(node, false);
        } else {
            if( debug ) std::cout << "fetch_node: node was FOUND!" << std::endl;
            bool re_evaluated = false;
            if( it->second->is_leaf() && !it->second->is_dead_end_ && !it->second->is_goal_ && (heuristic_ == 0) ) {
                // resample: throw other rollouts to get better estimation. Only done when heuristic_ == 0
                float old_val = it->second->value_;
                float new_val = old_val * it->second->nsamples_ + evaluate(state, depth);
                it->second->nsamples_ += leaf_nsamples_;
                it->second->value_ = new_val / it->second->nsamples_;
                re_evaluated = true;
            }
            return std::make_pair(it->second, re_evaluated);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r12d
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x60(%rdi), %r13
leaq 0x10(%rsp), %rsi
movq %r14, (%rsi)
movl %edx, 0x8(%rsi)
movq %r13, %rdi
callq 0x27452
testq %rax, %rax
je 0x26d89
movq %rax, %r15
testb %r12b, %r12b
je 0x26d6c
movq 0x182a8(%rip), %r12     # 0x3efd8
leaq 0x8e81(%rip), %rsi      # 0x2fbb8
movl $0x1b, %edx
movq %r12, %rdi
callq 0x62e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movq 0x18(%r15), %rax
movb 0x89(%rax), %cl
testb %cl, %cl
je 0x26ee1
xorl %edx, %edx
movq 0x18(%r15), %r15
jmp 0x27055
movl %ebp, 0xc(%rsp)
testb %r12b, %r12b
je 0x26dd4
movq 0x1823f(%rip), %r15     # 0x3efd8
leaq 0x8da3(%rip), %rsi      # 0x2fb43
movl $0x1e, %edx
movq %r15, %rdi
callq 0x62e0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r15, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
incl 0x50(%rbx)
movl $0xc0, %edi
callq 0x6290
movq %rax, %r15
xorl %eax, %eax
movq %rax, 0x8(%r15)
movq %rax, 0xf(%r15)
leaq 0x17e2b(%rip), %rcx     # 0x3ec20
movq %rcx, (%r15)
leaq 0x18(%r15), %rbp
xorps %xmm0, %xmm0
movups %xmm0, 0x1c(%r15)
movups %xmm0, 0x2c(%r15)
movups %xmm0, 0x3c(%r15)
movups %xmm0, 0x4c(%r15)
movq %rax, 0x5c(%r15)
movb $0x1, 0x74(%r15)
movq %rax, 0x78(%r15)
movq %rbp, %rdi
movq %r14, %rsi
callq 0xd546
movw $0x0, 0x88(%r15)
movl 0xc(%rsp), %eax
movl %eax, 0x8c(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x90(%r15)
movups %xmm0, 0xa0(%r15)
movups %xmm0, 0xb0(%r15)
leaq 0x10(%rsp), %rsi
movq %rbp, (%rsi)
movl %eax, %ebp
movl %eax, 0x8(%rsi)
movq %r15, 0x10(%rsi)
movq %r13, %rdi
callq 0x28892
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x20(%rax)
testb %al, %al
je 0x26efb
testb %r12b, %r12b
je 0x26ecc
movq 0x18147(%rip), %rbx     # 0x3efd8
leaq 0x8cca(%rip), %rsi      # 0x2fb62
movl $0x1c, %edx
movq %rbx, %rdi
callq 0x62e0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movl $0x0, 0x8(%r15)
movb $0x1, 0x88(%r15)
jmp 0x27053
cmpb $0x0, 0x88(%rax)
je 0x26f73
testb %cl, %cl
jne 0x26d7e
jmp 0x26f8c
movq 0x8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x28(%rax)
testb %al, %al
je 0x26ff1
testb %r12b, %r12b
je 0x26f57
movq 0x180bc(%rip), %r14     # 0x3efd8
leaq 0x8c5c(%rip), %rsi      # 0x2fb7f
movl $0x1c, %edx
movq %r14, %rdi
callq 0x62e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movq 0x8(%rbx), %rax
movss 0xc(%rax), %xmm0
movss %xmm0, 0x8(%r15)
movb $0x1, 0x89(%r15)
jmp 0x27053
movq 0xa8(%rax), %rdx
cmpq 0xb0(%rax), %rdx
setne %dl
orb %cl, %dl
jne 0x26d7e
xorl %edx, %edx
cmpb $0x0, 0x88(%rax)
jne 0x26d80
cmpq $0x0, 0x98(%rbx)
jne 0x26d80
movl 0x10(%rax), %ecx
cvtsi2ss %rcx, %xmm0
mulss 0x8(%rax), %xmm0
movss %xmm0, 0xc(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2729c
movq 0x18(%r15), %rax
movl 0x10(%rax), %ecx
addl 0x44(%rbx), %ecx
addss 0xc(%rsp), %xmm0
cvtsi2ss %rcx, %xmm1
movl %ecx, 0x10(%rax)
divss %xmm1, %xmm0
movss %xmm0, 0x8(%rax)
movb $0x1, %dl
jmp 0x26d80
testb %r12b, %r12b
je 0x27039
movq 0x17fdb(%rip), %r12     # 0x3efd8
leaq 0x8b98(%rip), %rsi      # 0x2fb9c
movl $0x1b, %edx
movq %r12, %rdi
callq 0x62e0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x6270
movsbl %al, %esi
movq %r12, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x61e0
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2729c
movss %xmm0, 0x8(%r15)
movl 0x44(%rbx), %eax
movl %eax, 0x10(%r15)
xorl %edx, %edx
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x6260
movq %rbx, %rdi
callq 0x6410