/**********************************************************************
 * DESCRIPTION:
 *   Serial Concurrent Wave Equation - C Version
 *   This program implements the concurrent wave equation
 *********************************************************************/
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <iomanip>

#define MAXPOINTS 1000000
#define MAXSTEPS 1000000
#define MINPOINTS 20
#define PI 3.14159265
#define THREADPERWARP 32
#define SMNUM		   80

void check_param(void);
void init_line(void);
void update (void);
void printfinal (void);

int nsteps,                 	/* number of time steps */
	tpoints, 	     		/* total points along string */
	rcode;                  	/* generic return code */
float  values[MAXPOINTS]; 	/* values at time t */
float *cudaValues;
int cudaArraySize;


/**********************************************************************
 *	Checks input values from parameters
 *********************************************************************/
void check_param(void)
{
	char tchar[20];

	/* check number of points, number of iterations */
	while ((tpoints < MINPOINTS) || (tpoints > MAXPOINTS)) {
		printf("Enter number of points along vibrating string [%d-%d]: "
				,MINPOINTS, MAXPOINTS);
		scanf("%s", tchar);
		tpoints = atoi(tchar);
		if ((tpoints < MINPOINTS) || (tpoints > MAXPOINTS))
			printf("Invalid. Please enter value between %d and %d\n",
					MINPOINTS, MAXPOINTS);
	}
	while ((nsteps < 1) || (nsteps > MAXSTEPS)) {
		printf("Enter number of time steps [1-%d]: ", MAXSTEPS);
		scanf("%s", tchar);
		nsteps = atoi(tchar);
		if ((nsteps < 1) || (nsteps > MAXSTEPS))
			printf("Invalid. Please enter value between 1 and %d\n", MAXSTEPS);
	}

	printf("Using points = %d, steps = %d\n", tpoints, nsteps);

}

/**********************************************************************
 *     Initialize points on line
 *********************************************************************/
void init_line(void)
{
	int i, j;
	float x, tmp;

	/* Calculate initial values based on sine curve */
	//float fac = 2.0 * PI;
	float fac = 6.2831853;
	//k = 0.0;
	tmp = tpoints - 1;
	for (j = 0; j < tpoints; ++j) {
		x = static_cast<float>(j)/tmp;
		values[j] = sin (fac * x);
	}

	/* Initialize old values array */
}
/**********************************************************************
 *     Print final results
 *********************************************************************/
void printfinal()
{
	int i;

	printf("0.0000 ");
	for (i = 1; i < tpoints; ++i) {
		printf("%6.4f ", values[i]);
		if (i%10 == 9)
			printf("\n");
	}
}
__global__ void cudaExecute(float* cudaAns,int howMany,int tpoints,int tIteration)
{
	float cudaValues,cudaOld,cudaNew;
	double cudaTwiceValue;
	double valuePar = 2.0 - static_cast<float>(0.09) * 2.0;
	for(int block=0;block<howMany;++block)
	{
		int ansIndex=block*(SMNUM*THREADPERWARP) + blockIdx.x*blockDim.x + threadIdx.x;
		cudaValues = cudaAns[ansIndex];
		cudaOld = cudaValues;
		for(int iter=0;iter<tIteration;++iter)
		{
			cudaTwiceValue = valuePar * cudaValues;
			cudaNew = (cudaTwiceValue) - cudaOld;
			//cudaNew = (2.0 * cudaValues)
			//				 - cudaOld
			//				 + (static_cast<float>(0.09) *  (-2.0)*cudaValues);
			cudaOld=cudaValues;
			cudaValues=cudaNew;
		}
		cudaAns[ansIndex]=cudaValues;
	}
}

/**********************************************************************
 *	Main program
 *********************************************************************/
int main(int argc, char *argv[])
{
	sscanf(argv[1],"%d",&tpoints);
	sscanf(argv[2],"%d",&nsteps);
	check_param();
	int howManyBlock=tpoints/(SMNUM*THREADPERWARP);
	if(tpoints%(SMNUM*THREADPERWARP)!=0)
		++howManyBlock;
	cudaArraySize = tpoints*sizeof(float);
	printf("Initializing points on the line...\n");
	cudaMalloc((void**)&cudaValues,cudaArraySize);
	init_line();
	cudaMemcpy(cudaValues,values,cudaArraySize,cudaMemcpyHostToDevice);
	cudaExecute<<<SMNUM,THREADPERWARP>>>(cudaValues,howManyBlock,tpoints,nsteps);
	cudaMemcpy(values,cudaValues,cudaArraySize-4,cudaMemcpyDeviceToHost);
	//update();
	printf("Updating all points for all time steps...\n");
	printf("Printing final results...\n");
	printfinal();
	printf("\nDone.\n\n");

	return 0;
}

	.file	"tmpxft_003b1b13_00000000-6_wave.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3921:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3921:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Enter number of points along vibrating string [%d-%d]: "
.LC1:
	.string	"%s"
.LC2:
	.string	"Invalid. Please enter value between %d and %d\n"
.LC3:
	.string	"Enter number of time steps [1-%d]: "
.LC4:
	.string	"Invalid. Please enter value between 1 and %d\n"
.LC5:
	.string	"Using points = %d, steps = %d\n"
	.text
	.globl	_Z11check_paramv
	.type	_Z11check_paramv, @function
_Z11check_paramv:
.LFB3915:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
.L4:
	movl	tpoints(%rip), %eax
	subl	$20, %eax
	cmpl	$999980, %eax
	jbe	.L14
	movl	$1000000, %ecx
	movl	$20, %edx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	4(%rsp), %rbx
	call	__printf_chk@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movq	%rbx, %rdi
	call	atoi@PLT
	movl	%eax, tpoints(%rip)
	subl	$20, %eax
	cmpl	$999980, %eax
	jbe	.L4
	movl	$1000000, %ecx
	movl	$20, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	jmp	.L4
.L14:
	leaq	.LC3(%rip), %rbp
.L7:
	movl	nsteps(%rip), %ecx
	leal	-1(%rcx), %eax
	cmpl	$999999, %eax
	jbe	.L15
	movl	$1000000, %edx
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	4(%rsp), %rbx
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	__isoc23_scanf@PLT
	movq	%rbx, %rdi
	call	atoi@PLT
	movl	%eax, nsteps(%rip)
	decl	%eax
	cmpl	$999999, %eax
	jbe	.L7
	movl	$1000000, %edx
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L15:
	movl	tpoints(%rip), %edx
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3915:
	.size	_Z11check_paramv, .-_Z11check_paramv
	.globl	_Z9init_linev
	.type	_Z9init_linev, @function
