// File: /workspace/github_cpp_makefile_star2_O2/rtackx[P]ComSim/projection.cpp
// Function: compute_projection_thread(void*)
void* compute_projection_thread(void* struct_args)
{
	projection_thread_args* args = static_cast<projection_thread_args*>(struct_args);

	pair<unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>>::iterator, bool> it_map;
	unordered_map<unsigned int, set<pair<unsigned int, float>, comp_pair>> map_neighbor;

	vector<Node*> list_distance_neighbors = args->p->get_neighbors(args->index, args->distance);
	float projection_weight;

	Node* node = new Node();
	node->id = args->p->in_graph->list_nodes[args->index]->id;
	node->main_index = args->p->in_graph->list_nodes[args->index]->main_index;

	it_map = map_neighbor.emplace(args->index, set<pair<unsigned int, float>, comp_pair>());

	for(auto& node_neighbor : list_distance_neighbors)
	{
		projection_weight = args->p->similarity_projection(args->p->in_graph->list_nodes[args->index], node_neighbor);

		if(projection_weight > 0.0)
			it_map.first->second.insert(make_pair(node_neighbor->index, projection_weight));
	}

	pthread_mutex_lock(&compute_projection_mutex);
	args->map_node->emplace(make_pair(args->index, node));
	args->map_neighbor->insert(map_neighbor.begin(), map_neighbor.end());
	pthread_mutex_unlock(&compute_projection_mutex);

	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
leaq 0x80(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq (%rdi), %rsi
leaq 0x8(%rdi), %r15
leaq 0xc(%rdi), %rcx
leaq 0x8(%rsp), %rdi
movq %r15, %rdx
callq 0x509c
pushq $0x68
popq %rdi
callq 0x2250
movq %rax, %r14
movq %rax, %rdi
callq 0x25bc
movq (%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %rsi
addq $0x8, %rsi
movq %r14, %rdi
addq $0x8, %rdi
callq 0x2130
movq (%rbx), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movl 0x8(%rbx), %ecx
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %eax
movl %eax, 0x4(%r14)
leaq 0x28(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x50(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %r15, %rsi
callq 0x5c84
movq %rax, %r15
leaq 0x20(%rsp), %r12
movq %r12, %rdi
callq 0x3b40
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
addq $0x10, %r15
cmpq %rbp, %r13
je 0x500f
movq (%rbx), %rdi
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
movl 0x8(%rbx), %esi
shlq $0x3, %rsi
addq 0x8(%rcx), %rsi
movq %r13, %rdx
callq *(%rax)
ucomiss 0x58c4(%rip), %xmm0     # 0xa8b0
jbe 0x5009
movq (%r13), %rax
movl (%rax), %eax
movl %eax, 0x20(%rsp)
movss %xmm0, 0x24(%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x47f6
addq $0x8, %r13
jmp 0x4fc6
leaq 0xc27a(%rip), %rdi      # 0x11290
callq 0x2320
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %eax
leaq 0x20(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, 0x8(%rsi)
callq 0x5dc0
movq 0x18(%rbx), %rdi
movq 0x60(%rsp), %rsi
xorl %edx, %edx
callq 0x5e82
leaq 0xc247(%rip), %rdi      # 0x11290
callq 0x21b0
xorl %edi, %edi
callq 0x23b0
jmp 0x5077
jmp 0x5077
jmp 0x5077
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3b40
jmp 0x507a
movq %rax, %rbx
movq %r14, %rdi
callq 0x2220
jmp 0x507a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5c76
jmp 0x5089
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3a98
movq %rbx, %rdi
callq 0x23a0
nop