/*
The data set that we are using has 4 attributes but we are using only 2 attributes.
Those 2 attributes are 1)Study Time 2) Exam Performance.
These 2 attributes will be used to calculate the student's "KnowledgeLevel"
KnowledgeLevel can be High or Low in our program but in the data set "KnowledgeLevel" has High, Low and Middle.
We will represent High as 1 and low as 0. For now we will consider Middle as High so it will be 1.
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include <cuda.h>
void readDataset(); /*<--- This function reads data set into below arrays.*/
void displayDataset();/*<--- This function will display our data set*/
__global__ void startClustering(float*,float*,float*,int,int,int,int,int,int,int,int,int,int,struct cluster*, struct cluster*);
void remapSeedValues();
void displayClusters();
int highCluster = 1, lowCluster = 1;
float study_time[260]/*<--- attribute number: 1*/, examPerformance[260]/*<--- attribute number: 2*/, targetAnswers[260]/*<---- real knowledge level: 3*/;
float ourAnswer[258]/*<--- this will store our answer for knowledge level 1 = High, 0 = Low*/;

/*sample seed value to create 2 clusters or knowledge levels*/
/*These seed values will change during different iterations*/
float svLX = 0.2, svLY = 0.2, svHX = 0.78, svHY = 0.78;
float psvLX, psvLY, psvHX, psvHY;
float seedDistance = 0.0;
/*examPerformance is on Y-axis and study_time is on X-axis*/

struct cluster
{
	float study_time;
	float exam_performance;
	float target_value;
}cluster_one[260], cluster_two[250];
int cluster_one_index = 0, cluster_two_index = 0;
__global__ void startClustering(float *study_time, float *examPerformance, float *targetAnswers,int N, int svHX, int svHY, int svLX, int svLY, int seedDistance, int lowCluster, int highCluster, int cluster_one_index, int cluster_two_index, struct cluster *cluster_one, struct cluster *cluster_two)
{
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	float distance_1, distance_2;
	
	distance_1 = (svHX-study_time[idx]) + (svHY-examPerformance[idx]);
	distance_2 = (svLX-study_time[idx]) + (svLY-examPerformance[idx]);
	
	if((distance_1 <= seedDistance) && (highCluster==1))
	{
		cluster_one[idx].study_time = study_time[idx];
		cluster_one[idx].exam_performance = examPerformance[idx];
		cluster_one[idx].target_value = targetAnswers[idx];
	}
	else if((distance_2 <= seedDistance) && (lowCluster==1))
	{
		cluster_two[idx].study_time = study_time[idx];
		cluster_two[idx].exam_performance = examPerformance[idx];
		cluster_two[idx].target_value = targetAnswers[idx];
	}
}
float calculateDistanceSerial(float x1, float x2, float y1,float y2)
{
	return abs(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
}
void startParallelProcessing()
{
	float *sT, *eP, *tA;
	struct cluster *c1, *c2;
	int N = 260;
	size_t size = N * sizeof(float);
	cudaMalloc((void **) &sT, size);
	cudaMalloc((void **) &eP, size);
	cudaMalloc((void **) &tA, size);
	cudaMemcpy(sT, study_time, size, cudaMemcpyHostToDevice);
	cudaMemcpy(eP, examPerformance, size, cudaMemcpyHostToDevice);
	cudaMemcpy(tA, targetAnswers, size, cudaMemcpyHostToDevice);	
	size = N * sizeof(struct cluster);
	cudaMalloc((void **) &c1, size);
	cudaMalloc((void **) &c2, size);
	cudaMemcpy(c1, cluster_one, size, cudaMemcpyHostToDevice);
	cudaMemcpy(c2, cluster_two, size, cudaMemcpyHostToDevice);
	int block_size = 1;
  	int n_blocks = N/block_size + (N%block_size == 0 ? 0:1);
	startClustering <<< n_blocks, block_size >>> (sT, eP, tA, N, svHX, svHY, svLX, svLY, seedDistance, lowCluster, highCluster, cluster_one_index, cluster_two_index, c1, c2);
	remapSeedValues();
	if(psvHX == svHX && psvHY == svHY)
	{
		printf("\nHigh Knowledge Cluster Seed Value Achieved Successfully.\n");
		highCluster = 0;
	}
	if(psvLX = svLX && psvLY == svLY)
	{
		printf("\nLow Knowledge Cluster Seed Value Achieved Successfully.\n");
		lowCluster = 0;
	}
	if(lowCluster==1 || highCluster==1)
	{
		startClustering <<< n_blocks, block_size >>> (sT, eP, tA, N, svHX, svHY, svLX, svLY, seedDistance, lowCluster, highCluster, cluster_one_index, cluster_two_index, c1, c2);
	}
	cudaMemcpy(cluster_one, c1, sizeof(struct cluster)*N, cudaMemcpyDeviceToHost);
	cudaMemcpy(cluster_two, c2, sizeof(struct cluster)*N, cudaMemcpyDeviceToHost);
	cudaFree(sT);
	cudaFree(eP);
	cudaFree(tA);
	cudaFree(c1);
	cudaFree(c2);
}
int main()
{
	//freopen("output.txt","w",stdout);
	readDataset();
	psvLX = svLX; psvLY = svLY; psvHX = svHX; psvHY = svHY;
	seedDistance = calculateDistanceSerial(svLX,svHX,svLY,svHY);
	displayDataset();
	startParallelProcessing();
	displayClusters();
	return 0;
}
void remapSeedValues()
{
	int counter, count = 0;
	float StudyTime = 0, ExamPerformance = 0;
	psvHX = svHX;
	psvHY = svHY;
	psvLX = svLX;
	psvLY = svLY;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_one[counter].study_time==0 && cluster_one[counter].exam_performance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].exam_performance + ExamPerformance;
	}
	svHX = StudyTime/count;
	svHY = ExamPerformance/count;
	ExamPerformance = StudyTime = 0;
	count = 0;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_two[counter].study_time==0 && cluster_two[counter].exam_performance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].exam_performance + ExamPerformance;
	}
	svLX = StudyTime/count;
	svLY = ExamPerformance/count;
	printf("\nPrevious Low X: %f\tNew Low X: %f\nPrevious Low Y: %f\tNew Low Y: %f\n",psvLX,svLX,psvLY,svLY);
	printf("\nPrevious High X: %f\tNew High X: %f\nPrevious High Y: %f\tNew High Y: %f\n",psvHX,svHX,psvHY,svHY);
	seedDistance = calculateDistanceSerial(svLX,svHX,svLY,svHY);
	/*count = 0;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_three[counter].study_time==0 && cluster_three[counter].examPerformance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].examPerformance + ExamPerformance;
	}*/
}
void readDataset()
{
	FILE *ptr_file;
    char buf[1000];
	ptr_file =fopen("input.txt","r");
    if (!ptr_file)
	{
		printf("Requested Input File Not Found :(");
		return;
	}
	
	int studyTimeIndex = 0, examPerformanceIndex = 0, targetAnswersIndex = 0;
	
	while (fgets(buf,1000, ptr_file)!=NULL)
	{
		int counter;
		char *p = strtok(buf,"\t");
		for(counter = 0;counter<=5 && p!=NULL;counter++)
		{
			if(p!=NULL)
			{
				switch(counter)
				{
					case 0:
						study_time[studyTimeIndex++] = atof(p);
						break;
					case 4:
						examPerformance[examPerformanceIndex++] = atof(p);
						break;
					case 5:
						if(strcmp(p,"High")==0 || strcmp(p,"Middle")==0)
						{
							targetAnswers[targetAnswersIndex++] = 1;
						}
						else
						{
							targetAnswers[targetAnswersIndex++] = 0;
						}
						break;
					default:
						break;
				}
			}
			p = strtok(NULL,"\t");
		}
	}
	fclose(ptr_file);
}
void displayDataset()
{
	printf("\n\nDisplaying Dataset Entries\n\nStudy Time\tExam Performance\tKnowledge Level\n\n");
	int counter = 0;
	for(counter = 0;counter<259;counter++)
	{
		printf("%f\t%f\t\t%f\n",study_time[counter],examPerformance[counter],targetAnswers[counter]);
	}
	printf("\n\nEnd of Displaying Dataset\n\n");
}
void displayClusters()
{
	int counter, total_ones = 0, total_zeroes = 0, total = 0;
	printf("\n\nDisplaying Cluster of Users with High KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n");
	for(counter = 2;counter<260;counter++)
	{
		if(cluster_one[counter].study_time==0 && cluster_one[counter].exam_performance==0)
		{
			break;
		}
		if(cluster_one[counter].target_value==1.0)
		{
			total_ones++;
		}
		if(cluster_one[counter].target_value==0.0)
		{
			total_zeroes++;
		}
		total++;
		printf("%f\t%f\t\t%f\n",cluster_one[counter].study_time, cluster_one[counter].exam_performance, cluster_one[counter].target_value);
	}
	printf("\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n",total,total_zeroes,total_ones);
	printf("-------------------------------------------------------------------------------");
	printf("\n\nDisplaying Cluster of Users with Low KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n");
	total = total_zeroes = total_ones = 0;	
	for(counter = 0;counter<260;counter++)
	{
		if(cluster_two[counter].study_time==0 && cluster_two[counter].exam_performance==0)
		{
			break;
		}
		if(cluster_two[counter].target_value==1.0)
		{
			total_ones++;
		}
		if(cluster_two[counter].target_value==0.0)
		{
			total_zeroes++;
		}
		total++;
		printf("%f\t%f\t\t%f\n",cluster_two[counter].study_time, cluster_two[counter].exam_performance, cluster_two[counter].target_value);
	}
	printf("\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n",total,total_zeroes,total_ones);
	printf("--------------------------------------------------------------------------------");
}

	.file	"tmpxft_00357192_00000000-6_project_3.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2036:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2036:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z23calculateDistanceSerialffff
	.type	_Z23calculateDistanceSerialffff, @function
