// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e30
leal 0x1(%rax), %esi
movq %rbx, %rdi
callq 0x30aa
movq %rbx, -0x30(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x555a
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x55a8
movq %r14, %rdi
callq 0xcbf7
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0xc740
movq -0x48(%rbp), %rbx
movq -0x40(%rbp), %r15
cmpq %r15, %rbx
je 0xd804
movq %r15, %rax
subq %rbx, %rax
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x139f(%rip), %rcx     # 0xc448
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdf01
leaq -0x13b1(%rip), %rdx     # 0xc448
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdfd4
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rdx
subq %rdi, %rdx
je 0xdb5b
sarq $0x4, %rdx
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq %r15, %rdx
jbe 0xdb7b
movups (%rdi,%r12), %xmm0
movaps %xmm0, -0x60(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7c34
movslq %eax, %rsi
movq %r14, %rdi
callq 0x3f6c
movq %rax, %rbx
leaq -0x150(%rbp), %rax
movq %rax, -0x160(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x160(%rbp), %rdi
callq 0x2bfe
movups 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
movups 0x40(%rbx), %xmm2
movups 0x50(%rbx), %xmm3
leaq -0x150(%rbp), %rax
movups %xmm3, 0x40(%rax)
movups %xmm2, 0x30(%rax)
movups %xmm1, 0x20(%rax)
movups %xmm0, 0x10(%rax)
leaq -0xf0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq -0x100(%rbp), %rdi
callq 0x2bfe
leaq -0x60(%rbp), %rdi
callq 0x7c3c
movslq %eax, %rsi
movq %r14, %rdi
callq 0x3f6c
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 0x2bfe
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 0x2bfe
leaq -0x1d0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x2bfe
leaq -0x150(%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 -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %rdi
callq 0x2bfe
movq %r14, %r13
movq %r14, %rdi
leaq -0x1e0(%rbp), %rsi
callq 0xcd29
leaq -0x250(%rbp), %rbx
movl %eax, %r14d
movq %rbx, -0x260(%rbp)
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x260(%rbp), %rdi
callq 0x2bfe
leaq -0xd0(%rbp), %rax
movups 0x10(%rax), %xmm0
movups 0x20(%rax), %xmm1
movups 0x30(%rax), %xmm2
movups 0x40(%rax), %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 -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x200(%rbp), %rdi
callq 0x2bfe
movq %r13, %rdi
leaq -0x260(%rbp), %rsi
callq 0xcd29
movl %eax, %ebx
movq -0x200(%rbp), %rdi
leaq -0x1f0(%rbp), %rax
cmpq %rax, %rdi
je 0xda6f
callq 0x21f0
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
cmpq %rax, %rdi
je 0xda87
callq 0x21f0
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0xda9f
callq 0x21f0
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xdab7
callq 0x21f0
cmpl %ebx, %r14d
movq %r13, %r14
je 0xdae2
movq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4ce4
movq %r14, %rdi
leaq -0x160(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0xce67
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0xdaf4
callq 0x21f0
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0xdb0c
callq 0x21f0
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0xdb24
callq 0x21f0
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
cmpq %rax, %rdi
je 0xdb3c
callq 0x21f0
incq %r15
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rdx
subq %rdi, %rdx
sarq $0x4, %rdx
addq $0x10, %r12
cmpq %rdx, %r15
jne 0xd81f
testq %rdi, %rdi
je 0xdb65
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 0x17d4(%rip), %rdi      # 0xf356
movq %r15, %rsi
xorl %eax, %eax
callq 0x22f0
jmp 0xdb93
jmp 0xdc5f
movq %rax, %rbx
jmp 0xdc70
jmp 0xdc5f
movq %rax, %rbx
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
cmpq %rax, %rdi
je 0xdc62
callq 0x21f0
jmp 0xdc62
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rax
cmpq %rax, %rdi
je 0xdc51
callq 0x21f0
jmp 0xdc51
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0xdc40
callq 0x21f0
jmp 0xdc40
movq %rax, %rbx
movq -0x260(%rbp), %rdi
leaq -0x250(%rbp), %rax
cmpq %rax, %rdi
je 0xdc2f
callq 0x21f0
jmp 0xdc2f
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
callq 0x2b90
jmp 0xdc2f
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x2b90
jmp 0xdc40
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x2b90
jmp 0xdc51
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x2b90
jmp 0xdc62
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xdc70
callq 0x21f0
movq -0x30(%rbp), %rdi
callq 0x2bc6
movq %rbx, %rdi
callq 0x2380
nop