// File: bonetblai[P]mdp-engine/ctp3/./graph.h
// Function: CTP::graph_t::dijkstra(int, int*, unsigned int const*, unsigned int const*, bool) const
void dijkstra(int source,
                  int *distances,
                  const unsigned *k_bitmap,
                  const unsigned *b_bitmap,
                  bool optimistic = false) const {

        static std::priority_queue<std::pair<int, int>,
                                   std::vector<std::pair<int, int> >,
                                   open_list_cmp> queue;

        // initialization
        for( int node = 0; node < num_nodes_; ++node )
            distances[node] = INT_MAX;

        // Dijsktra's
        distances[source] = 0;
        queue.push(std::make_pair(source, 0));
        while( !queue.empty() ) {
            std::pair<int, int> p = queue.top();
            queue.pop();
            if( p.second <= distances[p.first] ) {
                for( int i = 0, isz = at_[p.first].size(); i < isz; ++i ) {
                    int idx = at_[p.first][i];
                    if( good(idx, k_bitmap, b_bitmap, optimistic) ) {
                        const edge_t &edge = edge_list_[idx];
                        int cost = p.second + edge.cost_;
                        int next = p.first == edge.to_ ? edge.from_ : edge.to_;
                        if( cost < distances[next] ) {
                            distances[next] = cost;
                            queue.push(std::make_pair(next, cost));
                        }
                    }
                }
            }
        }
    }

// Assembly:
subq $0x88, %rsp
movb %r9b, %al
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
andb $0x1, %al
movb %al, 0x5f(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpb $0x0, 0x6eb89(%rip)     # 0x833a8
jne 0x14866
leaq 0x6eb80(%rip), %rdi     # 0x833a8
callq 0x6550
cmpl $0x0, %eax
je 0x14866
leaq 0x6eb4f(%rip), %rdi     # 0x83388
callq 0xdb50
jmp 0x14840
leaq -0x6b07(%rip), %rdi     # 0xdd40
leaq 0x6eb3a(%rip), %rsi     # 0x83388
leaq 0x6ea93(%rip), %rdx     # 0x832e8
callq 0x62e0
leaq 0x6eb47(%rip), %rdi     # 0x833a8
callq 0x6210
movl $0x0, 0x48(%rsp)
movq 0x8(%rsp), %rcx
movl 0x48(%rsp), %eax
cmpl (%rcx), %eax
jge 0x148b8
movq 0x70(%rsp), %rax
movslq 0x48(%rsp), %rcx
movl $0x7fffffff, (%rax,%rcx,4) # imm = 0x7FFFFFFF
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x1486e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
leaq 0x6eafa(%rip), %rdi     # 0x833a8
callq 0x6200
jmp 0x14a8d
movq 0x70(%rsp), %rax
movslq 0x7c(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl $0x0, 0x3c(%rsp)
leaq 0x7c(%rsp), %rdi
leaq 0x3c(%rsp), %rsi
callq 0xdbe0
movq %rax, 0x40(%rsp)
leaq 0x6ea9c(%rip), %rdi     # 0x83388
leaq 0x40(%rsp), %rsi
callq 0xdb80
leaq 0x6ea8b(%rip), %rdi     # 0x83388
callq 0xdc10
xorb $-0x1, %al
testb $0x1, %al
jne 0x1490d
jmp 0x14a85
leaq 0x6ea74(%rip), %rdi     # 0x83388
callq 0xdc30
movq (%rax), %rax
movq %rax, 0x34(%rsp)
leaq 0x6ea60(%rip), %rdi     # 0x83388
callq 0xdc40
movl 0x38(%rsp), %eax
movq 0x70(%rsp), %rcx
movslq 0x34(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jg 0x14a80
movq 0x8(%rsp), %rdi
movl $0x0, 0x30(%rsp)
addq $0x28, %rdi
movslq 0x34(%rsp), %rsi
callq 0xfd50
movq %rax, %rdi
callq 0xdcb0
movl %eax, 0x2c(%rsp)
movl 0x30(%rsp), %eax
cmpl 0x2c(%rsp), %eax
jge 0x14a7e
movq 0x8(%rsp), %rdi
addq $0x28, %rdi
movslq 0x34(%rsp), %rsi
callq 0xfd50
movq %rax, %rdi
movslq 0x30(%rsp), %rsi
callq 0x12b30
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movl 0x28(%rsp), %esi
movq 0x68(%rsp), %rdx
movq 0x60(%rsp), %rcx
movb 0x5f(%rsp), %al
andb $0x1, %al
movzbl %al, %r8d
callq 0x12b50
testb $0x1, %al
jne 0x149ca
jmp 0x14a6c
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movslq 0x28(%rsp), %rsi
callq 0x12bf0
movq %rax, 0x20(%rsp)
movl 0x38(%rsp), %eax
movq 0x20(%rsp), %rcx
addl 0x8(%rcx), %eax
movl %eax, 0x1c(%rsp)
movl 0x34(%rsp), %eax
movq 0x20(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x14a0d
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
jmp 0x14a19
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
movq 0x70(%rsp), %rcx
movslq 0x18(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x14a6a
movl 0x1c(%rsp), %edx
movq 0x70(%rsp), %rax
movslq 0x18(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
leaq 0x18(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0xdd10
movq %rax, 0x10(%rsp)
leaq 0x6e928(%rip), %rdi     # 0x83388
leaq 0x10(%rsp), %rsi
callq 0xdb80
jmp 0x14a6c
jmp 0x14a6e
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x1496b
jmp 0x14a80
jmp 0x148f6
addq $0x88, %rsp
retq
movq 0x50(%rsp), %rdi
callq 0x6520
nopw (%rax,%rax)