_Z23calculateDistanceSerialffff:
.LFB2027:
	.cfi_startproc
	endbr64
	subss	%xmm0, %xmm1
	subss	%xmm2, %xmm3
	mulss	%xmm1, %xmm1
	mulss	%xmm3, %xmm3
	movaps	%xmm1, %xmm0
	addss	%xmm3, %xmm0
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z23calculateDistanceSerialffff, .-_Z23calculateDistanceSerialffff
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"\nPrevious Low X: %f\tNew Low X: %f\nPrevious Low Y: %f\tNew Low Y: %f\n"
.LC2:
	.string	"\nPrevious High X: %f\tNew High X: %f\nPrevious High Y: %f\tNew High Y: %f\n"
	.text
	.globl	_Z15remapSeedValuesv
	.type	_Z15remapSeedValuesv, @function
_Z15remapSeedValuesv:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rdx
	.cfi_def_cfa_offset 16
	movss	svHX(%rip), %xmm0
	xorps	%xmm1, %xmm1
	xorl	%edx, %edx
	movss	svLY(%rip), %xmm2
	leaq	cluster_one(%rip), %rax
	movaps	%xmm1, %xmm3
	movaps	%xmm1, %xmm6
	movss	%xmm0, psvHX(%rip)
	movss	svHY(%rip), %xmm0
	movq	%rax, %rsi
	movss	%xmm2, psvLY(%rip)
	movss	%xmm0, psvHY(%rip)
	movss	svLX(%rip), %xmm0
	movss	%xmm0, psvLX(%rip)
.L8:
	movss	24(%rax), %xmm5
	movss	28(%rax), %xmm4
	ucomiss	%xmm6, %xmm5
	jp	.L4
	jne	.L4
	ucomiss	%xmm6, %xmm4
	jp	.L4
	je	.L6
.L4:
	incl	%edx
	addss	%xmm5, %xmm3
	addss	%xmm4, %xmm1
	addq	$12, %rax
	cmpl	$258, %edx
	jne	.L8
.L6:
	cvtsi2ssl	%edx, %xmm4
	leaq	cluster_two(%rip), %rcx
	movl	$24, %eax
	xorl	%edx, %edx
	leaq	4(%rcx), %rdi
	leaq	4+cluster_one(%rip), %r8
	divss	%xmm4, %xmm3
	divss	%xmm4, %xmm1
	movss	%xmm3, svHX(%rip)
	xorps	%xmm3, %xmm3
	movaps	%xmm3, %xmm4
	movss	%xmm1, svHY(%rip)
	movaps	%xmm3, %xmm1
.L9:
	ucomiss	(%rcx,%rax), %xmm4
	jnp	.L19
.L14:
	addss	(%rsi,%rax), %xmm1
	addss	(%r8,%rax), %xmm3
	incl	%edx
	addq	$12, %rax
	jmp	.L9
.L19:
	jne	.L14
	ucomiss	(%rdi,%rax), %xmm4
	jp	.L14
	jne	.L14
	cvtsi2ssl	%edx, %xmm4
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	movb	$4, %al
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm2, %xmm2
	divss	%xmm4, %xmm1
	divss	%xmm4, %xmm3
	movss	%xmm1, svLX(%rip)
	cvtss2sd	%xmm1, %xmm1
	movss	%xmm3, svLY(%rip)
	cvtss2sd	%xmm3, %xmm3
	call	__printf_chk@PLT
	leaq	.LC2(%rip), %rsi
	movb	$4, %al
	movl	$2, %edi
	cvtss2sd	psvHX(%rip), %xmm0
	cvtss2sd	svHX(%rip), %xmm1
	cvtss2sd	svHY(%rip), %xmm3
	cvtss2sd	psvHY(%rip), %xmm2
	call	__printf_chk@PLT
	movss	svHX(%rip), %xmm0
	movss	svHY(%rip), %xmm1
	subss	svLX(%rip), %xmm0
	subss	svLY(%rip), %xmm1
	mulss	%xmm0, %xmm0
	mulss	%xmm1, %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, seedDistance(%rip)
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z15remapSeedValuesv, .-_Z15remapSeedValuesv
	.section	.rodata.str1.1
.LC3:
	.string	"r"
.LC4:
	.string	"input.txt"
.LC5:
	.string	"Requested Input File Not Found :("
.LC6:
	.string	"\t"
.LC7:
	.string	"High"
.LC8:
	.string	"Middle"
	.text
	.globl	_Z11readDatasetv
	.type	_Z11readDatasetv, @function
