// File: guitld[P]Graph-Algorithms/source/Graph.cpp
// Function: Graph::dijkstra(int)
vector<int> Graph::dijkstra(int u){

     // Defining structures for the algorithm
     unordered_map<int, bool> visited;
     priority_queue <pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
     vector<int> dists (this->size(), 0);

     pq.push(pair<int, int> (0, u));
     
     while (!pq.empty()){
          // Popping the top of the priority queue
          pair<int,int> curr_v = pq.top();
          pq.pop();
          // Check whether the node was visited or not
          if (!visited[curr_v.second]){
               // Modifying its distance from 'u' vertex
               dists[curr_v.second - 1] = curr_v.first;
               visited[curr_v.second] = true;
               // Looping through its neighbors
               for (auto const &neighbor : this->adj_lists[curr_v.second])
                    if (!visited[neighbor.first])
                         pq.push(pair<int, int> (curr_v.first + neighbor.second, neighbor.first));
          }
     }
     
     return dists;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x67d0
leaq -0x70(%rbp), %rdi
callq 0x67f0
jmp 0x5146
movq -0xd8(%rbp), %rdi
movb $0x0, -0x7d(%rbp)
callq 0x66f0
movl %eax, -0xec(%rbp)
jmp 0x515e
movl -0xec(%rbp), %eax
cltq
movq %rax, -0x100(%rbp)
movl $0x0, -0x84(%rbp)
leaq -0x85(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x6820
movq -0xe8(%rbp), %rdi
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rcx
leaq -0x84(%rbp), %rdx
callq 0x6840
jmp 0x51ad
leaq -0x85(%rbp), %rdi
callq 0x68c0
movl $0x0, -0x94(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x94(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x6930
jmp 0x51dc
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x68e0
jmp 0x51ee
jmp 0x51f0
leaq -0x70(%rbp), %rdi
callq 0x6960
movb %al, -0x101(%rbp)
jmp 0x5201
movb -0x101(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5212
jmp 0x5425
leaq -0x70(%rbp), %rdi
callq 0x6980
movq %rax, -0x110(%rbp)
jmp 0x5224
movq -0x110(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xa0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x69a0
jmp 0x5240
leaq -0x9c(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x69f0
movq %rax, -0x118(%rbp)
jmp 0x5259
movq -0x118(%rbp), %rax
testb $0x1, (%rax)
jne 0x5420
movq -0xe8(%rbp), %rdi
leaq -0x9c(%rbp), %rax
movq %rax, -0x128(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x12c(%rbp)
movl -0x9c(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x5f70
movl -0x12c(%rbp), %ecx
movq -0x128(%rbp), %rsi
movl %ecx, (%rax)
leaq -0x50(%rbp), %rdi
callq 0x69f0
movq %rax, -0x120(%rbp)
jmp 0x52bb
movq -0xd8(%rbp), %rdi
movq -0x120(%rbp), %rax
movb $0x1, (%rax)
leaq -0x9c(%rbp), %rsi
callq 0x5890
movq %rax, -0x138(%rbp)
jmp 0x52e1
movq -0x138(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x5a70
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x5aa0
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x5ad0
testb $0x1, %al
jne 0x5331
jmp 0x541e
leaq -0xb0(%rbp), %rdi
callq 0x5b00
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x69f0
movq %rax, -0x140(%rbp)
jmp 0x535d
movq -0x140(%rbp), %rax
testb $0x1, (%rax)
jne 0x540b
movl -0xa0(%rbp), %eax
movq -0xc0(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0xcc(%rbp)
movq -0xc0(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
callq 0x6a20
jmp 0x53a1
leaq -0x70(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x68e0
jmp 0x53b3
jmp 0x540b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x5466
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x545d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x85(%rbp), %rdi
callq 0x68c0
jmp 0x545d
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
callq 0x5f90
jmp 0x545d
jmp 0x540d
leaq -0xb0(%rbp), %rdi
callq 0x5b20
jmp 0x5315
jmp 0x5420
jmp 0x51f0
movb $0x1, -0x7d(%rbp)
testb $0x1, -0x7d(%rbp)
jne 0x543b
movq -0xe8(%rbp), %rdi
callq 0x5f90
leaq -0x70(%rbp), %rdi
callq 0x6a50
leaq -0x50(%rbp), %rdi
callq 0x6a70
movq -0xe0(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x6a50
leaq -0x50(%rbp), %rdi
callq 0x6a70
movq -0x78(%rbp), %rdi
callq 0x22c0
nopl (%rax,%rax)