#include <iostream>
#include <curand.h>

using namespace std;

#include <curand.h>

struct random_d_array
{
  float *data;
  int n;

  random_d_array(int n) :n{n}
  {
    cudaMalloc((void**)&data, n*sizeof(float));
    curandGenerator_t gen;
    curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT);
    curandGenerateUniform(gen, data, n);
  }
  
  ~random_d_array()
  {
    cudaFree(&data);
  }
};

__global__ void MyKernel(float *d, float *a, float *b, int n)
{
  int idx = threadIdx.x + blockIdx.x * blockDim.x;
  if(idx < n)
    d[idx] = a[idx] * b[idx];
}

int main()
{
  int numBlocks;
  int blockSize = 32;
  
  int device;
  cudaDeviceProp prop;
  int activeWarps;
  int maxWarps;

  int N = 1024*1024;
  random_d_array a(N);
  random_d_array b(N);
  random_d_array d(N);

  string buffer;
  while(true)
    {
      cout << "Enter the block size or q to exit" << endl;
      cin >> buffer;
      if(buffer == "q") break;
      blockSize = stoi(buffer, nullptr);

      int gridSize = (N + blockSize - 1)/blockSize;

      cout << "blockSize = " << blockSize << ", gridSize = " << gridSize << endl;

      cudaGetDevice(&device);
      cudaGetDeviceProperties(&prop, device);
      
      cudaOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, MyKernel, blockSize, 0);
      
      activeWarps = numBlocks * blockSize/prop.warpSize;
      maxWarps = prop.maxThreadsPerMultiProcessor/prop.warpSize;

      cout << "Occupancy: " << (double)activeWarps/maxWarps * 100 << "%" << endl;

      double average = 0.0;
      int iterations = 5;
      
      for(int i = 0; i < iterations; ++i)
	{
	  cudaEvent_t start, stop;
	  cudaEventCreate(&start);
	  cudaEventCreate(&stop);
	  cudaEventRecord(start);
	  
	  MyKernel<<<gridSize,blockSize>>>(d.data, a.data, b.data, N);
	  
	  cudaEventRecord(stop); 
	  cudaEventSynchronize(stop);
	  float milliseconds = 0;  
	  cudaEventElapsedTime(&milliseconds, start, stop);
	  cudaEventDestroy(start);
	  cudaEventDestroy(stop);
	  cout << milliseconds << " ms" << endl;
	  if(i > 0)
	    average += milliseconds;
	}
      average /= (iterations - 1);
      cout << "Average = " << average << endl;
    }
}

	.file	"tmpxft_0033df21_00000000-6_occupancy.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3645:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3645:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4308:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4308:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.section	.text._ZN14random_d_arrayC2Ei,"axG",@progbits,_ZN14random_d_arrayC5Ei,comdat
	.align 2
	.weak	_ZN14random_d_arrayC2Ei
	.type	_ZN14random_d_arrayC2Ei, @function
_ZN14random_d_arrayC2Ei:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%esi, %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movl	%esi, 8(%rdi)
	leaq	0(,%rbx,4), %rsi
	call	cudaMalloc@PLT
	movq	%rsp, %rdi
	movl	$100, %esi
	call	curandCreateGenerator@PLT
	movq	0(%rbp), %rsi
	movq	(%rsp), %rdi
	movq	%rbx, %rdx
	call	curandGenerateUniform@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3636:
	.size	_ZN14random_d_arrayC2Ei, .-_ZN14random_d_arrayC2Ei
	.weak	_ZN14random_d_arrayC1Ei
	.set	_ZN14random_d_arrayC1Ei,_ZN14random_d_arrayC2Ei
	.text
	.globl	_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i
	.type	_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i, @function
_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i:
.LFB3667:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L7
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z8MyKernelPfS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L7:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3667:
	.size	_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i, .-_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i
	.globl	_Z8MyKernelPfS_S_i
	.type	_Z8MyKernelPfS_S_i, @function
_Z8MyKernelPfS_S_i:
.LFB3668:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i
	.cfi_endproc