_Z11readDatasetv:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC3(%rip), %rsi
	leaq	.LC4(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1032, %rsp
	.cfi_def_cfa_offset 1088
	movq	%fs:40, %rax
	movq	%rax, 1016(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	testq	%rax, %rax
	jne	.L33
	movq	1016(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$1032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
.L33:
	.cfi_restore_state
	movq	%rax, %r12
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
.L21:
	leaq	16(%rsp), %rbp
	movq	%r12, %rcx
	movl	$1000, %edx
	movl	$1000, %esi
	movq	%rbp, %rdi
	call	__fgets_chk@PLT
	testq	%rax, %rax
	je	.L44
	movq	%rbp, %rdi
	leaq	.LC6(%rip), %rsi
	xorl	%ebp, %ebp
	call	strtok@PLT
	leaq	examPerformance(%rip), %r15
	movq	%rax, %rdi
.L23:
	cmpl	$5, %ebp
	jg	.L21
	testq	%rdi, %rdi
	je	.L21
	cmpl	$4, %ebp
	je	.L24
	cmpl	$5, %ebp
	je	.L25
	testl	%ebp, %ebp
	jne	.L26
	call	atof@PLT
	movslq	%r13d, %rdx
	leaq	study_time(%rip), %rax
	incl	%r13d
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rax,%rdx,4)
	jmp	.L26
.L24:
	call	atof@PLT
	movslq	%r14d, %rax
	incl	%r14d
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%r15,%rax,4)
	jmp	.L26
.L25:
	leaq	.LC7(%rip), %rsi
	movq	%rdi, 8(%rsp)
	call	strcmp@PLT
	leal	1(%rbx), %edx
	leaq	targetAnswers(%rip), %rcx
	testl	%eax, %eax
	je	.L27
	movq	8(%rsp), %rdi
	leaq	.LC8(%rip), %rsi
	movl	%edx, 4(%rsp)
	call	strcmp@PLT
	movl	4(%rsp), %edx
	leaq	targetAnswers(%rip), %rcx
	testl	%eax, %eax
	jne	.L28
.L27:
	movl	$0x3f800000, (%rcx,%rbx,4)
	jmp	.L42
.L28:
	movl	$0x00000000, (%rcx,%rbx,4)
.L42:
	movslq	%edx, %rbx
.L26:
	xorl	%edi, %edi
	leaq	.LC6(%rip), %rsi
	incl	%ebp
	call	strtok@PLT
	movq	%rax, %rdi
	jmp	.L23
.L44:
	movq	%r12, %rdi
	call	fclose@PLT
	movq	1016(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
.L43:
	call	__stack_chk_fail@PLT
.L32:
	addq	$1032, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z11readDatasetv, .-_Z11readDatasetv
	.section	.rodata.str1.1
.LC10:
	.string	"\n\nDisplaying Dataset Entries\n\nStudy Time\tExam Performance\tKnowledge Level\n\n"
.LC11:
	.string	"%f\t%f\t\t%f\n"
.LC12:
	.string	"\n\nEnd of Displaying Dataset\n\n"
	.text
	.globl	_Z14displayDatasetv
	.type	_Z14displayDatasetv, @function
_Z14displayDatasetv:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	targetAnswers(%rip), %rbp
	xorl	%ebx, %ebx
	pushq	%rcx
	.cfi_def_cfa_offset 32
	call	__printf_chk@PLT
.L46:
	leaq	study_time(%rip), %rax
	cvtss2sd	0(%rbp,%rbx), %xmm2
	movl	$2, %edi
	leaq	.LC11(%rip), %rsi
	cvtss2sd	(%rax,%rbx), %xmm0
	leaq	examPerformance(%rip), %rax
	cvtss2sd	(%rax,%rbx), %xmm1
	movb	$3, %al
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	$1036, %rbx
	jne	.L46
	popq	%rdx
	.cfi_def_cfa_offset 24
	leaq	.LC12(%rip), %rsi
	popq	%rbx
	.cfi_def_cfa_offset 16
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2032:
	.size	_Z14displayDatasetv, .-_Z14displayDatasetv
	.section	.rodata.str1.1
.LC13:
	.string	"\n\nDisplaying Cluster of Users with High KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n"
.LC14:
	.string	"\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n"
.LC15:
	.string	"-------------------------------------------------------------------------------"
.LC16:
	.string	"\n\nDisplaying Cluster of Users with Low KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n"
.LC17:
	.string	"--------------------------------------------------------------------------------"
	.text
	.globl	_Z15displayClustersv
	.type	_Z15displayClustersv, @function
_Z15displayClustersv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	cluster_one(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	call	__printf_chk@PLT
	xorl	%r8d, %r8d
.L58:
	movss	24(%rbx), %xmm0
	xorps	%xmm2, %xmm2
	movss	28(%rbx), %xmm1
	ucomiss	%xmm2, %xmm0
	jp	.L50
	jne	.L50
	ucomiss	%xmm2, %xmm1
	jp	.L50
	je	.L52
.L50:
	movss	32(%rbx), %xmm2
	ucomiss	.LC9(%rip), %xmm2
	jp	.L54
	jne	.L54
	incl	%r8d
	jmp	.L56
.L54:
	xorps	%xmm3, %xmm3
	ucomiss	%xmm3, %xmm2
	jp	.L56
	jne	.L56
	incl	%r12d
.L56:
	incl	%ebp
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	movb	$3, %al
	addq	$12, %rbx
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm2, %xmm2
	cvtss2sd	%xmm1, %xmm1
	movl	%r8d, 12(%rsp)
	call	__printf_chk@PLT
	cmpl	$258, %ebp
	movl	12(%rsp), %r8d
	jne	.L58
.L52:
	leaq	.LC14(%rip), %r13
	movl	%r12d, %ecx
	movl	%ebp, %edx
	xorl	%eax, %eax
	movq	%r13, %rsi
	movl	$2, %edi
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	call	__printf_chk@PLT
	leaq	.LC15(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	.LC16(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	leaq	cluster_two(%rip), %rbx
	xorl	%r8d, %r8d
.L59:
	movss	(%rbx), %xmm0
	xorps	%xmm2, %xmm2
	movss	4(%rbx), %xmm1
	ucomiss	%xmm2, %xmm0
	jnp	.L76
.L68:
	movss	8(%rbx), %xmm2
	ucomiss	.LC9(%rip), %xmm2
	jp	.L62
	jne	.L62
	incl	%r8d
	jmp	.L64
.L62:
	xorps	%xmm3, %xmm3
	ucomiss	%xmm3, %xmm2
	jp	.L64
	jne	.L64
	incl	%r12d
.L64:
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	movb	$3, %al
	incl	%ebp
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm2, %xmm2
	cvtss2sd	%xmm1, %xmm1
	addq	$12, %rbx
	movl	%r8d, 12(%rsp)
	call	__printf_chk@PLT
	movl	12(%rsp), %r8d
	jmp	.L59
.L76:
	jne	.L68
	ucomiss	%xmm2, %xmm1
	jp	.L68
	jne	.L68
	movq	%r13, %rsi
	movl	%r12d, %ecx
	movl	%ebp, %edx
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %rsp
	.cfi_def_cfa_offset 40
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	leaq	.LC17(%rip), %rsi
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2033:
	.size	_Z15displayClustersv, .-_Z15displayClustersv
	.globl	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_
	.type	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_, @function
_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_:
.LFB2058:
	.cfi_startproc
	endbr64
	subq	$264, %rsp
	.cfi_def_cfa_offset 272
	movq	328(%rsp), %rax
	movq	%rdi, 56(%rsp)
	leaq	80(%rsp), %rdi
	movq	%rsi, 48(%rsp)
	leaq	92(%rsp), %rsi
	movq	%rax, 16(%rsp)
	movq	336(%rsp), %rax
	movq	%rdx, 40(%rsp)
	leaq	64(%rsp), %rdx
	movl	%ecx, 36(%rsp)
	leaq	72(%rsp), %rcx
	movl	%r8d, 32(%rsp)
	movl	%r9d, 28(%rsp)
	movq	%rax, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 248(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rax
	movl	$1, 88(%rsp)
	movq	%rax, 128(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 160(%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 168(%rsp)
	leaq	272(%rsp), %rax
	movq	%rax, 176(%rsp)
	leaq	280(%rsp), %rax
	movq	%rax, 184(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 192(%rsp)
	leaq	296(%rsp), %rax
	movq	%rax, 200(%rsp)
	leaq	304(%rsp), %rax
	movq	%rax, 208(%rsp)
	leaq	312(%rsp), %rax
	movq	%rax, 216(%rsp)
	leaq	320(%rsp), %rax
	movq	%rax, 224(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 232(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 240(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 80(%rsp)
	movq	%rax, 92(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L77
	pushq	72(%rsp)
	.cfi_def_cfa_offset 280
	leaq	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_(%rip), %rdi
	pushq	72(%rsp)
	.cfi_def_cfa_offset 288
	movq	108(%rsp), %rcx
	movl	116(%rsp), %r8d
	movq	96(%rsp), %rsi
	movl	104(%rsp), %edx
	leaq	144(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 280
	popq	%rdx
	.cfi_def_cfa_offset 272
.L77:
	movq	248(%rsp), %rax
	subq	%fs:40, %rax
	je	.L79
	call	__stack_chk_fail@PLT
.L79:
	addq	$264, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2058:
	.size	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_, .-_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_
	.globl	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.type	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, @function
_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_:
.LFB2059:
	.cfi_startproc
	endbr64
	jmp	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_
	.cfi_endproc
.LFE2059:
	.size	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, .-_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.section	.rodata.str1.1
.LC18:
	.string	"\nHigh Knowledge Cluster Seed Value Achieved Successfully.\n"
.LC19:
	.string	"\nLow Knowledge Cluster Seed Value Achieved Successfully.\n"
	.text
	.globl	_Z23startParallelProcessingv
	.type	_Z23startParallelProcessingv, @function
_Z23startParallelProcessingv:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$1040, %esi
	leaq	cluster_one(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	cluster_two(%rip), %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdi
	call	cudaMalloc@PLT
	leaq	16(%rsp), %rdi
	movl	$1040, %esi
	call	cudaMalloc@PLT
	leaq	24(%rsp), %rdi
	movl	$1040, %esi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	movl	$1, %ecx
	movl	$1040, %edx
	leaq	study_time(%rip), %rsi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movl	$1040, %edx
	leaq	examPerformance(%rip), %rsi
	call	cudaMemcpy@PLT
	movq	24(%rsp), %rdi
	movl	$1, %ecx
	movl	$1040, %edx
	leaq	targetAnswers(%rip), %rsi
	call	cudaMemcpy@PLT
	leaq	32(%rsp), %rdi
	movl	$3120, %esi
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$3120, %esi
	call	cudaMalloc@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$3120, %edx
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbx, %rsi
	movl	$3120, %edx
	call	cudaMemcpy@PLT
	movl	$1073741889, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$2, %rdi
	movl	$1, %ecx
	movabsq	$4294967297, %rdx
	movl	$1, %esi
	movq	%rdx, 60(%rsp)
	movl	$1, 68(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L83
	movl	cluster_two_index(%rip), %eax
	pushq	%rsi
	.cfi_def_cfa_offset 120
	movl	$260, %ecx
	cvttss2sil	svHY(%rip), %r9d
	pushq	48(%rsp)
	.cfi_def_cfa_offset 128
	cvttss2sil	svHX(%rip), %r8d
	pushq	48(%rsp)
	.cfi_def_cfa_offset 136
	pushq	%rax
	.cfi_def_cfa_offset 144
	movl	cluster_one_index(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 152
	movl	highCluster(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 160
	movl	lowCluster(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 168
	cvttss2sil	seedDistance(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 176
	cvttss2sil	svLY(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 184
	cvttss2sil	svLX(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 192
	movq	104(%rsp), %rdx
	movq	96(%rsp), %rsi
	movq	88(%rsp), %rdi
	call	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_
	addq	$80, %rsp
	.cfi_def_cfa_offset 112
.L83:
	call	_Z15remapSeedValuesv
	movss	psvHX(%rip), %xmm0
	ucomiss	svHX(%rip), %xmm0
	jp	.L84
	jne	.L84
	movss	psvHY(%rip), %xmm0
	ucomiss	svHY(%rip), %xmm0
	jp	.L84
	jne	.L84
	leaq	.LC18(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%ecx, %ecx
	movl	%ecx, highCluster(%rip)
.L84:
	xorps	%xmm0, %xmm0
	ucomiss	svLX(%rip), %xmm0
	jp	.L99
	movb	$0, %al
	je	.L87
.L99:
	movss	psvLY(%rip), %xmm0
	ucomiss	svLY(%rip), %xmm0
	movb	$0, %dl
	setnp	%al
	cmovne	%edx, %eax
.L87:
	movzbl	%al, %edx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, psvLX(%rip)
	testb	%al, %al
	je	.L89
	leaq	.LC19(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%edx, %edx
	movl	%edx, lowCluster(%rip)
	jmp	.L90
.L89:
	cmpl	$1, lowCluster(%rip)
	jne	.L90
.L93:
	movl	$1073741889, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	salq	$2, %rdi
	movl	$1, %esi
	movabsq	$4294967297, %rdx
	movl	$1, 68(%rsp)
	movq	%rdx, 60(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L94
	pushq	%rax
	.cfi_def_cfa_offset 120
	movl	cluster_two_index(%rip), %eax
	movl	$260, %ecx
	cvttss2sil	svHY(%rip), %r9d
	pushq	48(%rsp)
	.cfi_def_cfa_offset 128
	cvttss2sil	svHX(%rip), %r8d
	pushq	48(%rsp)
	.cfi_def_cfa_offset 136
	pushq	%rax
	.cfi_def_cfa_offset 144
	movl	cluster_one_index(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 152
	movl	highCluster(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 160
	movl	lowCluster(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 168
	cvttss2sil	seedDistance(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 176
	cvttss2sil	svLY(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 184
	cvttss2sil	svLX(%rip), %eax
	pushq	%rax
	.cfi_def_cfa_offset 192
	movq	104(%rsp), %rdx
	movq	96(%rsp), %rsi
	movq	88(%rsp), %rdi
	call	_Z61__device_stub__Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_PfS_S_iiiiiiiiiiP7clusterS1_
	addq	$80, %rsp
	.cfi_def_cfa_offset 112
	jmp	.L94
.L90:
	cmpl	$1, highCluster(%rip)
	je	.L93
.L94:
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movl	$3120, %edx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdi
	movl	$3120, %edx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L95
	call	__stack_chk_fail@PLT
.L95:
	addq	$88, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z23startParallelProcessingv, .-_Z23startParallelProcessingv
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z11readDatasetv
	movss	svLX(%rip), %xmm3
	movss	svLY(%rip), %xmm2
	movss	svHX(%rip), %xmm0
	movss	svHY(%rip), %xmm1
	movss	%xmm3, psvLX(%rip)
	movss	%xmm0, psvHX(%rip)
	subss	%xmm3, %xmm0
	movss	%xmm1, psvHY(%rip)
	subss	%xmm2, %xmm1
	movss	%xmm2, psvLY(%rip)
	mulss	%xmm0, %xmm0
	mulss	%xmm1, %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, seedDistance(%rip)
	call	_Z14displayDatasetv
	call	_Z23startParallelProcessingv
	call	_Z15displayClustersv
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2029:
	.size	main, .-main
	.section	.rodata.str1.1
.LC20:
	.string	"_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2061:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC20(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2061:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	cluster_two_index
	.bss
	.align 4
	.type	cluster_two_index, @object
	.size	cluster_two_index, 4
cluster_two_index:
	.zero	4
	.globl	cluster_one_index
	.align 4
	.type	cluster_one_index, @object
	.size	cluster_one_index, 4
cluster_one_index:
	.zero	4
	.globl	cluster_two
	.align 32
	.type	cluster_two, @object
	.size	cluster_two, 3000
cluster_two:
	.zero	3000
	.globl	cluster_one
	.align 32
	.type	cluster_one, @object
	.size	cluster_one, 3120
cluster_one:
	.zero	3120
	.globl	seedDistance
	.align 4
	.type	seedDistance, @object
	.size	seedDistance, 4
seedDistance:
	.zero	4
	.globl	psvHY
	.align 4
	.type	psvHY, @object
	.size	psvHY, 4
psvHY:
	.zero	4
	.globl	psvHX
	.align 4
	.type	psvHX, @object
	.size	psvHX, 4
psvHX:
	.zero	4
	.globl	psvLY
	.align 4
	.type	psvLY, @object
	.size	psvLY, 4
psvLY:
	.zero	4
	.globl	psvLX
	.align 4
	.type	psvLX, @object
	.size	psvLX, 4
psvLX:
	.zero	4
	.globl	svHY
	.data
	.align 4
	.type	svHY, @object
	.size	svHY, 4
svHY:
	.long	1061662228
	.globl	svHX
	.align 4
	.type	svHX, @object
	.size	svHX, 4
svHX:
	.long	1061662228
	.globl	svLY
	.align 4
	.type	svLY, @object
	.size	svLY, 4
svLY:
	.long	1045220557
	.globl	svLX
	.align 4
	.type	svLX, @object
	.size	svLX, 4
svLX:
	.long	1045220557
	.globl	ourAnswer
	.bss
	.align 32
	.type	ourAnswer, @object
	.size	ourAnswer, 1032
ourAnswer:
	.zero	1032
	.globl	targetAnswers
	.align 32
	.type	targetAnswers, @object
	.size	targetAnswers, 1040
targetAnswers:
	.zero	1040
	.globl	examPerformance
	.align 32
	.type	examPerformance, @object
	.size	examPerformance, 1040
examPerformance:
	.zero	1040
	.globl	study_time
	.align 32
	.type	study_time, @object
	.size	study_time, 1040
study_time:
	.zero	1040
	.globl	lowCluster
	.data
	.align 4
	.type	lowCluster, @object
	.size	lowCluster, 4
lowCluster:
	.long	1
	.globl	highCluster
	.align 4
	.type	highCluster, @object
	.size	highCluster, 4
highCluster:
	.long	1
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC9:
	.long	1065353216
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/*
The data set that we are using has 4 attributes but we are using only 2 attributes.
Those 2 attributes are 1)Study Time 2) Exam Performance.
These 2 attributes will be used to calculate the student's "KnowledgeLevel"
KnowledgeLevel can be High or Low in our program but in the data set "KnowledgeLevel" has High, Low and Middle.
We will represent High as 1 and low as 0. For now we will consider Middle as High so it will be 1.
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include <hip/hip_runtime.h>
void readDataset(); /*<--- This function reads data set into below arrays.*/
void displayDataset();/*<--- This function will display our data set*/
__global__ void startClustering(float*,float*,float*,int,int,int,int,int,int,int,int,int,int,struct cluster*, struct cluster*);
void remapSeedValues();
void displayClusters();
int highCluster = 1, lowCluster = 1;
float study_time[260]/*<--- attribute number: 1*/, examPerformance[260]/*<--- attribute number: 2*/, targetAnswers[260]/*<---- real knowledge level: 3*/;
float ourAnswer[258]/*<--- this will store our answer for knowledge level 1 = High, 0 = Low*/;

/*sample seed value to create 2 clusters or knowledge levels*/
/*These seed values will change during different iterations*/
float svLX = 0.2, svLY = 0.2, svHX = 0.78, svHY = 0.78;
float psvLX, psvLY, psvHX, psvHY;
float seedDistance = 0.0;
/*examPerformance is on Y-axis and study_time is on X-axis*/

struct cluster
{
	float study_time;
	float exam_performance;
	float target_value;
}cluster_one[260], cluster_two[250];
int cluster_one_index = 0, cluster_two_index = 0;
__global__ void startClustering(float *study_time, float *examPerformance, float *targetAnswers,int N, int svHX, int svHY, int svLX, int svLY, int seedDistance, int lowCluster, int highCluster, int cluster_one_index, int cluster_two_index, struct cluster *cluster_one, struct cluster *cluster_two)
{
	int idx = blockIdx.x * blockDim.x + threadIdx.x;
	float distance_1, distance_2;
	
	distance_1 = (svHX-study_time[idx]) + (svHY-examPerformance[idx]);
	distance_2 = (svLX-study_time[idx]) + (svLY-examPerformance[idx]);
	
	if((distance_1 <= seedDistance) && (highCluster==1))
	{
		cluster_one[idx].study_time = study_time[idx];
		cluster_one[idx].exam_performance = examPerformance[idx];
		cluster_one[idx].target_value = targetAnswers[idx];
	}
	else if((distance_2 <= seedDistance) && (lowCluster==1))
	{
		cluster_two[idx].study_time = study_time[idx];
		cluster_two[idx].exam_performance = examPerformance[idx];
		cluster_two[idx].target_value = targetAnswers[idx];
	}
}
float calculateDistanceSerial(float x1, float x2, float y1,float y2)
{
	return abs(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
}
void startParallelProcessing()
{
	float *sT, *eP, *tA;
	struct cluster *c1, *c2;
	int N = 260;
	size_t size = N * sizeof(float);
	hipMalloc((void **) &sT, size);
	hipMalloc((void **) &eP, size);
	hipMalloc((void **) &tA, size);
	hipMemcpy(sT, study_time, size, hipMemcpyHostToDevice);
	hipMemcpy(eP, examPerformance, size, hipMemcpyHostToDevice);
	hipMemcpy(tA, targetAnswers, size, hipMemcpyHostToDevice);	
	size = N * sizeof(struct cluster);
	hipMalloc((void **) &c1, size);
	hipMalloc((void **) &c2, size);
	hipMemcpy(c1, cluster_one, size, hipMemcpyHostToDevice);
	hipMemcpy(c2, cluster_two, size, hipMemcpyHostToDevice);
	int block_size = 1;
  	int n_blocks = N/block_size + (N%block_size == 0 ? 0:1);
	startClustering <<< n_blocks, block_size >>> (sT, eP, tA, N, svHX, svHY, svLX, svLY, seedDistance, lowCluster, highCluster, cluster_one_index, cluster_two_index, c1, c2);
	remapSeedValues();
	if(psvHX == svHX && psvHY == svHY)
	{
		printf("\nHigh Knowledge Cluster Seed Value Achieved Successfully.\n");
		highCluster = 0;
	}
	if(psvLX = svLX && psvLY == svLY)
	{
		printf("\nLow Knowledge Cluster Seed Value Achieved Successfully.\n");
		lowCluster = 0;
	}
	if(lowCluster==1 || highCluster==1)
	{
		startClustering <<< n_blocks, block_size >>> (sT, eP, tA, N, svHX, svHY, svLX, svLY, seedDistance, lowCluster, highCluster, cluster_one_index, cluster_two_index, c1, c2);
	}
	hipMemcpy(cluster_one, c1, sizeof(struct cluster)*N, hipMemcpyDeviceToHost);
	hipMemcpy(cluster_two, c2, sizeof(struct cluster)*N, hipMemcpyDeviceToHost);
	hipFree(sT);
	hipFree(eP);
	hipFree(tA);
	hipFree(c1);
	hipFree(c2);
}
int main()
{
	//freopen("output.txt","w",stdout);
	readDataset();
	psvLX = svLX; psvLY = svLY; psvHX = svHX; psvHY = svHY;
	seedDistance = calculateDistanceSerial(svLX,svHX,svLY,svHY);
	displayDataset();
	startParallelProcessing();
	displayClusters();
	return 0;
}
void remapSeedValues()
{
	int counter, count = 0;
	float StudyTime = 0, ExamPerformance = 0;
	psvHX = svHX;
	psvHY = svHY;
	psvLX = svLX;
	psvLY = svLY;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_one[counter].study_time==0 && cluster_one[counter].exam_performance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].exam_performance + ExamPerformance;
	}
	svHX = StudyTime/count;
	svHY = ExamPerformance/count;
	ExamPerformance = StudyTime = 0;
	count = 0;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_two[counter].study_time==0 && cluster_two[counter].exam_performance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].exam_performance + ExamPerformance;
	}
	svLX = StudyTime/count;
	svLY = ExamPerformance/count;
	printf("\nPrevious Low X: %f\tNew Low X: %f\nPrevious Low Y: %f\tNew Low Y: %f\n",psvLX,svLX,psvLY,svLY);
	printf("\nPrevious High X: %f\tNew High X: %f\nPrevious High Y: %f\tNew High Y: %f\n",psvHX,svHX,psvHY,svHY);
	seedDistance = calculateDistanceSerial(svLX,svHX,svLY,svHY);
	/*count = 0;
	for(counter=2;counter<260;counter++)
	{
		if(cluster_three[counter].study_time==0 && cluster_three[counter].examPerformance==0)
		{
			break;
		}
		count++;
		StudyTime = cluster_one[counter].study_time + StudyTime;
		ExamPerformance = cluster_one[counter].examPerformance + ExamPerformance;
	}*/
}
void readDataset()
{
	FILE *ptr_file;
    char buf[1000];
	ptr_file =fopen("input.txt","r");
    if (!ptr_file)
	{
		printf("Requested Input File Not Found :(");
		return;
	}
	
	int studyTimeIndex = 0, examPerformanceIndex = 0, targetAnswersIndex = 0;
	
	while (fgets(buf,1000, ptr_file)!=NULL)
	{
		int counter;
		char *p = strtok(buf,"\t");
		for(counter = 0;counter<=5 && p!=NULL;counter++)
		{
			if(p!=NULL)
			{
				switch(counter)
				{
					case 0:
						study_time[studyTimeIndex++] = atof(p);
						break;
					case 4:
						examPerformance[examPerformanceIndex++] = atof(p);
						break;
					case 5:
						if(strcmp(p,"High")==0 || strcmp(p,"Middle")==0)
						{
							targetAnswers[targetAnswersIndex++] = 1;
						}
						else
						{
							targetAnswers[targetAnswersIndex++] = 0;
						}
						break;
					default:
						break;
				}
			}
			p = strtok(NULL,"\t");
		}
	}
	fclose(ptr_file);
}
void displayDataset()
{
	printf("\n\nDisplaying Dataset Entries\n\nStudy Time\tExam Performance\tKnowledge Level\n\n");
	int counter = 0;
	for(counter = 0;counter<259;counter++)
	{
		printf("%f\t%f\t\t%f\n",study_time[counter],examPerformance[counter],targetAnswers[counter]);
	}
	printf("\n\nEnd of Displaying Dataset\n\n");
}
void displayClusters()
{
	int counter, total_ones = 0, total_zeroes = 0, total = 0;
	printf("\n\nDisplaying Cluster of Users with High KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n");
	for(counter = 2;counter<260;counter++)
	{
		if(cluster_one[counter].study_time==0 && cluster_one[counter].exam_performance==0)
		{
			break;
		}
		if(cluster_one[counter].target_value==1.0)
		{
			total_ones++;
		}
		if(cluster_one[counter].target_value==0.0)
		{
			total_zeroes++;
		}
		total++;
		printf("%f\t%f\t\t%f\n",cluster_one[counter].study_time, cluster_one[counter].exam_performance, cluster_one[counter].target_value);
	}
	printf("\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n",total,total_zeroes,total_ones);
	printf("-------------------------------------------------------------------------------");
	printf("\n\nDisplaying Cluster of Users with Low KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n\n");
	total = total_zeroes = total_ones = 0;	
	for(counter = 0;counter<260;counter++)
	{
		if(cluster_two[counter].study_time==0 && cluster_two[counter].exam_performance==0)
		{
			break;
		}
		if(cluster_two[counter].target_value==1.0)
		{
			total_ones++;
		}
		if(cluster_two[counter].target_value==0.0)
		{
			total_zeroes++;
		}
		total++;
		printf("%f\t%f\t\t%f\n",cluster_two[counter].study_time, cluster_two[counter].exam_performance, cluster_two[counter].target_value);
	}
	printf("\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n",total,total_zeroes,total_ones);
	printf("--------------------------------------------------------------------------------");
}

	.text
	.file	"project_3.hip"
	.globl	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_ # -- Begin function _Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.type	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_,@function
_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_: # @_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$224, %rsp
	.cfi_def_cfa_offset 272
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	20(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	16(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	272(%rsp), %rax
	movq	%rax, 48(%rbx)
	leaq	280(%rsp), %rax
	movq	%rax, 56(%rbx)
	leaq	288(%rsp), %rax
	movq	%rax, 64(%rbx)
	leaq	296(%rsp), %rax
	movq	%rax, 72(%rbx)
	leaq	304(%rsp), %rax
	movq	%rax, 80(%rbx)
	leaq	312(%rsp), %rax
	movq	%rax, 88(%rbx)
	leaq	320(%rsp), %rax
	movq	%rax, 96(%rbx)
	leaq	328(%rsp), %rax
	movq	%rax, 104(%rbx)
	leaq	336(%rsp), %rax
	movq	%rax, 112(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$240, %rsp
	.cfi_adjust_cfa_offset -240
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, .Lfunc_end0-_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z23calculateDistanceSerialffff
.LCPI1_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.text
	.globl	_Z23calculateDistanceSerialffff
	.type	_Z23calculateDistanceSerialffff,@function
_Z23calculateDistanceSerialffff:        # @_Z23calculateDistanceSerialffff
	.cfi_startproc
# %bb.0:
	subss	%xmm0, %xmm1
	mulss	%xmm1, %xmm1
	subss	%xmm2, %xmm3
	mulss	%xmm3, %xmm3
	addss	%xmm1, %xmm3
	andps	.LCPI1_0(%rip), %xmm3
	movaps	%xmm3, %xmm0
	retq
.Lfunc_end1:
	.size	_Z23calculateDistanceSerialffff, .Lfunc_end1-_Z23calculateDistanceSerialffff
	.cfi_endproc
                                        # -- End function
	.globl	_Z23startParallelProcessingv    # -- Begin function _Z23startParallelProcessingv
	.type	_Z23startParallelProcessingv,@function
_Z23startParallelProcessingv:           # @_Z23startParallelProcessingv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$4294967297, %rbx               # imm = 0x100000001
	leaq	32(%rsp), %r14
	movl	$1040, %esi                     # imm = 0x410
	movq	%r14, %rdi
	callq	hipMalloc
	leaq	24(%rsp), %r15
	movl	$1040, %esi                     # imm = 0x410
	movq	%r15, %rdi
	callq	hipMalloc
	leaq	16(%rsp), %r12
	movl	$1040, %esi                     # imm = 0x410
	movq	%r12, %rdi
	callq	hipMalloc
	movq	(%r14), %rdi
	movl	$study_time, %esi
	movl	$1040, %edx                     # imm = 0x410
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	movl	$examPerformance, %esi
	movl	$1040, %edx                     # imm = 0x410
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r12), %rdi
	movl	$targetAnswers, %esi
	movl	$1040, %edx                     # imm = 0x410
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	8(%rsp), %r14
	movl	$3120, %esi                     # imm = 0xC30
	movq	%r14, %rdi
	callq	hipMalloc
	movq	%rsp, %r15
	movl	$3120, %esi                     # imm = 0xC30
	movq	%r15, %rdi
	callq	hipMalloc
	movq	(%r14), %rdi
	movl	$cluster_one, %esi
	movl	$3120, %edx                     # imm = 0xC30
	movl	$1, %ecx
	callq	hipMemcpy
	movq	(%r15), %rdi
	movl	$cluster_two, %esi
	movl	$3120, %edx                     # imm = 0xC30
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	259(%rbx), %r14
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	cvttss2si	svHX(%rip), %r8d
	cvttss2si	svHY(%rip), %r9d
	movq	32(%rsp), %rdi
	cvttss2si	svLX(%rip), %eax
	movq	24(%rsp), %rsi
	cvttss2si	svLY(%rip), %r10d
	movq	16(%rsp), %rdx
	cvttss2si	seedDistance(%rip), %r11d
	movl	lowCluster(%rip), %r15d
	movl	highCluster(%rip), %r12d
	movl	cluster_one_index(%rip), %r13d
	movl	cluster_two_index(%rip), %ebp
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	$260, %ecx                      # imm = 0x104
	pushq	8(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%rbp
	.cfi_adjust_cfa_offset 8
	pushq	%r13
	.cfi_adjust_cfa_offset 8
	pushq	%r12
	.cfi_adjust_cfa_offset 8
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	%r11
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	callq	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	addq	$80, %rsp
	.cfi_adjust_cfa_offset -80
.LBB2_2:
	callq	_Z15remapSeedValuesv
	movss	psvHX(%rip), %xmm0              # xmm0 = mem[0],zero,zero,zero
	ucomiss	svHX(%rip), %xmm0
	jne	.LBB2_5
	jp	.LBB2_5
# %bb.3:
	movss	psvHY(%rip), %xmm0              # xmm0 = mem[0],zero,zero,zero
	ucomiss	svHY(%rip), %xmm0
	jne	.LBB2_5
	jp	.LBB2_5
# %bb.4:
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$0, highCluster(%rip)
.LBB2_5:
	movss	svLY(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	psvLY(%rip), %xmm1              # xmm1 = mem[0],zero,zero,zero
	cmpeqps	%xmm0, %xmm1
	xorps	%xmm0, %xmm0
	movss	svLX(%rip), %xmm2               # xmm2 = mem[0],zero,zero,zero
	cmpneqps	%xmm0, %xmm2
	andps	%xmm1, %xmm2
	movd	%xmm2, %eax
	movl	%eax, %ecx
	andl	$1, %ecx
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ecx, %xmm0
	movss	%xmm0, psvLX(%rip)
	testb	$1, %al
	je	.LBB2_6
# %bb.7:
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$0, lowCluster(%rip)
	xorl	%eax, %eax
	jmp	.LBB2_8
.LBB2_6:                                # %._crit_edge
	cmpl	$1, lowCluster(%rip)
	sete	%al
.LBB2_8:
	testb	%al, %al
	jne	.LBB2_10
# %bb.9:
	cmpl	$1, highCluster(%rip)
	jne	.LBB2_12
.LBB2_10:
	movq	%r14, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_12
# %bb.11:
	cvttss2si	svHX(%rip), %r8d
	cvttss2si	svHY(%rip), %r9d
	movq	32(%rsp), %rdi
	cvttss2si	svLX(%rip), %eax
	movq	24(%rsp), %rsi
	cvttss2si	svLY(%rip), %r10d
	movq	16(%rsp), %rdx
	cvttss2si	seedDistance(%rip), %r11d
	movl	lowCluster(%rip), %ebx
	movl	highCluster(%rip), %r14d
	movl	cluster_one_index(%rip), %r15d
	movl	cluster_two_index(%rip), %r12d
	subq	$8, %rsp
	.cfi_adjust_cfa_offset 8
	movl	$260, %ecx                      # imm = 0x104
	pushq	8(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	24(%rsp)
	.cfi_adjust_cfa_offset 8
	pushq	%r12
	.cfi_adjust_cfa_offset 8
	pushq	%r15
	.cfi_adjust_cfa_offset 8
	pushq	%r14
	.cfi_adjust_cfa_offset 8
	pushq	%rbx
	.cfi_adjust_cfa_offset 8
	pushq	%r11
	.cfi_adjust_cfa_offset 8
	pushq	%r10
	.cfi_adjust_cfa_offset 8
	pushq	%rax
	.cfi_adjust_cfa_offset 8
	callq	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	addq	$80, %rsp
	.cfi_adjust_cfa_offset -80
.LBB2_12:
	movq	8(%rsp), %rsi
	movl	$cluster_one, %edi
	movl	$3120, %edx                     # imm = 0xC30
	movl	$2, %ecx
	callq	hipMemcpy
	movq	(%rsp), %rsi
	movl	$cluster_two, %edi
	movl	$3120, %edx                     # imm = 0xC30
	movl	$2, %ecx
	callq	hipMemcpy
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z23startParallelProcessingv, .Lfunc_end2-_Z23startParallelProcessingv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z15remapSeedValuesv
.LCPI3_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.text
	.globl	_Z15remapSeedValuesv
	.type	_Z15remapSeedValuesv,@function
_Z15remapSeedValuesv:                   # @_Z15remapSeedValuesv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movss	svHX(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, psvHX(%rip)
	movss	svHY(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, psvHY(%rip)
	movss	svLX(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, psvLX(%rip)
	movss	svLY(%rip), %xmm2               # xmm2 = mem[0],zero,zero,zero
	movss	%xmm2, psvLY(%rip)
	xorl	%eax, %eax
	xorps	%xmm4, %xmm4
	movl	$cluster_one+28, %ecx
	xorps	%xmm1, %xmm1
	xorps	%xmm3, %xmm3
.LBB3_1:                                # =>This Inner Loop Header: Depth=1
	movss	-4(%rcx), %xmm6                 # xmm6 = mem[0],zero,zero,zero
	movss	(%rcx), %xmm5                   # xmm5 = mem[0],zero,zero,zero
	ucomiss	%xmm4, %xmm6
	jne	.LBB3_3
	jp	.LBB3_3
# %bb.2:                                #   in Loop: Header=BB3_1 Depth=1
	ucomiss	%xmm4, %xmm5
	jne	.LBB3_3
	jnp	.LBB3_5
.LBB3_3:                                # %._crit_edge
                                        #   in Loop: Header=BB3_1 Depth=1
	incl	%eax
	addss	%xmm6, %xmm3
	addss	%xmm5, %xmm1
	addq	$12, %rcx
	cmpl	$258, %eax                      # imm = 0x102
	jne	.LBB3_1
# %bb.4:
	movl	$258, %eax                      # imm = 0x102
.LBB3_5:
	xorps	%xmm4, %xmm4
	cvtsi2ss	%eax, %xmm4
	divss	%xmm4, %xmm3
	movss	%xmm3, svHX(%rip)
	divss	%xmm4, %xmm1
	movss	%xmm1, svHY(%rip)
	xorl	%ecx, %ecx
	xorps	%xmm4, %xmm4
	xorps	%xmm3, %xmm3
	xorps	%xmm1, %xmm1
	xorl	%eax, %eax
.LBB3_6:                                # =>This Inner Loop Header: Depth=1
	movss	cluster_two+24(%rcx), %xmm5     # xmm5 = mem[0],zero,zero,zero
	ucomiss	%xmm4, %xmm5
	jne	.LBB3_8
	jp	.LBB3_8
# %bb.7:                                #   in Loop: Header=BB3_6 Depth=1
	movss	cluster_two+28(%rcx), %xmm5     # xmm5 = mem[0],zero,zero,zero
	ucomiss	%xmm4, %xmm5
	jne	.LBB3_8
	jnp	.LBB3_10
.LBB3_8:                                #   in Loop: Header=BB3_6 Depth=1
	incl	%eax
	addss	cluster_one+24(%rcx), %xmm1
	addss	cluster_one+28(%rcx), %xmm3
	addq	$12, %rcx
	cmpl	$3096, %ecx                     # imm = 0xC18
	jne	.LBB3_6
# %bb.9:
	movl	$258, %eax                      # imm = 0x102
.LBB3_10:
	xorps	%xmm4, %xmm4
	cvtsi2ss	%eax, %xmm4
	divss	%xmm4, %xmm1
	movss	%xmm1, svLX(%rip)
	divss	%xmm4, %xmm3
	movss	%xmm3, svLY(%rip)
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	cvtss2sd	%xmm2, %xmm2
	cvtss2sd	%xmm3, %xmm3
	movl	$.L.str.2, %edi
	movb	$4, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cvtss2sd	psvHX(%rip), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	svHX(%rip), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	psvHY(%rip), %xmm2
	xorps	%xmm3, %xmm3
	cvtss2sd	svHY(%rip), %xmm3
	movl	$.L.str.3, %edi
	movb	$4, %al
	callq	printf
	movss	svHX(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	svHY(%rip), %xmm1               # xmm1 = mem[0],zero,zero,zero
	subss	svLX(%rip), %xmm0
	mulss	%xmm0, %xmm0
	subss	svLY(%rip), %xmm1
	mulss	%xmm1, %xmm1
	addss	%xmm0, %xmm1
	andps	.LCPI3_0(%rip), %xmm1
	movss	%xmm1, seedDistance(%rip)
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z15remapSeedValuesv, .Lfunc_end3-_Z15remapSeedValuesv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI4_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	_Z11readDatasetv
	movss	svLX(%rip), %xmm0               # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, psvLX(%rip)
	movss	svLY(%rip), %xmm1               # xmm1 = mem[0],zero,zero,zero
	movss	%xmm1, psvLY(%rip)
	movss	svHX(%rip), %xmm2               # xmm2 = mem[0],zero,zero,zero
	movss	%xmm2, psvHX(%rip)
	movss	svHY(%rip), %xmm3               # xmm3 = mem[0],zero,zero,zero
	movss	%xmm3, psvHY(%rip)
	subss	%xmm0, %xmm2
	mulss	%xmm2, %xmm2
	subss	%xmm1, %xmm3
	mulss	%xmm3, %xmm3
	addss	%xmm2, %xmm3
	andps	.LCPI4_0(%rip), %xmm3
	movss	%xmm3, seedDistance(%rip)
	callq	_Z14displayDatasetv
	callq	_Z23startParallelProcessingv
	callq	_Z15displayClustersv
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z11readDatasetv
.LCPI5_0:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z11readDatasetv
	.type	_Z11readDatasetv,@function
_Z11readDatasetv:                       # @_Z11readDatasetv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1016, %rsp                     # imm = 0x3F8
	.cfi_def_cfa_offset 1072
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$.L.str.4, %edi
	movl	$.L.str.5, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB5_3
# %bb.1:                                # %.preheader
	movq	%rax, %rbx
	leaq	16(%rsp), %rdi
	movl	$1000, %esi                     # imm = 0x3E8
	movq	%rax, %rdx
	callq	fgets
	testq	%rax, %rax
	je	.LBB5_20
# %bb.2:                                # %.lr.ph36.preheader
	xorl	%ebp, %ebp
	leaq	16(%rsp), %r14
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
.LBB5_5:                                # %.lr.ph36
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_7 Depth 2
	movl	$.L.str.7, %esi
	movq	%r14, %rbx
	movq	%r14, %rdi
	callq	strtok
	testq	%rax, %rax
	je	.LBB5_4
# %bb.6:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB5_5 Depth=1
	movq	%rax, %r15
	xorl	%r14d, %r14d
.LBB5_7:                                # %.lr.ph
                                        #   Parent Loop BB5_5 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpl	$5, %r14d
	je	.LBB5_12
# %bb.8:                                # %.lr.ph
                                        #   in Loop: Header=BB5_7 Depth=2
	cmpl	$4, %r14d
	je	.LBB5_11
# %bb.9:                                # %.lr.ph
                                        #   in Loop: Header=BB5_7 Depth=2
	testl	%r14d, %r14d
	jne	.LBB5_18
# %bb.10:                               #   in Loop: Header=BB5_7 Depth=2
	movq	%r15, %rdi
	callq	atof
	cvtsd2ss	%xmm0, %xmm0
	movl	%r12d, %eax
	leal	1(%r12), %edx
	movl	$study_time, %ecx
	movl	%edx, %r12d
	jmp	.LBB5_17
.LBB5_11:                               #   in Loop: Header=BB5_7 Depth=2
	movq	%r15, %rdi
	callq	atof
	cvtsd2ss	%xmm0, %xmm0
	movl	%r13d, %eax
	leal	1(%r13), %edx
	movl	$examPerformance, %ecx
	movl	%edx, %r13d
	jmp	.LBB5_17
.LBB5_12:                               #   in Loop: Header=BB5_7 Depth=2
	movl	$.L.str.8, %esi
	movq	%r15, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB5_14
# %bb.13:                               #   in Loop: Header=BB5_7 Depth=2
	movl	$.L.str.9, %esi
	movq	%r15, %rdi
	callq	strcmp
	testl	%eax, %eax
	je	.LBB5_14
# %bb.15:                               #   in Loop: Header=BB5_7 Depth=2
	movl	%ebp, %eax
	leal	1(%rbp), %edx
	xorps	%xmm0, %xmm0
	movl	$targetAnswers, %ecx
	jmp	.LBB5_16
.LBB5_14:                               #   in Loop: Header=BB5_7 Depth=2
	movl	%ebp, %eax
	leal	1(%rbp), %edx
	movl	$targetAnswers, %ecx
	movss	.LCPI5_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
.LBB5_16:                               # %.sink.split
                                        #   in Loop: Header=BB5_7 Depth=2
	movl	%edx, %ebp
.LBB5_17:                               # %.sink.split
                                        #   in Loop: Header=BB5_7 Depth=2
	cltq
	movss	%xmm0, (%rcx,%rax,4)
.LBB5_18:                               #   in Loop: Header=BB5_7 Depth=2
	movl	$.L.str.7, %esi
	xorl	%edi, %edi
	callq	strtok
	cmpl	$4, %r14d
	ja	.LBB5_4
# %bb.19:                               #   in Loop: Header=BB5_7 Depth=2
	movq	%rax, %r15
	incl	%r14d
	testq	%rax, %rax
	jne	.LBB5_7
.LBB5_4:                                # %.loopexit
                                        #   in Loop: Header=BB5_5 Depth=1
	movq	%rbx, %r14
	movq	%rbx, %rdi
	movl	$1000, %esi                     # imm = 0x3E8
	movq	8(%rsp), %rbx                   # 8-byte Reload
	movq	%rbx, %rdx
	callq	fgets
	testq	%rax, %rax
	jne	.LBB5_5
.LBB5_20:                               # %._crit_edge
	movq	%rbx, %rdi
	callq	fclose
	addq	$1016, %rsp                     # imm = 0x3F8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB5_3:
	.cfi_def_cfa_offset 1072
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	addq	$1016, %rsp                     # imm = 0x3F8
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end5:
	.size	_Z11readDatasetv, .Lfunc_end5-_Z11readDatasetv
	.cfi_endproc
                                        # -- End function
	.globl	_Z14displayDatasetv             # -- Begin function _Z14displayDatasetv
	.type	_Z14displayDatasetv,@function
_Z14displayDatasetv:                    # @_Z14displayDatasetv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	movq	$-1036, %rbx                    # imm = 0xFBF4
.LBB6_1:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	study_time+1036(%rbx), %xmm0
	xorps	%xmm1, %xmm1
	cvtss2sd	examPerformance+1036(%rbx), %xmm1
	xorps	%xmm2, %xmm2
	cvtss2sd	targetAnswers+1036(%rbx), %xmm2
	movl	$.L.str.11, %edi
	movb	$3, %al
	callq	printf
	addq	$4, %rbx
	jne	.LBB6_1
# %bb.2:
	movl	$.Lstr.3, %edi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end6:
	.size	_Z14displayDatasetv, .Lfunc_end6-_Z14displayDatasetv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z15displayClustersv
.LCPI7_0:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z15displayClustersv
	.type	_Z15displayClustersv,@function
_Z15displayClustersv:                   # @_Z15displayClustersv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$.Lstr.4, %edi
	callq	puts@PLT
	xorl	%ebp, %ebp
	movl	$cluster_one+32, %ebx
	xorps	%xmm2, %xmm2
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.LBB7_1:                                # =>This Inner Loop Header: Depth=1
	movss	-8(%rbx), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	-4(%rbx), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm2, %xmm0
	jne	.LBB7_3
	jp	.LBB7_3
# %bb.2:                                #   in Loop: Header=BB7_1 Depth=1
	ucomiss	%xmm2, %xmm1
	jne	.LBB7_3
	jnp	.LBB7_5
.LBB7_3:                                # %._crit_edge
                                        #   in Loop: Header=BB7_1 Depth=1
	movss	(%rbx), %xmm3                   # xmm3 = mem[0],zero,zero,zero
	xorps	%xmm4, %xmm4
	cmpeqss	%xmm3, %xmm4
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm3, %xmm2
	cmpeqss	.LCPI7_0(%rip), %xmm3
	movd	%xmm3, %eax
	subl	%eax, %r15d
	movd	%xmm4, %eax
	subl	%eax, %r14d
	incl	%ebp
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	movl	$.L.str.11, %edi
	movb	$3, %al
	callq	printf
	xorps	%xmm2, %xmm2
	addq	$12, %rbx
	cmpl	$258, %ebp                      # imm = 0x102
	jne	.LBB7_1
# %bb.4:
	movl	$258, %ebp                      # imm = 0x102
.LBB7_5:
	xorl	%ebx, %ebx
	movl	$.L.str.14, %edi
	movl	%ebp, %esi
	movl	%r14d, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.15, %edi
	xorl	%eax, %eax
	callq	printf
	movl	$.Lstr.5, %edi
	callq	puts@PLT
	movl	$cluster_two+8, %r15d
	xorps	%xmm2, %xmm2
	xorl	%ebp, %ebp
	xorl	%r14d, %r14d
.LBB7_6:                                # =>This Inner Loop Header: Depth=1
	movss	-8(%r15), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movss	-4(%r15), %xmm1                 # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm2, %xmm0
	jne	.LBB7_8
	jp	.LBB7_8
# %bb.7:                                #   in Loop: Header=BB7_6 Depth=1
	ucomiss	%xmm2, %xmm1
	jne	.LBB7_8
	jnp	.LBB7_10
.LBB7_8:                                # %._crit_edge54
                                        #   in Loop: Header=BB7_6 Depth=1
	movss	(%r15), %xmm3                   # xmm3 = mem[0],zero,zero,zero
	xorps	%xmm4, %xmm4
	cmpeqss	%xmm3, %xmm4
	xorps	%xmm2, %xmm2
	cvtss2sd	%xmm3, %xmm2
	cmpeqss	.LCPI7_0(%rip), %xmm3
	movd	%xmm3, %eax
	subl	%eax, %r14d
	movd	%xmm4, %eax
	subl	%eax, %ebp
	incq	%rbx
	cvtss2sd	%xmm0, %xmm0
	cvtss2sd	%xmm1, %xmm1
	movl	$.L.str.11, %edi
	movb	$3, %al
	callq	printf
	xorps	%xmm2, %xmm2
	addq	$12, %r15
	cmpq	$260, %rbx                      # imm = 0x104
	jne	.LBB7_6
# %bb.9:
	movl	$260, %ebx                      # imm = 0x104
.LBB7_10:                               # %.split.loop.exit57
	movl	$.L.str.14, %edi
	movl	%ebx, %esi
	movl	%ebp, %edx
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.17, %edi
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.Lfunc_end7:
	.size	_Z15displayClustersv, .Lfunc_end7-_Z15displayClustersv
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB8_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB8_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end8:
	.size	__hip_module_ctor, .Lfunc_end8-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB9_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB9_2:
	retq
.Lfunc_end9:
	.size	__hip_module_dtor, .Lfunc_end9-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	highCluster,@object             # @highCluster
	.data
	.globl	highCluster
	.p2align	2, 0x0
highCluster:
	.long	1                               # 0x1
	.size	highCluster, 4

	.type	lowCluster,@object              # @lowCluster
	.globl	lowCluster
	.p2align	2, 0x0
lowCluster:
	.long	1                               # 0x1
	.size	lowCluster, 4

	.type	study_time,@object              # @study_time
	.bss
	.globl	study_time
	.p2align	4, 0x0
study_time:
	.zero	1040
	.size	study_time, 1040

	.type	examPerformance,@object         # @examPerformance
	.globl	examPerformance
	.p2align	4, 0x0
examPerformance:
	.zero	1040
	.size	examPerformance, 1040

	.type	targetAnswers,@object           # @targetAnswers
	.globl	targetAnswers
	.p2align	4, 0x0
targetAnswers:
	.zero	1040
	.size	targetAnswers, 1040

	.type	ourAnswer,@object               # @ourAnswer
	.globl	ourAnswer
	.p2align	4, 0x0
ourAnswer:
	.zero	1032
	.size	ourAnswer, 1032

	.type	svLX,@object                    # @svLX
	.data
	.globl	svLX
	.p2align	2, 0x0
svLX:
	.long	0x3e4ccccd                      # float 0.200000003
	.size	svLX, 4

	.type	svLY,@object                    # @svLY
	.globl	svLY
	.p2align	2, 0x0
svLY:
	.long	0x3e4ccccd                      # float 0.200000003
	.size	svLY, 4

	.type	svHX,@object                    # @svHX
	.globl	svHX
	.p2align	2, 0x0
svHX:
	.long	0x3f47ae14                      # float 0.779999971
	.size	svHX, 4

	.type	svHY,@object                    # @svHY
	.globl	svHY
	.p2align	2, 0x0
svHY:
	.long	0x3f47ae14                      # float 0.779999971
	.size	svHY, 4

	.type	psvLX,@object                   # @psvLX
	.bss
	.globl	psvLX
	.p2align	2, 0x0
psvLX:
	.long	0x00000000                      # float 0
	.size	psvLX, 4

	.type	psvLY,@object                   # @psvLY
	.globl	psvLY
	.p2align	2, 0x0
psvLY:
	.long	0x00000000                      # float 0
	.size	psvLY, 4

	.type	psvHX,@object                   # @psvHX
	.globl	psvHX
	.p2align	2, 0x0
psvHX:
	.long	0x00000000                      # float 0
	.size	psvHX, 4

	.type	psvHY,@object                   # @psvHY
	.globl	psvHY
	.p2align	2, 0x0
psvHY:
	.long	0x00000000                      # float 0
	.size	psvHY, 4

	.type	seedDistance,@object            # @seedDistance
	.globl	seedDistance
	.p2align	2, 0x0
seedDistance:
	.long	0x00000000                      # float 0
	.size	seedDistance, 4

	.type	cluster_one,@object             # @cluster_one
	.globl	cluster_one
	.p2align	4, 0x0
cluster_one:
	.zero	3120
	.size	cluster_one, 3120

	.type	cluster_two,@object             # @cluster_two
	.globl	cluster_two
	.p2align	4, 0x0
cluster_two:
	.zero	3000
	.size	cluster_two, 3000

	.type	cluster_one_index,@object       # @cluster_one_index
	.globl	cluster_one_index
	.p2align	2, 0x0
cluster_one_index:
	.long	0                               # 0x0
	.size	cluster_one_index, 4

	.type	cluster_two_index,@object       # @cluster_two_index
	.globl	cluster_two_index
	.p2align	2, 0x0
cluster_two_index:
	.long	0                               # 0x0
	.size	cluster_two_index, 4

	.type	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_,@object # @_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.section	.rodata,"a",@progbits
	.globl	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.p2align	3, 0x0
_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_:
	.quad	_Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.size	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, 8

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"\nPrevious Low X: %f\tNew Low X: %f\nPrevious Low Y: %f\tNew Low Y: %f\n"
	.size	.L.str.2, 68

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"\nPrevious High X: %f\tNew High X: %f\nPrevious High Y: %f\tNew High Y: %f\n"
	.size	.L.str.3, 72

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"input.txt"
	.size	.L.str.4, 10

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"r"
	.size	.L.str.5, 2

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"Requested Input File Not Found :("
	.size	.L.str.6, 34

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\t"
	.size	.L.str.7, 2

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"High"
	.size	.L.str.8, 5

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Middle"
	.size	.L.str.9, 7

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"%f\t%f\t\t%f\n"
	.size	.L.str.11, 11

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"\n\nTotal Entries: %d\tLow Entried: %d\tHigh Entries: %d\n"
	.size	.L.str.14, 54

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"-------------------------------------------------------------------------------"
	.size	.L.str.15, 80

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"--------------------------------------------------------------------------------"
	.size	.L.str.17, 81

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_"
	.size	.L__unnamed_1, 48

	.type	__hip_fatbin_wrapper,@object    # @__hip_fatbin_wrapper
	.section	.hipFatBinSegment,"a",@progbits
	.p2align	3, 0x0
__hip_fatbin_wrapper:
	.long	1212764230                      # 0x48495046
	.long	1                               # 0x1
	.quad	__hip_fatbin
	.quad	0
	.size	__hip_fatbin_wrapper, 24

	.type	__hip_gpubin_handle,@object     # @__hip_gpubin_handle
	.local	__hip_gpubin_handle
	.comm	__hip_gpubin_handle,8,8
	.section	.init_array,"aw",@init_array
	.p2align	3, 0x0
	.quad	__hip_module_ctor
	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"\nHigh Knowledge Cluster Seed Value Achieved Successfully."
	.size	.Lstr, 58

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"\nLow Knowledge Cluster Seed Value Achieved Successfully."
	.size	.Lstr.1, 57

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"\n\nDisplaying Dataset Entries\n\nStudy Time\tExam Performance\tKnowledge Level\n"
	.size	.Lstr.2, 75

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"\n\nEnd of Displaying Dataset\n"
	.size	.Lstr.3, 29

	.type	.Lstr.4,@object                 # @str.4
.Lstr.4:
	.asciz	"\n\nDisplaying Cluster of Users with High KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n"
	.size	.Lstr.4, 119

	.type	.Lstr.5,@object                 # @str.5
.Lstr.5:
	.asciz	"\n\nDisplaying Cluster of Users with Low KnowledgeLevel: \nStudy Time\tExam Performance\tTarget Cluster (1: High, 0: Low)\n"
	.size	.Lstr.5, 118

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z30__device_stub__startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym study_time
	.addrsig_sym examPerformance
	.addrsig_sym targetAnswers
	.addrsig_sym cluster_one
	.addrsig_sym cluster_two
	.addrsig_sym _Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_ ; -- Begin function _Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.globl	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
	.p2align	8
	.type	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_,@function
_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_: ; @_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x5c
	s_load_b128 s[4:7], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[2:3], null, s15, s2, v[0:1]
	v_ashrrev_i32_e32 v3, 31, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	v_add_co_u32 v5, vcc_lo, s4, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v6, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v3, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v1, vcc_lo
	global_load_b32 v7, v[5:6], off
	global_load_b32 v8, v[3:4], off
	s_clause 0x1
	s_load_b256 s[4:11], s[0:1], 0x1c
	s_load_b128 s[12:15], s[0:1], 0x40
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_i32_e32 v5, s4
	v_cvt_f32_i32_e32 v6, s5
	v_cvt_f32_i32_e32 v9, s8
	s_cmp_eq_u32 s10, 1
	s_cselect_b32 s2, -1, 0
	s_waitcnt vmcnt(0)
	v_dual_sub_f32 v5, v5, v7 :: v_dual_sub_f32 v6, v6, v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_f32_e32 v5, v5, v6
	v_cmp_le_f32_e32 vcc_lo, v5, v9
	v_dual_mov_b32 v5, s12 :: v_dual_mov_b32 v6, s13
	s_and_b32 s2, s2, vcc_lo
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b32 s4, s2, -1
	s_and_saveexec_b32 s3, s4
	s_cbranch_execz .LBB0_2
; %bb.1:
	v_cvt_f32_i32_e32 v5, s6
	v_cvt_f32_i32_e32 v6, s7
	s_cmp_eq_u32 s9, 1
	s_cselect_b32 s4, -1, 0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_dual_sub_f32 v5, v5, v7 :: v_dual_sub_f32 v6, v6, v8
	s_and_not1_b32 s2, s2, exec_lo
	v_add_f32_e32 v5, v5, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cmp_le_f32_e32 vcc_lo, v5, v9
	v_dual_mov_b32 v5, s14 :: v_dual_mov_b32 v6, s15
	s_and_b32 s4, s4, vcc_lo
	s_and_b32 s4, s4, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s2, s2, s4
.LBB0_2:                                ; %Flow
	s_or_b32 exec_lo, exec_lo, s3
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_4
; %bb.3:                                ; %.sink.split
	v_mad_i64_i32 v[8:9], null, v2, 12, v[5:6]
	s_load_b64 s[0:1], s[0:1], 0x10
	global_store_b32 v[8:9], v7, off
	global_load_b32 v2, v[3:4], off
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[8:9], v2, off offset:4
	global_load_b32 v0, v[0:1], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[8:9], v0, off offset:8
.LBB0_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 336
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 10
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_, .Lfunc_end0-_Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 372
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .offset:         36
        .size:           4
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     by_value
      - .offset:         44
        .size:           4
        .value_kind:     by_value
      - .offset:         48
        .size:           4
        .value_kind:     by_value
      - .offset:         52
        .size:           4
        .value_kind:     by_value
      - .offset:         56
        .size:           4
        .value_kind:     by_value
      - .offset:         60
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         64
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         72
        .size:           8
        .value_kind:     global_buffer
      - .offset:         80
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         84
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         88
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         92
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         94
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         96
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         98
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         100
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         102
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         120
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         128
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         136
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         144
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 336
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z15startClusteringPfS_S_iiiiiiiiiiP7clusterS1_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
