// File: /workspace/github_cpp_makefile_star2_O3/ADAPTLab[P]MuDBSCAN/MuC_RTree.cpp
// Function: insertPointintoGroup(group*, data*)
void insertPointintoGroup(Group currGroup, Data currDataPoint)
{
	// Data master = data
	DataPoint d = currGroup->master;

	double dist = distance(currDataPoint->iData, d);
	
	currGroup->total_count++;
	addHelper[0] = currDataPoint->id;

	VECTOR_ADD(currGroup->total_points, addHelper);
	double two = 2;

	if(dist <= EPS/two)
	{
		currGroup->inner_count++;
		addHelper[0] = currDataPoint->id;
		VECTOR_ADD(currGroup->inner_points, addHelper);
	}

	if(currGroup->threshold < dist) currGroup->threshold = dist;

	currDataPoint->group_id = currGroup->id;

	BCell currBCell = currGroup->bcell;
	int x,i;

	if(VECTOR_TOTAL(currGroup->total_points) == 1)
	{
		for(x = 0; x < DIMENSION; x++)
		{
			currBCell->minActualBoundary[x] = currDataPoint->iData[x];
			currBCell->maxActualBoundary[x] = currDataPoint->iData[x];
		}		
	}
	else
	{
		for(i = 0; i< DIMENSION; i++)
		{
			if(currBCell->minActualBoundary[i] > currDataPoint->iData[i])
			{
				currBCell->minActualBoundary[i] = currDataPoint->iData[i];
			}

			if(currBCell->maxActualBoundary[i] < currDataPoint->iData[i])
			{
				currBCell->maxActualBoundary[i] = currDataPoint->iData[i];
			}
		}
	}

	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xe9da(%rip), %r15      # 0x17364
movslq (%r15), %rax
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testq %rax, %rax
jle 0x89bd
movq 0x28(%r14), %rcx
movq (%rbx), %rdx
xorl %esi, %esi
movsd (%rdx,%rsi,8), %xmm2
subsd (%rcx,%rsi,8), %xmm2
mulsd %xmm2, %xmm2
addsd %xmm2, %xmm0
incq %rsi
cmpq %rsi, %rax
jne 0x89a3
ucomisd %xmm1, %xmm0
jb 0x89c9
sqrtsd %xmm0, %xmm0
jmp 0x89ce
callq 0x3230
movsd %xmm0, -0x28(%rbp)
incl 0x1c(%r14)
movl 0x1c(%rbx), %eax
leaq 0xe9af(%rip), %r12      # 0x17390
movq (%r12), %rsi
movl %eax, (%rsi)
movq 0x10(%r14), %rdi
callq 0x3c20
leaq 0xe961(%rip), %rax      # 0x17358
movsd (%rax), %xmm0
mulsd 0x976d(%rip), %xmm0     # 0x12170
movsd -0x28(%rbp), %xmm1
ucomisd %xmm1, %xmm0
movapd %xmm1, %xmm0
jb 0x8a2d
incl 0x18(%r14)
movl 0x1c(%rbx), %eax
movq (%r12), %rsi
movl %eax, (%rsi)
movq 0x8(%r14), %rdi
callq 0x3c20
movsd -0x28(%rbp), %xmm0
fldt 0x40(%r14)
movsd %xmm0, -0x30(%rbp)
fldl -0x30(%rbp)
fucomi %st(1), %st
fstp %st(1)
jbe 0x8a45
fstpt 0x40(%r14)
fldz
fstp %st(0)
movl (%r14), %eax
movl %eax, 0x20(%rbx)
movq 0x10(%r14), %rdi
movq 0x38(%r14), %r14
callq 0x3a4d
movl (%r15), %ecx
cmpl $0x1, %eax
jne 0x8a8c
testl %ecx, %ecx
jle 0x8acb
movq (%rbx), %rax
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rsi
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm0
movsd %xmm0, (%rdx,%rdi,8)
movsd %xmm0, (%rsi,%rdi,8)
incq %rdi
cmpq %rdi, %rcx
jne 0x8a73
jmp 0x8acb
testl %ecx, %ecx
jle 0x8acb
movq 0x10(%r14), %rax
movq 0x18(%r14), %rdx
movq (%rbx), %rsi
xorl %edi, %edi
movsd (%rax,%rdi,8), %xmm1
movsd (%rsi,%rdi,8), %xmm0
ucomisd %xmm0, %xmm1
jbe 0x8ab7
movsd %xmm0, (%rax,%rdi,8)
movsd (%rsi,%rdi,8), %xmm0
ucomisd (%rdx,%rdi,8), %xmm0
jbe 0x8ac3
movsd %xmm0, (%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rcx
jne 0x8a9d
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq