#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <cuda.h>

#define MAXPOINTS 1000000
#define MAXSTEPS 1000000
#define MINPOINTS 20
#define PI 3.14159265

void check_param(void);
void init_line(void);
void update (void);
void printfinal (void);
__device__ void do_math(float*, float*, float*, int );

//---------------------------------------------------------------------------
//	Kernel function
//---------------------------------------------------------------------------
__global__ void gpu_init_line( float*, float*, int );
__global__ void gpu_update( float*, float*, float*, int, int );


int nsteps,                 	/* number of time steps */
	tpoints, 	     		/* total points along string */
	rcode;                  	/* generic return code */

float  values[MAXPOINTS+2], 	/* values at time t */
	   oldval[MAXPOINTS+2], 	/* values at time (t-dt) */
	   newval[MAXPOINTS+2]; 	/* values at time (t+dt) */

float *gValues, 
	  *gOldVal, 
	  *gNewVal;


/**********************************************************************
 *	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
 *********************************************************************/
__global__ void gpu_init_line( float *gOld, float *gVal, int tpoints )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	/* Initialize old values array */
	gOld[index] = gVal[index];
}

void init_line(void)
{
	//int i, j;
	int j;
	float x, fac, k, tmp;

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

	cudaMemcpy( gValues, values, (MAXPOINTS+2)*sizeof(float),
			cudaMemcpyHostToDevice );

	dim3 dimBlock( 512 ), dimGrid( (tpoints + dimBlock.x -1) / dimBlock.x );
	gpu_init_line<<<dimGrid, dimBlock>>>( gOldVal, gValues, tpoints );
}


/**********************************************************************
 *      Calculate new values using wave equation
 *********************************************************************/
__device__ void do_math(float *gOld, float *gVal, float *gNew, int i)
{
	float dtime, c, dx, tau, sqtau;

	dtime = 0.3;
	c = 1.0;
	dx = 1.0;
	tau = (c * dtime / dx);
	sqtau = tau * tau;
	gNew[i] = (2.0 * gVal[i]) - gOld[i] + (sqtau *  (-2.0)*gVal[i]);
}

/**********************************************************************
 *     Update all values along line a specified number of times
 *********************************************************************/
__global__ void gpu_update( float *gOld, float *gVal, float *gNew, int nsteps,
		int tpoints )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	/* Update values for each time step */
	for( int i=0; i < nsteps; i++ ) {
		/* global endpoints */
		if( (index == 1) || (index == tpoints) )
			gNew[index] = 0.0;
		else
			do_math( gOld, gVal, gNew, index );

		/* Update old values with new values */
		gOld[index] = gVal[index];
		gVal[index] = gNew[index];
	}
}

void update()
{

	dim3 threadsPerBlock( 512 ),
		 blocksPerGrid( (tpoints + threadsPerBlock.x -1) / threadsPerBlock.x );
	gpu_update<<<blocksPerGrid, threadsPerBlock>>>( gOldVal, gValues, gNewVal, nsteps, tpoints );

	cudaMemcpy( values, gValues, (MAXPOINTS+2)*sizeof(float),
			cudaMemcpyDeviceToHost );
}


/**********************************************************************
 *     Print final results
 *********************************************************************/
void printfinal()
{
	int i;

	for (i = 1; i <= tpoints; i++) {
		printf("%6.4f ", values[i]);
		if (i%10 == 0)
			printf("\n");
	}
}

/**********************************************************************
 *	Main program
 *********************************************************************/
int main(int argc, char *argv[])
{
	sscanf(argv[1],"%d",&tpoints);
	sscanf(argv[2],"%d",&nsteps);

	/*	Allocate space in device Global Memory	*/
	cudaMalloc( (void**)&gValues, (MAXPOINTS+2)*sizeof(float) );
	cudaMalloc( (void**)&gOldVal, (MAXPOINTS+2)*sizeof(float) );
	cudaMalloc( (void**)&gNewVal, (MAXPOINTS+2)*sizeof(float) );

	check_param();
	printf("Initializing points on the line...\n");
	init_line();
	printf("Updating all points for all time steps...\n");
	update();
	printf("Printing final results...\n");
	printfinal();
	printf("\nDone.\n\n");

	/*	Free allocated space in device Global Memory	*/
	cudaFree( gValues );
	cudaFree( gOldVal );
	cudaFree( gNewVal );

	return 0;
}

	.file	"tmpxft_002e681d_00000000-6_cuda_wave.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2035:
	.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:
