#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
const int max_movie = 1683;
const int max_user = 944;
#define THREAD_NUM 256
#define BLOCK_NUM 32

__global__ static void test(float* rate,float* result)
{
	const int tid=threadIdx.x;
	const int bid=blockIdx.x;
	int i,k,j;
	float sum;
	for(i=bid*THREAD_NUM+tid;i<max_movie-1;i+=BLOCK_NUM*THREAD_NUM)
	{
		for(k=1;k<max_movie;k++)
		{
			if(k==i+1)
				continue;
			else
			{
				sum=0;
				//count=0;
				for(j=1;j<max_user;j++)
				{
					if((rate[j*max_movie+i+1]==-1)||(rate[j*max_movie+k]==-1))
						continue;
					else
					{
						sum=sum+(rate[j*max_movie+i+1]-rate[j*max_movie+k])*(rate[j*max_movie+i+1]-rate[j*max_movie+k]);
						//count++;
					}
				}
				result[(i+1)*max_movie+k]=sqrt(sum);
			}
		}


	}

}


int main()
{
	cout<<"start:"<<endl;
	FILE *fp = fopen("/home/3160102482/myhelloworld/ml-100k/u2.base","r");

	float a[max_movie*max_user];
	float* res;
	res=(float*)malloc(sizeof(float)*max_movie*max_movie);
	int movieid,userid,stamp,i,j;
	float rating;
	float* gpudata;
	float* result;
	float min;
	int minindex1,minindex2,minindex3,k;
	//cout<<"yes"<<endl;
	//cout<<"4";
	for(i=0;i<max_user;i++)
		for(j=0;j<max_movie;j++)
			a[i*max_movie+j]=-1;
	//cout<<"3";
	cudaMalloc((void**)&gpudata,sizeof(float)*max_movie*max_user);
	cudaMalloc((void**)&result,sizeof(float)*max_movie*max_movie);
	while(!feof(fp)){
		fscanf(fp,"%d%d%f%d",&userid, &movieid, &rating, &stamp);
		a[userid*max_movie+movieid]=rating;
	}
	fclose(fp);
	cudaMemcpy(gpudata,a,sizeof(float)*max_movie*max_user,cudaMemcpyHostToDevice);
	//cout<<"1";
	test<<<BLOCK_NUM,THREAD_NUM,0>>>(gpudata,result);
	cudaMemcpy(res,result,sizeof(float)*max_movie*max_movie,cudaMemcpyDeviceToHost);

	cudaFree(gpudata);
	cudaFree(result);
	fp = fopen("/home/3160102482/myhelloworld/ml-100k/u2.test","r");
	while(!feof(fp)){
			fscanf(fp,"%d%d%f%d",&userid, &movieid, &rating, &stamp);
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if(i==(movieid*max_movie+movieid))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex1=k;
						min=res[i];
					}

				}
			}
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if((i==(movieid*max_movie+movieid))||(i==(movieid*max_movie+minindex1)))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex2=k;
						min=res[i];
					}

				}
			}
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if((i==(movieid*max_movie+movieid))||(i==(movieid*max_movie+minindex1))||(i==(movieid*max_movie+minindex2)))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex3=k;
						min=res[i];
					}

				}
			}
			cout<<"userid:"<<userid<<" ";
			cout<<"movieid:"<<movieid<<" "; 
			cout<<"estimate:"<<(float)(a[userid*max_movie+minindex1]+a[userid*max_movie+minindex2]+a[userid*max_movie+minindex3])/3<<" ";
			cout<<"real:"<<rating<<endl;
			cout<<endl;
		}
		fclose(fp);
	//cout<<res[1687];
}

	.file	"tmpxft_00275ac7_00000000-6_mymain.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3638:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3638:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.type	_ZL25__device_stub__Z4testPfS_PfS_, @function
_ZL25__device_stub__Z4testPfS_PfS_:
.LFB3660:
	.cfi_startproc
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L2
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_ZL4testPfS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L2:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3660:
	.size	_ZL25__device_stub__Z4testPfS_PfS_, .-_ZL25__device_stub__Z4testPfS_PfS_
	.type	_ZL4testPfS_, @function
_ZL4testPfS_:
.LFB3661:
	.cfi_startproc
	endbr64
	jmp	_ZL25__device_stub__Z4testPfS_PfS_
	.cfi_endproc
.LFE3661:
	.size	_ZL4testPfS_, .-_ZL4testPfS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"start:"
.LC2:
	.string	"r"
.LC3:
	.string	"/home/3160102482/myhelloworld/ml-100k/u2.base"
.LC5:
	.string	"%d%d%f%d"
.LC6:
	.string	"/home/3160102482/myhelloworld/ml-100k/u2.test"
.LC7:
	.string	"userid:"
.LC8:
	.string	" "
.LC9:
	.string	"movieid:"
.LC10:
	.string	"estimate:"
.LC12:
	.string	"real:"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3635:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-6352896(%rsp), %r11
	.cfi_def_cfa 11, 6352952
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2200, %rsp
	.cfi_def_cfa_offset 6355152
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 6355080(%rsp)
	xorl	%eax, %eax
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	.LC2(%rip), %rsi
	leaq	.LC3(%rip), %rdi
	call	fopen@PLT
	movl	$11329956, %edi
	movq	%rax, %r13
	call	malloc@PLT
	leaq	72(%rsp), %rdx
	xorl	%ecx, %ecx
	movq	%rdx, 8(%rsp)
	movq	%rax, %rbx
.L9:
	xorl	%eax, %eax
.L10:
	movl	$0xbf800000, (%rdx,%rax,4)
	incq	%rax
	cmpq	$1683, %rax
	jne	.L10
	addl	$1683, %ecx
	addq	$6732, %rdx
	cmpl	$1588752, %ecx
	jne	.L9
	leaq	32(%rsp), %rdi
	movl	$6355008, %esi
	leaq	.LC5(%rip), %r15
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$11329956, %esi
	call	cudaMalloc@PLT
.L12:
	movq	%r13, %rdi
	call	feof@PLT
	testl	%eax, %eax
	jne	.L41
	leaq	16(%rsp), %rcx
	leaq	20(%rsp), %rdx
	movq	%r15, %rsi
	movq	%r13, %rdi
	leaq	24(%rsp), %r9
	leaq	28(%rsp), %r8
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	imull	$1683, 20(%rsp), %eax
	addl	16(%rsp), %eax
	movss	28(%rsp), %xmm0
	cltq
	movss	%xmm0, 72(%rsp,%rax,4)
	jmp	.L12
