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


#define ITER 340000
#define SIZE 500
#define BLOCK 1
#define THREAD 1


void stopwatch(int);
__global__ void manymanyLocal();
__global__ void manymanyGlobal(int*,int* );
__global__ void manymanyShared();

int main()
{

	printf("SIZE : %d\nBLOCK : %d\nTHREAD : %d\nITER : %d\n",SIZE,BLOCK,THREAD,ITER);
/*
	커널 함수는 비동기 함수라서 쓰레드만 돌려놓고 호스트는 그래도 진행한다  
	cudaTHreadSynchronize() 는 이전에 생성된 쓰레드들이 끝날때 까지 기다린다  
*/
/*
	stopwatch(0);
	printf("Local : ");
	for(int i=0; i< ITER;i++)
	{	
	manymanyLocal<<<BLOCK,THREAD>>>();
	cudaThreadSynchronize();
	}	
	stopwatch(1);
*/

	int *a;
	int *b;
	int t;		
	cudaMalloc((void**)&a,sizeof(int)*SIZE );
	cudaMalloc((void**)&b,sizeof(int)*SIZE);


	stopwatch(0);
	printf("Global : ");
	manymanyGlobal<<<BLOCK,THREAD>>>(a,b);
	cudaMemcpy(&t,a,sizeof(int),cudaMemcpyDeviceToHost);
//	cudaThreadSynchronize();
	stopwatch(1);

	cudaFree(b);
	
	stopwatch(0);
	printf("Shared : ");
	manymanyShared<<<BLOCK,THREAD>>>();
	cudaMemcpy(&t,a,sizeof(int),cudaMemcpyDeviceToHost);
	cudaFree(a);
//	cudaThreadSynchronize();
	stopwatch(1);



}

__global__ void manymanyLocal()
{
	int a[SIZE];
	int b[SIZE];

for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}
 
}



__global__ void manymanyGlobal(int* a,int* b)
{
	
for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}	
}

__global__ void manymanyShared()
{
	__shared__ int a[SIZE];
	__shared__ int b[SIZE];

	__syncthreads();	
		
for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}	

}


void stopwatch(int flag)
{
	const long long NANOS = 1000000000LL;
	static struct timespec startTS,endTS;
	static long long diff = 0;
	
	//start
	if(flag == 0)
	{
		diff = 0;
		if(-1 == clock_gettime(CLOCK_MONOTONIC,&startTS))
			printf("Failed to call clock_gettime\n");
	}
	//end
	else if(flag == 1)
	{		
		if(-1 == clock_gettime(CLOCK_MONOTONIC,&endTS))
			printf("Failed to call clock_gettime\n");
		diff = NANOS * (endTS.tv_sec - startTS.tv_sec) + (endTS.tv_nsec - startTS.tv_nsec);
		
		printf("elapsed time : % lld micros\n",diff/1000);
	}
	else
	{
		printf("wrong flag | 0 : start, 1 : end\n");
	}

}



	.file	"tmpxft_002af644_00000000-6_3_sharedMemory.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Failed to call clock_gettime\n"
.LC1:
	.string	"elapsed time : % lld micros\n"
	.text
	.type	_Z9stopwatchi.part.0, @function
_Z9stopwatchi.part.0:
.LFB2176:
	.cfi_startproc
	pushq	%rsi
	.cfi_def_cfa_offset 16
	movl	$1, %edi
	leaq	_ZZ9stopwatchiE5endTS(%rip), %rsi
	call	clock_gettime@PLT
	incl	%eax
	jne	.L3
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L3:
	movq	_ZZ9stopwatchiE5endTS(%rip), %rax
	movl	$1000, %ecx
	movl	$2, %edi
	subq	_ZZ9stopwatchiE7startTS(%rip), %rax
	imulq	$1000000000, %rax, %rax
	addq	8+_ZZ9stopwatchiE5endTS(%rip), %rax
	subq	8+_ZZ9stopwatchiE7startTS(%rip), %rax
	cqto
	leaq	.LC1(%rip), %rsi
	idivq	%rcx
	popq	%rcx
	.cfi_def_cfa_offset 8
	movq	%rax, %rdx
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2176:
	.size	_Z9stopwatchi.part.0, .-_Z9stopwatchi.part.0
	.section	.rodata.str1.1
.LC2:
	.string	"wrong flag | 0 : start, 1 : end\n"
	.text
	.globl	_Z9stopwatchi
	.type	_Z9stopwatchi, @function
_Z9stopwatchi:
.LFB2028:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jne	.L7
	pushq	%rcx
	.cfi_def_cfa_offset 16
	leaq	_ZZ9stopwatchiE7startTS(%rip), %rsi
	movl	$1, %edi
	call	clock_gettime@PLT
	incl	%eax
	jne	.L6
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	.L13
.L7:
	decl	%edi
	jne	.L9
	jmp	_Z9stopwatchi.part.0
.L9:
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.L13:
	jmp	__printf_chk@PLT
.L6:
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z9stopwatchi, .-_Z9stopwatchi
	.globl	_Z32__device_stub__Z13manymanyLocalvv
	.type	_Z32__device_stub__Z13manymanyLocalvv, @function
_Z32__device_stub__Z13manymanyLocalvv:
.LFB2053:
	.cfi_startproc
	endbr64
	subq	$88, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	movabsq	$4294967297, %rax
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	leaq	28(%rsp), %rsi
	leaq	16(%rsp), %rdi
	movl	$1, 24(%rsp)
	movl	$1, 36(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 28(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L14
	pushq	8(%rsp)
	.cfi_def_cfa_offset 104
	leaq	_Z13manymanyLocalv(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 112
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
.L14:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	addq	$88, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2053:
	.size	_Z32__device_stub__Z13manymanyLocalvv, .-_Z32__device_stub__Z13manymanyLocalvv
	.globl	_Z13manymanyLocalv
	.type	_Z13manymanyLocalv, @function
_Z13manymanyLocalv:
.LFB2054:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z13manymanyLocalvv
	.cfi_endproc
.LFE2054:
	.size	_Z13manymanyLocalv, .-_Z13manymanyLocalv
	.globl	_Z36__device_stub__Z14manymanyGlobalPiS_PiS_
	.type	_Z36__device_stub__Z14manymanyGlobalPiS_PiS_, @function
_Z36__device_stub__Z14manymanyGlobalPiS_PiS_:
.LFB2055:
	.cfi_startproc
	endbr64
	subq	$120, %rsp
	.cfi_def_cfa_offset 128
	movq	%rdi, 8(%rsp)
	leaq	32(%rsp), %rcx
	leaq	24(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	40(%rsp), %rdi
	leaq	52(%rsp), %rsi
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rax
	movl	$1, 48(%rsp)
	movq	%rax, 88(%rsp)
	movq	%rsp, %rax
	movq	%rax, 96(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 40(%rsp)
	movq	%rax, 52(%rsp)
	movl	$1, 60(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L19
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z14manymanyGlobalPiS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L19:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z36__device_stub__Z14manymanyGlobalPiS_PiS_, .-_Z36__device_stub__Z14manymanyGlobalPiS_PiS_
	.globl	_Z14manymanyGlobalPiS_
	.type	_Z14manymanyGlobalPiS_, @function
_Z14manymanyGlobalPiS_:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z14manymanyGlobalPiS_PiS_
	.cfi_endproc
.LFE2056:
	.size	_Z14manymanyGlobalPiS_, .-_Z14manymanyGlobalPiS_
	.globl	_Z33__device_stub__Z14manymanySharedvv
	.type	_Z33__device_stub__Z14manymanySharedvv, @function
_Z33__device_stub__Z14manymanySharedvv:
.LFB2057:
	.cfi_startproc
	endbr64
	subq	$88, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	movabsq	$4294967297, %rax
	leaq	8(%rsp), %rcx
	movq	%rsp, %rdx
	leaq	28(%rsp), %rsi
	leaq	16(%rsp), %rdi
	movl	$1, 24(%rsp)
	movl	$1, 36(%rsp)
	movq	%rax, 16(%rsp)
	movq	%rax, 28(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	pushq	8(%rsp)
	.cfi_def_cfa_offset 104
	leaq	_Z14manymanySharedv(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 112
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
.L24:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$88, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2057:
	.size	_Z33__device_stub__Z14manymanySharedvv, .-_Z33__device_stub__Z14manymanySharedvv
	.globl	_Z14manymanySharedv
	.type	_Z14manymanySharedv, @function
_Z14manymanySharedv:
.LFB2058:
	.cfi_startproc
	endbr64
	jmp	_Z33__device_stub__Z14manymanySharedvv
	.cfi_endproc
.LFE2058:
	.size	_Z14manymanySharedv, .-_Z14manymanySharedv
	.section	.rodata.str1.1
.LC3:
	.string	"SIZE : %d\nBLOCK : %d\nTHREAD : %d\nITER : %d\n"
.LC4:
	.string	"Global : "
.LC5:
	.string	"Shared : "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$1, %ecx
	movl	$500, %edx
	movl	$2, %edi
	movl	$340000, %r9d
	movl	$1, %r8d
	leaq	.LC3(%rip), %rsi
	subq	$64, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	16(%rsp), %rdi
	movl	$2000, %esi
	call	cudaMalloc@PLT
	movl	$2000, %esi
	leaq	24(%rsp), %rdi
	call	cudaMalloc@PLT
	xorl	%edi, %edi
	call	_Z9stopwatchi
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movl	$1, 52(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 44(%rsp)
	movq	%rdi, 32(%rsp)
	movl	$1, 40(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L30
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdi
	call	_Z36__device_stub__Z14manymanyGlobalPiS_PiS_
.L30:
	movq	16(%rsp), %rsi
	leaq	12(%rsp), %rbx
	movl	$2, %ecx
	movl	$4, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	call	_Z9stopwatchi.part.0
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%edi, %edi
	call	_Z9stopwatchi
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$4294967297, %rdi
	movl	$1, %esi
	movl	$1, 52(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 44(%rsp)
	movq	%rdi, 32(%rsp)
	movl	$1, 40(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L31
	call	_Z33__device_stub__Z14manymanySharedvv
.L31:
	movq	16(%rsp), %rsi
	movl	$2, %ecx
	movl	$4, %edx
	movq	%rbx, %rdi
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	call	_Z9stopwatchi.part.0
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	addq	$64, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	main, .-main
	.section	.rodata.str1.1
.LC6:
	.string	"_Z14manymanySharedv"
.LC7:
	.string	"_Z14manymanyGlobalPiS_"
.LC8:
	.string	"_Z13manymanyLocalv"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2060:
	.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	.LC6(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z14manymanySharedv(%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	.LC7(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z14manymanyGlobalPiS_(%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
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC8(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13manymanyLocalv(%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
.LFE2060:
	.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
	.local	_ZZ9stopwatchiE5endTS
	.comm	_ZZ9stopwatchiE5endTS,16,16
	.local	_ZZ9stopwatchiE7startTS
	.comm	_ZZ9stopwatchiE7startTS,16,16
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


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


#define ITER 340000
#define SIZE 500
#define BLOCK 1
#define THREAD 1


void stopwatch(int);
__global__ void manymanyLocal();
__global__ void manymanyGlobal(int*,int* );
__global__ void manymanyShared();

int main()
{

	printf("SIZE : %d\nBLOCK : %d\nTHREAD : %d\nITER : %d\n",SIZE,BLOCK,THREAD,ITER);
/*
	커널 함수는 비동기 함수라서 쓰레드만 돌려놓고 호스트는 그래도 진행한다  
	cudaTHreadSynchronize() 는 이전에 생성된 쓰레드들이 끝날때 까지 기다린다  
*/
/*
	stopwatch(0);
	printf("Local : ");
	for(int i=0; i< ITER;i++)
	{	
	manymanyLocal<<<BLOCK,THREAD>>>();
	cudaThreadSynchronize();
	}	
	stopwatch(1);
*/

	int *a;
	int *b;
	int t;		
	hipMalloc((void**)&a,sizeof(int)*SIZE );
	hipMalloc((void**)&b,sizeof(int)*SIZE);


	stopwatch(0);
	printf("Global : ");
	manymanyGlobal<<<BLOCK,THREAD>>>(a,b);
	hipMemcpy(&t,a,sizeof(int),hipMemcpyDeviceToHost);
//	cudaThreadSynchronize();
	stopwatch(1);

	hipFree(b);
	
	stopwatch(0);
	printf("Shared : ");
	manymanyShared<<<BLOCK,THREAD>>>();
	hipMemcpy(&t,a,sizeof(int),hipMemcpyDeviceToHost);
	hipFree(a);
//	cudaThreadSynchronize();
	stopwatch(1);



}

__global__ void manymanyLocal()
{
	int a[SIZE];
	int b[SIZE];

for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}
 
}



__global__ void manymanyGlobal(int* a,int* b)
{
	
for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}	
}

__global__ void manymanyShared()
{
	__shared__ int a[SIZE];
	__shared__ int b[SIZE];

	__syncthreads();	
		
for(int j=0; j < ITER; j++)
	for(int i=threadIdx.x;i<SIZE;i+=THREAD)
	{
		a[i]=0;
		b[i]=0;
	}	

}


void stopwatch(int flag)
{
	const long long NANOS = 1000000000LL;
	static struct timespec startTS,endTS;
	static long long diff = 0;
	
	//start
	if(flag == 0)
	{
		diff = 0;
		if(-1 == clock_gettime(CLOCK_MONOTONIC,&startTS))
			printf("Failed to call clock_gettime\n");
	}
	//end
	else if(flag == 1)
	{		
		if(-1 == clock_gettime(CLOCK_MONOTONIC,&endTS))
			printf("Failed to call clock_gettime\n");
		diff = NANOS * (endTS.tv_sec - startTS.tv_sec) + (endTS.tv_nsec - startTS.tv_nsec);
		
		printf("elapsed time : % lld micros\n",diff/1000);
	}
	else
	{
		printf("wrong flag | 0 : start, 1 : end\n");
	}

}



	.text
	.file	"3_sharedMemory.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movabsq	$4294967297, %rbx               # imm = 0x100000001
	movl	$.L.str, %edi
	movl	$500, %esi                      # imm = 0x1F4
	movl	$1, %edx
	movl	$1, %ecx
	movl	$340000, %r8d                   # imm = 0x53020
	xorl	%eax, %eax
	callq	printf
	leaq	8(%rsp), %rdi
	movl	$2000, %esi                     # imm = 0x7D0
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movl	$2000, %esi                     # imm = 0x7D0
	callq	hipMalloc
	xorl	%edi, %edi
	callq	_Z9stopwatchi
	movl	$.L.str.1, %edi
	xorl	%eax, %eax
	callq	printf
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_2
# %bb.1:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	callq	_Z29__device_stub__manymanyGlobalPiS_
.LBB0_2:
	movq	8(%rsp), %rsi
	leaq	20(%rsp), %rdi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	$1, %edi
	callq	_Z9stopwatchi
	movq	24(%rsp), %rdi
	callq	hipFree
	xorl	%edi, %edi
	callq	_Z9stopwatchi
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%rbx, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB0_4
# %bb.3:
	callq	_Z29__device_stub__manymanySharedv
.LBB0_4:
	movq	8(%rsp), %rsi
	leaq	20(%rsp), %rdi
	movl	$4, %edx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	callq	hipFree
	movl	$1, %edi
	callq	_Z9stopwatchi
	xorl	%eax, %eax
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.globl	_Z9stopwatchi                   # -- Begin function _Z9stopwatchi
	.type	_Z9stopwatchi,@function
_Z9stopwatchi:                          # @_Z9stopwatchi
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	cmpl	$1, %edi
	je	.LBB1_4
# %bb.1:
	testl	%edi, %edi
	jne	.LBB1_7
# %bb.2:
	movl	$_ZZ9stopwatchiE7startTS, %esi
	movl	$1, %edi
	callq	clock_gettime
	cmpl	$-1, %eax
	je	.LBB1_8
# %bb.3:
	popq	%rax
	.cfi_def_cfa_offset 8
	retq
.LBB1_4:
	.cfi_def_cfa_offset 16
	movl	$_ZZ9stopwatchiE5endTS, %esi
	movl	$1, %edi
	callq	clock_gettime
	cmpl	$-1, %eax
	jne	.LBB1_6
# %bb.5:
	movl	$.Lstr.2, %edi
	callq	puts@PLT
.LBB1_6:
	movq	_ZZ9stopwatchiE5endTS(%rip), %rax
	subq	_ZZ9stopwatchiE7startTS(%rip), %rax
	imulq	$1000000000, %rax, %rcx         # imm = 0x3B9ACA00
	movq	_ZZ9stopwatchiE5endTS+8(%rip), %rax
	subq	_ZZ9stopwatchiE7startTS+8(%rip), %rax
	addq	%rcx, %rax
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
	movl	$.L.str.4, %edi
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	jmp	printf                          # TAILCALL
.LBB1_7:
	.cfi_def_cfa_offset 16
	movl	$.Lstr, %edi
	jmp	.LBB1_9
.LBB1_8:
	movl	$.Lstr.2, %edi
.LBB1_9:
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	puts@PLT                        # TAILCALL
.Lfunc_end1:
	.size	_Z9stopwatchi, .Lfunc_end1-_Z9stopwatchi
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__manymanyGlobalPiS_ # -- Begin function _Z29__device_stub__manymanyGlobalPiS_
	.type	_Z29__device_stub__manymanyGlobalPiS_,@function
_Z29__device_stub__manymanyGlobalPiS_:  # @_Z29__device_stub__manymanyGlobalPiS_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	24(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	16(%rsp), %rcx
	movq	%rsi, (%rcx)
	leaq	64(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	leaq	48(%rsp), %r14
	leaq	32(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rsp, %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z14manymanyGlobalPiS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z29__device_stub__manymanyGlobalPiS_, .Lfunc_end2-_Z29__device_stub__manymanyGlobalPiS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z29__device_stub__manymanySharedv # -- Begin function _Z29__device_stub__manymanySharedv
	.type	_Z29__device_stub__manymanySharedv,@function
_Z29__device_stub__manymanySharedv:     # @_Z29__device_stub__manymanySharedv
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rbx
	leaq	24(%rsp), %r14
	leaq	16(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movq	%r12, %rcx
	callq	__hipPopCallConfiguration
	movq	(%rbx), %rsi
	movl	8(%rbx), %edx
	movq	(%r14), %rcx
	movl	8(%r14), %r8d
	movq	%rsp, %r9
	movl	$_Z14manymanySharedv, %edi
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	pushq	(%r15)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$72, %rsp
	.cfi_adjust_cfa_offset -72
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end3:
	.size	_Z29__device_stub__manymanySharedv, .Lfunc_end3-_Z29__device_stub__manymanySharedv
	.cfi_endproc
                                        # -- End function
	.globl	_Z28__device_stub__manymanyLocalv # -- Begin function _Z28__device_stub__manymanyLocalv
	.type	_Z28__device_stub__manymanyLocalv,@function
_Z28__device_stub__manymanyLocalv:      # @_Z28__device_stub__manymanyLocalv
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rbx
	leaq	24(%rsp), %r14
	leaq	16(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movq	%r12, %rcx
	callq	__hipPopCallConfiguration
	movq	(%rbx), %rsi
	movl	8(%rbx), %edx
	movq	(%r14), %rcx
	movl	8(%r14), %r8d
	movq	%rsp, %r9
	movl	$_Z13manymanyLocalv, %edi
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	pushq	(%r15)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$72, %rsp
	.cfi_adjust_cfa_offset -72
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	_Z28__device_stub__manymanyLocalv, .Lfunc_end4-_Z28__device_stub__manymanyLocalv
	.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	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13manymanyLocalv, %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	$_Z14manymanyGlobalPiS_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z14manymanySharedv, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %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_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	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"SIZE : %d\nBLOCK : %d\nTHREAD : %d\nITER : %d\n"
	.size	.L.str, 44

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Global : "
	.size	.L.str.1, 10

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

	.type	.L.str.2,@object                # @.str.2
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.2:
	.asciz	"Shared : "
	.size	.L.str.2, 10

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

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

	.type	_ZZ9stopwatchiE7startTS,@object # @_ZZ9stopwatchiE7startTS
	.local	_ZZ9stopwatchiE7startTS
	.comm	_ZZ9stopwatchiE7startTS,16,8
	.type	_ZZ9stopwatchiE5endTS,@object   # @_ZZ9stopwatchiE5endTS
	.local	_ZZ9stopwatchiE5endTS
	.comm	_ZZ9stopwatchiE5endTS,16,8
	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"elapsed time : % lld micros\n"
	.size	.L.str.4, 29

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13manymanyLocalv"
	.size	.L__unnamed_1, 19

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

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z14manymanySharedv"
	.size	.L__unnamed_3, 20

	.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	"wrong flag | 0 : start, 1 : end"
	.size	.Lstr, 32

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Failed to call clock_gettime"
	.size	.Lstr.2, 29

	.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 _Z29__device_stub__manymanyGlobalPiS_
	.addrsig_sym _Z29__device_stub__manymanySharedv
	.addrsig_sym _Z28__device_stub__manymanyLocalv
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z14manymanyGlobalPiS_
	.addrsig_sym _Z14manymanySharedv
	.addrsig_sym _Z13manymanyLocalv
	.addrsig_sym _ZZ9stopwatchiE7startTS
	.addrsig_sym _ZZ9stopwatchiE5endTS
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13manymanyLocalv      ; -- Begin function _Z13manymanyLocalv
	.globl	_Z13manymanyLocalv
	.p2align	8
	.type	_Z13manymanyLocalv,@function
_Z13manymanyLocalv:                     ; @_Z13manymanyLocalv
; %bb.0:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13manymanyLocalv
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 0
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 0
		.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 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.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	_Z13manymanyLocalv, .Lfunc_end0-_Z13manymanyLocalv
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 4
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; 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	_Z14manymanyGlobalPiS_  ; -- Begin function _Z14manymanyGlobalPiS_
	.globl	_Z14manymanyGlobalPiS_
	.p2align	8
	.type	_Z14manymanyGlobalPiS_,@function
_Z14manymanyGlobalPiS_:                 ; @_Z14manymanyGlobalPiS_
; %bb.0:
	s_load_b128 s[0:3], s[0:1], 0x0
	v_lshlrev_b32_e32 v2, 2, v0
	v_dual_mov_b32 v8, 0 :: v_dual_add_nc_u32 v9, -1, v0
	v_cmp_gt_u32_e32 vcc_lo, 0x1f4, v0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_co_u32 v0, s0, s0, v2
	v_add_co_ci_u32_e64 v1, null, s1, 0, s0
	v_add_co_u32 v2, s0, s2, v2
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v3, null, s3, 0, s0
	s_mov_b32 s2, 0
.LBB1_1:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_3 Depth 2
	s_and_saveexec_b32 s3, vcc_lo
	s_cbranch_execz .LBB1_4
; %bb.2:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB1_1 Depth=1
	s_delay_alu instid0(VALU_DEP_1)
	v_dual_mov_b32 v5, v3 :: v_dual_mov_b32 v4, v2
	v_dual_mov_b32 v7, v1 :: v_dual_mov_b32 v6, v0
	v_mov_b32_e32 v10, v9
	s_mov_b32 s4, 0
.LBB1_3:                                ; %.lr.ph
                                        ;   Parent Loop BB1_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v10, 1, v10
	global_store_b32 v[6:7], v8, off
	global_store_b32 v[4:5], v8, off
	v_add_co_u32 v6, s0, v6, 4
	v_add_co_ci_u32_e64 v7, s0, 0, v7, s0
	v_cmp_lt_u32_e64 s0, 0x1f2, v10
	v_add_co_u32 v4, s1, v4, 4
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v5, s1, 0, v5, s1
	s_or_b32 s4, s0, s4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s4
	s_cbranch_execnz .LBB1_3
.LBB1_4:                                ; %Flow22
                                        ;   in Loop: Header=BB1_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s3
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s2, 0x53020
	s_cbranch_scc0 .LBB1_1
; %bb.5:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14manymanyGlobalPiS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 16
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 11
		.amdhsa_next_free_sgpr 5
		.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	_Z14manymanyGlobalPiS_, .Lfunc_end1-_Z14manymanyGlobalPiS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 236
; NumSgprs: 7
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 7
; NumVGPRsForWavesPerEU: 11
; 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	_Z14manymanySharedv     ; -- Begin function _Z14manymanySharedv
	.globl	_Z14manymanySharedv
	.p2align	8
	.type	_Z14manymanySharedv,@function
_Z14manymanySharedv:                    ; @_Z14manymanySharedv
; %bb.0:
	s_barrier
	buffer_gl0_inv
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z14manymanySharedv
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 0
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 0
		.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 1
		.amdhsa_next_free_sgpr 1
		.amdhsa_reserve_vcc 0
		.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_end2:
	.size	_Z14manymanySharedv, .Lfunc_end2-_Z14manymanySharedv
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 16
; NumSgprs: 0
; NumVgprs: 0
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 0
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 1
; NumVGPRsForWavesPerEU: 1
; 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:           []
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 4
    .kernarg_segment_size: 0
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13manymanyLocalv
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z13manymanyLocalv.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .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
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 16
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14manymanyGlobalPiS_
    .private_segment_fixed_size: 0
    .sgpr_count:     7
    .sgpr_spill_count: 0
    .symbol:         _Z14manymanyGlobalPiS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:           []
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 4
    .kernarg_segment_size: 0
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z14manymanySharedv
    .private_segment_fixed_size: 0
    .sgpr_count:     0
    .sgpr_spill_count: 0
    .symbol:         _Z14manymanySharedv.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     0
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