_Z9init_linev:
.LFB3916:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	values(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movl	tpoints(%rip), %ebp
	leal	-1(%rbp), %eax
	cvtsi2ssl	%eax, %xmm1
	movss	%xmm1, 12(%rsp)
.L17:
	cmpl	%ebx, %ebp
	jle	.L20
	cvtsi2ssl	%ebx, %xmm0
	divss	12(%rsp), %xmm0
	mulss	.LC6(%rip), %xmm0
	call	sinf@PLT
	movss	%xmm0, (%r12,%rbx,4)
	incq	%rbx
	jmp	.L17
.L20:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3916:
	.size	_Z9init_linev, .-_Z9init_linev
	.section	.rodata.str1.1
.LC7:
	.string	"0.0000 "
.LC8:
	.string	"%6.4f "
.LC9:
	.string	"\n"
	.text
	.globl	_Z10printfinalv
	.type	_Z10printfinalv, @function
_Z10printfinalv:
.LFB3917:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	values(%rip), %r12
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	$1, %ebx
	call	__printf_chk@PLT
.L22:
	cmpl	%ebx, tpoints(%rip)
	movl	%ebx, %ebp
	jle	.L26
	leaq	.LC8(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	(%r12,%rbx,4), %xmm0
	call	__printf_chk@PLT
	movl	%ebp, %eax
	movl	$10, %ecx
	cltd
	idivl	%ecx
	cmpl	$9, %edx
	jne	.L23
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L23:
	incq	%rbx
	jmp	.L22
.L26:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3917:
	.size	_Z10printfinalv, .-_Z10printfinalv
	.globl	_Z34__device_stub__Z11cudaExecutePfiiiPfiii
	.type	_Z34__device_stub__Z11cudaExecutePfiiiPfiii, @function
_Z34__device_stub__Z11cudaExecutePfiiiPfiii:
.LFB3943:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movl	%esi, 20(%rsp)
	leaq	68(%rsp), %rsi
	movl	%edx, 16(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 12(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L27
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11cudaExecutePfiii(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L27:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L29
	call	__stack_chk_fail@PLT
.L29:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3943:
	.size	_Z34__device_stub__Z11cudaExecutePfiiiPfiii, .-_Z34__device_stub__Z11cudaExecutePfiiiPfiii
	.globl	_Z11cudaExecutePfiii
	.type	_Z11cudaExecutePfiii, @function
_Z11cudaExecutePfiii:
.LFB3944:
	.cfi_startproc
	endbr64
	jmp	_Z34__device_stub__Z11cudaExecutePfiiiPfiii
	.cfi_endproc
.LFE3944:
	.size	_Z11cudaExecutePfiii, .-_Z11cudaExecutePfiii
	.section	.rodata.str1.1
.LC10:
	.string	"%d"
.LC11:
	.string	"Initializing points on the line...\n"
.LC12:
	.string	"Updating all points for all time steps...\n"
.LC13:
	.string	"Printing final results...\n"
.LC14:
	.string	"\nDone.\n\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3918:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC10(%rip), %rbp
	leaq	tpoints(%rip), %rdx
	xorl	%eax, %eax
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 64
	movq	8(%rsi), %rdi
	movq	%rbp, %rsi
	call	__isoc23_sscanf@PLT
	movq	16(%rbx), %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	nsteps(%rip), %rdx
	leaq	values(%rip), %rbp
	call	__isoc23_sscanf@PLT
	call	_Z11check_paramv
	movl	tpoints(%rip), %eax
	movl	$2560, %ecx
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	cltd
	idivl	%ecx
	cmpl	$1, %edx
	sbbl	$-1, %eax
	movl	%eax, %ebx
	movl	tpoints(%rip), %eax
	leal	0(,%rax,4), %edx
	xorl	%eax, %eax
	movl	%edx, cudaArraySize(%rip)
	call	__printf_chk@PLT
	movslq	cudaArraySize(%rip), %rsi
	leaq	cudaValues(%rip), %rdi
	call	cudaMalloc@PLT
	call	_Z9init_linev
	movslq	cudaArraySize(%rip), %rdx
	movl	$1, %ecx
	movq	%rbp, %rsi
	movq	cudaValues(%rip), %rdi
	call	cudaMemcpy@PLT
	movl	$134217729, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$268435461, %edi
	salq	$5, %rdx
	movl	$1, %ecx
	movl	$1, %esi
	salq	$4, %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L34
	movl	nsteps(%rip), %ecx
	movl	tpoints(%rip), %edx
	movl	%ebx, %esi
	movq	cudaValues(%rip), %rdi
	call	_Z34__device_stub__Z11cudaExecutePfiiiPfiii
.L34:
	movl	cudaArraySize(%rip), %eax
	movq	cudaValues(%rip), %rsi
	movl	$2, %ecx
	movq	%rbp, %rdi
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	call	cudaMemcpy@PLT
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z10printfinalv
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$40, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3918:
	.size	main, .-main
	.section	.rodata.str1.1
.LC15:
	.string	"_Z11cudaExecutePfiii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3946:
	.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	.LC15(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z11cudaExecutePfiii(%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
.LFE3946:
	.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	cudaArraySize
	.bss
	.align 4
	.type	cudaArraySize, @object
	.size	cudaArraySize, 4
cudaArraySize:
	.zero	4
	.globl	cudaValues
	.align 8
	.type	cudaValues, @object
	.size	cudaValues, 8
cudaValues:
	.zero	8
	.globl	values
	.align 32
	.type	values, @object
	.size	values, 4000000
values:
	.zero	4000000
	.globl	rcode
	.align 4
	.type	rcode, @object
	.size	rcode, 4
rcode:
	.zero	4
	.globl	tpoints
	.align 4
	.type	tpoints, @object
	.size	tpoints, 4
tpoints:
	.zero	4
	.globl	nsteps
	.align 4
	.type	nsteps, @object
	.size	nsteps, 4
nsteps:
	.zero	4
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC6:
	.long	1086918619
	.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:

/**********************************************************************
 * DESCRIPTION:
 *   Serial Concurrent Wave Equation - C Version
 *   This program implements the concurrent wave equation
 *********************************************************************/

#include <hip/hip_runtime.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <iostream>
#include <iomanip>

#define MAXPOINTS 1000000
#define MAXSTEPS 1000000
#define MINPOINTS 20
#define PI 3.14159265
#define THREADPERWARP 32
#define SMNUM		   80

void check_param(void);
void init_line(void);
void update (void);
void printfinal (void);

int nsteps,                 	/* number of time steps */
	tpoints, 	     		/* total points along string */
	rcode;                  	/* generic return code */
float  values[MAXPOINTS]; 	/* values at time t */
float *cudaValues;
int cudaArraySize;


/**********************************************************************
 *	Checks input values from parameters
 *********************************************************************/
void check_param(void)
{
	char tchar[20];

	/* check number of points, number of iterations */
	while ((tpoints < MINPOINTS) || (tpoints > MAXPOINTS)) {
		printf("Enter number of points along vibrating string [%d-%d]: "
				,MINPOINTS, MAXPOINTS);
		scanf("%s", tchar);
		tpoints = atoi(tchar);
		if ((tpoints < MINPOINTS) || (tpoints > MAXPOINTS))
			printf("Invalid. Please enter value between %d and %d\n",
					MINPOINTS, MAXPOINTS);
	}
	while ((nsteps < 1) || (nsteps > MAXSTEPS)) {
		printf("Enter number of time steps [1-%d]: ", MAXSTEPS);
		scanf("%s", tchar);
		nsteps = atoi(tchar);
		if ((nsteps < 1) || (nsteps > MAXSTEPS))
			printf("Invalid. Please enter value between 1 and %d\n", MAXSTEPS);
	}

	printf("Using points = %d, steps = %d\n", tpoints, nsteps);

}

/**********************************************************************
 *     Initialize points on line
 *********************************************************************/
void init_line(void)
{
	int i, j;
	float x, tmp;

	/* Calculate initial values based on sine curve */
	//float fac = 2.0 * PI;
	float fac = 6.2831853;
	//k = 0.0;
	tmp = tpoints - 1;
	for (j = 0; j < tpoints; ++j) {
		x = static_cast<float>(j)/tmp;
		values[j] = sin (fac * x);
	}

	/* Initialize old values array */
}
/**********************************************************************
 *     Print final results
 *********************************************************************/
void printfinal()
{
	int i;

	printf("0.0000 ");
	for (i = 1; i < tpoints; ++i) {
		printf("%6.4f ", values[i]);
		if (i%10 == 9)
			printf("\n");
	}
}
__global__ void cudaExecute(float* cudaAns,int howMany,int tpoints,int tIteration)
{
	float cudaValues,cudaOld,cudaNew;
	double cudaTwiceValue;
	double valuePar = 2.0 - static_cast<float>(0.09) * 2.0;
	for(int block=0;block<howMany;++block)
	{
		int ansIndex=block*(SMNUM*THREADPERWARP) + blockIdx.x*blockDim.x + threadIdx.x;
		cudaValues = cudaAns[ansIndex];
		cudaOld = cudaValues;
		for(int iter=0;iter<tIteration;++iter)
		{
			cudaTwiceValue = valuePar * cudaValues;
			cudaNew = (cudaTwiceValue) - cudaOld;
			//cudaNew = (2.0 * cudaValues)
			//				 - cudaOld
			//				 + (static_cast<float>(0.09) *  (-2.0)*cudaValues);
			cudaOld=cudaValues;
			cudaValues=cudaNew;
		}
		cudaAns[ansIndex]=cudaValues;
	}
}

/**********************************************************************
 *	Main program
 *********************************************************************/
int main(int argc, char *argv[])
{
	sscanf(argv[1],"%d",&tpoints);
	sscanf(argv[2],"%d",&nsteps);
	check_param();
	int howManyBlock=tpoints/(SMNUM*THREADPERWARP);
	if(tpoints%(SMNUM*THREADPERWARP)!=0)
		++howManyBlock;
	cudaArraySize = tpoints*sizeof(float);
	printf("Initializing points on the line...\n");
	hipMalloc((void**)&cudaValues,cudaArraySize);
	init_line();
	hipMemcpy(cudaValues,values,cudaArraySize,hipMemcpyHostToDevice);
	cudaExecute<<<SMNUM,THREADPERWARP>>>(cudaValues,howManyBlock,tpoints,nsteps);
	hipMemcpy(values,cudaValues,cudaArraySize-4,hipMemcpyDeviceToHost);
	//update();
	printf("Updating all points for all time steps...\n");
	printf("Printing final results...\n");
	printfinal();
	printf("\nDone.\n\n");

	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z11check_paramv                # -- Begin function _Z11check_paramv
	.type	_Z11check_paramv,@function
_Z11check_paramv:                       # @_Z11check_paramv
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	tpoints(%rip), %eax
	leal	-1000001(%rax), %ecx
	cmpl	$-999982, %ecx                  # imm = 0xFFF0BDD2
	ja	.LBB0_3
# %bb.1:
	movq	%rsp, %rbx
.LBB0_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str, %edi
	movl	$20, %esi
	movl	$1000000, %edx                  # imm = 0xF4240
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.1, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movq	%rbx, %rdi
	callq	atoi
                                        # kill: def $eax killed $eax def $rax
	movl	%eax, tpoints(%rip)
	leal	-1000001(%rax), %ecx
	cmpl	$-999982, %ecx                  # imm = 0xFFF0BDD2
	ja	.LBB0_3
# %bb.9:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str.2, %edi
	movl	$20, %esi
	movl	$1000000, %edx                  # imm = 0xF4240
	xorl	%eax, %eax
	callq	printf
	movl	tpoints(%rip), %eax
	leal	-1000001(%rax), %ecx
	cmpl	$-999981, %ecx                  # imm = 0xFFF0BDD3
	jb	.LBB0_2
.LBB0_3:                                # %.preheader
	movl	nsteps(%rip), %edx
	movl	$-1000001, %r14d                # imm = 0xFFF0BDBF
	leal	(%rdx,%r14), %ecx
	cmpl	%r14d, %ecx
	ja	.LBB0_8
# %bb.4:
	movq	%rsp, %rbx
.LBB0_5:                                # %.lr.ph4
                                        # =>This Inner Loop Header: Depth=1
	movl	$.L.str.3, %edi
	movl	$1000000, %esi                  # imm = 0xF4240
	xorl	%eax, %eax
	callq	printf
	movl	$.L.str.1, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movq	%rbx, %rdi
	callq	atoi
	movl	%eax, %edx
	movl	%eax, nsteps(%rip)
	leal	(%rdx,%r14), %eax
	cmpl	%r14d, %eax
	ja	.LBB0_7
# %bb.6:                                #   in Loop: Header=BB0_5 Depth=1
	movl	$.L.str.4, %edi
	movl	$1000000, %esi                  # imm = 0xF4240
	xorl	%eax, %eax
	callq	printf
	movl	nsteps(%rip), %edx
	leal	-1000001(%rdx), %eax
	cmpl	$-1000000, %eax                 # imm = 0xFFF0BDC0
	jb	.LBB0_5
.LBB0_7:                                # %._crit_edge.loopexit
	movl	tpoints(%rip), %eax
.LBB0_8:                                # %._crit_edge
	movl	$.L.str.5, %edi
	movl	%eax, %esi
                                        # kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	printf
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z11check_paramv, .Lfunc_end0-_Z11check_paramv
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z9init_linev
.LCPI1_0:
	.long	0x40c90fdb                      # float 6.28318548
	.text
	.globl	_Z9init_linev
	.type	_Z9init_linev,@function
_Z9init_linev:                          # @_Z9init_linev
	.cfi_startproc
# %bb.0:
	movl	tpoints(%rip), %eax
	testl	%eax, %eax
	jle	.LBB1_4
# %bb.1:                                # %.lr.ph.preheader
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -16
	decl	%eax
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	xorl	%ebx, %ebx
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%ebx, %xmm0
	divss	12(%rsp), %xmm0                 # 4-byte Folded Reload
	mulss	.LCPI1_0(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm0
	callq	sin
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, values(,%rbx,4)
	incq	%rbx
	movslq	tpoints(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB1_2
# %bb.3:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	.cfi_restore %rbx
.LBB1_4:                                # %._crit_edge
	retq
.Lfunc_end1:
	.size	_Z9init_linev, .Lfunc_end1-_Z9init_linev
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printfinalv                 # -- Begin function _Z10printfinalv
	.type	_Z10printfinalv,@function
_Z10printfinalv:                        # @_Z10printfinalv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %rbp, -16
	movl	$.L.str.6, %edi
	xorl	%eax, %eax
	callq	printf
	cmpl	$2, tpoints(%rip)
	jl	.LBB2_5
# %bb.1:                                # %.lr.ph.preheader
	movl	$1, %ebx
	movl	$3435973837, %r14d              # imm = 0xCCCCCCCD
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%ebx, %eax
	imulq	%r14, %rax
	shrq	$35, %rax
	addl	%eax, %eax
	leal	(%rax,%rax,4), %eax
	movl	%ebx, %ebp
	subl	%eax, %ebp
	xorps	%xmm0, %xmm0
	cvtss2sd	values(,%rbx,4), %xmm0
	movl	$.L.str.7, %edi
	movb	$1, %al
	callq	printf
	cmpl	$9, %ebp
	jne	.LBB2_4
# %bb.3:                                #   in Loop: Header=BB2_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB2_4:                                #   in Loop: Header=BB2_2 Depth=1
	incq	%rbx
	movslq	tpoints(%rip), %rax
	cmpq	%rax, %rbx
	jl	.LBB2_2
.LBB2_5:                                # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z10printfinalv, .Lfunc_end2-_Z10printfinalv
	.cfi_endproc
                                        # -- End function
	.globl	_Z26__device_stub__cudaExecutePfiii # -- Begin function _Z26__device_stub__cudaExecutePfiii
	.type	_Z26__device_stub__cudaExecutePfiii,@function
_Z26__device_stub__cudaExecutePfiii:    # @_Z26__device_stub__cudaExecutePfiii
	.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	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	20(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	16(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	12(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%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	$_Z11cudaExecutePfiii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	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_end3:
	.size	_Z26__device_stub__cudaExecutePfiii, .Lfunc_end3-_Z26__device_stub__cudaExecutePfiii
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rsi, %rbx
	movq	8(%rsi), %rdi
	movl	$.L.str.9, %esi
	movl	$tpoints, %edx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	16(%rbx), %rdi
	movl	$.L.str.9, %esi
	movl	$nsteps, %edx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	callq	_Z11check_paramv
	movl	tpoints(%rip), %ebx
	leal	(,%rbx,4), %eax
	movl	%eax, cudaArraySize(%rip)
	movl	$.Lstr, %edi
	callq	puts@PLT
	movslq	cudaArraySize(%rip), %rsi
	movl	$cudaValues, %edi
	callq	hipMalloc
	callq	_Z9init_linev
	movq	cudaValues(%rip), %rdi
	movslq	cudaArraySize(%rip), %rdx
	movl	$values, %esi
	movl	$1, %ecx
	callq	hipMemcpy
	movabsq	$4294967328, %rdx               # imm = 0x100000020
	leaq	48(%rdx), %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:
	movslq	%ebx, %rax
	imulq	$1717986919, %rax, %rax         # imm = 0x66666667
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$42, %rax
	addl	%ecx, %eax
	movl	%eax, %ecx
	shll	$9, %ecx
	leal	(%rcx,%rcx,4), %ecx
	xorl	%esi, %esi
	cmpl	%ecx, %ebx
	setne	%sil
	addl	%eax, %esi
	movq	cudaValues(%rip), %rdi
	movl	tpoints(%rip), %edx
	movl	nsteps(%rip), %ecx
	callq	_Z26__device_stub__cudaExecutePfiii
.LBB4_2:
	movq	cudaValues(%rip), %rsi
	movslq	cudaArraySize(%rip), %rdx
	addq	$-4, %rdx
	movl	$values, %edi
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	callq	_Z10printfinalv
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11cudaExecutePfiii, %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_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	nsteps,@object                  # @nsteps
	.bss
	.globl	nsteps
	.p2align	2, 0x0
nsteps:
	.long	0                               # 0x0
	.size	nsteps, 4

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

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

	.type	values,@object                  # @values
	.globl	values
	.p2align	4, 0x0
values:
	.zero	4000000
	.size	values, 4000000

	.type	cudaValues,@object              # @cudaValues
	.globl	cudaValues
	.p2align	3, 0x0
cudaValues:
	.quad	0
	.size	cudaValues, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Enter number of points along vibrating string [%d-%d]: "
	.size	.L.str, 56

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"%s"
	.size	.L.str.1, 3

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Invalid. Please enter value between %d and %d\n"
	.size	.L.str.2, 47

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Enter number of time steps [1-%d]: "
	.size	.L.str.3, 36

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Invalid. Please enter value between 1 and %d\n"
	.size	.L.str.4, 46

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Using points = %d, steps = %d\n"
	.size	.L.str.5, 31

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"%6.4f "
	.size	.L.str.7, 7

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

	.type	.L.str.9,@object                # @.str.9
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.9:
	.asciz	"%d"
	.size	.L.str.9, 3

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z11cudaExecutePfiii"
	.size	.L__unnamed_1, 21

	.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	"Initializing points on the line..."
	.size	.Lstr, 35

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Updating all points for all time steps..."
	.size	.Lstr.1, 42

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Printing final results..."
	.size	.Lstr.2, 26

	.type	.Lstr.3,@object                 # @str.3
.Lstr.3:
	.asciz	"\nDone.\n"
	.size	.Lstr.3, 8

	.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 _Z26__device_stub__cudaExecutePfiii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym nsteps
	.addrsig_sym tpoints
	.addrsig_sym values
	.addrsig_sym cudaValues
	.addrsig_sym _Z11cudaExecutePfiii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11cudaExecutePfiii    ; -- Begin function _Z11cudaExecutePfiii
	.globl	_Z11cudaExecutePfiii
	.p2align	8
	.type	_Z11cudaExecutePfiii,@function
_Z11cudaExecutePfiii:                   ; @_Z11cudaExecutePfiii
; %bb.0:
	s_load_b32 s6, s[0:1], 0x8
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s6, 1
	s_cbranch_scc1 .LBB0_5
; %bb.1:                                ; %.lr.ph27
	s_clause 0x2
	s_load_b32 s4, s[0:1], 0x24
	s_load_b32 s7, s[0:1], 0x10
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s1, s4, 0xffff
	s_cmp_gt_i32 s7, 0
	s_brev_b32 s4, 10
	s_cselect_b32 s0, -1, 0
	s_mov_b32 s5, 0x3ffd1eb8
	v_cndmask_b32_e64 v1, 0, 1, s0
	s_mul_i32 s15, s15, s1
	s_mov_b32 s1, 0
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_ne_u32_e64 s0, 1, v1
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	s_mul_i32 s8, s1, 0xa00
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add3_u32 v1, s15, s8, v0
	s_mov_b32 s8, s7
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	v_add_co_u32 v1, vcc_lo, s2, v1
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v2, vcc_lo, s3, v2, vcc_lo
	s_and_b32 vcc_lo, exec_lo, s0
	global_load_b32 v3, v[1:2], off
	s_waitcnt vmcnt(0)
	v_mov_b32_e32 v4, v3
	s_cbranch_vccnz .LBB0_4
.LBB0_3:                                ; %.lr.ph
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mov_b32_e32 v7, v3
	v_cvt_f64_f32_e32 v[3:4], v4
	s_add_i32 s8, s8, -1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_cmp_eq_u32 s8, 0
	v_cvt_f64_f32_e32 v[5:6], v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[3:4], v[5:6], s[4:5], -v[3:4]
	v_cvt_f32_f64_e32 v3, v[3:4]
	v_mov_b32_e32 v4, v7
	s_cbranch_scc0 .LBB0_3
.LBB0_4:                                ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s1, s1, 1
	global_store_b32 v[1:2], v3, off
	s_cmp_eq_u32 s1, s6
	s_cbranch_scc0 .LBB0_2
.LBB0_5:                                ; %._crit_edge28
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11cudaExecutePfiii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 280
		.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 8
		.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	_Z11cudaExecutePfiii, .Lfunc_end0-_Z11cudaExecutePfiii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 272
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; 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
      - .offset:         8
        .size:           4
        .value_kind:     by_value
      - .offset:         12
        .size:           4
        .value_kind:     by_value
      - .offset:         16
        .size:           4
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         28
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         36
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         38
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         40
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         42
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         44
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         46
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         88
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 280
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z11cudaExecutePfiii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11cudaExecutePfiii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
