// File: /workspace/github_cpp_makefile_star2_O2/ADAPTLab[P]MuDBSCAN/clustering.cpp
// Function: sequentialClustering(dataHdr*)
void sequentialClustering(DataHdr dataList)
{
	int i;
	int j, k, npid, prID;
	int rank, nproc, mpi_namelen;

	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
	MPI_Comm_size(MPI_COMM_WORLD, &nproc);

	int pid;
	int root, root1, root2, tid;

    noiseNeighbours = (int**)calloc(dataList->localCnt, sizeof(int*));
    // assert(noiseNeighbours != NULL);
    
	Neighbours neigh = NULL,neigh1 = NULL;
	
	clusteringstart = MPI_Wtime();
	Data data;
	for(i = 0; i < dataList->localCnt; i++)
	{
		noiseNeighbours[i] = NULL;
		pid = i;
		data = dataList->dataClstElem + i;

		if(data->isProcessed == TRUE || data->core_tag == TRUE)
        {
            continue;   
        }

		neigh = findNeighbours3(dataList, i, EPS, NULL);
		data->isProcessed = TRUE;

		if(neigh->inner_neighbours >= MINPOINTS)
		{
			//Merging has already happened in the findNeighbours3 method. No need to duplicate merging
			continue;
		}


		if(VECTOR_TOTAL(neigh->neighbours_local_inner) + VECTOR_TOTAL(neigh->neighbours_remote_inner) + VECTOR_TOTAL(neigh->neighbours_local_outer) + VECTOR_TOTAL(neigh->neighbours_remote_outer) >= MINPOINTS)
		{
			// Current point is a core point
			// pid is a core point
			root = pid;

			data->core_tag = TRUE;
			data->ClusterID = 1;
			
			//NEEDS MODIFICATION
			Data dataroot1;
			Data dataroot2;
			for (j = 0; j < VECTOR_TOTAL(neigh->neighbours_local_inner); j++)
    		{

				Data datalocal = dataList->dataClstElem + neigh->neighbours_local_inner->intItems[j];
				npid = datalocal->id;

				root1 = npid;
				root2 = root;

				if(datalocal->core_tag == TRUE || datalocal->ClusterID == 0)
				{
					datalocal->ClusterID = 1;

					 dataroot1 = dataList->dataClstElem + root1;
					 dataroot2 = dataList->dataClstElem + root2;

					unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
					// REMS algorithm to (union) merge the trees
					
				}
			}


			//Data dataroot1;
			//Data dataroot2;
			for (j = 0; j < VECTOR_TOTAL(neigh->neighbours_local_outer); j++)
    		{

				Data datalocal = dataList->dataClstElem + neigh->neighbours_local_outer->intItems[j];
				npid = datalocal->id;

				root1 = npid;
				root2 = root;

				if(datalocal->core_tag == TRUE || datalocal->ClusterID == 0)
				{
					datalocal->ClusterID = 1;

					 dataroot1 = dataList->dataClstElem + root1;
					 dataroot2 = dataList->dataClstElem + root2;

					unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
					// REMS algorithm to (union) merge the trees
					
				}
			}
		}
		else
		{
			data->core_tag = FALSE;
			if(data->ClusterID == 1)
			{
				;
			}
			else
			{
				data->ClusterID = 0;
				Data neighbour;
				Data dataroot1;
				Data dataroot2;
	            for(j=0;j<VECTOR_TOTAL(neigh->neighbours_local_inner);j++)
	            {
	                neighbour = dataList->dataClstElem + neigh->neighbours_local_inner->intItems[j];
	                if(neighbour->core_tag == TRUE) //Border point scenario.
	                {
	                	root1 = data->id;
						root2 = neighbour->id;

						data->ClusterID = 1;

						Data dataroot1 = dataList->dataClstElem + root1;
						Data dataroot2 = dataList->dataClstElem + root2;
						unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
						// REMS algorithm to (union) merge the trees
	                    data->ClusterID = 1;
	                    neighbour->ClusterID = 1;
	                    break;
	                }
	            }

	            //Data dataroot1;
	            //Data dataroot2;
	            for(j=0;j<VECTOR_TOTAL(neigh->neighbours_local_outer);j++)
	            {
	                neighbour = dataList->dataClstElem + neigh->neighbours_local_outer->intItems[j];
	                if(neighbour->core_tag == TRUE) //Border point scenario.
	                {
	                	root1 = data->id;
						root2 = neighbour->id;

						data->ClusterID = 1;

						dataroot1 = dataList->dataClstElem + root1;
						dataroot2 = dataList->dataClstElem + root2;
						unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
						// REMS algorithm to (union) merge the trees
	                    data->ClusterID = 1;
	                    neighbour->ClusterID = 1;
	                    break;
	                }
	            }

	            if(data->ClusterID == 0)
	            {
	                noiseNeighbours[data->id] = (int*)malloc(sizeof(int)*MINPOINTS);

	                int k = 0;
	            	for(k=0;k<MINPOINTS;k++) noiseNeighbours[data->id][k] = -1;
	            	k=0;

	                for(j=0; j<VECTOR_TOTAL(neigh->neighbours_local_inner); j++)
	                {
                       	noiseNeighbours[data->id][k++] = neigh->neighbours_local_inner->intItems[j];
	                }

	                for(j=0; j<VECTOR_TOTAL(neigh->neighbours_local_outer); j++)
	                {
                       	noiseNeighbours[data->id][k++] = neigh->neighbours_local_outer->intItems[j];
	                }

	                for(j=0; j<VECTOR_TOTAL(neigh->neighbours_remote_inner); j++)
	                {
                       	noiseNeighbours[data->id][k++] = neigh->neighbours_remote_inner->intItems[j];
	                }

	                for(j=0; j<VECTOR_TOTAL(neigh->neighbours_remote_outer); j++)
	                {
                       	noiseNeighbours[data->id][k++] = neigh->neighbours_remote_outer->intItems[j];
	                }
	            }
			}
		}

		VECTOR_FREE(neigh->neighbours_local_outer);
		free(neigh->neighbours_local_outer);

		VECTOR_FREE(neigh->neighbours_remote_outer);
		free(neigh->neighbours_remote_outer);

		VECTOR_FREE(neigh->neighbours_local_inner);
		free(neigh->neighbours_local_inner);

		VECTOR_FREE(neigh->neighbours_remote_inner);
		free(neigh->neighbours_remote_inner);

		free(neigh);
		neigh = NULL;
	}

	clusteringend = MPI_Wtime();
	postprocessingstart = MPI_Wtime();
	postprocessingstart = MPI_Wtime();


	Data dataroot1;
	Data dataroot2;
	for(i=0; i<dataList->localCnt; i++)
	{
	    Data potentialNoise = dataList->dataClstElem + i;
	    
	    if(potentialNoise->ClusterID == 0 && noiseNeighbours[i] != NULL)
	    {
	    	int v;
		    for(v=0; v<MINPOINTS; v++)
		    {
		        if(noiseNeighbours[i][v] >= 0)
		        {
		            Data data = dataList->dataClstElem + noiseNeighbours[i][v];
		            if(data->core_tag == TRUE)
		            {
		            	root1 = data->id;
						root2 = potentialNoise->id;

						dataroot1 = dataList->dataClstElem + root1;
						dataroot2 = dataList->dataClstElem + root2;
						unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
						
						// REMS algorithm to (union) merge the trees
	                    data->ClusterID = 1;
		                potentialNoise->ClusterID = 1;
		                break;
		            }
		        }
		    }
		    free(noiseNeighbours[i]);
		}
	}

	free(noiseNeighbours);
	//Data data;
	Neighbours n;
	RHdrNd hdrNdTree;
	Data data2;
	Group g;
	for(i=0; i<VECTOR_TOTAL(unprocessedCore); i++)
	{
		data = dataList->dataClstElem + unprocessedCore->intItems[i];
		g = groupList->groupItems[data->group_id];
		Region region = createCellRegOfPoint(data, EPS);

		vectorc* neighbours_local_outer = (vectorc*)malloc(sizeof(struct vectorc));
		VECTOR_INIT(neighbours_local_outer, INTEGER);

		vectorc* neighbours_remote_outer = (vectorc*)malloc(sizeof(struct vectorc));
		VECTOR_INIT(neighbours_remote_outer, INTEGER);

		n = (Neighbours)malloc(sizeof(struct neighbours));

		n->neighbours_local_outer = neighbours_local_outer;
		n->neighbours_remote_outer = neighbours_remote_outer;

		hdrNdTree = g->bcell->auxCellRTree;
		for(k=0; k<VECTOR_TOTAL(g->corepoints); k++)
		{
			data2 = dataList->dataClstElem + g->corepoints->intItems[k];
			if(data2->haloPoint == FALSE)
			{
			    if(RisContains(region, data2->iData))
			    {
			    	if(distance(data->iData, data2->iData) <= EPS)
			    	{
				    	addHelper[0] = data2->id;
						VECTOR_ADD(n->neighbours_local_outer, addHelper);
			    	}
			    }
			}
		}
		Group rg;
		DataPoint d;
		Data data2;
		//RHdrNd hdrNdTree;
		for(j=0; j<VECTOR_TOTAL(g->reachable_groups); j++)
		{
			rg = groupList->groupItems[g->reachable_groups->intItems[j]];
			d = (dataList->dataClstElem + rg->master_id)->iData;
			Region potentialRegion = createCellRegOfDataPoint(d, EPS);

			if(GisOverLap(region, potentialRegion))
			{
				hdrNdTree = rg->bcell->auxCellRTree;
				for(k=0; k<VECTOR_TOTAL(rg->corepoints); k++)
				{
				    data2 = dataList->dataClstElem + rg->corepoints->intItems[k];
				    if(data2->haloPoint == FALSE)
				    {
				        if(RisContains(region, data2->iData))
			            {
			                if(distance(data->iData, data2->iData) <= EPS)
					    	{
						    	addHelper[0] = data2->id;
								VECTOR_ADD(n->neighbours_local_outer, addHelper);
					    	}
			            }
				    }
				}
			}
			free(potentialRegion->iBottomLeft);
			free(potentialRegion->iTopRight);
			free(potentialRegion);
		}
		Data temp;
		Data dataroot1;
		Data dataroot2;
		for(j=0;j<VECTOR_TOTAL(n->neighbours_local_outer);j++)
		{
			temp = dataList->dataClstElem + n->neighbours_local_outer->intItems[j];

			int root1 = temp->id;
			int root2 = data->id;
			int root;
			dataroot1 = dataList->dataClstElem + root1;
			dataroot2 = dataList->dataClstElem + root2;
			unionFindMerge(dataList, root1, root2, dataroot1, dataroot2);
	     	data->ClusterID = 1;
		}

		VECTOR_FREE(n->neighbours_remote_outer);
		VECTOR_FREE(n->neighbours_local_outer);
		free(n->neighbours_local_outer);
		free(n->neighbours_remote_outer);
		free(n);

		free(region->iBottomLeft);
		free(region->iTopRight);
		free(region);
	}
	 postprocessingend =  MPI_Wtime();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r13
movq 0x738b(%rip), %r14      # 0x13fb0
leaq -0x68(%rbp), %rsi
movq %r14, %rdi
callq 0x2370
leaq -0x64(%rbp), %rsi
movq %r14, %rdi
callq 0x2250
movslq 0x4(%r13), %rdi
pushq $0x8
popq %rsi
callq 0x2180
leaq 0x7728(%rip), %rcx      # 0x14378
movq %rax, (%rcx)
callq 0x22d0
leaq 0x77c9(%rip), %rax      # 0x14428
movsd %xmm0, (%rax)
xorl %ebx, %ebx
movslq 0x4(%r13), %rax
cmpq %rax, %rbx
jge 0xd0aa
leaq 0x76ff(%rip), %rax      # 0x14378
movq (%rax), %rax
andq $0x0, (%rax,%rbx,8)
movq 0x8(%r13), %r12
movq %rbx, %r14
shlq $0x6, %r14
cmpl $0x1, 0x2c(%r12,%r14)
je 0xce71
addq %r14, %r12
cmpl $0x1, 0x28(%r12)
je 0xce71
leaq 0x767a(%rip), %rax      # 0x14328
movsd (%rax), %xmm0
movq %r13, %rdi
movl %ebx, %esi
xorl %edx, %edx
callq 0x6591
movq %rax, %r15
movl $0x1, 0x2c(%r12)
movl 0x28(%rax), %eax
leaq 0x765c(%rip), %rcx      # 0x14330
cmpl (%rcx), %eax
jge 0xce71
movq %rbx, -0x38(%rbp)
movq 0x10(%r15), %rdi
callq 0x2831
movl %eax, -0x30(%rbp)
movq 0x8(%r15), %rdi
callq 0x2831
movl %eax, %ebx
addl -0x30(%rbp), %ebx
movq 0x20(%r15), %rdi
callq 0x2831
movl %eax, -0x30(%rbp)
movq 0x18(%r15), %rdi
callq 0x2831
addl -0x30(%rbp), %eax
addl %ebx, %eax
leaq 0x7615(%rip), %rcx      # 0x14330
cmpl (%rcx), %eax
jge 0xce79
andl $0x0, 0x28(%r12)
cmpl $0x1, 0x30(%r12)
je 0xce1d
andl $0x0, 0x30(%r12)
movq 0x10(%r15), %rdi
xorl %r14d, %r14d
callq 0x2831
cltq
cmpq %rax, %r14
jge 0xcda6
movq 0x8(%r13), %rax
movq 0x10(%r15), %rdi
movq 0x8(%rdi), %rcx
movslq (%rcx,%r14,4), %rbx
shlq $0x6, %rbx
incq %r14
cmpl $0x1, 0x28(%rax,%rbx)
jne 0xcd42
addq %rax, %rbx
movslq 0x1c(%r12), %rsi
movslq 0x1c(%rbx), %rdx
pushq $0x1
popq %r14
movl %r14d, 0x30(%r12)
movq %rsi, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
movq %rdx, %r8
shlq $0x6, %r8
addq %rax, %r8
movq %r13, %rdi
callq 0x2aa8
movl %r14d, 0x30(%r12)
movl %r14d, 0x30(%rbx)
movq 0x20(%r15), %rdi
xorl %r14d, %r14d
callq 0x2831
cltq
cmpq %rax, %r14
jge 0xce11
movq 0x8(%r13), %rax
movq 0x20(%r15), %rdi
movq 0x8(%rdi), %rcx
movslq (%rcx,%r14,4), %rbx
shlq $0x6, %rbx
incq %r14
cmpl $0x1, 0x28(%rax,%rbx)
jne 0xcdad
addq %rax, %rbx
movslq 0x1c(%r12), %rsi
movslq 0x1c(%rbx), %rdx
pushq $0x1
popq %r14
movl %r14d, 0x30(%r12)
movq %rsi, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
movq %rdx, %r8
shlq $0x6, %r8
addq %rax, %r8
movq %r13, %rdi
callq 0x2aa8
movl %r14d, 0x30(%r12)
movl %r14d, 0x30(%rbx)
cmpl $0x0, 0x30(%r12)
je 0xcf4e
movq 0x20(%r15), %rdi
callq 0x2a78
movq 0x20(%r15), %rdi
callq 0x2280
movq 0x18(%r15), %rdi
callq 0x2a78
movq 0x18(%r15), %rdi
callq 0x2280
movq 0x10(%r15), %rdi
callq 0x2a78
movq 0x10(%r15), %rdi
callq 0x2280
movq 0x8(%r15), %rdi
callq 0x2a78
movq 0x8(%r15), %rdi
callq 0x2280
movq %r15, %rdi
callq 0x2280
movq -0x38(%rbp), %rbx
incq %rbx
jmp 0xcc65
pushq $0x1
popq %rax
movl %eax, 0x28(%r12)
movl %eax, 0x30(%r12)
xorl %ebx, %ebx
movq 0x10(%r15), %rdi
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xcee8
movq 0x8(%r13), %r8
movq 0x10(%r15), %rax
movq 0x8(%rax), %rax
movslq (%rax,%rbx,4), %rcx
shlq $0x6, %rcx
leaq (%r8,%rcx), %rax
movslq 0x1c(%r8,%rcx), %rsi
cmpl $0x1, 0x28(%r8,%rcx)
je 0xcec3
cmpl $0x0, 0x30(%rax)
jne 0xcee3
movl $0x1, 0x30(%rax)
movq %rsi, %rcx
shlq $0x6, %rcx
addq %r8, %rcx
addq %r14, %r8
movq %r13, %rdi
movq -0x38(%rbp), %rdx
callq 0x2aa8
incq %rbx
jmp 0xce88
xorl %ebx, %ebx
movq 0x20(%r15), %rdi
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xce1d
movq 0x8(%r13), %r8
movq 0x20(%r15), %rax
movq 0x8(%rax), %rax
movslq (%rax,%rbx,4), %rcx
shlq $0x6, %rcx
leaq (%r8,%rcx), %rax
movslq 0x1c(%r8,%rcx), %rsi
cmpl $0x1, 0x28(%r8,%rcx)
je 0xcf29
cmpl $0x0, 0x30(%rax)
jne 0xcf49
movl $0x1, 0x30(%rax)
movq %rsi, %rcx
shlq $0x6, %rcx
addq %r8, %rcx
addq %r14, %r8
movq %r13, %rdi
movq -0x38(%rbp), %rdx
callq 0x2aa8
incq %rbx
jmp 0xceea
leaq 0x73db(%rip), %rax      # 0x14330
movslq (%rax), %rbx
movq %rbx, %rdi
shlq $0x2, %rdi
callq 0x2320
leaq 0x740d(%rip), %rsi      # 0x14378
movq (%rsi), %rcx
movslq 0x1c(%r12), %rdx
movq %rax, (%rcx,%rdx,8)
movq (%rsi), %rax
xorl %ecx, %ecx
movslq %ebx, %rdx
cmpq %rdx, %rcx
jge 0xcf9f
movslq 0x1c(%r12), %rdx
movq (%rax,%rdx,8), %rdx
orl $-0x1, (%rdx,%rcx,4)
incq %rcx
leaq 0x7395(%rip), %rdx      # 0x14330
movl (%rdx), %ebx
jmp 0xcf7c
movq %r13, -0x30(%rbp)
movq 0x10(%r15), %rdi
xorl %r14d, %r14d
xorl %r13d, %r13d
callq 0x2831
cltq
cmpq %rax, %r13
jge 0xcfe5
movq 0x10(%r15), %rdi
movq 0x8(%rdi), %rax
movl (%rax,%r13,4), %eax
leaq 0x73ac(%rip), %rcx      # 0x14378
movq (%rcx), %rcx
movslq 0x1c(%r12), %rdx
movq (%rcx,%rdx,8), %rcx
movl %eax, (%rcx,%r13,4)
incq %r13
addq $0x4, %r14
jmp 0xcfad
movq 0x20(%r15), %rdi
xorl %ebx, %ebx
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd022
movq 0x20(%r15), %rdi
movq 0x8(%rdi), %rax
movl (%rax,%rbx,4), %eax
leaq 0x736f(%rip), %rcx      # 0x14378
movq (%rcx), %rcx
movslq 0x1c(%r12), %rdx
movq (%rcx,%rdx,8), %rcx
movl %eax, (%rcx,%r14)
incq %rbx
addq $0x4, %r14
jmp 0xcfeb
movq 0x8(%r15), %rdi
addq %rbx, %r13
xorl %ebx, %ebx
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd065
movq 0x8(%r15), %rdi
movq 0x8(%rdi), %rax
movl (%rax,%rbx,4), %eax
leaq 0x732f(%rip), %rcx      # 0x14378
movq (%rcx), %rcx
movslq 0x1c(%r12), %rdx
movq (%rcx,%rdx,8), %rcx
movl %eax, (%rcx,%r13,4)
incq %r13
incq %rbx
addq $0x4, %r14
jmp 0xd02b
movq 0x18(%r15), %rdi
xorl %ebx, %ebx
movq -0x30(%rbp), %r13
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xce1d
movq 0x18(%r15), %rdi
movq 0x8(%rdi), %rax
movl (%rax,%rbx,4), %eax
leaq 0x72e7(%rip), %rcx      # 0x14378
movq (%rcx), %rcx
movslq 0x1c(%r12), %rdx
movq (%rcx,%rdx,8), %rcx
movl %eax, (%rcx,%r14)
incq %rbx
addq $0x4, %r14
jmp 0xd06f
callq 0x22d0
leaq 0x737a(%rip), %rax      # 0x14430
movsd %xmm0, (%rax)
callq 0x22d0
leaq 0x737a(%rip), %rbx      # 0x14440
movsd %xmm0, (%rbx)
callq 0x22d0
movsd %xmm0, (%rbx)
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x4(%r13), %rax
cmpq %rax, %r15
jge 0xd190
movq 0x8(%r13), %rax
movq %r15, %rbx
shlq $0x6, %rbx
cmpl $0x0, 0x30(%rax,%rbx)
jne 0xd188
leaq 0x7275(%rip), %rcx      # 0x14378
movq (%rcx), %rcx
movq (%rcx,%r15,8), %rdi
testq %rdi, %rdi
je 0xd188
addq %rax, %rbx
leaq 0x7217(%rip), %rcx      # 0x14330
movl (%rcx), %ecx
testl %ecx, %ecx
cmovlel %r14d, %ecx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xd183
movslq (%rdi,%rdx,4), %r12
testq %r12, %r12
js 0xd13d
shlq $0x6, %r12
cmpl $0x1, 0x28(%rax,%r12)
je 0xd142
incq %rdx
jmp 0xd123
addq %rax, %r12
movslq 0x1c(%r12), %rsi
movslq 0x1c(%rbx), %rdx
movq %rsi, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
movq %rdx, %r8
shlq $0x6, %r8
addq %rax, %r8
movq %r13, %rdi
callq 0x2aa8
pushq $0x1
popq %rax
movl %eax, 0x30(%r12)
movl %eax, 0x30(%rbx)
leaq 0x71fc(%rip), %rax      # 0x14378
movq (%rax), %rax
movq (%rax,%r15,8), %rdi
callq 0x2280
incq %r15
jmp 0xd0d9
leaq 0x71e1(%rip), %rax      # 0x14378
movq (%rax), %rdi
callq 0x2280
xorl %ebx, %ebx
leaq 0x7208(%rip), %rax      # 0x143b0
movq (%rax), %rdi
movq %rax, %r14
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd48a
movq 0x8(%r13), %rax
movq (%r14), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, -0x50(%rbp)
movslq (%rcx,%rbx,4), %rcx
shlq $0x6, %rcx
leaq (%rax,%rcx), %rdi
leaq 0x7190(%rip), %rdx      # 0x14370
movq (%rdx), %rdx
movq (%rdx), %rdx
movslq 0x20(%rax,%rcx), %rax
movq (%rdx,%rax,8), %r12
leaq 0x7132(%rip), %rax      # 0x14328
movsd (%rax), %xmm0
movq %rdi, -0x30(%rbp)
callq 0x6b91
movq %rax, -0x38(%rbp)
pushq $0x30
popq %rbx
movq %rbx, %rdi
callq 0x2320
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
callq 0x27ac
movq %rbx, %rdi
callq 0x2320
movq %rax, -0x48(%rbp)
movq %rax, %rdi
xorl %esi, %esi
callq 0x27ac
xorl %ebx, %ebx
movq 0x58(%r12), %rdi
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd2b7
movq 0x8(%r13), %r14
movq 0x58(%r12), %rax
movq 0x8(%rax), %rax
movslq (%rax,%rbx,4), %rax
shlq $0x6, %rax
cmpl $0x0, 0x8(%r14,%rax)
je 0xd26a
incq %rbx
jmp 0xd237
addq %rax, %r14
movq (%r14), %rsi
movq -0x38(%rbp), %rdi
callq 0x4e4e
testl %eax, %eax
je 0xd265
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq (%r14), %rsi
callq 0x61e9
leaq 0x7095(%rip), %rax      # 0x14328
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jb 0xd265
movl 0x1c(%r14), %eax
leaq 0x70b8(%rip), %rcx      # 0x14360
movq (%rcx), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0x29f0
jmp 0xd265
xorl %ebx, %ebx
movq %r15, -0x40(%rbp)
movq %r12, -0x58(%rbp)
movq 0x50(%r12), %rdi
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd3e6
leaq 0x7093(%rip), %rax      # 0x14370
movq (%rax), %rax
movq (%rax), %rax
movq 0x50(%r12), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, -0x60(%rbp)
movslq (%rcx,%rbx,4), %rcx
movq (%rax,%rcx,8), %rbx
movq 0x8(%r13), %rax
movslq 0x30(%rbx), %rcx
shlq $0x6, %rcx
movq (%rax,%rcx), %rdi
leaq 0x7019(%rip), %rax      # 0x14328
movsd (%rax), %xmm0
callq 0x6c32
movq %rax, %r14
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x5150
testl %eax, %eax
je 0xd3b9
xorl %r12d, %r12d
movq 0x58(%rbx), %rdi
callq 0x2831
cltq
cmpq %rax, %r12
jge 0xd3b9
movq %r13, %r15
movq 0x8(%r13), %r13
movq 0x58(%rbx), %rax
movq 0x8(%rax), %rax
movslq (%rax,%r12,4), %rax
shlq $0x6, %rax
cmpl $0x0, 0x8(%r13,%rax)
je 0xd369
incq %r12
movq %r15, %r13
jmp 0xd332
addq %rax, %r13
movq (%r13), %rsi
movq -0x38(%rbp), %rdi
callq 0x4e4e
testl %eax, %eax
je 0xd361
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq (%r13), %rsi
callq 0x61e9
leaq 0x6f94(%rip), %rax      # 0x14328
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
jb 0xd361
movl 0x1c(%r13), %eax
leaq 0x6fb7(%rip), %rcx      # 0x14360
movq (%rcx), %rsi
movl %eax, (%rsi)
movq -0x40(%rbp), %rdi
callq 0x29f0
jmp 0xd361
movq (%r14), %rdi
callq 0x2280
movq 0x8(%r14), %rdi
callq 0x2280
movq %r14, %rdi
callq 0x2280
movq -0x60(%rbp), %rbx
incq %rbx
movq -0x40(%rbp), %r15
movq -0x58(%rbp), %r12
jmp 0xd2c1
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x2831
cltq
cmpq %rax, %rbx
jge 0xd43d
movq 0x8(%r13), %rax
movq 0x8(%r15), %rcx
movslq (%rcx,%rbx,4), %rcx
shlq $0x6, %rcx
movslq 0x1c(%rax,%rcx), %rsi
movq -0x30(%rbp), %r14
movslq 0x1c(%r14), %rdx
movq %rsi, %rcx
shlq $0x6, %rcx
addq %rax, %rcx
movq %rdx, %r8
shlq $0x6, %r8
addq %rax, %r8
movq %r13, %rdi
callq 0x2aa8
movl $0x1, 0x30(%r14)
incq %rbx
jmp 0xd3e8
movq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x2a78
movq %r15, %rdi
callq 0x2a78
movq %r15, %rdi
callq 0x2280
movq %rbx, %rdi
callq 0x2280
movq -0x38(%rbp), %rbx
movq (%rbx), %rdi
callq 0x2280
movq 0x8(%rbx), %rdi
callq 0x2280
movq %rbx, %rdi
callq 0x2280
movq -0x50(%rbp), %rbx
incq %rbx
jmp 0xd1a1
callq 0x22d0
leaq 0x6fa2(%rip), %rax      # 0x14438
movsd %xmm0, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq