// File: 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:
subq $0x248, %rsp            # imm = 0x248
movq %rdi, 0x98(%rsp)
movq %rdi, %rax
movq %rax, 0x88(%rsp)
movq %rdi, 0x240(%rsp)
movq %rsi, 0x238(%rsp)
movq %rdx, 0x230(%rsp)
movq %rcx, 0x228(%rsp)
movq 0x238(%rsp), %rax
movq %rax, 0x90(%rsp)
movb $0x0, 0x227(%rsp)
callq 0x10640
leaq 0x208(%rsp), %rdi
callq 0x10640
leaq 0x1f0(%rsp), %rdi
callq 0x10640
leaq 0x1d8(%rsp), %rdi
callq 0x10640
movq 0x90(%rsp), %rax
movq 0x98(%rsp), %rdi
movl $0x0, 0x1d0(%rsp)
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x230(%rsp), %rcx
movl (%rcx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x1c8(%rsp)
leaq 0x1c8(%rsp), %rsi
callq 0x10650
jmp 0xe8b6
jmp 0xe8b8
movl 0x1d0(%rsp), %ecx
movq 0x228(%rsp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x87(%rsp)
jae 0xe8ef
movq 0x98(%rsp), %rdi
callq 0x5620
cmpq $0x0, %rax
seta %al
movb %al, 0x87(%rsp)
movb 0x87(%rsp), %al
testb $0x1, %al
jne 0xe8ff
jmp 0xedcb
leaq 0x208(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x10450
movq %rax, 0x1a8(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x10780
movq 0x98(%rsp), %rdi
callq 0x10420
movq 0x98(%rsp), %rdi
movq %rax, 0x1a0(%rsp)
callq 0x10450
movq 0x70(%rsp), %rdi
movq %rax, 0x198(%rsp)
movq 0x1b0(%rsp), %rsi
movq 0x1a0(%rsp), %rdx
movq 0x198(%rsp), %rcx
callq 0x106c0
movq %rax, 0x78(%rsp)
jmp 0xe981
movq 0x78(%rsp), %rax
movq %rax, 0x190(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x107c0
movq 0x98(%rsp), %rax
movq %rax, 0x188(%rsp)
movq 0x188(%rsp), %rdi
callq 0x10420
movq %rax, 0x180(%rsp)
movq 0x188(%rsp), %rdi
callq 0x10450
movq %rax, 0x178(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x10480
testb $0x1, %al
jne 0xe9f3
jmp 0xeba1
leaq 0x180(%rsp), %rdi
callq 0x104c0
movq %rax, 0x170(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x107c0
movq 0x170(%rsp), %rax
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rdi
callq 0x107e0
movq %rax, 0x160(%rsp)
movq 0x168(%rsp), %rdi
callq 0x10810
movq %rax, 0x158(%rsp)
leaq 0x160(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x10840
testb $0x1, %al
jne 0xea74
jmp 0xeafe
leaq 0x160(%rsp), %rdi
callq 0x10860
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x10650
jmp 0xeaa0
jmp 0xeaa2
leaq 0x160(%rsp), %rdi
callq 0x10880
jmp 0xea56
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x105e0
leaq 0x1f0(%rsp), %rdi
callq 0x105e0
leaq 0x208(%rsp), %rdi
callq 0x105e0
movq 0x98(%rsp), %rdi
callq 0x105e0
jmp 0xee21
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x10450
movq %rax, 0x140(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x10780
leaq 0x1d8(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x10420
movq 0x58(%rsp), %rdi
movq %rax, 0x138(%rsp)
callq 0x10450
movq 0x60(%rsp), %rdi
movq %rax, 0x130(%rsp)
movq 0x148(%rsp), %rsi
movq 0x138(%rsp), %rdx
movq 0x130(%rsp), %rcx
callq 0x106c0
movq %rax, 0x68(%rsp)
jmp 0xeb82
movq 0x68(%rsp), %rax
movq %rax, 0x128(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x10500
jmp 0xe9d5
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x10420
movq 0x50(%rsp), %rdi
movq %rax, 0x120(%rsp)
callq 0x10450
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x108b0
jmp 0xebe4
leaq 0x208(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x10420
movq 0x48(%rsp), %rdi
movq %rax, 0x110(%rsp)
callq 0x10450
movq %rax, 0x108(%rsp)
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x108b0
jmp 0xec27
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x10420
movq 0x38(%rsp), %rdi
movq %rax, 0xf0(%rsp)
callq 0x10450
movq %rax, 0xe8(%rsp)
movq 0xf0(%rsp), %rdi
movq 0xe8(%rsp), %rsi
callq 0x10990
movq %rax, 0x40(%rsp)
jmp 0xec6f
movq 0x40(%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x10780
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x10450
movq %rax, 0xd8(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x10780
movq 0x28(%rsp), %rdi
movq 0x100(%rsp), %rsi
movq 0xe0(%rsp), %rdx
callq 0x108f0
movq %rax, 0x30(%rsp)
jmp 0xece1
movq 0x98(%rsp), %rdi
movq 0x30(%rsp), %rax
movq %rax, 0xd0(%rsp)
callq 0x107c0
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x10420
movq 0x10(%rsp), %rdi
movq %rax, 0xc8(%rsp)
callq 0x10450
movq %rax, 0xc0(%rsp)
leaq 0x208(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x10420
movq 0x18(%rsp), %rdi
movq %rax, 0xb8(%rsp)
callq 0x10450
movq 0x98(%rsp), %rdi
movq %rax, 0xb0(%rsp)
callq 0x10a70
movq %rax, 0x20(%rsp)
jmp 0xed67
movq 0x20(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xc8(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0xb0(%rsp), %rcx
movq 0xa8(%rsp), %r8
callq 0x109e0
movq %rax, 0x8(%rsp)
jmp 0xeda8
movq 0x8(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl 0x1d0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1d0(%rsp)
jmp 0xe8b8
movb $0x1, 0x227(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x105e0
leaq 0x1f0(%rsp), %rdi
callq 0x105e0
leaq 0x208(%rsp), %rdi
callq 0x105e0
testb $0x1, 0x227(%rsp)
jne 0xee11
movq 0x98(%rsp), %rdi
callq 0x105e0
movq 0x88(%rsp), %rax
addq $0x248, %rsp            # imm = 0x248
retq
movq 0x1c0(%rsp), %rdi
callq 0x3400
nop