// File: /workspace/github_cpp_makefile_star2_O2/rtackx[P]ComSim/projection.cpp
// Function: Projection::get_neighbors(unsigned int&, unsigned int&) const
vector<Node*> Projection::get_neighbors(unsigned int& index, unsigned int& distance) const
{
	vector<Node*> list_neighbors, hist_list_neighbors, list_distance_neighbors;
	vector<Node*> neighbors_node;
	unsigned int i, d = 0;
	Node* node = in_graph->list_nodes[index];
	list_neighbors.push_back(node);

	while(d < distance && list_neighbors.size() > 0)
	{
		hist_list_neighbors.insert(hist_list_neighbors.end(), list_neighbors.begin(), list_neighbors.end());
		list_distance_neighbors.clear();

		for(auto& n : list_neighbors)
		{
			neighbors_node.clear();
			for(auto& neighbor : n->neighbor_weights)
				neighbors_node.push_back(neighbor.first);

			list_distance_neighbors.insert(list_distance_neighbors.end(), neighbors_node.begin(), neighbors_node.end());
		}

		sort(list_distance_neighbors.begin(), list_distance_neighbors.end());
		sort(hist_list_neighbors.begin(), hist_list_neighbors.end());
		list_distance_neighbors.erase(unique(list_distance_neighbors.begin(), list_distance_neighbors.end()), list_distance_neighbors.end());
		list_neighbors.clear();

		set_difference(list_distance_neighbors.begin(), list_distance_neighbors.end(),
					   hist_list_neighbors.begin(), hist_list_neighbors.end(),
					   back_inserter(list_neighbors));

		d++;

	}

	return list_neighbors;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, 0x58(%rsp)
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
andq $0x0, 0x50(%rsp)
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rsp)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x30(%rsp)
movaps %xmm0, (%rsp)
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rsi), %rax
movq 0x8(%rax), %rax
movl (%rdx), %ecx
movq (%rax,%rcx,8), %rax
leaq 0x60(%rsp), %rsi
movq %rax, (%rsi)
callq 0x5b46
xorl %esi, %esi
movq %rsp, %r12
leaq 0x20(%rsp), %r13
movq 0x58(%rsp), %rax
cmpl (%rax), %esi
jae 0x5208
movq (%rbx), %rdx
movq 0x8(%rbx), %rcx
cmpq %rdx, %rcx
je 0x5208
movl %esi, 0x1c(%rsp)
movq 0x48(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x5b64
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x5142
movq %rax, 0x8(%rsp)
movq (%rbx), %r15
movq 0x8(%rbx), %r14
cmpq %r14, %r15
je 0x519a
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x515f
movq %rax, 0x28(%rsp)
movq (%r15), %rbp
addq $0x40, %rbp
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x517d
leaq 0x8(%rbp), %rsi
movq %r13, %rdi
callq 0x5b46
jmp 0x5166
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq %r12, %rdi
callq 0x5b64
addq $0x8, %r15
jmp 0x5149
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x6484
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x6484
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x68aa
movq 0x8(%rsp), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x5b84
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x51e2
movq %rax, 0x8(%rbx)
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
movq %rbx, %r8
callq 0x6966
movl 0x1c(%rsp), %esi
incl %esi
jmp 0x5102
leaq 0x20(%rsp), %rdi
callq 0x5c76
movq %rsp, %rdi
callq 0x5c76
leaq 0x40(%rsp), %rdi
callq 0x5c76
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5242
jmp 0x5242
jmp 0x5242
jmp 0x5242
jmp 0x5242
jmp 0x5242
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x5c76
movq %rsp, %rdi
callq 0x5c76
leaq 0x40(%rsp), %rdi
callq 0x5c76
movq %rbx, %rdi
callq 0x5c76
movq %r14, %rdi
callq 0x23a0
nop