// File: /workspace/github_cpp_makefile_star2_O2/guitld[P]Graph-Algorithms/source/Graph.cpp
// Function: Graph::minimum_tree_cost()
int Graph::minimum_tree_cost(){

     // 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(), 99999999);
     int cost = 0;

     dists[this->adj_lists.begin()->first - 1] = 0;

     pq.push(pair<int, int> (0, this->adj_lists.begin()->first));
     
     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]){
               // Increasing the cost
               cost += curr_v.first;
               visited[curr_v.second] = true;
               // Looping through its neighbors
               for (auto const &neighbor : this->adj_lists[curr_v.second]){
                    int v = neighbor.first;
                    int weight = neighbor.second;
                    if (!visited[neighbor.first] && dists[v - 1] > weight){
                         dists[v - 1] = weight;
                         pq.push(pair<int, int> (dists[v - 1], v));
                    }
               }
          }
     }

     return cost;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
leaq -0x88(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
andq $0x0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movslq 0x18(%rdi), %rsi
leaq -0x30(%rbp), %rdx
movl $0x5f5e0ff, (%rdx)      # imm = 0x5F5E0FF
leaq -0x80(%rbp), %rdi
leaq -0x3c(%rbp), %rcx
callq 0x3c68
movq 0x10(%rbx), %rax
movslq 0x8(%rax), %rcx
movq -0x80(%rbp), %rdx
andl $0x0, -0x4(%rdx,%rcx,4)
leaq -0x30(%rbp), %rsi
andl $0x0, (%rsi)
movl 0x8(%rax), %eax
movl %eax, 0x4(%rsi)
leaq -0x60(%rbp), %rdi
callq 0x3cc8
xorl %r14d, %r14d
leaq -0x2c(%rbp), %r15
leaq -0xb8(%rbp), %r13
movq %rbx, -0x68(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
je 0x3985
movq (%rax), %rax
movq %rax, -0x30(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3ce8
movq %r13, %rdi
movq %r15, %rsi
callq 0x5de2
cmpb $0x0, (%rax)
jne 0x38d5
addl -0x30(%rbp), %r14d
movq %r13, %rdi
movq %r15, %rsi
callq 0x5de2
movl %r14d, -0x34(%rbp)
movb $0x1, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4170
movq %rax, %rbx
movq %rax, %r15
movq (%r15), %r15
cmpq %rbx, %r15
je 0x3974
leaq 0x10(%r15), %rsi
movl 0x10(%r15), %r14d
movl 0x14(%r15), %r12d
movq %r13, %rdi
callq 0x5de2
cmpb $0x0, (%rax)
jne 0x392a
movslq %r14d, %rax
movq -0x80(%rbp), %rcx
cmpl %r12d, -0x4(%rcx,%rax,4)
jle 0x392a
movl %r12d, -0x4(%rcx,%rax,4)
movl %r12d, -0x3c(%rbp)
movl %eax, -0x38(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x3cc8
jmp 0x392a
movq -0x68(%rbp), %rbx
movl -0x34(%rbp), %r14d
leaq -0x2c(%rbp), %r15
jmp 0x38d5
leaq -0x80(%rbp), %rdi
callq 0x4b5e
leaq -0x60(%rbp), %rdi
callq 0x4074
leaq -0xb8(%rbp), %rdi
callq 0x40b2
movl %r14d, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x39c5
movq %rax, %rbx
jmp 0x39d1
jmp 0x39c5
jmp 0x39c5
jmp 0x39c5
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x4b5e
leaq -0x60(%rbp), %rdi
callq 0x4074
leaq -0xb8(%rbp), %rdi
callq 0x40b2
movq %rbx, %rdi
callq 0x2240