// File: /workspace/github_cpp_makefile_star2_O3/jkeys-ecg-nmsu[P]graph-with-search-algorithms/Kruskal.cpp
// Function: Kruskal_MST_djsets(Graph&)
Graph Kruskal_MST_djsets ( Graph & g) {	
	Graph r(g.num_nodes() + 1);
	r.copyNodes(g);
	r.copyEdges(g);
		
	make_set(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(find(g, u) != find(g,v)) {
			// cerr << "in djsets, sets are disjoint, edge: ";
			// e.print(r);			
			
			r.pushEdge(e);
			MST_union(g, u, v);
		}
	}
	
	return r; //MST is contained in m_edges_MST
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4e6e
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x30e8
movq %rbx, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x559e
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x55ec
movq %r14, %rdi
callq 0xcc89
leaq -0x50(%rbp), %rdi
movq %r14, -0x38(%rbp)
movq %r14, %rsi
callq 0xc7b5
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %rbx
cmpq %rbx, %r13
je 0xdbdf
movq %rbx, %rax
subq %r13, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x13c0(%rip), %rcx     # 0xc4b4
movq %r13, %rdi
movq %rbx, %rsi
callq 0xdf6e
leaq -0x13d2(%rip), %rdx     # 0xc4b4
movq %r13, %rdi
movq %rbx, %rsi
callq 0xe041
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %rdx
subq %r13, %rdx
je 0xdbdf
sarq $0x4, %rdx
leaq -0x150(%rbp), %r14
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq %r15, %rdx
jbe 0xdc02
movups (%r13,%r12), %xmm0
movaps %xmm0, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7cb4
movq -0x38(%rbp), %r13
movslq %eax, %rsi
movq %r13, %rdi
callq 0x3faa
movq %rax, %rbx
leaq -0xd0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x2c2e
movups 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
movups 0x40(%rbx), %xmm2
movups 0x50(%rbx), %xmm3
leaq -0xd0(%rbp), %rax
movups %xmm3, 0x40(%rax)
movups %xmm2, 0x30(%rax)
movups %xmm1, 0x20(%rax)
movups %xmm0, 0x10(%rax)
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x2c2e
leaq -0x60(%rbp), %rdi
callq 0x7cbc
movslq %eax, %rsi
movq %r13, %rdi
callq 0x3faa
movq %rax, %rbx
movq %r14, -0x160(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x160(%rbp), %rdi
callq 0x2c2e
movups 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
movups 0x40(%rbx), %xmm2
movups 0x50(%rbx), %xmm3
movups %xmm3, 0x40(%r14)
movups %xmm2, 0x30(%r14)
movups %xmm1, 0x20(%r14)
movups %xmm0, 0x10(%r14)
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x2c2e
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x2c2e
leaq -0xd0(%rbp), %rax
movups 0x10(%rax), %xmm0
movups 0x20(%rax), %xmm1
movups 0x30(%rax), %xmm2
movups 0x40(%rax), %xmm3
leaq -0x1d0(%rbp), %rax
movups %xmm3, 0x40(%rax)
movups %xmm2, 0x30(%rax)
movups %xmm1, 0x20(%rax)
movups %xmm0, 0x10(%rax)
leaq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %rdi
callq 0x2c2e
movq %r13, %rdi
leaq -0x1e0(%rbp), %rsi
callq 0xcdbb
leaq -0x250(%rbp), %rbx
movl %eax, %r13d
movq %rbx, -0x260(%rbp)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
addq %rsi, %rdx
leaq -0x260(%rbp), %rdi
callq 0x2c2e
movups 0x10(%r14), %xmm0
movups 0x20(%r14), %xmm1
movups 0x30(%r14), %xmm2
movups 0x40(%r14), %xmm3
movups %xmm3, 0x40(%rbx)
movups %xmm2, 0x30(%rbx)
movups %xmm1, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
leaq -0x1f0(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x200(%rbp), %rdi
callq 0x2c2e
movq -0x38(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0xcdbb
movl %eax, %ebx
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xdaf9
callq 0x21f0
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
cmpq %rax, %rdi
je 0xdb11
callq 0x21f0
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xdb29
callq 0x21f0
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xdb41
callq 0x21f0
cmpl %ebx, %r13d
movq -0x38(%rbp), %rbx
je 0xdb6d
movq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4d22
movq %rbx, %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x160(%rbp), %rdx
callq 0xcef9
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0xdb85
callq 0x21f0
movq -0x160(%rbp), %rdi
cmpq %r14, %rdi
je 0xdb96
callq 0x21f0
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xdba8
callq 0x21f0
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0xdbc0
callq 0x21f0
incq %r15
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %rdx
subq %r13, %rdx
sarq $0x4, %rdx
addq $0x10, %r12
cmpq %rdx, %r15
jne 0xd8b3
testq %r13, %r13
je 0xdbec
movq %r13, %rdi
callq 0x21f0
movq -0x30(%rbp), %rax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x174d(%rip), %rdi      # 0xf356
movq %r15, %rsi
xorl %eax, %eax
callq 0x22f0
jmp 0xdc1a
jmp 0xdcdf
movq %rax, %rbx
jmp 0xdcf0
jmp 0xdcdf
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0xdce2
callq 0x21f0
jmp 0xdce2
movq %rax, %rbx
movq -0x160(%rbp), %rdi
cmpq %r14, %rdi
je 0xdcd1
callq 0x21f0
jmp 0xdcd1
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xdcc0
callq 0x21f0
jmp 0xdcc0
movq %rax, %rbx
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
cmpq %rax, %rdi
je 0xdcaf
callq 0x21f0
jmp 0xdcaf
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
callq 0x2bc0
jmp 0xdcaf
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x2bc0
jmp 0xdcc0
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x2bc0
jmp 0xdcd1
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x2bc0
jmp 0xdce2
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xdcf0
callq 0x21f0
movq -0x30(%rbp), %rdi
callq 0x2bf6
movq %rbx, %rdi
callq 0x2380
nop