// File: /workspace/github_cpp_makefile_star2_O1/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)
xorl %eax, %eax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rax, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movq %rax, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %rax, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rsi), %rax
movq 0x8(%rax), %rax
movl (%rdx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x60(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
movq %rdi, 0x18(%rsp)
je 0x57b2
movq %rax, (%rsi)
addq $0x8, 0x8(%rdi)
jmp 0x57bc
leaq 0x60(%rsp), %rdx
callq 0x6a20
movq 0x58(%rsp), %rax
cmpl $0x0, (%rax)
je 0x5961
xorl %r14d, %r14d
movq %rsp, %r12
leaq 0x20(%rsp), %r13
movq 0x18(%rsp), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rcx
cmpq %rdx, %rcx
je 0x5961
movq 0x48(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x6b56
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x5809
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %r15
movq 0x8(%rax), %rbp
cmpq %rbp, %r15
je 0x587f
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x582b
movq %rax, 0x28(%rsp)
movq (%r15), %rax
movq 0x40(%rax), %rbx
testq %rbx, %rbx
je 0x5862
leaq 0x8(%rbx), %rdx
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x5855
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x585d
movq %r13, %rdi
callq 0x6a20
movq (%rbx), %rbx
jmp 0x5832
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq %r12, %rdi
callq 0x6b56
addq $0x8, %r15
jmp 0x5815
movq (%rsp), %rbp
movq 0x8(%rsp), %r15
cmpq %r15, %rbp
je 0x58ba
movq %r15, %rax
subq %rbp, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x6d42
movq %rbp, %rdi
movq %r15, %rsi
callq 0x6e2b
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %rbp
cmpq %rbp, %r15
je 0x58f6
movq %rbp, %rax
subq %r15, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6d42
movq %r15, %rdi
movq %rbp, %rsi
callq 0x6e2b
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x70c0
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x5926
movq 0x8(%rsp), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
addq %rsi, %rax
cmpq %rax, %rdx
je 0x5926
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %r8
movq (%r8), %rax
cmpq %rax, 0x8(%r8)
je 0x5938
movq %rax, 0x8(%r8)
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq 0x48(%rsp), %rcx
callq 0x7119
incl %r14d
movq 0x58(%rsp), %rax
cmpl (%rax), %r14d
jb 0x57d5
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x5970
callq 0x2220
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x597e
callq 0x2220
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x598d
callq 0x2220
movq 0x18(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x59ab
jmp 0x59ab
jmp 0x59ab
jmp 0x59ab
jmp 0x59ab
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x59bd
callq 0x2220
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x59cb
callq 0x2220
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x59da
callq 0x2220
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x59ec
callq 0x2220
movq %r14, %rdi
callq 0x23d0