// File: /workspace/github_cpp_makefile_star2_O2/jkeys-ecg-nmsu[P]graph-with-search-algorithms/Kruskal.cpp
// Function: Kruskal_MST_cclabels(Graph&)
Graph Kruskal_MST_cclabels ( Graph & g) {	
	Graph r(g.num_nodes() + 1);
	r.copyNodes(g);
	r.copyEdges(g);
	r.reset();
		
	make_set_cc(g);
	
	vector<Edge> E = get_all_edges(g);
	
	// make_edge_heap(E);
	
	sort(E.begin(), E.end(), edge_heap_comp);
	
	// while(!E.empty()) {
	for(int i = 0; i != E.size(); i++) {
		// Edge e = cheapest_edge(E); //get cheapest edge and pop
		Edge e = E.at(i);
		Node u = g.getNode(e.u_id());
		Node v = g.getNode(e.v_id());
		
		if(!same_set_cc(g, u, v)) {
			// cerr << "in cc, sets are disjoint, edge: ";
			// e.print(r);
			
			r.pushEdge(e);			
			union_set_cc(g, u, v);
		}
		
		
	}
	
	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x41a8
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x2cbc
movq %rbx, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4724
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x476c
movq -0x30(%rbp), %rdi
callq 0x4698
movq %r14, %rdi
callq 0x9a75
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x9af5
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
leaq -0x68d(%rip), %rdx      # 0x99a8
callq 0xa796
xorl %esi, %esi
leaq -0x368(%rbp), %r13
leaq -0x2e8(%rbp), %rbx
movq -0x40(%rbp), %rax
subq -0x48(%rbp), %rax
sarq $0x4, %rax
cmpq %rax, %rsi
je 0xa185
leaq -0x48(%rbp), %rdi
movq %rsi, -0x68(%rbp)
callq 0x4ff0
movups (%rax), %xmm0
movaps %xmm0, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x6b30
movslq %eax, %rsi
movq %r14, %rdi
callq 0x36ce
leaq -0x168(%rbp), %rdi
movq %rax, %rsi
callq 0x28ba
leaq -0x60(%rbp), %rdi
callq 0x6b38
movslq %eax, %rsi
movq %r14, %rdi
callq 0x36ce
leaq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x28ba
movq %r13, %rdi
leaq -0x168(%rbp), %rsi
callq 0x28ba
movq %rbx, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x28ba
movq %r14, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x9bf0
movl %eax, %r12d
movq %rbx, %rdi
callq 0x2918
movq %r13, %rdi
callq 0x2918
testb %r12b, %r12b
jne 0xa15e
movq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4086
movq %r15, %r12
leaq -0x1e8(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x28ba
leaq -0x268(%rbp), %r14
movq %r14, %rdi
leaq -0xe8(%rbp), %rsi
callq 0x28ba
movq %r12, %rdi
leaq -0x1e8(%rbp), %r12
movq %r12, %rsi
movq %r14, %rdx
callq 0x9cbd
movq %r14, %rdi
callq 0x2918
movq %r12, %rdi
callq 0x2918
leaq -0xe8(%rbp), %rdi
callq 0x2918
leaq -0x168(%rbp), %rdi
callq 0x2918
movq -0x68(%rbp), %rsi
incq %rsi
movq %r15, %r14
jmp 0xa04a
leaq -0x48(%rbp), %rdi
callq 0x29fc
movq -0x30(%rbp), %rax
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa1ff
jmp 0xa1a8
movq %rax, %rbx
jmp 0xa21c
movq %rax, %rbx
jmp 0xa1c1
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x2918
leaq -0x1e8(%rbp), %rdi
jmp 0xa1e7
movq %rax, %rbx
leaq -0x2e8(%rbp), %rdi
callq 0x2918
jmp 0xa1e0
jmp 0xa1ff
movq %rax, %rbx
leaq -0x368(%rbp), %rdi
callq 0x2918
jmp 0xa1f1
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x2918
jmp 0xa207
movq %rax, %rbx
jmp 0xa213
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
callq 0x2918
leaq -0x48(%rbp), %rdi
callq 0x29fc
movq -0x30(%rbp), %rdi
callq 0x2938
movq %rbx, %rdi
callq 0x2370