.L41:
	movq	%r13, %rdi
	call	fclose@PLT
	movq	8(%rsp), %rsi
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movl	$6355008, %edx
	call	cudaMemcpy@PLT
	movl	$16777217, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$134217729, %edi
	salq	$8, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$5, %rdi
	movq	%rdx, 60(%rsp)
	movl	$1, 68(%rsp)
	movq	%rdi, 48(%rsp)
	movl	$1, 56(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	movq	40(%rsp), %rsi
	movq	32(%rsp), %rdi
	call	_ZL25__device_stub__Z4testPfS_PfS_
.L14:
	movq	40(%rsp), %rsi
	movl	$2, %ecx
	movl	$11329956, %edx
	movq	%rbx, %rdi
	leaq	.LC5(%rip), %r15
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC2(%rip), %rsi
	leaq	.LC6(%rip), %rdi
	call	fopen@PLT
	movq	%rax, 8(%rsp)
.L15:
	movq	8(%rsp), %rdi
	call	feof@PLT
	testl	%eax, %eax
	jne	.L42
	movq	8(%rsp), %rdi
	leaq	16(%rsp), %rcx
	movq	%r15, %rsi
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	28(%rsp), %r8
	leaq	24(%rsp), %r9
	call	__isoc23_fscanf@PLT
	movl	16(%rsp), %edx
	movl	$1, %esi
	imull	$1683, 20(%rsp), %r8d
	movss	.LC0(%rip), %xmm0
	movss	.LC4(%rip), %xmm2
	imull	$1683, %edx, %ecx
	imull	$1684, %edx, %edx
	leal	1(%rcx), %eax
	cltq
	movq	%rax, %rdi
.L19:
	cmpl	%edi, %edx
	je	.L16
	leal	(%rsi,%r8), %r9d
	movslq	%r9d, %r9
	ucomiss	72(%rsp,%r9,4), %xmm2
	jp	.L30
	je	.L16
.L30:
	movss	(%rbx,%rdi,4), %xmm1
	comiss	%xmm1, %xmm0
	minss	%xmm0, %xmm1
	cmova	%esi, %ebp
	movaps	%xmm1, %xmm0
.L16:
	incl	%esi
	incq	%rdi
	cmpl	$1683, %esi
	jne	.L19
	movss	.LC0(%rip), %xmm0
	movss	.LC4(%rip), %xmm2
	movq	%rax, %rdi
	leal	(%rcx,%rbp), %r10d
	movl	$1, %esi
.L23:
	cmpl	%edi, %edx
	je	.L20
	cmpl	%edi, %r10d
	je	.L20
	leal	(%rsi,%r8), %r9d
	movslq	%r9d, %r9
	ucomiss	72(%rsp,%r9,4), %xmm2
	jp	.L32
	je	.L20
.L32:
	movss	(%rbx,%rdi,4), %xmm1
	comiss	%xmm1, %xmm0
	minss	%xmm0, %xmm1
	cmova	%esi, %r12d
	movaps	%xmm1, %xmm0
.L20:
	incl	%esi
	incq	%rdi
	cmpl	$1683, %esi
	jne	.L23
	movss	.LC0(%rip), %xmm0
	leal	(%rcx,%rbp), %r9d
	movl	$1, %esi
	addl	%r12d, %ecx
.L27:
	cmpl	%eax, %edx
	je	.L24
	cmpl	%eax, %r9d
	je	.L24
	cmpl	%eax, %ecx
	je	.L24
	leal	(%rsi,%r8), %edi
	movss	.LC4(%rip), %xmm3
	movslq	%edi, %rdi
	ucomiss	72(%rsp,%rdi,4), %xmm3
	jp	.L34
	je	.L24
.L34:
	movss	(%rbx,%rax,4), %xmm1
	comiss	%xmm1, %xmm0
	minss	%xmm0, %xmm1
	cmova	%esi, %r14d
	movaps	%xmm1, %xmm0
.L24:
	incl	%esi
	incq	%rax
	cmpl	$1683, %esi
	jne	.L27
	leaq	.LC7(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	20(%rsp), %esi
	leaq	.LC8(%rip), %r13
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC9(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	16(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC10(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	imull	$1683, 20(%rsp), %eax
	leal	(%rax,%rbp), %ecx
	leal	(%rax,%r12), %edx
	addl	%r14d, %eax
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	cltq
	movss	72(%rsp,%rcx,4), %xmm0
	addss	72(%rsp,%rdx,4), %xmm0
	addss	72(%rsp,%rax,4), %xmm0
	divss	.LC11(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC12(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtss2sd	28(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	jmp	.L15
.L42:
	movq	8(%rsp), %rdi
	call	fclose@PLT
	movq	6355080(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$6355096, %rsp
	.cfi_def_cfa_offset 56
	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
	ret
	.cfi_endproc
.LFE3635:
	.size	main, .-main
	.section	.rodata.str1.1
.LC13:
	.string	"_Z4testPfS_"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3663:
	.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	.LC13(%rip), %rdx
	movq	%rax, %rdi
	leaq	_ZL4testPfS_(%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
.LFE3663:
	.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
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1120403456
	.align 4
.LC4:
	.long	-1082130432
	.align 4
.LC11:
	.long	1077936128
	.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:


#include <hip/hip_runtime.h>
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
const int max_movie = 1683;
const int max_user = 944;
#define THREAD_NUM 256
#define BLOCK_NUM 32

__global__ static void test(float* rate,float* result)
{
	const int tid=threadIdx.x;
	const int bid=blockIdx.x;
	int i,k,j;
	float sum;
	for(i=bid*THREAD_NUM+tid;i<max_movie-1;i+=BLOCK_NUM*THREAD_NUM)
	{
		for(k=1;k<max_movie;k++)
		{
			if(k==i+1)
				continue;
			else
			{
				sum=0;
				//count=0;
				for(j=1;j<max_user;j++)
				{
					if((rate[j*max_movie+i+1]==-1)||(rate[j*max_movie+k]==-1))
						continue;
					else
					{
						sum=sum+(rate[j*max_movie+i+1]-rate[j*max_movie+k])*(rate[j*max_movie+i+1]-rate[j*max_movie+k]);
						//count++;
					}
				}
				result[(i+1)*max_movie+k]=sqrt(sum);
			}
		}


	}

}


int main()
{
	cout<<"start:"<<endl;
	FILE *fp = fopen("/home/3160102482/myhelloworld/ml-100k/u2.base","r");

	float a[max_movie*max_user];
	float* res;
	res=(float*)malloc(sizeof(float)*max_movie*max_movie);
	int movieid,userid,stamp,i,j;
	float rating;
	float* gpudata;
	float* result;
	float min;
	int minindex1,minindex2,minindex3,k;
	//cout<<"yes"<<endl;
	//cout<<"4";
	for(i=0;i<max_user;i++)
		for(j=0;j<max_movie;j++)
			a[i*max_movie+j]=-1;
	//cout<<"3";
	hipMalloc((void**)&gpudata,sizeof(float)*max_movie*max_user);
	hipMalloc((void**)&result,sizeof(float)*max_movie*max_movie);
	while(!feof(fp)){
		fscanf(fp,"%d%d%f%d",&userid, &movieid, &rating, &stamp);
		a[userid*max_movie+movieid]=rating;
	}
	fclose(fp);
	hipMemcpy(gpudata,a,sizeof(float)*max_movie*max_user,hipMemcpyHostToDevice);
	//cout<<"1";
	test<<<BLOCK_NUM,THREAD_NUM,0>>>(gpudata,result);
	hipMemcpy(res,result,sizeof(float)*max_movie*max_movie,hipMemcpyDeviceToHost);

	hipFree(gpudata);
	hipFree(result);
	fp = fopen("/home/3160102482/myhelloworld/ml-100k/u2.test","r");
	while(!feof(fp)){
			fscanf(fp,"%d%d%f%d",&userid, &movieid, &rating, &stamp);
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if(i==(movieid*max_movie+movieid))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex1=k;
						min=res[i];
					}

				}
			}
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if((i==(movieid*max_movie+movieid))||(i==(movieid*max_movie+minindex1)))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex2=k;
						min=res[i];
					}

				}
			}
			min=100;
			for(i=movieid*max_movie+1;i<(movieid+1)*max_movie;i++)
			{
				if((i==(movieid*max_movie+movieid))||(i==(movieid*max_movie+minindex1))||(i==(movieid*max_movie+minindex2)))
					continue;
				else
				{
					k=i-movieid*max_movie;
					if((a[userid*max_movie+k]!=-1)&&(res[i]<min))
					{
						minindex3=k;
						min=res[i];
					}

				}
			}
			cout<<"userid:"<<userid<<" ";
			cout<<"movieid:"<<movieid<<" "; 
			cout<<"estimate:"<<(float)(a[userid*max_movie+minindex1]+a[userid*max_movie+minindex2]+a[userid*max_movie+minindex3])/3<<" ";
			cout<<"real:"<<rating<<endl;
			cout<<endl;
		}
		fclose(fp);
	//cout<<res[1687];
}

	.text
	.file	"mymain.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI0_0:
	.long	0x42c80000                      # float 100
.LCPI0_1:
	.long	0xbf800000                      # float -1
.LCPI0_2:
	.long	0x40400000                      # float 3
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.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	$6355064, %rsp                  # imm = 0x60F878
	.cfi_def_cfa_offset 6355120
	.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	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movl	$.L.str.1, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movq	%rax, %r14
	movl	$11329956, %edi                 # imm = 0xACE1A4
	callq	malloc
	movq	%rax, %rbx
	leaq	48(%rsp), %rax
	xorl	%ecx, %ecx
.LBB0_1:                                # %.preheader85
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_2 Depth 2
	xorl	%edx, %edx
.LBB0_2:                                #   Parent Loop BB0_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movl	$-1082130432, (%rax,%rdx,4)     # imm = 0xBF800000
	incq	%rdx
	cmpq	$1683, %rdx                     # imm = 0x693
	jne	.LBB0_2
# %bb.3:                                #   in Loop: Header=BB0_1 Depth=1
	incq	%rcx
	addq	$6732, %rax                     # imm = 0x1A4C
	cmpq	$944, %rcx                      # imm = 0x3B0
	jne	.LBB0_1
# %bb.4:
	leaq	32(%rsp), %rdi
	movl	$6355008, %esi                  # imm = 0x60F840
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movl	$11329956, %esi                 # imm = 0xACE1A4
	callq	hipMalloc
	movq	%r14, %rdi
	callq	feof
	testl	%eax, %eax
	jne	.LBB0_7
# %bb.5:                                # %.lr.ph.preheader
	leaq	12(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	20(%rsp), %r13
	leaq	44(%rsp), %rbp
.LBB0_6:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.3, %esi
	movq	%r14, %rdi
	movq	%r15, %rdx
	movq	%r12, %rcx
	movq	%r13, %r8
	movq	%rbp, %r9
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movss	20(%rsp), %xmm0                 # xmm0 = mem[0],zero,zero,zero
	movslq	12(%rsp), %rax
	imulq	$1683, %rax, %rax               # imm = 0x693
	movslq	16(%rsp), %rcx
	addq	%rax, %rcx
	movss	%xmm0, 48(%rsp,%rcx,4)
	movq	%r14, %rdi
	callq	feof
	testl	%eax, %eax
	je	.LBB0_6
.LBB0_7:                                # %._crit_edge
	movq	%r14, %rdi
	callq	fclose
	movq	32(%rsp), %rdi
	leaq	48(%rsp), %rsi
	movl	$6355008, %edx                  # imm = 0x60F840
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294967328, %rdi               # imm = 0x100000020
	leaq	224(%rdi), %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_9
# %bb.8:
	movq	32(%rsp), %rdi
	movq	24(%rsp), %rsi
	callq	_ZL19__device_stub__testPfS_
.LBB0_9:
	movq	24(%rsp), %rsi
	movl	$11329956, %edx                 # imm = 0xACE1A4
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	32(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movl	$.L.str.4, %edi
	movl	$.L.str.2, %esi
	callq	fopen
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	feof
	testl	%eax, %eax
	jne	.LBB0_36
# %bb.10:                               # %.lr.ph114.preheader
	addq	$4, %rbx
                                        # implicit-def: $r12d
                                        # implicit-def: $ebp
                                        # implicit-def: $r13d
.LBB0_11:                               # %.lr.ph114
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_13 Depth 2
                                        #     Child Loop BB0_20 Depth 2
                                        #     Child Loop BB0_28 Depth 2
	movl	$.L.str.3, %esi
	movq	%r14, %rdi
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %rcx
	leaq	20(%rsp), %r8
	leaq	44(%rsp), %r9
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	movslq	16(%rsp), %rax
	imull	$1683, %eax, %esi               # imm = 0x693
	movl	$1683, %ecx                     # imm = 0x693
	leal	(%rsi,%rcx), %edi
	leal	1(%rsi), %r8d
	cmpl	%edi, %r8d
	jge	.LBB0_35
# %bb.12:                               # %.lr.ph94
                                        #   in Loop: Header=BB0_11 Depth=1
	imull	$1683, 12(%rsp), %r9d           # imm = 0x693
	imulq	$1684, %rax, %rax               # imm = 0x694
	movslq	%esi, %rcx
	leaq	(%rbx,%rcx,4), %rdx
	notq	%rcx
	addq	%rcx, %rax
	incl	%r9d
	xorl	%r10d, %r10d
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movss	.LCPI0_1(%rip), %xmm2           # xmm2 = mem[0],zero,zero,zero
.LBB0_13:                               #   Parent Loop BB0_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%r10, %rax
	je	.LBB0_17
# %bb.14:                               #   in Loop: Header=BB0_13 Depth=2
	leal	(%r9,%r10), %r11d
	movslq	%r11d, %r11
	movss	48(%rsp,%r11,4), %xmm1          # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm2, %xmm1
	jne	.LBB0_15
	jnp	.LBB0_17
.LBB0_15:                               #   in Loop: Header=BB0_13 Depth=2
	movss	(%rdx,%r10,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm1, %xmm0
	jbe	.LBB0_17
# %bb.16:                               #   in Loop: Header=BB0_13 Depth=2
	leaq	1(%r10), %r13
	movaps	%xmm1, %xmm0
.LBB0_17:                               #   in Loop: Header=BB0_13 Depth=2
	incq	%r10
	cmpl	$1682, %r10d                    # imm = 0x692
	jne	.LBB0_13
# %bb.18:                               # %.preheader84
                                        #   in Loop: Header=BB0_11 Depth=1
	cmpl	%edi, %r8d
	jge	.LBB0_35
# %bb.19:                               # %.lr.ph100
                                        #   in Loop: Header=BB0_11 Depth=1
	leal	(%rsi,%r13), %r9d
	imull	$1683, 12(%rsp), %r10d          # imm = 0x693
	movslq	%r10d, %r10
	movslq	%r9d, %r9
	addq	%rcx, %r9
	leaq	52(%rsp), %r11
	leaq	(%r11,%r10,4), %r10
	xorl	%r11d, %r11d
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
.LBB0_20:                               #   Parent Loop BB0_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%r11, %rax
	je	.LBB0_25
# %bb.21:                               #   in Loop: Header=BB0_20 Depth=2
	cmpq	%r11, %r9
	je	.LBB0_25
# %bb.22:                               #   in Loop: Header=BB0_20 Depth=2
	movss	(%r10,%r11,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm2, %xmm1
	jne	.LBB0_23
	jnp	.LBB0_25
.LBB0_23:                               #   in Loop: Header=BB0_20 Depth=2
	movss	(%rdx,%r11,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm1, %xmm0
	jbe	.LBB0_25
# %bb.24:                               #   in Loop: Header=BB0_20 Depth=2
	leal	1(%r11), %ebp
	movaps	%xmm1, %xmm0
.LBB0_25:                               #   in Loop: Header=BB0_20 Depth=2
	incq	%r11
	cmpl	$1682, %r11d                    # imm = 0x692
	jne	.LBB0_20
# %bb.26:                               # %.preheader
                                        #   in Loop: Header=BB0_11 Depth=1
	cmpl	%edi, %r8d
	jge	.LBB0_35
# %bb.27:                               # %.lr.ph106
                                        #   in Loop: Header=BB0_11 Depth=1
	addl	%ebp, %esi
	imull	$1683, 12(%rsp), %edi           # imm = 0x693
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	addq	%rsi, %rcx
	leaq	52(%rsp), %rsi
	leaq	(%rsi,%rdi,4), %rsi
	xorl	%edi, %edi
	movss	.LCPI0_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
.LBB0_28:                               #   Parent Loop BB0_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	cmpq	%rdi, %rax
	je	.LBB0_34
# %bb.29:                               #   in Loop: Header=BB0_28 Depth=2
	cmpq	%rdi, %r9
	je	.LBB0_34
# %bb.30:                               #   in Loop: Header=BB0_28 Depth=2
	cmpq	%rdi, %rcx
	je	.LBB0_34
# %bb.31:                               #   in Loop: Header=BB0_28 Depth=2
	movss	(%rsi,%rdi,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm2, %xmm1
	jne	.LBB0_32
	jnp	.LBB0_34
.LBB0_32:                               #   in Loop: Header=BB0_28 Depth=2
	movss	(%rdx,%rdi,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	ucomiss	%xmm1, %xmm0
	jbe	.LBB0_34
# %bb.33:                               #   in Loop: Header=BB0_28 Depth=2
	leal	1(%rdi), %r12d
	movaps	%xmm1, %xmm0
.LBB0_34:                               #   in Loop: Header=BB0_28 Depth=2
	incq	%rdi
	cmpl	$1682, %edi                     # imm = 0x692
	jne	.LBB0_28
.LBB0_35:                               # %._crit_edge107
                                        #   in Loop: Header=BB0_11 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$7, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	12(%rsp), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	16(%rsp), %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.8, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movslq	12(%rsp), %rax
	imulq	$1683, %rax, %rax               # imm = 0x693
	movslq	%r13d, %rcx
	addq	%rax, %rcx
	movss	48(%rsp,%rcx,4), %xmm0          # xmm0 = mem[0],zero,zero,zero
	leal	(%rax,%rbp), %ecx
	movslq	%ecx, %rcx
	addss	48(%rsp,%rcx,4), %xmm0
	addl	%r12d, %eax
	cltq
	addss	48(%rsp,%rax,4), %xmm0
	divss	.LCPI0_2(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.6, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$5, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	xorps	%xmm0, %xmm0
	cvtss2sd	20(%rsp), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %r15
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	movq	%r14, %rdi
	callq	feof
	testl	%eax, %eax
	je	.LBB0_11
.LBB0_36:                               # %._crit_edge115
	movq	%r14, %rdi
	callq	fclose
	xorl	%eax, %eax
	addq	$6355064, %rsp                  # imm = 0x60F878
	.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_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	_ZL19__device_stub__testPfS_,@function # -- Begin function _ZL19__device_stub__testPfS_
_ZL19__device_stub__testPfS_:           # @_ZL19__device_stub__testPfS_
	.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	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_ZL4testPfS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	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_end1:
	.size	_ZL19__device_stub__testPfS_, .Lfunc_end1-_ZL19__device_stub__testPfS_
	.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	.LBB2_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB2_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_ZL4testPfS_, %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_end2:
	.size	__hip_module_ctor, .Lfunc_end2-__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	.LBB3_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
.LBB3_2:
	retq
.Lfunc_end3:
	.size	__hip_module_dtor, .Lfunc_end3-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"start:"
	.size	.L.str, 7

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/3160102482/myhelloworld/ml-100k/u2.base"
	.size	.L.str.1, 46

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

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"%d%d%f%d"
	.size	.L.str.3, 9

	.type	_ZL4testPfS_,@object            # @_ZL4testPfS_
	.section	.rodata,"a",@progbits
	.p2align	3, 0x0
_ZL4testPfS_:
	.quad	_ZL19__device_stub__testPfS_
	.size	_ZL4testPfS_, 8

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"/home/3160102482/myhelloworld/ml-100k/u2.test"
	.size	.L.str.4, 46

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

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

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

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"estimate:"
	.size	.L.str.8, 10

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"real:"
	.size	.L.str.9, 6

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_ZL4testPfS_"
	.size	.L__unnamed_1, 13

	.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

	.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 _ZL19__device_stub__testPfS_
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZL4testPfS_
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.section	.text._ZL4testPfS_,"axG",@progbits,_ZL4testPfS_,comdat
	.globl	_ZL4testPfS_                    ; -- Begin function _ZL4testPfS_
	.p2align	8
	.type	_ZL4testPfS_,@function
_ZL4testPfS_:                           ; @_ZL4testPfS_
; %bb.0:
	v_lshl_add_u32 v2, s15, 8, v0
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e32 0x692, v2
	s_cbranch_execz .LBB0_12
; %bb.1:                                ; %.preheader40.lr.ph
	s_load_b128 s[0:3], s[0:1], 0x0
	v_dual_mov_b32 v3, 0 :: v_dual_add_nc_u32 v0, 0x693, v2
	s_mov_b32 s10, 0
	s_waitcnt lgkmcnt(0)
	s_add_u32 s4, s0, 0x1a50
	s_addc_u32 s5, s1, 0
	s_add_u32 s8, s0, 4
	s_addc_u32 s9, s1, 0
.LBB0_2:                                ; %.preheader40
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
                                        ;       Child Loop BB0_5 Depth 3
	v_ashrrev_i32_e32 v1, 31, v0
	v_add_nc_u32_e32 v4, 1, v2
	s_mov_b64 s[6:7], s[4:5]
	s_mov_b32 s11, 1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[5:6], 2, v[0:1]
	v_mul_lo_u32 v1, 0x693, v4
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, s8, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, s9, v6, vcc_lo
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_5 Depth 3
	s_mov_b32 s12, exec_lo
	v_cmpx_ne_u32_e64 s11, v4
	s_cbranch_execz .LBB0_10
; %bb.4:                                ; %.preheader.preheader
                                        ;   in Loop: Header=BB0_3 Depth=2
	v_mov_b32_e32 v7, 0
	s_mov_b64 s[0:1], 0
.LBB0_5:                                ; %.preheader
                                        ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_3 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_delay_alu instid0(SALU_CYCLE_1)
	v_add_co_u32 v8, vcc_lo, v5, s0
	v_add_co_ci_u32_e32 v9, vcc_lo, s1, v6, vcc_lo
	s_mov_b32 s13, exec_lo
	global_load_b32 v8, v[8:9], off
	s_waitcnt vmcnt(0)
	v_cmpx_neq_f32_e32 -1.0, v8
	s_cbranch_execz .LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=3
	s_add_u32 s14, s6, s0
	s_addc_u32 s15, s7, s1
	global_load_b32 v9, v3, s[14:15]
	s_waitcnt vmcnt(0)
	v_cmp_eq_f32_e32 vcc_lo, -1.0, v9
	s_cbranch_vccnz .LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=3
	v_sub_f32_e32 v8, v8, v9
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v7, v8, v8
.LBB0_8:                                ;   in Loop: Header=BB0_5 Depth=3
	s_or_b32 exec_lo, exec_lo, s13
	s_add_u32 s0, s0, 0x1a4c
	s_addc_u32 s1, s1, 0
	s_cmp_lg_u32 s0, 0x60ddf4
	s_cbranch_scc1 .LBB0_5
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=2
	v_mul_f32_e32 v8, 0x4f800000, v7
	v_cmp_gt_f32_e32 vcc_lo, 0xf800000, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v9, v7, v8, vcc_lo
	v_sqrt_f32_e32 v7, v9
	s_waitcnt_depctr 0xfff
	v_add_nc_u32_e32 v8, -1, v7
	v_add_nc_u32_e32 v10, 1, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_fma_f32 v11, -v8, v7, v9
	v_fma_f32 v12, -v10, v7, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_ge_f32_e64 s0, 0, v11
	v_cndmask_b32_e64 v7, v7, v8, s0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cmp_lt_f32_e64 s0, 0, v12
	v_cndmask_b32_e64 v10, v7, v10, s0
	v_add_nc_u32_e32 v7, s11, v1
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_f32_e32 v11, 0x37800000, v10
	v_ashrrev_i32_e32 v8, 31, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cndmask_b32_e32 v10, v10, v11, vcc_lo
	v_lshlrev_b64 v[7:8], 2, v[7:8]
	v_cmp_class_f32_e64 vcc_lo, v9, 0x260
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v9, v10, v9, vcc_lo
	v_add_co_u32 v7, vcc_lo, s2, v7
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v8, vcc_lo, s3, v8, vcc_lo
	global_store_b32 v[7:8], v9, off
.LBB0_10:                               ; %Flow59
                                        ;   in Loop: Header=BB0_3 Depth=2
	s_or_b32 exec_lo, exec_lo, s12
	s_add_i32 s11, s11, 1
	s_add_u32 s6, s6, 4
	s_addc_u32 s7, s7, 0
	s_cmpk_lg_i32 s11, 0x693
	s_cbranch_scc1 .LBB0_3
; %bb.11:                               ;   in Loop: Header=BB0_2 Depth=1
	v_add_nc_u32_e32 v1, 0x2000, v2
	v_cmp_lt_i32_e32 vcc_lo, 0xffffe691, v2
	v_add_nc_u32_e32 v0, 0x2000, v0
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_mov_b32_e32 v2, v1
	s_or_b32 s10, vcc_lo, s10
	s_and_not1_b32 exec_lo, exec_lo, s10
	s_cbranch_execnz .LBB0_2
.LBB0_12:                               ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _ZL4testPfS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.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 13
		.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
	.section	.text._ZL4testPfS_,"axG",@progbits,_ZL4testPfS_,comdat
.Lfunc_end0:
	.size	_ZL4testPfS_, .Lfunc_end0-_ZL4testPfS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 524
; NumSgprs: 18
; NumVgprs: 13
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 13
; 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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _ZL4testPfS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _ZL4testPfS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     13
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
