// File: rtackx[P]ComSim/projection.cpp
// Function: LHN1::similarity_projection(Node*&, Node*&)
float LHN1::similarity_projection(Node*& node1, Node*& node2)
{
	set<Node*> intersection = get_intersection(node1, node2);

	float projection_weight, sum_weight1, sum_weight2, wtemp;
	projection_weight = sum_weight1 = sum_weight2 = 0.0;

	for(auto& neighbor : node1->neighbor_weights)
	{
		wtemp = node1->neighbor_weights[neighbor.first];
		if(intersection.find(neighbor.first) != intersection.end())
		{
			projection_weight += wtemp;
		}

		sum_weight1 += wtemp;
	}
	for(auto& neighbor : node2->neighbor_weights)
	{
		wtemp = node2->neighbor_weights[neighbor.first];
		if(intersection.find(neighbor.first) != intersection.end())
		{
			projection_weight += wtemp;
		}

		sum_weight2 += wtemp;
	}

	return 1.0 * projection_weight / (sum_weight1 * sum_weight2);
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq %rdx, 0xe0(%rsp)
movq 0xf0(%rsp), %rsi
movq 0xe8(%rsp), %rdx
movq 0xe0(%rsp), %rcx
leaq 0xb0(%rsp), %rdi
callq 0xefe0
xorps %xmm0, %xmm0
movss %xmm0, 0xa4(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0xa8(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0xac(%rsp)
movq 0xe8(%rsp), %rax
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
callq 0x107e0
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
callq 0x10810
movq %rax, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x10840
testb $0x1, %al
jne 0xff27
jmp 0x10028
leaq 0x90(%rsp), %rdi
callq 0x10860
movq %rax, 0x80(%rsp)
movq 0xe8(%rsp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
movq 0x80(%rsp), %rsi
callq 0x7c60
movq %rax, 0x28(%rsp)
jmp 0xff5f
movq 0x28(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0xa0(%rsp)
movq 0x80(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x10d10
movq %rax, 0x20(%rsp)
jmp 0xff8d
movq 0x20(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x10d50
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x10cf0
testb $0x1, %al
jne 0xffbe
jmp 0xfffb
movss 0xa0(%rsp), %xmm0
addss 0xac(%rsp), %xmm0
movss %xmm0, 0xac(%rsp)
jmp 0xfffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x10ce0
jmp 0x1019a
movss 0xa0(%rsp), %xmm0
addss 0xa8(%rsp), %xmm0
movss %xmm0, 0xa8(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x10880
jmp 0xff09
movq 0xe0(%rsp), %rax
movq (%rax), %rax
addq $0x30, %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
callq 0x107e0
movq %rax, 0x50(%rsp)
movq 0x58(%rsp), %rdi
callq 0x10810
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x10840
testb $0x1, %al
jne 0x10072
jmp 0x10142
leaq 0x50(%rsp), %rdi
callq 0x10860
movq %rax, 0x40(%rsp)
movq 0xe0(%rsp), %rax
movq (%rax), %rdi
addq $0x30, %rdi
movq 0x40(%rsp), %rsi
callq 0x7c60
movq %rax, 0x18(%rsp)
jmp 0x100a1
movq 0x18(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0xa0(%rsp)
movq 0x40(%rsp), %rsi
leaq 0xb0(%rsp), %rdi
callq 0x10d10
movq %rax, 0x10(%rsp)
jmp 0x100cc
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x10d50
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x10cf0
testb $0x1, %al
jne 0x100fd
jmp 0x10118
movss 0xa0(%rsp), %xmm0
addss 0xac(%rsp), %xmm0
movss %xmm0, 0xac(%rsp)
movss 0xa0(%rsp), %xmm0
addss 0xa4(%rsp), %xmm0
movss %xmm0, 0xa4(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x10880
jmp 0x1005a
movss 0xac(%rsp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x12759(%rip), %xmm0    # 0x228b0
mulsd %xmm1, %xmm0
movss 0xa8(%rsp), %xmm1
mulss 0xa4(%rsp), %xmm1
cvtss2sd %xmm1, %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x10ce0
movss 0xc(%rsp), %xmm0
addq $0xf8, %rsp
retq
movq 0x78(%rsp), %rdi
callq 0x3400
nopw %cs:(%rax,%rax)