// File: ADAPTLab[P]MuDBSCAN/MuC_RTree.cpp
// Function: findReachableGroupsofGroupG(dataHdr*, GhdrNd*, int)
void findReachableGroupsofGroupG(DataHdr dataList, GHdrNd GRTree, int i)
{
	if(GisLstEmpty(GRTree))
	{
		return ;
	}
	
	Group G = groupList->groupItems[i];
 	unsigned int uiRecCnt = 0;
	int iCnt = 0;
    double t;
    static int flag = 0;

	GLstNd lstNdTemp = GRTree->ptrFirstNd;
	Group currGroup = NULL;
	
	DataPoint d = (dataList->dataClstElem + G->master_id)->iData;
	Region x3rgnRect = createCellRegOfDataPoint(d, 3*EPS);

	while(lstNdTemp != NULL)
    {
		switch(lstNdTemp->tnInfo->ndType)
        {
           case INTNODE:   
				if(GisOverLap(lstNdTemp->tnInfo->tdInfo->rgnRect, x3rgnRect))
	            {
	            	//if((dataList->dataClstElem + G->master_id)->debugPoint==TRUE){
						//printf("%lf\t%lf\t%lf\tRank Is %d\t Overlaps Group ID%d\n",d[0],d[1],d[2],rank,(dataList->dataClstElem + G->master_id)->group_id);
					//}
	            	findReachableGroupsofGroupG(dataList, lstNdTemp->ptrChildLst, i);
	            }
            break;
            case EXTNODE:   
				if(G->id != lstNdTemp->tnInfo->tdInfo->groupElem && distance(d, (dataList->dataClstElem + (groupList->groupItems[lstNdTemp->tnInfo->tdInfo->groupElem])->master_id)->iData) <= 3*EPS)
				{
						addHelper[0] = lstNdTemp->tnInfo->tdInfo->groupElem;
						VECTOR_ADD(G->reachable_groups, addHelper);
				}      			            				
            break;
		}
		lstNdTemp = lstNdTemp->ptrNextNd;
	}

	free(x3rgnRect->iBottomLeft);
	free(x3rgnRect->iTopRight);
	free(x3rgnRect);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x102b0
cmpl $0x0, %eax
je 0x17d26
jmp 0x17ed9
leaq 0x20ae3(%rip), %rax     # 0x38810
movq (%rax), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movslq 0x30(%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movsd 0x144b5(%rip), %xmm0    # 0x2c240
leaq 0x20a36(%rip), %rax     # 0x387c8
mulsd (%rax), %xmm0
callq 0x17c20
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x17eb7
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x54(%rbp)
testl %eax, %eax
je 0x17dc9
jmp 0x17dbc
movl -0x54(%rbp), %eax
subl $0x1, %eax
je 0x17dfe
jmp 0x17ea6
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movq -0x50(%rbp), %rsi
callq 0x148f0
cmpl $0x0, %eax
je 0x17df9
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x14(%rbp), %edx
callq 0x17d00
jmp 0x17ea6
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x8(%rcx), %eax
je 0x17ea4
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x209e5(%rip), %rcx     # 0x38810
movq (%rcx), %rcx
movq (%rcx), %rcx
movq -0x38(%rbp), %rdx
movq (%rdx), %rdx
movq 0x8(%rdx), %rdx
movslq 0x8(%rdx), %rdx
movq (%rcx,%rdx,8), %rcx
movslq 0x30(%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x16af0
movaps %xmm0, %xmm1
movsd 0x143de(%rip), %xmm0    # 0x2c240
leaq 0x2095f(%rip), %rax     # 0x387c8
mulsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x17ea4
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %ecx
leaq 0x20978(%rip), %rax     # 0x38800
movq (%rax), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdi
leaq 0x20964(%rip), %rax     # 0x38800
movq (%rax), %rsi
callq 0xa6e0
jmp 0x17ea6
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x17d9f
movq -0x50(%rbp), %rax
movq (%rax), %rdi
callq 0x97c0
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x97c0
movq -0x50(%rbp), %rdi
callq 0x97c0
addq $0x60, %rsp
popq %rbp
retq
nop