.LFE3668:
	.size	_Z8MyKernelPfS_S_i, .-_Z8MyKernelPfS_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z8MyKernelPfS_S_i"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3670:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z8MyKernelPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3670:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev,"axG",@progbits,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD5Ev,comdat
	.align 2
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.type	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, @function
_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev:
.LFB3749:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	call	__errno_location@PLT
	cmpl	$0, (%rax)
	jne	.L14
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L14:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3749:
	.size	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev, .-_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.weak	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	.set	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev,_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev
	.section	.rodata.str1.1
.LC2:
	.string	"Enter the block size or q to exit"
.LC3:
	.string	"stoi"
.LC4:
	.string	"blockSize = "
.LC5:
	.string	", gridSize = "
.LC6:
	.string	"Occupancy: "
.LC8:
	.string	"%"
.LC10:
	.string	" ms"
.LC12:
	.string	"Average = "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3641:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3641
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$1048576, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$1240, %rsp
	.cfi_def_cfa_offset 1296
	movq	%fs:40, %rax
	movq	%rax, 1224(%rsp)
	xorl	%eax, %eax
	leaq	112(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
.LEHB0:
	call	_ZN14random_d_arrayC1Ei
.LEHE0:
	leaq	128(%rsp), %rax
	movl	$1048576, %esi
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
.LEHB1:
	call	_ZN14random_d_arrayC1Ei
.LEHE1:
	leaq	144(%rsp), %rax
	movl	$1048576, %esi
	movq	%rax, %rdi
	movq	%rax, 32(%rsp)
.LEHB2:
	call	_ZN14random_d_arrayC1Ei
.LEHE2:
	leaq	176(%rsp), %rax
	xorl	%edx, %edx
	movb	$0, 176(%rsp)
	movq	%rax, 160(%rsp)
	movq	%rdx, 168(%rsp)
.L34:
	leaq	_ZSt4cout(%rip), %r13
	leaq	160(%rsp), %rax
	leaq	.LC2(%rip), %rsi
	movq	%r13, %rdi
	movq	%rax, 40(%rsp)
.LEHB3:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	40(%rsp), %rsi
	leaq	_ZSt3cin(%rip), %rdi
	call	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
.LEHE3:
	cmpq	$1, 168(%rsp)
	jne	.L18
	movq	160(%rsp), %rax
	cmpb	$113, (%rax)
	je	.L19
.L18:
	call	__errno_location@PLT
	leaq	96(%rsp), %r14
	movl	$10, %edx
	movq	160(%rsp), %rbp
	movq	%rax, %r12
	movl	(%rax), %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	movl	%eax, 84(%rsp)
	xorl	%eax, %eax
	movl	%eax, (%r12)
	call	__isoc23_strtol@PLT
	cmpq	96(%rsp), %rbp
	leaq	84(%rsp), %rbp
	movq	%rax, %rbx
	jne	.L47
	jmp	.L53
.L19:
	movq	40(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	je	.L38
	jmp	.L48
.L53:
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	leaq	.LC3(%rip), %rdi
.LEHB4:
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L47:
	cmpl	$34, (%r12)
	je	.L23
	movl	$2147483648, %eax
	movl	$4294967295, %edx
	addq	%rbx, %rax
	cmpq	%rax, %rdx
	jnb	.L24
.L23:
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	leaq	.LC3(%rip), %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE4:
.L24:
	movq	%rbp, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	leal	1048575(%rbx), %eax
	leaq	.LC4(%rip), %rsi
	movq	%r13, %rdi
	cltd
	idivl	%ebx
	movl	%eax, %ebp
.LEHB5:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%ebx, %esi
	call	_ZNSolsEi@PLT
	jmp	.L54
.L42:
	endbr64
	movq	%rax, %rbx
.L27:
	movq	%rbp, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	jmp	.L28
.L54:
	movq	%rax, %rdi
	leaq	.LC5(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%ebp, %esi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	60(%rsp), %rdi
	call	cudaGetDevice@PLT
	movl	60(%rsp), %esi
	leaq	192(%rsp), %rdi
	call	cudaGetDeviceProperties_v2@PLT
	leaq	56(%rsp), %rdi
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	movl	%ebx, %edx
	leaq	_Z8MyKernelPfS_S_i(%rip), %rsi
	call	cudaOccupancyMaxActiveBlocksPerMultiprocessorWithFlags@PLT
	movl	56(%rsp), %eax
	movl	500(%rsp), %ecx
	leaq	.LC6(%rip), %rsi
	movq	%r13, %rdi
	imull	%ebx, %eax
	cltd
	idivl	%ecx
	movl	%eax, %r15d
	movl	816(%rsp), %eax
	cltd
	idivl	%ecx
	movl	%eax, %r12d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cvtsi2sdl	%r15d, %xmm0
	movq	%rax, %rdi
	cvtsi2sdl	%r12d, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	.LC7(%rip), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC8(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	$0x000000000, 8(%rsp)
	xorl	%r12d, %r12d
	movabsq	$4294967297, %r15
.L33:
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%r15, 100(%rsp)
	movl	104(%rsp), %ecx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, 88(%rsp)
	movl	92(%rsp), %esi
	movl	%ebx, 96(%rsp)
	movq	96(%rsp), %rdx
	movl	%ebp, 84(%rsp)
	movq	84(%rsp), %rdi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L29
.L31:
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	jmp	.L55
.L29:
	movq	128(%rsp), %rdx
	movq	112(%rsp), %rsi
	movl	$1048576, %ecx
	movq	144(%rsp), %rdi
	call	_Z32__device_stub__Z8MyKernelPfS_S_iPfS_S_i
	jmp	.L31
.L55:
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	movq	%r14, %rdi
	movl	$0x00000000, 96(%rsp)
	call	cudaEventElapsedTime@PLT
	movq	64(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	72(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	%r13, %rdi
	cvtss2sd	96(%rsp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	testl	%r12d, %r12d
	je	.L32
	cvtss2sd	96(%rsp), %xmm0
	addsd	8(%rsp), %xmm0
	movsd	%xmm0, 8(%rsp)
.L32:
	incl	%r12d
	cmpl	$5, %r12d
	jne	.L33
	movsd	8(%rsp), %xmm2
	mulsd	.LC11(%rip), %xmm2
	leaq	.LC12(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	movq	%xmm2, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE5:
	jmp	.L34
.L41:
	endbr64
	movq	%rax, %rbx
.L28:
	movq	40(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	32(%rsp), %rdi
	call	cudaFree@PLT
	jmp	.L35
.L40:
	endbr64
	movq	%rax, %rbx
.L35:
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	jmp	.L36
.L39:
	endbr64
	movq	%rax, %rbx
.L36:
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	1224(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L48:
	call	__stack_chk_fail@PLT
.L38:
	addq	$1240, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3641:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3641:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3641-.LLSDACSB3641
.LLSDACSB3641:
	.uleb128 .LEHB0-.LFB3641
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3641
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L39-.LFB3641
	.uleb128 0
	.uleb128 .LEHB2-.LFB3641
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L40-.LFB3641
	.uleb128 0
	.uleb128 .LEHB3-.LFB3641
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L41-.LFB3641
	.uleb128 0
	.uleb128 .LEHB4-.LFB3641
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L42-.LFB3641
	.uleb128 0
	.uleb128 .LEHB5-.LFB3641
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L41-.LFB3641
	.uleb128 0
	.uleb128 .LEHB6-.LFB3641
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE3641:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC7:
	.long	0
	.long	1079574528
	.align 8
.LC11:
	.long	0
	.long	1070596096
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.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 <iostream>
#include <hiprand/hiprand.h>

using namespace std;



struct random_d_array
{
  float *data;
  int n;

  random_d_array(int n) :n{n}
  {
    hipMalloc((void**)&data, n*sizeof(float));
    hiprandGenerator_t gen;
    hiprandCreateGenerator(&gen, HIPRAND_RNG_PSEUDO_DEFAULT);
    hiprandGenerateUniform(gen, data, n);
  }
  
  ~random_d_array()
  {
    hipFree(&data);
  }
};

__global__ void MyKernel(float *d, float *a, float *b, int n)
{
  int idx = threadIdx.x + blockIdx.x * blockDim.x;
  if(idx < n)
    d[idx] = a[idx] * b[idx];
}

int main()
{
  int numBlocks;
  int blockSize = 32;
  
  int device;
  hipDeviceProp_t prop;
  int activeWarps;
  int maxWarps;

  int N = 1024*1024;
  random_d_array a(N);
  random_d_array b(N);
  random_d_array d(N);

  string buffer;
  while(true)
    {
      cout << "Enter the block size or q to exit" << endl;
      cin >> buffer;
      if(buffer == "q") break;
      blockSize = stoi(buffer, nullptr);

      int gridSize = (N + blockSize - 1)/blockSize;

      cout << "blockSize = " << blockSize << ", gridSize = " << gridSize << endl;

      hipGetDevice(&device);
      hipGetDeviceProperties(&prop, device);
      
      hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, MyKernel, blockSize, 0);
      
      activeWarps = numBlocks * blockSize/prop.warpSize;
      maxWarps = prop.maxThreadsPerMultiProcessor/prop.warpSize;

      cout << "Occupancy: " << (double)activeWarps/maxWarps * 100 << "%" << endl;

      double average = 0.0;
      int iterations = 5;
      
      for(int i = 0; i < iterations; ++i)
	{
	  hipEvent_t start, stop;
	  hipEventCreate(&start);
	  hipEventCreate(&stop);
	  hipEventRecord(start);
	  
	  MyKernel<<<gridSize,blockSize>>>(d.data, a.data, b.data, N);
	  
	  hipEventRecord(stop); 
	  hipEventSynchronize(stop);
	  float milliseconds = 0;  
	  hipEventElapsedTime(&milliseconds, start, stop);
	  hipEventDestroy(start);
	  hipEventDestroy(stop);
	  cout << milliseconds << " ms" << endl;
	  if(i > 0)
	    average += milliseconds;
	}
      average /= (iterations - 1);
      cout << "Average = " << average << endl;
    }
}

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

                                        # End of file scope inline assembly
	.globl	_Z23__device_stub__MyKernelPfS_S_i # -- Begin function _Z23__device_stub__MyKernelPfS_S_i
	.type	_Z23__device_stub__MyKernelPfS_S_i,@function
_Z23__device_stub__MyKernelPfS_S_i:     # @_Z23__device_stub__MyKernelPfS_S_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), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	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	$_Z8MyKernelPfS_S_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_end0:
	.size	_Z23__device_stub__MyKernelPfS_S_i, .Lfunc_end0-_Z23__device_stub__MyKernelPfS_S_i
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI1_0:
	.quad	0x4059000000000000              # double 100
.LCPI1_1:
	.quad	0x8000000000000000              # double -0
.LCPI1_2:
	.quad	0x3fd0000000000000              # double 0.25
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1592, %rsp                     # imm = 0x638
	.cfi_def_cfa_offset 1648
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	72(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	_ZN14random_d_arrayC2Ei
.Ltmp0:
	leaq	56(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	_ZN14random_d_arrayC2Ei
.Ltmp1:
# %bb.1:
.Ltmp3:
	leaq	40(%rsp), %rdi
	movl	$1048576, %esi                  # imm = 0x100000
	callq	_ZN14random_d_arrayC2Ei
.Ltmp4:
# %bb.2:
	leaq	104(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
	leaq	24(%rsp), %r14
	leaq	4(%rsp), %r15
.LBB1_3:                                # %_ZNSolsEPFRSoS_E.exit53
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_32 Depth 2
.Ltmp6:
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$33, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp7:
# %bb.4:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB1_3 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp8:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp9:
# %bb.5:                                # %.noexc
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp10:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp11:
# %bb.6:                                # %.noexc62
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp12:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp13:
# %bb.7:                                # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp14:
	movl	$_ZSt3cin, %edi
	leaq	88(%rsp), %rsi
	callq	_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE
.Ltmp15:
# %bb.8:                                #   in Loop: Header=BB1_3 Depth=1
	movq	88(%rsp), %r13
	cmpq	$1, 96(%rsp)
	jne	.LBB1_10
# %bb.9:                                # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit
                                        #   in Loop: Header=BB1_3 Depth=1
	cmpb	$113, (%r13)
	je	.LBB1_56
.LBB1_10:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.thread83
                                        #   in Loop: Header=BB1_3 Depth=1
	callq	__errno_location
	movq	%rax, %rbx
	movl	(%rax), %ebp
	movl	$0, (%rax)
	movq	%r13, %rdi
	movq	%r14, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%r13, 24(%rsp)
	je	.LBB1_62
# %bb.11:                               #   in Loop: Header=BB1_3 Depth=1
	movq	%rax, %r12
	movslq	%r12d, %rax
	cmpq	%r12, %rax
	jne	.LBB1_64
# %bb.12:                               #   in Loop: Header=BB1_3 Depth=1
	movl	(%rbx), %eax
	cmpl	$34, %eax
	je	.LBB1_64
# %bb.13:                               #   in Loop: Header=BB1_3 Depth=1
	testl	%eax, %eax
	jne	.LBB1_15
# %bb.14:                               #   in Loop: Header=BB1_3 Depth=1
	movl	%ebp, (%rbx)
.LBB1_15:                               #   in Loop: Header=BB1_3 Depth=1
	leal	1048575(%r12), %eax
	cltd
	idivl	%r12d
	movl	%eax, 8(%rsp)                   # 4-byte Spill
.Ltmp17:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp18:
# %bb.16:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit43
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp19:
	movl	$_ZSt4cout, %edi
	movl	%r12d, %esi
	callq	_ZNSolsEi
.Ltmp20:
# %bb.17:                               #   in Loop: Header=BB1_3 Depth=1
.Ltmp21:
	movq	%rax, %r13
	movl	$.L.str.3, %esi
	movl	$13, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp22:
# %bb.18:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit44
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp23:
	movq	%r13, %rdi
	movl	8(%rsp), %esi                   # 4-byte Reload
	callq	_ZNSolsEi
.Ltmp24:
# %bb.19:                               #   in Loop: Header=BB1_3 Depth=1
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
.Ltmp25:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp26:
# %bb.20:                               # %.noexc64
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp27:
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
.Ltmp28:
# %bb.21:                               # %.noexc65
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp29:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp30:
# %bb.22:                               # %_ZNSolsEPFRSoS_E.exit45
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp31:
	leaq	32(%rsp), %rdi
	callq	hipGetDevice
.Ltmp32:
# %bb.23:                               #   in Loop: Header=BB1_3 Depth=1
	movl	32(%rsp), %esi
.Ltmp33:
	leaq	120(%rsp), %rdi
	callq	hipGetDevicePropertiesR0600
.Ltmp34:
# %bb.24:                               #   in Loop: Header=BB1_3 Depth=1
.Ltmp35:
	movl	$_Z8MyKernelPfS_S_i, %esi
	leaq	36(%rsp), %rdi
	movl	%r12d, %edx
	xorl	%ecx, %ecx
	callq	hipOccupancyMaxActiveBlocksPerMultiprocessor
.Ltmp36:
# %bb.25:                               # %_Z44hipOccupancyMaxActiveBlocksPerMultiprocessorIPFvPfS0_S0_iEE10hipError_tPiT_im.exit
                                        #   in Loop: Header=BB1_3 Depth=1
	movl	36(%rsp), %r13d
	movl	428(%rsp), %ebp
	movl	744(%rsp), %ebx
.Ltmp37:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp38:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit46
                                        #   in Loop: Header=BB1_3 Depth=1
	movl	%ebx, %eax
	cltd
	idivl	%ebp
	movl	%eax, %ecx
	imull	%r12d, %r13d
	movl	%r13d, %eax
	cltd
	idivl	%ebp
	cvtsi2sd	%eax, %xmm0
	cvtsi2sd	%ecx, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	.LCPI1_0(%rip), %xmm0
.Ltmp39:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp40:
# %bb.27:                               # %_ZNSolsEd.exit
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp41:
	movq	%rax, %r13
	movl	$.L.str.5, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp42:
# %bb.28:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit47
                                        #   in Loop: Header=BB1_3 Depth=1
	movq	(%r13), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
.Ltmp43:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp44:
# %bb.29:                               # %.noexc68
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp45:
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
.Ltmp46:
# %bb.30:                               # %.noexc69
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp47:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp48:
# %bb.31:                               # %_ZNSolsEPFRSoS_E.exit48.preheader
                                        #   in Loop: Header=BB1_3 Depth=1
	movl	8(%rsp), %ebx                   # 4-byte Reload
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rbx
	movl	%r12d, %r12d
	orq	%rax, %r12
	xorpd	%xmm0, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$5, %ebp
.LBB1_32:                               #   Parent Loop BB1_3 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp50:
	movq	%r14, %rdi
	callq	hipEventCreate
.Ltmp51:
# %bb.33:                               #   in Loop: Header=BB1_32 Depth=2
.Ltmp52:
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
.Ltmp53:
# %bb.34:                               #   in Loop: Header=BB1_32 Depth=2
	movq	24(%rsp), %rdi
.Ltmp54:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp55:
# %bb.35:                               #   in Loop: Header=BB1_32 Depth=2
.Ltmp56:
	movq	%rbx, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp57:
# %bb.36:                               #   in Loop: Header=BB1_32 Depth=2
	testl	%eax, %eax
	jne	.LBB1_38
# %bb.37:                               #   in Loop: Header=BB1_32 Depth=2
	movq	40(%rsp), %rdi
	movq	72(%rsp), %rsi
	movq	56(%rsp), %rdx
.Ltmp58:
	movl	$1048576, %ecx                  # imm = 0x100000
	callq	_Z23__device_stub__MyKernelPfS_S_i
.Ltmp59:
.LBB1_38:                               #   in Loop: Header=BB1_32 Depth=2
	movq	16(%rsp), %rdi
.Ltmp60:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp61:
# %bb.39:                               #   in Loop: Header=BB1_32 Depth=2
	movq	16(%rsp), %rdi
.Ltmp62:
	callq	hipEventSynchronize
.Ltmp63:
# %bb.40:                               #   in Loop: Header=BB1_32 Depth=2
	movl	$0, 4(%rsp)
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp65:
	movq	%r15, %rdi
	callq	hipEventElapsedTime
.Ltmp66:
# %bb.41:                               #   in Loop: Header=BB1_32 Depth=2
	movq	24(%rsp), %rdi
.Ltmp67:
	callq	hipEventDestroy
.Ltmp68:
# %bb.42:                               #   in Loop: Header=BB1_32 Depth=2
	movq	16(%rsp), %rdi
.Ltmp69:
	callq	hipEventDestroy
.Ltmp70:
# %bb.43:                               #   in Loop: Header=BB1_32 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rsp), %xmm0
.Ltmp71:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp72:
# %bb.44:                               # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB1_32 Depth=2
.Ltmp73:
	movq	%rax, %r13
	movl	$.L.str.6, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp74:
# %bb.45:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit50
                                        #   in Loop: Header=BB1_32 Depth=2
	movq	(%r13), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
.Ltmp75:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp76:
# %bb.46:                               # %.noexc72
                                        #   in Loop: Header=BB1_32 Depth=2
.Ltmp77:
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
.Ltmp78:
# %bb.47:                               # %.noexc73
                                        #   in Loop: Header=BB1_32 Depth=2
.Ltmp79:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp80:
# %bb.48:                               # %_ZNSolsEPFRSoS_E.exit51
                                        #   in Loop: Header=BB1_32 Depth=2
	movsd	.LCPI1_1(%rip), %xmm0           # xmm0 = mem[0],zero
	cmpl	$5, %ebp
	je	.LBB1_50
# %bb.49:                               # %_ZNSolsEPFRSoS_E.exit51
                                        #   in Loop: Header=BB1_32 Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	4(%rsp), %xmm0
.LBB1_50:                               # %_ZNSolsEPFRSoS_E.exit51
                                        #   in Loop: Header=BB1_32 Depth=2
	movsd	8(%rsp), %xmm1                  # 8-byte Reload
                                        # xmm1 = mem[0],zero
	addsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)                  # 8-byte Spill
	decl	%ebp
	jne	.LBB1_32
# %bb.51:                               #   in Loop: Header=BB1_3 Depth=1
.Ltmp82:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$10, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp83:
# %bb.52:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit49
                                        #   in Loop: Header=BB1_3 Depth=1
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	mulsd	.LCPI1_2(%rip), %xmm0
.Ltmp84:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp85:
# %bb.53:                               # %_ZNSolsEd.exit52
                                        #   in Loop: Header=BB1_3 Depth=1
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp86:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp87:
# %bb.54:                               # %.noexc76
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp88:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp89:
# %bb.55:                               # %.noexc77
                                        #   in Loop: Header=BB1_3 Depth=1
.Ltmp90:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp91:
	jmp	.LBB1_3
.LBB1_56:                               # %_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_.exit.thread
	leaq	104(%rsp), %rax
	cmpq	%rax, %r13
	je	.LBB1_58
# %bb.57:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB1_58:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
.Ltmp107:
	leaq	40(%rsp), %rdi
	callq	hipFree
.Ltmp108:
# %bb.59:                               # %_ZN14random_d_arrayD2Ev.exit
.Ltmp110:
	leaq	56(%rsp), %rdi
	callq	hipFree
.Ltmp111:
# %bb.60:                               # %_ZN14random_d_arrayD2Ev.exit54
.Ltmp113:
	leaq	72(%rsp), %rdi
	callq	hipFree
.Ltmp114:
# %bb.61:                               # %_ZN14random_d_arrayD2Ev.exit55
	xorl	%eax, %eax
	addq	$1592, %rsp                     # imm = 0x638
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_62:
	.cfi_def_cfa_offset 1648
.Ltmp95:
	movl	$.L.str.8, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp96:
# %bb.63:
.LBB1_64:                               # %.critedge.i.i
.Ltmp93:
	movl	$.L.str.8, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp94:
# %bb.65:
.LBB1_66:
.Ltmp115:
	jmp	.LBB1_88
.LBB1_67:
.Ltmp112:
	jmp	.LBB1_88
.LBB1_68:
.Ltmp109:
	jmp	.LBB1_88
.LBB1_69:
.Ltmp5:
	movq	%rax, %r14
	jmp	.LBB1_82
.LBB1_70:
.Ltmp2:
	movq	%rax, %r14
	jmp	.LBB1_83
.LBB1_71:
.Ltmp97:
	movq	%rax, %r14
	cmpl	$0, (%rbx)
	jne	.LBB1_79
# %bb.72:
	movl	%ebp, (%rbx)
	jmp	.LBB1_79
.LBB1_73:
.Ltmp92:
	jmp	.LBB1_78
.LBB1_74:
.Ltmp16:
	jmp	.LBB1_78
.LBB1_75:
.Ltmp49:
	jmp	.LBB1_78
.LBB1_76:
.Ltmp64:
	jmp	.LBB1_78
.LBB1_77:
.Ltmp81:
.LBB1_78:                               # %.body
	movq	%rax, %r14
.LBB1_79:                               # %.body
	movq	88(%rsp), %rdi
	leaq	104(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB1_81
# %bb.80:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i56
	callq	_ZdlPv
.LBB1_81:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit58
.Ltmp98:
	leaq	40(%rsp), %rdi
	callq	hipFree
.Ltmp99:
.LBB1_82:                               # %_ZN14random_d_arrayD2Ev.exit59
.Ltmp101:
	leaq	56(%rsp), %rdi
	callq	hipFree
.Ltmp102:
.LBB1_83:                               # %_ZN14random_d_arrayD2Ev.exit60
.Ltmp104:
	leaq	72(%rsp), %rdi
	callq	hipFree
.Ltmp105:
# %bb.84:                               # %_ZN14random_d_arrayD2Ev.exit61
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.LBB1_85:
.Ltmp106:
	jmp	.LBB1_88
.LBB1_86:
.Ltmp103:
	jmp	.LBB1_88
.LBB1_87:
.Ltmp100:
.LBB1_88:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp15-.Ltmp6                 #   Call between .Ltmp6 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp48-.Ltmp17                #   Call between .Ltmp17 and .Ltmp48
	.uleb128 .Ltmp49-.Lfunc_begin0          #     jumps to .Ltmp49
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp50-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp63-.Ltmp50                #   Call between .Ltmp50 and .Ltmp63
	.uleb128 .Ltmp64-.Lfunc_begin0          #     jumps to .Ltmp64
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp80-.Ltmp65                #   Call between .Ltmp65 and .Ltmp80
	.uleb128 .Ltmp81-.Lfunc_begin0          #     jumps to .Ltmp81
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp82-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp91-.Ltmp82                #   Call between .Ltmp82 and .Ltmp91
	.uleb128 .Ltmp92-.Lfunc_begin0          #     jumps to .Ltmp92
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp107-.Lfunc_begin0         # >> Call Site 9 <<
	.uleb128 .Ltmp108-.Ltmp107              #   Call between .Ltmp107 and .Ltmp108
	.uleb128 .Ltmp109-.Lfunc_begin0         #     jumps to .Ltmp109
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp110-.Lfunc_begin0         # >> Call Site 10 <<
	.uleb128 .Ltmp111-.Ltmp110              #   Call between .Ltmp110 and .Ltmp111
	.uleb128 .Ltmp112-.Lfunc_begin0         #     jumps to .Ltmp112
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp113-.Lfunc_begin0         # >> Call Site 11 <<
	.uleb128 .Ltmp114-.Ltmp113              #   Call between .Ltmp113 and .Ltmp114
	.uleb128 .Ltmp115-.Lfunc_begin0         #     jumps to .Ltmp115
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp95-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp94-.Ltmp95                #   Call between .Ltmp95 and .Ltmp94
	.uleb128 .Ltmp97-.Lfunc_begin0          #     jumps to .Ltmp97
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp98-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp99-.Ltmp98                #   Call between .Ltmp98 and .Ltmp99
	.uleb128 .Ltmp100-.Lfunc_begin0         #     jumps to .Ltmp100
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp101-.Lfunc_begin0         # >> Call Site 14 <<
	.uleb128 .Ltmp102-.Ltmp101              #   Call between .Ltmp101 and .Ltmp102
	.uleb128 .Ltmp103-.Lfunc_begin0         #     jumps to .Ltmp103
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp104-.Lfunc_begin0         # >> Call Site 15 <<
	.uleb128 .Ltmp105-.Ltmp104              #   Call between .Ltmp104 and .Ltmp105
	.uleb128 .Ltmp106-.Lfunc_begin0         #     jumps to .Ltmp106
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp105-.Lfunc_begin0         # >> Call Site 16 <<
	.uleb128 .Lfunc_end1-.Ltmp105           #   Call between .Ltmp105 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZN14random_d_arrayC2Ei,"axG",@progbits,_ZN14random_d_arrayC2Ei,comdat
	.weak	_ZN14random_d_arrayC2Ei         # -- Begin function _ZN14random_d_arrayC2Ei
	.p2align	1, 0x90
	.type	_ZN14random_d_arrayC2Ei,@function
_ZN14random_d_arrayC2Ei:                # @_ZN14random_d_arrayC2Ei
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	movl	%esi, 8(%rdi)
	movslq	%esi, %r14
	leaq	(,%r14,4), %rsi
	callq	hipMalloc
	leaq	8(%rsp), %r15
	movq	%r15, %rdi
	movl	$400, %esi                      # imm = 0x190
	callq	hiprandCreateGenerator
	movq	(%r15), %rdi
	movq	(%rbx), %rsi
	movq	%r14, %rdx
	callq	hiprandGenerateUniform
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_ZN14random_d_arrayC2Ei, .Lfunc_end2-_ZN14random_d_arrayC2Ei
	.cfi_endproc
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end3:
	.size	__clang_call_terminate, .Lfunc_end3-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z8MyKernelPfS_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__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	.LBB5_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
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z8MyKernelPfS_S_i,@object      # @_Z8MyKernelPfS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z8MyKernelPfS_S_i
	.p2align	3, 0x0
_Z8MyKernelPfS_S_i:
	.quad	_Z23__device_stub__MyKernelPfS_S_i
	.size	_Z8MyKernelPfS_S_i, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Enter the block size or q to exit"
	.size	.L.str, 34

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"blockSize = "
	.size	.L.str.2, 13

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	", gridSize = "
	.size	.L.str.3, 14

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Occupancy: "
	.size	.L.str.4, 12

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

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Average = "
	.size	.L.str.7, 11

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

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

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

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

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z23__device_stub__MyKernelPfS_S_i
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z8MyKernelPfS_S_i
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt3cin
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z8MyKernelPfS_S_i      ; -- Begin function _Z8MyKernelPfS_S_i
	.globl	_Z8MyKernelPfS_S_i
	.p2align	8
	.type	_Z8MyKernelPfS_S_i,@function
_Z8MyKernelPfS_S_i:                     ; @_Z8MyKernelPfS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b32 s3, s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_add_co_u32 v2, vcc_lo, s6, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v3, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s4, v0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s5, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_mul_f32_e32 v2, v2, v3
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8MyKernelPfS_S_i
		.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 6
		.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	_Z8MyKernelPfS_S_i, .Lfunc_end0-_Z8MyKernelPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 184
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         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:           _Z8MyKernelPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z8MyKernelPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
