// File: bonetblai[P]mdp-engine/ctp3/./ctp3.h
// Function: shortest_path_cache_t::lookup(CTP::graph_t const&, int, state_info_t const&)
std::pair<bool, const int*> lookup(const CTP::graph_t &graph, int source, const state_info_t &info) {
        ++lookups_;
        shortest_path_cache_item_t *item = items_[source];
        shortest_path_cache_item_t::const_iterator it = item->find(info);
        if( it != item->end() ) {
            ++hits_;
            return std::make_pair(true, it->second);
        } else {
            if( size_ < capacity_ ) {
                ++size_;
                int *distances = new int[num_nodes_];
                graph.dijkstra(source, distances, info.known_, info.blocked_, false);
                distances[source] = graph.bfs(source, num_nodes_ - 1, info.known_, info.blocked_, true);
                item->insert(std::make_pair(info, distances));
                return std::make_pair(true, distances);
            } else {
                graph.dijkstra(source, distances_, info.known_, info.blocked_, false);
                distances_[source] = graph.bfs(source, num_nodes_ - 1, info.known_, info.blocked_, true);
                return std::make_pair(false, distances_);
            }
        }
    }

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movl %edx, 0x114(%rsp)
movq %rcx, 0x108(%rsp)
movq 0x120(%rsp), %rax
movq %rax, 0x20(%rsp)
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq 0x10(%rax), %rax
movslq 0x114(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x14aa0
movq %rax, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x14ad0
movq 0x100(%rsp), %rdi
callq 0x14b20
movq %rax, 0xe8(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x14b00
testb $0x1, %al
jne 0x14506
jmp 0x14566
movq 0x20(%rsp), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
movb $0x1, 0xd7(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x14b80
movq %rax, %rsi
addq $0x48, %rsi
leaq 0xd7(%rsp), %rdi
callq 0x14b50
movb %al, 0xd8(%rsp)
movq %rdx, 0xe0(%rsp)
leaq 0x128(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x14ba0
jmp 0x14783
movq 0x20(%rsp), %rcx
movl 0x1c(%rcx), %eax
cmpl 0x18(%rcx), %eax
jae 0x146d3
movq 0x20(%rsp), %rax
movl 0x1c(%rax), %ecx
incl %ecx
movl %ecx, 0x1c(%rax)
movslq (%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
movq $-0x1, %rax
cmovoq %rax, %rdi
callq 0x6030
movq %rax, 0xc8(%rsp)
movq 0x118(%rsp), %rdi
movl 0x114(%rsp), %esi
movq 0xc8(%rsp), %rdx
movq 0x108(%rsp), %rcx
movq %rcx, %r8
addq $0x24, %r8
xorl %r9d, %r9d
callq 0x147e0
movq 0x20(%rsp), %rax
movq 0x118(%rsp), %rdi
movl 0x114(%rsp), %esi
movl (%rax), %edx
decl %edx
movq 0x108(%rsp), %rcx
movq %rcx, %r8
addq $0x24, %r8
movl $0x1, %r9d
callq 0x125e0
movl %eax, %edx
movq 0xc8(%rsp), %rax
movslq 0x114(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x100(%rsp), %rax
movq %rax, (%rsp)
movq 0x108(%rsp), %rsi
leaq 0x78(%rsp), %rdi
movq %rdi, 0x8(%rsp)
leaq 0xc8(%rsp), %rdx
callq 0x14c20
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x14bd0
movb %dl, 0x17(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x14663
movb 0x17(%rsp), %al
movq 0x18(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movb %al, 0x60(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x14c60
movb $0x1, 0x47(%rsp)
leaq 0x47(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x14c70
movb %al, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
leaq 0x128(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x14ba0
jmp 0x14783
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x14c60
jmp 0x1479a
movq 0x20(%rsp), %rax
movq 0x118(%rsp), %rdi
movl 0x114(%rsp), %esi
movq 0x8(%rax), %rdx
movq 0x108(%rsp), %rcx
movq 0x108(%rsp), %r8
addq $0x24, %r8
xorl %r9d, %r9d
callq 0x147e0
movq 0x20(%rsp), %rax
movq 0x118(%rsp), %rdi
movl 0x114(%rsp), %esi
movl (%rax), %edx
subl $0x1, %edx
movq 0x108(%rsp), %rcx
movq 0x108(%rsp), %r8
addq $0x24, %r8
movl $0x1, %r9d
callq 0x125e0
movq 0x20(%rsp), %rsi
movl %eax, %edx
movq 0x8(%rsi), %rax
movslq 0x114(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movb $0x0, 0x2f(%rsp)
addq $0x8, %rsi
leaq 0x2f(%rsp), %rdi
callq 0x14c70
movb %al, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
leaq 0x128(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x14ba0
movb 0x128(%rsp), %al
movq 0x130(%rsp), %rdx
addq $0x138, %rsp            # imm = 0x138
retq
movq 0x70(%rsp), %rdi
callq 0x6520
nopw %cs:(%rax,%rax)
nop