// File: 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
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movq 0x105c2(%rip), %rdi     # 0x37fa8
leaq -0x20(%rbp), %rsi
callq 0x99e0
movq 0x105b2(%rip), %rdi     # 0x37fa8
leaq -0x24(%rbp), %rsi
callq 0x9790
movq -0x8(%rbp), %rax
movslq 0x4(%rax), %rdi
movl $0x8, %esi
callq 0x9400
movq %rax, %rcx
leaq 0x10dfd(%rip), %rax     # 0x38818
movq %rcx, (%rax)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
callq 0x9880
leaq 0x10e8e(%rip), %rax     # 0x388c8
movsd %xmm0, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x28246
leaq 0x10dbc(%rip), %rax     # 0x38818
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpl $0x1, 0x2c(%rax)
je 0x27a9c
movq -0x58(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x27aa1
jmp 0x28238
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x10d19(%rip), %rax     # 0x387c8
movsd (%rax), %xmm0
xorl %eax, %eax
movl %eax, %edx
callq 0x170f0
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
movl $0x1, 0x2c(%rax)
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
leaq 0x10cf7(%rip), %rcx     # 0x387d0
cmpl (%rcx), %eax
jl 0x27ae2
jmp 0x28238
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa2b0
movl %eax, -0x158(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x158(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x154(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x154(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x150(%rbp)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x150(%rbp), %eax
addl %ecx, %eax
leaq 0x10c83(%rip), %rcx     # 0x387d0
cmpl (%rcx), %eax
jl 0x27d32
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x58(%rbp), %rax
movl $0x1, 0x28(%rax)
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x15c(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x15c(%rbp), %eax
cmpl %ecx, %eax
jge 0x27c4f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x70(%rbp), %rax
cmpl $0x1, 0x28(%rax)
je 0x27bef
movq -0x70(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x27c3f
movq -0x70(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
callq 0xf1b0
jmp 0x27c41
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x27b78
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x160(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x160(%rbp), %eax
cmpl %ecx, %eax
jge 0x27d2d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x78(%rbp), %rax
cmpl $0x1, 0x28(%rax)
je 0x27ccd
movq -0x78(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x27d1d
movq -0x78(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0x60(%rbp), %rcx
movq -0x68(%rbp), %r8
callq 0xf1b0
jmp 0x27d1f
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x27c56
jmp 0x281bf
movq -0x58(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x58(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0x27d4c
jmp 0x281bd
movq -0x58(%rbp), %rax
movl $0x0, 0x30(%rax)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x164(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x164(%rbp), %eax
cmpl %ecx, %eax
jge 0x27e51
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x27e41
movq -0x58(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x80(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %r8
callq 0xf1b0
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x80(%rbp), %rax
movl $0x1, 0x30(%rax)
jmp 0x27e51
jmp 0x27e43
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x27d5e
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x168(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x168(%rbp), %eax
cmpl %ecx, %eax
jge 0x27f4b
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x27f3b
movq -0x58(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x80(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0x88(%rbp), %rcx
movq -0x90(%rbp), %r8
callq 0xf1b0
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0x80(%rbp), %rax
movl $0x1, 0x30(%rax)
jmp 0x27f4b
jmp 0x27f3d
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x27e58
movq -0x58(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x281bb
leaq 0x10870(%rip), %rax     # 0x387d0
movslq (%rax), %rdi
shlq $0x2, %rdi
callq 0x9910
movq %rax, %rdx
leaq 0x108a2(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
leaq 0x1082a(%rip), %rcx     # 0x387d0
cmpl (%rcx), %eax
jge 0x27fdf
leaq 0x10867(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movslq -0xa4(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x27f99
movl $0x0, -0xa4(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x16c(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x16c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2805d
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x107ec(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movl -0xa4(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xa4(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x27ff0
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x170(%rbp)
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x170(%rbp), %eax
cmpl %ecx, %eax
jge 0x280d1
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x10778(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movl -0xa4(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xa4(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x28064
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x174(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x174(%rbp), %eax
cmpl %ecx, %eax
jge 0x28145
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x10704(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movl -0xa4(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xa4(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x280d8
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x178(%rbp)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x178(%rbp), %eax
cmpl %ecx, %eax
jge 0x281b9
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0x10690(%rip), %rax     # 0x38818
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x1c(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movl -0xa4(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0xa4(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2814c
jmp 0x281bb
jmp 0x281bd
jmp 0x281bf
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa7f0
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x97c0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xa7f0
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x97c0
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa7f0
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x97c0
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa7f0
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x97c0
movq -0x48(%rbp), %rdi
callq 0x97c0
movq $0x0, -0x48(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x27a45
callq 0x9880
leaq 0x1067e(%rip), %rax     # 0x388d0
movsd %xmm0, (%rax)
callq 0x9880
leaq 0x1067e(%rip), %rax     # 0x388e0
movsd %xmm0, (%rax)
callq 0x9880
leaq 0x1066e(%rip), %rax     # 0x388e0
movsd %xmm0, (%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jge 0x2841f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2840f
leaq 0x10559(%rip), %rax     # 0x38818
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x2840f
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
leaq 0x104e8(%rip), %rcx     # 0x387d0
cmpl (%rcx), %eax
jge 0x283f8
leaq 0x10521(%rip), %rax     # 0x38818
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0xc4(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x283e2
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x104f6(%rip), %rcx     # 0x38818
movq (%rcx), %rcx
movslq -0xc(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0xc4(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x283e0
movq -0xd0(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0xc0(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x38(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
movq -0xb0(%rbp), %rcx
movq -0xb8(%rbp), %r8
callq 0xf1b0
movq -0xd0(%rbp), %rax
movl $0x1, 0x30(%rax)
movq -0xc0(%rbp), %rax
movl $0x1, 0x30(%rax)
jmp 0x283f8
jmp 0x283e2
jmp 0x283e4
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x282db
leaq 0x10419(%rip), %rax     # 0x38818
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x97c0
jmp 0x28411
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2827d
leaq 0x103f2(%rip), %rax     # 0x38818
movq (%rax), %rdi
callq 0x97c0
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x17c(%rbp)
leaq 0x1040b(%rip), %rax     # 0x38850
movq (%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x17c(%rbp), %eax
cmpl %ecx, %eax
jge 0x289b3
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x103e4(%rip), %rcx     # 0x38850
movq (%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0xc(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
leaq 0x10383(%rip), %rax     # 0x38810
movq (%rax), %rax
movq (%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x20(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xf0(%rbp)
movq -0x58(%rbp), %rdi
leaq 0x10317(%rip), %rax     # 0x387c8
movsd (%rax), %xmm0
callq 0x17b40
movq %rax, -0xf8(%rbp)
movl $0x30, %edi
callq 0x9910
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
xorl %esi, %esi
callq 0xa170
movl $0x30, %edi
callq 0x9910
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rdi
xorl %esi, %esi
callq 0xa170
movl $0x30, %edi
callq 0x9910
movq %rax, -0xd8(%rbp)
movq -0x100(%rbp), %rcx
movq -0xd8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x108(%rbp), %rcx
movq -0xd8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0xf0(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0xe0(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x180(%rbp)
movq -0xf0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x180(%rbp), %eax
cmpl %ecx, %eax
jge 0x2863d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xf0(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x14(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x2862d
movq -0xf8(%rbp), %rdi
movq -0xe8(%rbp), %rax
movq (%rax), %rsi
callq 0x14380
cmpl $0x0, %eax
je 0x2862b
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0xe8(%rbp), %rax
movq (%rax), %rsi
callq 0x16af0
movaps %xmm0, %xmm1
leaq 0x101d9(%rip), %rax     # 0x387c8
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x28629
movq -0xe8(%rbp), %rax
movl 0x1c(%rax), %ecx
leaq 0x101f6(%rip), %rax     # 0x38800
movq (%rax), %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x101df(%rip), %rax     # 0x38800
movq (%rax), %rsi
callq 0xa6e0
jmp 0x2862b
jmp 0x2862d
jmp 0x2862f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x28551
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x184(%rbp)
movq -0xf0(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x184(%rbp), %eax
cmpl %ecx, %eax
jge 0x2883e
leaq 0x1019c(%rip), %rax     # 0x38810
movq (%rax), %rax
movq (%rax), %rax
movq -0xf0(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x110(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x110(%rbp), %rcx
movslq 0x30(%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
leaq 0x100fa(%rip), %rax     # 0x387c8
movsd (%rax), %xmm0
callq 0x17c20
movq %rax, -0x128(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x128(%rbp), %rsi
callq 0x148f0
cmpl $0x0, %eax
je 0x28805
movq -0x110(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0xe0(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x188(%rbp)
movq -0x110(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x188(%rbp), %eax
cmpl %ecx, %eax
jge 0x28803
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x110(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x14(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x287f3
movq -0xf8(%rbp), %rdi
movq -0x120(%rbp), %rax
movq (%rax), %rsi
callq 0x14380
cmpl $0x0, %eax
je 0x287f1
movq -0x58(%rbp), %rax
movq (%rax), %rdi
movq -0x120(%rbp), %rax
movq (%rax), %rsi
callq 0x16af0
movaps %xmm0, %xmm1
leaq 0x10013(%rip), %rax     # 0x387c8
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x287ef
movq -0x120(%rbp), %rax
movl 0x1c(%rax), %ecx
leaq 0x10030(%rip), %rax     # 0x38800
movq (%rax), %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
leaq 0x10019(%rip), %rax     # 0x38800
movq (%rax), %rsi
callq 0xa6e0
jmp 0x287f1
jmp 0x287f3
jmp 0x287f5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x28717
jmp 0x28805
movq -0x128(%rbp), %rax
movq (%rax), %rdi
callq 0x97c0
movq -0x128(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x97c0
movq -0x128(%rbp), %rdi
callq 0x97c0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x28644
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x18c(%rbp)
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa2b0
movl %eax, %ecx
movl -0x18c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2892e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xd8(%rbp), %rcx
movq 0x20(%rcx), %rcx
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x144(%rbp)
movq -0x58(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x148(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x144(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x148(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x140(%rbp)
movq -0x8(%rbp), %rdi
movl -0x144(%rbp), %esi
movl -0x148(%rbp), %edx
movq -0x138(%rbp), %rcx
movq -0x140(%rbp), %r8
callq 0xf1b0
movq -0x58(%rbp), %rax
movl $0x1, 0x30(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x28845
movq -0xd8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xa7f0
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xa7f0
movq -0xd8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x97c0
movq -0xd8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x97c0
movq -0xd8(%rbp), %rdi
callq 0x97c0
movq -0xf8(%rbp), %rax
movq (%rax), %rdi
callq 0x97c0
movq -0xf8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x97c0
movq -0xf8(%rbp), %rdi
callq 0x97c0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x28435
callq 0x9880
leaq 0xff19(%rip), %rax      # 0x388d8
movsd %xmm0, (%rax)
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopl (%rax)