.LFB2027:
	.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
.LFE2027:
	.size	_Z11check_paramv, .-_Z11check_paramv
	.globl	_Z7do_mathPfS_S_i
	.type	_Z7do_mathPfS_S_i, @function
_Z7do_mathPfS_S_i:
.LFB2029:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE2029:
	.size	_Z7do_mathPfS_S_i, .-_Z7do_mathPfS_S_i
	.section	.rodata.str1.1
.LC6:
	.string	"%6.4f "
.LC7:
	.string	"\n"
	.text
	.globl	_Z10printfinalv
	.type	_Z10printfinalv, @function
_Z10printfinalv:
.LFB2031:
	.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
	movl	$1, %ebx
.L19:
	cmpl	%ebx, tpoints(%rip)
	movl	%ebx, %ebp
	jl	.L23
	leaq	.LC6(%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
	testl	%edx, %edx
	jne	.L20
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	incq	%rbx
	jmp	.L19
.L23:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z10printfinalv, .-_Z10printfinalv
	.globl	_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i
	.type	_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i, @function
_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdi, 24(%rsp)
	leaq	40(%rsp), %rcx
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 12(%rsp)
	leaq	32(%rsp), %rdx
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 112(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	pushq	40(%rsp)
	.cfi_def_cfa_offset 152
	leaq	_Z13gpu_init_linePfS_i(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 160
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 152
	popq	%rdx
	.cfi_def_cfa_offset 144
.L24:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$136, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i, .-_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i
	.globl	_Z13gpu_init_linePfS_i
	.type	_Z13gpu_init_linePfS_i, @function
_Z13gpu_init_linePfS_i:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i
	.cfi_endproc
.LFE2058:
	.size	_Z13gpu_init_linePfS_i, .-_Z13gpu_init_linePfS_i
	.globl	_Z9init_linev
	.type	_Z9init_linev, @function
_Z9init_linev:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorps	%xmm1, %xmm1
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	values(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movl	tpoints(%rip), %r12d
	leal	-1(%r12), %eax
	cvtsi2ssl	%eax, %xmm2
	movss	%xmm2, 8(%rsp)
.L30:
	incq	%rbx
	cmpl	%ebx, %r12d
	jl	.L34
	movaps	%xmm1, %xmm0
	divss	8(%rsp), %xmm0
	movss	%xmm1, 12(%rsp)
	mulss	.LC9(%rip), %xmm0
	call	sinf@PLT
	movss	12(%rsp), %xmm1
	addss	.LC10(%rip), %xmm1
	movss	%xmm0, 0(%rbp,%rbx,4)
	jmp	.L30
.L34:
	movq	gValues(%rip), %rdi
	movl	$1, %ecx
	movl	$4000008, %edx
	movq	%rbp, %rsi
	call	cudaMemcpy@PLT
	movl	$8388609, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	tpoints(%rip), %eax
	salq	$9, %rdx
	movl	$1, %ecx
	addl	$511, %eax
	shrl	$9, %eax
	movl	%eax, 36(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	36(%rsp), %rdi
	movl	44(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L29
	movl	tpoints(%rip), %edx
	movq	gValues(%rip), %rsi
	movq	gOldVal(%rip), %rdi
	addq	$48, %rsp
	.cfi_remember_state
	.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
	jmp	_Z36__device_stub__Z13gpu_init_linePfS_iPfS_i
.L29:
	.cfi_restore_state
	addq	$48, %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
.LFE2028:
	.size	_Z9init_linev, .-_Z9init_linev
	.globl	_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii
	.type	_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii, @function
_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, (%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L35
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10gpu_updatePfS_S_ii(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L35:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii, .-_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii
	.globl	_Z10gpu_updatePfS_S_ii
	.type	_Z10gpu_updatePfS_S_ii, @function
_Z10gpu_updatePfS_S_ii:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii
	.cfi_endproc
.LFE2060:
	.size	_Z10gpu_updatePfS_S_ii, .-_Z10gpu_updatePfS_S_ii
	.globl	_Z6updatev
	.type	_Z6updatev, @function
_Z6updatev:
.LFB2030:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movl	tpoints(%rip), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$8388609, %edx
	movl	$1, %ecx
	addl	$511, %eax
	salq	$9, %rdx
	shrl	$9, %eax
	movl	%eax, 20(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 24(%rsp)
	movq	20(%rsp), %rdi
	movl	28(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L41
	movl	tpoints(%rip), %r8d
	movl	nsteps(%rip), %ecx
	movq	gNewVal(%rip), %rdx
	movq	gValues(%rip), %rsi
	movq	gOldVal(%rip), %rdi
	call	_Z36__device_stub__Z10gpu_updatePfS_S_iiPfS_S_ii
.L41:
	movq	gValues(%rip), %rsi
	movl	$2, %ecx
	movl	$4000008, %edx
	leaq	values(%rip), %rdi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	cudaMemcpy@PLT
	.cfi_endproc
.LFE2030:
	.size	_Z6updatev, .-_Z6updatev
	.section	.rodata.str1.1
.LC11:
	.string	"%d"
.LC12:
	.string	"Initializing points on the line...\n"
.LC13:
	.string	"Updating all points for all time steps...\n"
.LC14:
	.string	"Printing final results...\n"
.LC15:
	.string	"\nDone.\n\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC11(%rip), %rbp
	leaq	tpoints(%rip), %rdx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rsi, %rbx
	pushq	%rax
	.cfi_def_cfa_offset 32
	movq	8(%rsi), %rdi
	xorl	%eax, %eax
	movq	%rbp, %rsi
	call	__isoc23_sscanf@PLT
	movq	16(%rbx), %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	nsteps(%rip), %rdx
	call	__isoc23_sscanf@PLT
	movl	$4000008, %esi
	leaq	gValues(%rip), %rdi
	call	cudaMalloc@PLT
	movl	$4000008, %esi
	leaq	gOldVal(%rip), %rdi
	call	cudaMalloc@PLT
	movl	$4000008, %esi
	leaq	gNewVal(%rip), %rdi
	call	cudaMalloc@PLT
	call	_Z11check_paramv
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z9init_linev
	leaq	.LC13(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z6updatev
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	call	_Z10printfinalv
	leaq	.LC15(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	gValues(%rip), %rdi
	call	cudaFree@PLT
	movq	gOldVal(%rip), %rdi
	call	cudaFree@PLT
	movq	gNewVal(%rip), %rdi
	call	cudaFree@PLT
	popq	%rdx
	.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
.LFE2032:
	.size	main, .-main
	.section	.rodata.str1.1
.LC16:
	.string	"_Z10gpu_updatePfS_S_ii"
.LC17:
	.string	"_Z13gpu_init_linePfS_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2062:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -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	.LC16(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z10gpu_updatePfS_S_ii(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC17(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13gpu_init_linePfS_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	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	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2062:
	.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	gNewVal
	.bss
	.align 8
	.type	gNewVal, @object
	.size	gNewVal, 8
gNewVal:
	.zero	8
	.globl	gOldVal
	.align 8
	.type	gOldVal, @object
	.size	gOldVal, 8
gOldVal:
	.zero	8
	.globl	gValues
	.align 8
	.type	gValues, @object
	.size	gValues, 8
gValues:
	.zero	8
	.globl	newval
	.align 32
	.type	newval, @object
	.size	newval, 4000008
newval:
	.zero	4000008
	.globl	oldval
	.align 32
	.type	oldval, @object
	.size	oldval, 4000008
oldval:
	.zero	4000008
	.globl	values
	.align 32
	.type	values, @object
	.size	values, 4000008
values:
	.zero	4000008
	.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
.LC9:
	.long	1086918619
	.align 4
.LC10:
	.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:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <hip/hip_runtime.h>

#define MAXPOINTS 1000000
#define MAXSTEPS 1000000
#define MINPOINTS 20
#define PI 3.14159265

void check_param(void);
void init_line(void);
void update (void);
void printfinal (void);
__device__ void do_math(float*, float*, float*, int );

//---------------------------------------------------------------------------
//	Kernel function
//---------------------------------------------------------------------------
__global__ void gpu_init_line( float*, float*, int );
__global__ void gpu_update( float*, float*, float*, int, int );


int nsteps,                 	/* number of time steps */
	tpoints, 	     		/* total points along string */
	rcode;                  	/* generic return code */

float  values[MAXPOINTS+2], 	/* values at time t */
	   oldval[MAXPOINTS+2], 	/* values at time (t-dt) */
	   newval[MAXPOINTS+2]; 	/* values at time (t+dt) */

float *gValues, 
	  *gOldVal, 
	  *gNewVal;


/**********************************************************************
 *	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
 *********************************************************************/
__global__ void gpu_init_line( float *gOld, float *gVal, int tpoints )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	/* Initialize old values array */
	gOld[index] = gVal[index];
}

void init_line(void)
{
	//int i, j;
	int j;
	float x, fac, k, tmp;

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

	hipMemcpy( gValues, values, (MAXPOINTS+2)*sizeof(float),
			hipMemcpyHostToDevice );

	dim3 dimBlock( 512 ), dimGrid( (tpoints + dimBlock.x -1) / dimBlock.x );
	gpu_init_line<<<dimGrid, dimBlock>>>( gOldVal, gValues, tpoints );
}


/**********************************************************************
 *      Calculate new values using wave equation
 *********************************************************************/
__device__ void do_math(float *gOld, float *gVal, float *gNew, int i)
{
	float dtime, c, dx, tau, sqtau;

	dtime = 0.3;
	c = 1.0;
	dx = 1.0;
	tau = (c * dtime / dx);
	sqtau = tau * tau;
	gNew[i] = (2.0 * gVal[i]) - gOld[i] + (sqtau *  (-2.0)*gVal[i]);
}

/**********************************************************************
 *     Update all values along line a specified number of times
 *********************************************************************/
__global__ void gpu_update( float *gOld, float *gVal, float *gNew, int nsteps,
		int tpoints )
{
	int index = blockIdx.x * blockDim.x + threadIdx.x;

	/* Update values for each time step */
	for( int i=0; i < nsteps; i++ ) {
		/* global endpoints */
		if( (index == 1) || (index == tpoints) )
			gNew[index] = 0.0;
		else
			do_math( gOld, gVal, gNew, index );

		/* Update old values with new values */
		gOld[index] = gVal[index];
		gVal[index] = gNew[index];
	}
}

void update()
{

	dim3 threadsPerBlock( 512 ),
		 blocksPerGrid( (tpoints + threadsPerBlock.x -1) / threadsPerBlock.x );
	gpu_update<<<blocksPerGrid, threadsPerBlock>>>( gOldVal, gValues, gNewVal, nsteps, tpoints );

	hipMemcpy( values, gValues, (MAXPOINTS+2)*sizeof(float),
			hipMemcpyDeviceToHost );
}


/**********************************************************************
 *     Print final results
 *********************************************************************/
void printfinal()
{
	int i;

	for (i = 1; i <= tpoints; i++) {
		printf("%6.4f ", values[i]);
		if (i%10 == 0)
			printf("\n");
	}
}

/**********************************************************************
 *	Main program
 *********************************************************************/
int main(int argc, char *argv[])
{
	sscanf(argv[1],"%d",&tpoints);
	sscanf(argv[2],"%d",&nsteps);

	/*	Allocate space in device Global Memory	*/
	hipMalloc( (void**)&gValues, (MAXPOINTS+2)*sizeof(float) );
	hipMalloc( (void**)&gOldVal, (MAXPOINTS+2)*sizeof(float) );
	hipMalloc( (void**)&gNewVal, (MAXPOINTS+2)*sizeof(float) );

	check_param();
	printf("Initializing points on the line...\n");
	init_line();
	printf("Updating all points for all time steps...\n");
	update();
	printf("Printing final results...\n");
	printfinal();
	printf("\nDone.\n\n");

	/*	Free allocated space in device Global Memory	*/
	hipFree( gValues );
	hipFree( gOldVal );
	hipFree( gNewVal );

	return 0;
}

	.text
	.file	"cuda_wave.hip"
	.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
	.globl	_Z28__device_stub__gpu_init_linePfS_i # -- Begin function _Z28__device_stub__gpu_init_linePfS_i
	.type	_Z28__device_stub__gpu_init_linePfS_i,@function
_Z28__device_stub__gpu_init_linePfS_i:  # @_Z28__device_stub__gpu_init_linePfS_i
	.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	32(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	12(%rsp), %rsi
	movl	%edx, (%rsi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%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	$_Z13gpu_init_linePfS_i, %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_end1:
	.size	_Z28__device_stub__gpu_init_linePfS_i, .Lfunc_end1-_Z28__device_stub__gpu_init_linePfS_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z9init_linev
.LCPI2_0:
	.long	0x40c90fdb                      # float 6.28318548
.LCPI2_1:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z9init_linev
	.type	_Z9init_linev,@function
_Z9init_linev:                          # @_Z9init_linev
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -16
	movl	tpoints(%rip), %eax
	testl	%eax, %eax
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	decl	%eax
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, 12(%rsp)                 # 4-byte Spill
	xorps	%xmm0, %xmm0
	xorl	%ebx, %ebx
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movss	%xmm0, 8(%rsp)                  # 4-byte Spill
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	divss	12(%rsp), %xmm0                 # 4-byte Folded Reload
	mulss	.LCPI2_0(%rip), %xmm0
	callq	sinf
	movss	%xmm0, values+4(,%rbx,4)
	movss	8(%rsp), %xmm0                  # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	addss	.LCPI2_1(%rip), %xmm0
	movslq	tpoints(%rip), %rax
	incq	%rbx
	cmpq	%rax, %rbx
	jl	.LBB2_2
.LBB2_3:                                # %._crit_edge
	movq	gValues(%rip), %rdi
	movl	$values, %esi
	movl	$4000008, %edx                  # imm = 0x3D0908
	movl	$1, %ecx
	callq	hipMemcpy
	movl	$511, %edi                      # imm = 0x1FF
	addl	tpoints(%rip), %edi
	shrl	$9, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$512, %rdx                      # imm = 0x200
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB2_5
# %bb.4:
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.LBB2_5:
	.cfi_def_cfa_offset 32
	movq	gOldVal(%rip), %rdi
	movq	gValues(%rip), %rsi
	movl	tpoints(%rip), %edx
	addq	$16, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	_Z28__device_stub__gpu_init_linePfS_i # TAILCALL
.Lfunc_end2:
	.size	_Z9init_linev, .Lfunc_end2-_Z9init_linev
	.cfi_endproc
                                        # -- End function
	.globl	_Z25__device_stub__gpu_updatePfS_S_ii # -- Begin function _Z25__device_stub__gpu_updatePfS_S_ii
	.type	_Z25__device_stub__gpu_updatePfS_S_ii,@function
_Z25__device_stub__gpu_updatePfS_S_ii:  # @_Z25__device_stub__gpu_updatePfS_S_ii
	.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	$128, %rsp
	.cfi_def_cfa_offset 176
	.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	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	movq	%rsp, %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%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	$_Z10gpu_updatePfS_S_ii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	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	_Z25__device_stub__gpu_updatePfS_S_ii, .Lfunc_end3-_Z25__device_stub__gpu_updatePfS_S_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z6updatev                      # -- Begin function _Z6updatev
	.type	_Z6updatev,@function
_Z6updatev:                             # @_Z6updatev
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movl	$511, %edi                      # imm = 0x1FF
	addl	tpoints(%rip), %edi
	shrl	$9, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$512, %rdx                      # imm = 0x200
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:
	movq	gOldVal(%rip), %rdi
	movq	gValues(%rip), %rsi
	movq	gNewVal(%rip), %rdx
	movl	nsteps(%rip), %ecx
	movl	tpoints(%rip), %r8d
	callq	_Z25__device_stub__gpu_updatePfS_S_ii
.LBB4_2:
	movq	gValues(%rip), %rsi
	movl	$values, %edi
	movl	$4000008, %edx                  # imm = 0x3D0908
	movl	$2, %ecx
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	hipMemcpy                       # TAILCALL
.Lfunc_end4:
	.size	_Z6updatev, .Lfunc_end4-_Z6updatev
	.cfi_endproc
                                        # -- End function
	.globl	_Z10printfinalv                 # -- Begin function _Z10printfinalv
	.type	_Z10printfinalv,@function
_Z10printfinalv:                        # @_Z10printfinalv
	.cfi_startproc
# %bb.0:
	cmpl	$0, tpoints(%rip)
	jle	.LBB5_6
# %bb.1:                                # %.lr.ph.preheader
	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	$1, %ebx
	xorl	%r14d, %r14d
	movl	$3435973837, %r15d              # imm = 0xCCCCCCCD
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%ebx, %eax
	imulq	%r15, %rax
	shrq	$35, %rax
	leal	(%rax,%rax,4), %eax
	leal	-1(,%rax,2), %ebp
	xorps	%xmm0, %xmm0
	cvtss2sd	values+4(,%r14,4), %xmm0
	movl	$.L.str.6, %edi
	movb	$1, %al
	callq	printf
	cmpl	%r14d, %ebp
	jne	.LBB5_4
# %bb.3:                                #   in Loop: Header=BB5_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
.LBB5_4:                                #   in Loop: Header=BB5_2 Depth=1
	movslq	tpoints(%rip), %rax
	incq	%r14
	incl	%ebx
	cmpq	%rax, %r14
	jl	.LBB5_2
# %bb.5:
	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
	.cfi_restore %rbx
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
.LBB5_6:                                # %._crit_edge
	retq
.Lfunc_end5:
	.size	_Z10printfinalv, .Lfunc_end5-_Z10printfinalv
	.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.8, %esi
	movl	$tpoints, %edx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movq	16(%rbx), %rdi
	movl	$.L.str.8, %esi
	movl	$nsteps, %edx
	xorl	%eax, %eax
	callq	__isoc23_sscanf
	movl	$gValues, %edi
	movl	$4000008, %esi                  # imm = 0x3D0908
	callq	hipMalloc
	movl	$gOldVal, %edi
	movl	$4000008, %esi                  # imm = 0x3D0908
	callq	hipMalloc
	movl	$gNewVal, %edi
	movl	$4000008, %esi                  # imm = 0x3D0908
	callq	hipMalloc
	callq	_Z11check_paramv
	movl	$.Lstr, %edi
	callq	puts@PLT
	callq	_Z9init_linev
	movl	$.Lstr.1, %edi
	callq	puts@PLT
	callq	_Z6updatev
	movl	$.Lstr.2, %edi
	callq	puts@PLT
	callq	_Z10printfinalv
	movl	$.Lstr.3, %edi
	callq	puts@PLT
	movq	gValues(%rip), %rdi
	callq	hipFree
	movq	gOldVal(%rip), %rdi
	callq	hipFree
	movq	gNewVal(%rip), %rdi
	callq	hipFree
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	main, .Lfunc_end6-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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13gpu_init_linePfS_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z10gpu_updatePfS_S_ii, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__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	4000008
	.size	values, 4000008

	.type	oldval,@object                  # @oldval
	.globl	oldval
	.p2align	4, 0x0
oldval:
	.zero	4000008
	.size	oldval, 4000008

	.type	newval,@object                  # @newval
	.globl	newval
	.p2align	4, 0x0
newval:
	.zero	4000008
	.size	newval, 4000008

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

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

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

	.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	_Z13gpu_init_linePfS_i,@object  # @_Z13gpu_init_linePfS_i
	.section	.rodata,"a",@progbits
	.globl	_Z13gpu_init_linePfS_i
	.p2align	3, 0x0
_Z13gpu_init_linePfS_i:
	.quad	_Z28__device_stub__gpu_init_linePfS_i
	.size	_Z13gpu_init_linePfS_i, 8

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

	.type	.L.str.6,@object                # @.str.6
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.6:
	.asciz	"%6.4f "
	.size	.L.str.6, 7

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13gpu_init_linePfS_i"
	.size	.L__unnamed_1, 23

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z10gpu_updatePfS_S_ii"
	.size	.L__unnamed_2, 23

	.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 _Z28__device_stub__gpu_init_linePfS_i
	.addrsig_sym _Z25__device_stub__gpu_updatePfS_S_ii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym nsteps
	.addrsig_sym tpoints
	.addrsig_sym values
	.addrsig_sym gValues
	.addrsig_sym gOldVal
	.addrsig_sym gNewVal
	.addrsig_sym _Z13gpu_init_linePfS_i
	.addrsig_sym _Z10gpu_updatePfS_S_ii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13gpu_init_linePfS_i  ; -- Begin function _Z13gpu_init_linePfS_i
	.globl	_Z13gpu_init_linePfS_i
	.p2align	8
	.type	_Z13gpu_init_linePfS_i,@function
_Z13gpu_init_linePfS_i:                 ; @_Z13gpu_init_linePfS_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x24
	s_load_b128 s[0:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	v_add_co_u32 v2, vcc_lo, s2, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_load_b32 v2, v[2:3], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13gpu_init_linePfS_i
		.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 4
		.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	_Z13gpu_init_linePfS_i, .Lfunc_end0-_Z13gpu_init_linePfS_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 120
; NumSgprs: 18
; NumVgprs: 4
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 4
; 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
	.protected	_Z10gpu_updatePfS_S_ii  ; -- Begin function _Z10gpu_updatePfS_S_ii
	.globl	_Z10gpu_updatePfS_S_ii
	.p2align	8
	.type	_Z10gpu_updatePfS_S_ii,@function
_Z10gpu_updatePfS_S_ii:                 ; @_Z10gpu_updatePfS_S_ii
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s2, 1
	s_cbranch_scc1 .LBB1_5
; %bb.1:                                ; %.lr.ph
	s_clause 0x2
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b128 s[8:11], s[0:1], 0x0
	s_load_b64 s[6:7], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_brev_b32 s4, 1
	s_mov_b32 s5, 0xbfc70a3d
	v_ashrrev_i32_e32 v2, 31, v1
	v_cmp_ne_u32_e32 vcc_lo, 1, v1
	v_cmp_ne_u32_e64 s0, s3, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[4:5], 2, v[1:2]
	s_and_b32 s0, vcc_lo, s0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v0, s1, s10, v4
	v_add_co_ci_u32_e64 v1, s1, s11, v5, s1
	v_add_co_u32 v2, s1, s8, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, s1, s9, v5, s1
	v_add_co_u32 v4, s1, s6, v4
	v_add_co_ci_u32_e64 v5, s1, s7, v5, s1
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v6, 0
	s_and_saveexec_b32 s1, s0
	s_cbranch_execz .LBB1_4
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	global_load_b32 v6, v[0:1], off
	global_load_b32 v8, v[2:3], off
	s_waitcnt vmcnt(1)
	v_cvt_f64_f32_e32 v[6:7], v6
	s_waitcnt vmcnt(0)
	v_cvt_f64_f32_e32 v[8:9], v8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[8:9], v[6:7], 2.0, -v[8:9]
	v_fma_f64 v[6:7], v[6:7], s[4:5], v[8:9]
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_f32_f64_e32 v6, v[6:7]
.LBB1_4:                                ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s1
	global_store_b32 v[4:5], v6, off
	global_load_b32 v6, v[0:1], off
	s_add_i32 s2, s2, -1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s2, 0
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v6, off
	global_load_b32 v6, v[4:5], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[0:1], v6, off
	s_cbranch_scc0 .LBB1_2
.LBB1_5:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10gpu_updatePfS_S_ii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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_end1:
	.size	_Z10gpu_updatePfS_S_ii, .Lfunc_end1-_Z10gpu_updatePfS_S_ii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 324
; 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
      - .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:           _Z13gpu_init_linePfS_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13gpu_init_linePfS_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     4
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .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:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10gpu_updatePfS_S_ii
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z10gpu_updatePfS_S_ii.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
