
#include <iostream>
#include "cuda.h"

using Real = double;

//Test wrapper to run a function multiple times
template<typename PerfFunc>
float kernel_timer_wrapper(const int n_burn, const int n_perf, PerfFunc perf_func){

  //Initialize the timer and test
  cudaEvent_t start, stop;
  cudaEventCreate(&start);
  cudaEventCreate(&stop);

  for( int i_run = 0; i_run < n_burn + n_perf; i_run++){

    if(i_run == n_burn){
      //Burn in time is over, start timing
      cudaEventRecord(start);
    }

    //Run the function timing performance
    perf_func();
  }
  cudaEventRecord(stop);

  cudaEventSynchronize(stop);
  float milliseconds = 0;
  cudaEventElapsedTime(&milliseconds, start, stop);

  return milliseconds/1000.;
}

//A few integers that are needed for indexing on device
__constant__ int c_n_side3;
__constant__ int c_n_side2;
__constant__ int c_n_side;
__constant__ int c_n_side2n_buf;
__constant__ int c_n_buf;

__global__ void k_zbuffer_pack_array4d(Real* array4d_in, Real* array1d_buf){

  const int idx =  threadIdx.x + blockIdx.x*blockDim.x;

  const int v_var = idx / c_n_side2n_buf;
  const int k_grid = (idx - v_var * c_n_side2n_buf) / c_n_side2;
  const int j_grid = (idx - v_var * c_n_side2n_buf - k_grid * c_n_side2) / c_n_side;
  const int i_grid = idx - v_var * c_n_side2n_buf - k_grid * c_n_side2 - j_grid * c_n_side;

  array1d_buf[idx] = array4d_in[i_grid + j_grid*c_n_side + (k_grid+c_n_buf)*c_n_side2 + v_var*c_n_side3];
}

__global__ void k_zbuffer_pack_array_of_array3d(Real** array_of_array3d_in, Real* array1d_buf){
  const int idx =  threadIdx.x + blockIdx.x*blockDim.x;

  const int v_var = idx / c_n_side2n_buf;
  const int k_grid = (idx - v_var * c_n_side2n_buf) / c_n_side2;
  const int j_grid = (idx - v_var * c_n_side2n_buf - k_grid * c_n_side2) / c_n_side;
  const int i_grid = idx - v_var * c_n_side2n_buf - k_grid * c_n_side2 - j_grid * c_n_side;

  array1d_buf[idx] = array_of_array3d_in[v_var][i_grid + j_grid*c_n_side + (k_grid+c_n_buf)*c_n_side2];
}


int main(int argc, char* argv[]) {
  std::size_t pos;
  const int n_var = std::stoi(argv[1],&pos);
  const int n_side = std::stoi(argv[2],&pos);
  const int n_buf = std::stoi(argv[3],&pos);
  const int n_run = std::stoi(argv[4],&pos);

  //Order of iteration, fastest moving to slowest moving:
  // x (full n_side), y (full n_side), z (only n_buf), var (n_var)
  const int buf_size = n_side*n_side*n_buf*n_var;
  const int n_side3 = n_side*n_side*n_side;
  const int n_side2 = n_side*n_side;
  const int n_side2n_buf = n_side*n_side*n_buf;

  const int n_grid = n_side3;

  const int threads_per_block = 128;
  const int cuda_grid = buf_size/threads_per_block;
  const int cuda_block = threads_per_block;


  //Move useful indexing variables into constant memory
  cudaMemcpyToSymbol(c_n_side3, &n_side3, sizeof(n_side3));
  cudaMemcpyToSymbol(c_n_side2, &n_side2, sizeof(n_side2));
  cudaMemcpyToSymbol(c_n_side, &n_side, sizeof(n_side));
  cudaMemcpyToSymbol(c_n_side2n_buf, &n_side2n_buf, sizeof(n_side2n_buf));
  cudaMemcpyToSymbol(c_n_buf, &n_buf, sizeof(n_buf));

  //Setup a 1d view for the buffer
  Real* d_array1d_buf;
  cudaMalloc(&d_array1d_buf, sizeof(Real)*buf_size);

  //Setup a raw 4D view
  Real* d_array4d_in;
  cudaMalloc(&d_array4d_in, sizeof(Real)*n_var*n_grid);

  float time_array4d = kernel_timer_wrapper( n_run, n_run,
    [&] () {
      k_zbuffer_pack_array4d<<< cuda_grid, cuda_block >>> 
        (d_array4d_in, d_array1d_buf);
  });

  //Setup an array of arrays
  //Array of arrays on device
  CUdeviceptr* d_array_of_array3d_in;
  cudaMalloc(&d_array_of_array3d_in, sizeof(CUdeviceptr)*n_var);

  //Array of arrays on host
  CUdeviceptr* h_array_of_array3d_in  = (CUdeviceptr*) malloc(sizeof(CUdeviceptr)*n_var);

  //Malloc each 3d array
  for(int i = 0; i < n_var; i++) {
        cudaMalloc((void**)(h_array_of_array3d_in+i ), n_grid * sizeof(Real));
  }

  //Move h_array_of_array1d to d_array_of_array3d
  cudaMemcpy(d_array_of_array3d_in, h_array_of_array3d_in, sizeof(CUdeviceptr) * n_var, cudaMemcpyHostToDevice);


  double time_array_of_array3d = kernel_timer_wrapper( n_run, n_run,
    [&] () {
      k_zbuffer_pack_array_of_array3d<<< cuda_grid, cuda_block >>> 
        ( (Real**) d_array_of_array3d_in, d_array1d_buf);
  });


  double cell_cycles_per_second_array4d = static_cast<double>(n_side2n_buf)*static_cast<double>(n_run)/time_array4d; 
  double cell_cycles_per_second_array_of_array3d = static_cast<double>(n_side2n_buf)*static_cast<double>(n_run)/time_array_of_array3d; 
  std::cout<< n_var << " " << n_side << " " << n_run << " " << n_buf << " " << time_array4d << " " << time_array_of_array3d << " " 
           << cell_cycles_per_second_array4d << " " << cell_cycles_per_second_array_of_array3d << std::endl;


  //free each 1d array
  for(int i = 0; i < n_var; i++) {
        cudaFree(h_array_of_array3d_in+i);
  }

  free(h_array_of_array3d_in);
  cudaFree(d_array_of_array3d_in);

  cudaFree(d_array4d_in);

  cudaFree(d_array1d_buf);


}

	.file	"tmpxft_002556cb_00000000-6_cuda_zbuffer_pack.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3641:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3641:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_
	.type	_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_, @function
_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_:
.LFB3663:
	.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	.L2
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z22k_zbuffer_pack_array4dPdS_(%rip), %rdi
	pushq	32(%rsp)
	.cfi_def_cfa_offset 144
	movq	68(%rsp), %rcx
	movl	76(%rsp), %r8d
	movq	56(%rsp), %rsi
	movl	64(%rsp), %edx
	leaq	104(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 136
	popq	%rdx
	.cfi_def_cfa_offset 128
.L2:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3663:
	.size	_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_, .-_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_
	.globl	_Z22k_zbuffer_pack_array4dPdS_
	.type	_Z22k_zbuffer_pack_array4dPdS_, @function
_Z22k_zbuffer_pack_array4dPdS_:
.LFB3664:
	.cfi_startproc
	endbr64
	jmp	_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_
	.cfi_endproc
.LFE3664:
	.size	_Z22k_zbuffer_pack_array4dPdS_, .-_Z22k_zbuffer_pack_array4dPdS_
	.globl	_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_
	.type	_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_, @function
_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_:
.LFB3665:
	.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	.L8
	pushq	32(%rsp)
	.cfi_def_cfa_offset 136
	leaq	_Z31k_zbuffer_pack_array_of_array3dPPdS_(%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
.L8:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$120, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3665:
	.size	_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_, .-_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_
	.globl	_Z31k_zbuffer_pack_array_of_array3dPPdS_
	.type	_Z31k_zbuffer_pack_array_of_array3dPPdS_, @function
_Z31k_zbuffer_pack_array_of_array3dPPdS_:
.LFB3666:
	.cfi_startproc
	endbr64
	jmp	_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_
	.cfi_endproc
.LFE3666:
	.size	_Z31k_zbuffer_pack_array_of_array3dPPdS_, .-_Z31k_zbuffer_pack_array_of_array3dPPdS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z31k_zbuffer_pack_array_of_array3dPPdS_"
.LC1:
	.string	"_Z22k_zbuffer_pack_array4dPdS_"
.LC2:
	.string	"c_n_side3"
.LC3:
	.string	"c_n_side2"
.LC4:
	.string	"c_n_side"
.LC5:
	.string	"c_n_side2n_buf"
.LC6:
	.string	"c_n_buf"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3668:
	.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	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z31k_zbuffer_pack_array_of_array3dPPdS_(%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	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z22k_zbuffer_pack_array4dPdS_(%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	%r8d, %r8d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	movl	$4, %r9d
	leaq	_ZL9c_n_side3(%rip), %rsi
	pushq	$1
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	call	__cudaRegisterVar@PLT
	popq	%rax
	.cfi_def_cfa_offset 24
	popq	%rdx
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC3(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL9c_n_side2(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rcx
	.cfi_def_cfa_offset 24
	popq	%rsi
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC4(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL8c_n_side(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%rdi
	.cfi_def_cfa_offset 24
	popq	%r8
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC5(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movq	%rdx, %rcx
	movl	$4, %r9d
	leaq	_ZL14c_n_side2n_buf(%rip), %rsi
	call	__cudaRegisterVar@PLT
	popq	%r9
	.cfi_def_cfa_offset 24
	popq	%r10
	.cfi_def_cfa_offset 16
	pushq	$0
	.cfi_def_cfa_offset 24
	pushq	$1
	.cfi_def_cfa_offset 32
	leaq	.LC6(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	movl	$4, %r9d
	movq	%rdx, %rcx
	leaq	_ZL7c_n_buf(%rip), %rsi
	call	__cudaRegisterVar@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	popq	%r11
	.cfi_def_cfa_offset 24
	popq	%rbx
	.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
.LFE3668:
	.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:
.LFB3747:
	.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	.L15
	movl	(%rbx), %edx
	movl	%edx, (%rax)
.L15:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3747:
	.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
.LC7:
	.string	"stoi"
	.text
	.type	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0, @function
_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0:
.LFB4309:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4309
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movl	%edx, 12(%rsp)
	leaq	28(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__errno_location@PLT
	movl	12(%rsp), %edx
	leaq	32(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%rax, %rbp
	movl	(%rax), %eax
	movl	%eax, 28(%rsp)
	xorl	%eax, %eax
	movl	%eax, 0(%rbp)
	call	__isoc23_strtol@PLT
	movq	32(%rsp), %rdx
	cmpq	%rdx, %rbx
	jne	.L19
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	.LC7(%rip), %rdi
.LEHB0:
	call	_ZSt24__throw_invalid_argumentPKc@PLT
.L19:
	cmpl	$34, 0(%rbp)
	je	.L21
	movl	$2147483648, %ecx
	movl	$4294967295, %esi
	addq	%rax, %rcx
	cmpq	%rcx, %rsi
	jnb	.L22
.L21:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	.LC7(%rip), %rdi
	call	_ZSt20__throw_out_of_rangePKc@PLT
.LEHE0:
.L22:
	testq	%r12, %r12
	je	.L24
	subq	%rbx, %rdx
	movq	%rdx, (%r12)
.L24:
	movq	%r13, %rdi
	movl	%eax, 12(%rsp)
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movl	12(%rsp), %eax
	movq	40(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	jmp	.L32
.L28:
	endbr64
	movq	%rax, %rbx
.L25:
	movq	%r13, %rdi
	call	_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD1Ev
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	movq	%rbx, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L32:
	call	__stack_chk_fail@PLT
.L27:
	addq	$56, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4309:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4309:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4309-.LLSDACSB4309
.LLSDACSB4309:
	.uleb128 .LEHB0-.LFB4309
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L28-.LFB4309
	.uleb128 0
	.uleb128 .LEHB1-.LFB4309
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4309:
	.text
	.size	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0, .-_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC8:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB3969:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L36
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	leaq	.LC8(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L36:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L38
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L38:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L39
.L41:
	call	__stack_chk_fail@PLT
.L39:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3969:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC11:
	.string	" "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3636:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3636
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	8(%rsi), %rsi
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	152(%rsp), %r12
	leaq	140(%rsp), %rax
	movq	%rax, %rdx
	movq	%r12, %rdi
	movq	%rax, (%rsp)
	leaq	80(%rsp), %r13
.LEHB2:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE2:
	movq	152(%rsp), %rdi
	movl	$10, %edx
	movq	%r13, %rsi
.LEHB3:
	call	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0
.LEHE3:
	movq	%r12, %rdi
	movl	%eax, %ebx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	16(%rbp), %rsi
	movq	(%rsp), %rdx
	movq	%r12, %rdi
.LEHB4:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE4:
	movq	152(%rsp), %rdi
	movl	$10, %edx
	movq	%r13, %rsi
.LEHB5:
	call	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0
.LEHE5:
	movq	%r12, %rdi
	movl	%eax, 60(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	24(%rbp), %rsi
	movq	(%rsp), %rdx
	movq	%r12, %rdi
.LEHB6:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE6:
	movq	152(%rsp), %rdi
	movl	$10, %edx
	movq	%r13, %rsi
.LEHB7:
	call	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0
.LEHE7:
	movq	%r12, %rdi
	movl	%eax, 64(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	32(%rbp), %rsi
	movq	(%rsp), %rdx
	movq	%r12, %rdi
.LEHB8:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE8:
	movq	152(%rsp), %rdi
	movl	$10, %edx
	movq	%r13, %rsi
.LEHB9:
	call	_ZNSt7__cxx114stoiERKNS_12basic_stringIcSt11char_traitsIcESaIcEEEPmi.isra.0
.LEHE9:
	movabsq	$4294967424, %r14
	movq	%r12, %rdi
	movl	%eax, %ebp
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movl	60(%rsp), %r12d
	movl	64(%rsp), %edx
	movl	$128, %ecx
	leaq	68(%rsp), %rsi
	movl	$1, %r8d
	leaq	_ZL9c_n_side3(%rip), %rdi
	movl	%r12d, %eax
	imull	%r12d, %eax
	imull	%eax, %edx
	movl	%eax, 72(%rsp)
	imull	%eax, %r12d
	movl	%edx, %r13d
	movl	%edx, 76(%rsp)
	imull	%ebx, %r13d
	movl	%r12d, 68(%rsp)
	movslq	%r12d, %r12
	movl	%r13d, %eax
	cltd
	idivl	%ecx
	xorl	%ecx, %ecx
	movl	$4, %edx
	movl	%eax, 40(%rsp)
.LEHB10:
	call	cudaMemcpyToSymbol@PLT
	leaq	72(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL9c_n_side2(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	leaq	60(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL8c_n_side(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	leaq	76(%rsp), %rsi
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	_ZL14c_n_side2n_buf(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movl	$1, %r8d
	xorl	%ecx, %ecx
	movl	$4, %edx
	leaq	64(%rsp), %rsi
	leaq	_ZL7c_n_buf(%rip), %rdi
	call	cudaMemcpyToSymbol@PLT
	movslq	%r13d, %rsi
	leaq	88(%rsp), %rdi
	movslq	%ebx, %r13
	salq	$3, %rsi
	call	cudaMalloc@PLT
	leaq	0(,%r12,8), %rax
	leaq	96(%rsp), %rdi
	xorl	%r12d, %r12d
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	imulq	%r13, %rsi
	call	cudaMalloc@PLT
	leaq	112(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 32(%rsp)
	call	cudaEventCreate@PLT
	leaq	120(%rsp), %rdi
	call	cudaEventCreate@PLT
	leal	(%rbp,%rbp), %eax
	movl	%eax, 28(%rsp)
.L43:
	movl	28(%rsp), %eax
	cmpl	%eax, %r12d
	jge	.L72
	cmpl	%r12d, %ebp
	jne	.L44
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
.L44:
	movl	40(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r14, %rdx
	movl	$1, %ecx
	movq	%r14, 140(%rsp)
	movl	%eax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 132(%rsp)
	movq	128(%rsp), %rdi
	movl	136(%rsp), %esi
	movl	$1, 148(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L45
	movq	88(%rsp), %rsi
	movq	96(%rsp), %rdi
	call	_Z44__device_stub__Z22k_zbuffer_pack_array4dPdS_PdS_
.L45:
	incl	%r12d
	jmp	.L43
.L72:
	movq	120(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	120(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	120(%rsp), %rdx
	movq	112(%rsp), %rsi
	movl	$0x00000000, 140(%rsp)
	movq	(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	0(,%r13,8), %rax
	leaq	104(%rsp), %rdi
	xorl	%r13d, %r13d
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	movss	140(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	movss	%xmm0, 44(%rsp)
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdi
	call	malloc@PLT
	movq	%rax, %r12
	movq	%rax, %r14
	movq	%rax, %r15
.L47:
	cmpl	%ebx, %r13d
	jge	.L73
	movq	16(%rsp), %rsi
	movq	%r15, %rdi
	incl	%r13d
	addq	$8, %r15
	call	cudaMalloc@PLT
	jmp	.L47
.L73:
	movq	8(%rsp), %rdx
	movq	104(%rsp), %rdi
	movq	%r12, %rsi
	xorl	%r13d, %r13d
	movabsq	$4294967424, %r15
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	120(%rsp), %rdi
	call	cudaEventCreate@PLT
.L49:
	cmpl	%r13d, 28(%rsp)
	jle	.L74
	cmpl	%r13d, %ebp
	jne	.L50
	movq	112(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
.L50:
	movl	40(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	%r15, %rdx
	movl	$1, %ecx
	movq	%r15, 140(%rsp)
	movl	%eax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 132(%rsp)
	movq	128(%rsp), %rdi
	movl	136(%rsp), %esi
	movl	$1, 148(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L51
	movq	88(%rsp), %rsi
	movq	104(%rsp), %rdi
	call	_Z54__device_stub__Z31k_zbuffer_pack_array_of_array3dPPdS_PPdS_
.L51:
	incl	%r13d
	jmp	.L49
.L74:
	movq	120(%rsp), %rdi
	xorl	%esi, %esi
	leaq	.LC11(%rip), %r13
	call	cudaEventRecord@PLT
	movq	120(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	120(%rsp), %rdx
	movq	112(%rsp), %rsi
	movl	$0x00000000, 140(%rsp)
	movq	(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	cvtsi2sdl	76(%rsp), %xmm1
	movl	%ebx, %esi
	movss	140(%rsp), %xmm0
	divss	.LC10(%rip), %xmm0
	cvtss2sd	%xmm0, %xmm3
	cvtsi2sdl	%ebp, %xmm0
	leaq	_ZSt4cout(%rip), %rdi
	movsd	%xmm3, (%rsp)
	mulsd	%xmm0, %xmm1
	cvtss2sd	44(%rsp), %xmm0
	movsd	%xmm0, 16(%rsp)
	movaps	%xmm1, %xmm2
	divsd	%xmm0, %xmm2
	divsd	%xmm3, %xmm1
	movsd	%xmm2, 8(%rsp)
	movq	%xmm1, %r15
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	60(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebp, %esi
	xorl	%ebp, %ebp
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	64(%rsp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	16(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movsd	8(%rsp), %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r15, %xmm0
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
.L53:
	cmpl	%ebx, %ebp
	jge	.L75
	movq	%r14, %rdi
	incl	%ebp
	addq	$8, %r14
	call	cudaFree@PLT
	jmp	.L53
.L75:
	movq	%r12, %rdi
	call	free@PLT
	movq	104(%rsp), %rdi
	call	cudaFree@PLT
	movq	96(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	je	.L63
	jmp	.L68
.L64:
	endbr64
	jmp	.L71
.L65:
	endbr64
	jmp	.L71
.L66:
	endbr64
	jmp	.L71
.L67:
	endbr64
.L71:
	movq	%rax, %rbx
.L61:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L68
	movq	%rbx, %rdi
	call	_Unwind_Resume@PLT
.LEHE10:
.L68:
	call	__stack_chk_fail@PLT
.L63:
	addq	$200, %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
.LFE3636:
	.section	.gcc_except_table
.LLSDA3636:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3636-.LLSDACSB3636
.LLSDACSB3636:
	.uleb128 .LEHB2-.LFB3636
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB3-.LFB3636
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L64-.LFB3636
	.uleb128 0
	.uleb128 .LEHB4-.LFB3636
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB5-.LFB3636
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L65-.LFB3636
	.uleb128 0
	.uleb128 .LEHB6-.LFB3636
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB3636
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L66-.LFB3636
	.uleb128 0
	.uleb128 .LEHB8-.LFB3636
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB9-.LFB3636
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L67-.LFB3636
	.uleb128 0
	.uleb128 .LEHB10-.LFB3636
	.uleb128 .LEHE10-.LEHB10
	.uleb128 0
	.uleb128 0
.LLSDACSE3636:
	.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
	.local	_ZL7c_n_buf
	.comm	_ZL7c_n_buf,4,4
	.local	_ZL14c_n_side2n_buf
	.comm	_ZL14c_n_side2n_buf,4,4
	.local	_ZL8c_n_side
	.comm	_ZL8c_n_side,4,4
	.local	_ZL9c_n_side2
	.comm	_ZL9c_n_side2,4,4
	.local	_ZL9c_n_side3
	.comm	_ZL9c_n_side3,4,4
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC10:
	.long	1148846080
	.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 <iostream>
#include "hip/hip_runtime.h"

using Real = double;

//Test wrapper to run a function multiple times
template<typename PerfFunc>
float kernel_timer_wrapper(const int n_burn, const int n_perf, PerfFunc perf_func){

  //Initialize the timer and test
  hipEvent_t start, stop;
  hipEventCreate(&start);
  hipEventCreate(&stop);

  for( int i_run = 0; i_run < n_burn + n_perf; i_run++){

    if(i_run == n_burn){
      //Burn in time is over, start timing
      hipEventRecord(start);
    }

    //Run the function timing performance
    perf_func();
  }
  hipEventRecord(stop);

  hipEventSynchronize(stop);
  float milliseconds = 0;
  hipEventElapsedTime(&milliseconds, start, stop);

  return milliseconds/1000.;
}

//A few integers that are needed for indexing on device
__constant__ int c_n_side3;
__constant__ int c_n_side2;
__constant__ int c_n_side;
__constant__ int c_n_side2n_buf;
__constant__ int c_n_buf;

__global__ void k_zbuffer_pack_array4d(Real* array4d_in, Real* array1d_buf){

  const int idx =  threadIdx.x + blockIdx.x*blockDim.x;

  const int v_var = idx / c_n_side2n_buf;
  const int k_grid = (idx - v_var * c_n_side2n_buf) / c_n_side2;
  const int j_grid = (idx - v_var * c_n_side2n_buf - k_grid * c_n_side2) / c_n_side;
  const int i_grid = idx - v_var * c_n_side2n_buf - k_grid * c_n_side2 - j_grid * c_n_side;

  array1d_buf[idx] = array4d_in[i_grid + j_grid*c_n_side + (k_grid+c_n_buf)*c_n_side2 + v_var*c_n_side3];
}

__global__ void k_zbuffer_pack_array_of_array3d(Real** array_of_array3d_in, Real* array1d_buf){
  const int idx =  threadIdx.x + blockIdx.x*blockDim.x;

  const int v_var = idx / c_n_side2n_buf;
  const int k_grid = (idx - v_var * c_n_side2n_buf) / c_n_side2;
  const int j_grid = (idx - v_var * c_n_side2n_buf - k_grid * c_n_side2) / c_n_side;
  const int i_grid = idx - v_var * c_n_side2n_buf - k_grid * c_n_side2 - j_grid * c_n_side;

  array1d_buf[idx] = array_of_array3d_in[v_var][i_grid + j_grid*c_n_side + (k_grid+c_n_buf)*c_n_side2];
}


int main(int argc, char* argv[]) {
  std::size_t pos;
  const int n_var = std::stoi(argv[1],&pos);
  const int n_side = std::stoi(argv[2],&pos);
  const int n_buf = std::stoi(argv[3],&pos);
  const int n_run = std::stoi(argv[4],&pos);

  //Order of iteration, fastest moving to slowest moving:
  // x (full n_side), y (full n_side), z (only n_buf), var (n_var)
  const int buf_size = n_side*n_side*n_buf*n_var;
  const int n_side3 = n_side*n_side*n_side;
  const int n_side2 = n_side*n_side;
  const int n_side2n_buf = n_side*n_side*n_buf;

  const int n_grid = n_side3;

  const int threads_per_block = 128;
  const int cuda_grid = buf_size/threads_per_block;
  const int cuda_block = threads_per_block;


  //Move useful indexing variables into constant memory
  hipMemcpyToSymbol(HIP_SYMBOL(c_n_side3), &n_side3, sizeof(n_side3));
  hipMemcpyToSymbol(HIP_SYMBOL(c_n_side2), &n_side2, sizeof(n_side2));
  hipMemcpyToSymbol(HIP_SYMBOL(c_n_side), &n_side, sizeof(n_side));
  hipMemcpyToSymbol(HIP_SYMBOL(c_n_side2n_buf), &n_side2n_buf, sizeof(n_side2n_buf));
  hipMemcpyToSymbol(HIP_SYMBOL(c_n_buf), &n_buf, sizeof(n_buf));

  //Setup a 1d view for the buffer
  Real* d_array1d_buf;
  hipMalloc(&d_array1d_buf, sizeof(Real)*buf_size);

  //Setup a raw 4D view
  Real* d_array4d_in;
  hipMalloc(&d_array4d_in, sizeof(Real)*n_var*n_grid);

  float time_array4d = kernel_timer_wrapper( n_run, n_run,
    [&] () {
      k_zbuffer_pack_array4d<<< cuda_grid, cuda_block >>> 
        (d_array4d_in, d_array1d_buf);
  });

  //Setup an array of arrays
  //Array of arrays on device
  hipDeviceptr_t* d_array_of_array3d_in;
  hipMalloc(&d_array_of_array3d_in, sizeof(hipDeviceptr_t)*n_var);

  //Array of arrays on host
  hipDeviceptr_t* h_array_of_array3d_in  = (hipDeviceptr_t*) malloc(sizeof(hipDeviceptr_t)*n_var);

  //Malloc each 3d array
  for(int i = 0; i < n_var; i++) {
        hipMalloc((void**)(h_array_of_array3d_in+i ), n_grid * sizeof(Real));
  }

  //Move h_array_of_array1d to d_array_of_array3d
  hipMemcpy(d_array_of_array3d_in, h_array_of_array3d_in, sizeof(hipDeviceptr_t) * n_var, hipMemcpyHostToDevice);


  double time_array_of_array3d = kernel_timer_wrapper( n_run, n_run,
    [&] () {
      k_zbuffer_pack_array_of_array3d<<< cuda_grid, cuda_block >>> 
        ( (Real**) d_array_of_array3d_in, d_array1d_buf);
  });


  double cell_cycles_per_second_array4d = static_cast<double>(n_side2n_buf)*static_cast<double>(n_run)/time_array4d; 
  double cell_cycles_per_second_array_of_array3d = static_cast<double>(n_side2n_buf)*static_cast<double>(n_run)/time_array_of_array3d; 
  std::cout<< n_var << " " << n_side << " " << n_run << " " << n_buf << " " << time_array4d << " " << time_array_of_array3d << " " 
           << cell_cycles_per_second_array4d << " " << cell_cycles_per_second_array_of_array3d << std::endl;


  //free each 1d array
  for(int i = 0; i < n_var; i++) {
        hipFree(h_array_of_array3d_in+i);
  }

  free(h_array_of_array3d_in);
  hipFree(d_array_of_array3d_in);

  hipFree(d_array4d_in);

  hipFree(d_array1d_buf);


}

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

                                        # End of file scope inline assembly
	.globl	_Z37__device_stub__k_zbuffer_pack_array4dPdS_ # -- Begin function _Z37__device_stub__k_zbuffer_pack_array4dPdS_
	.type	_Z37__device_stub__k_zbuffer_pack_array4dPdS_,@function
_Z37__device_stub__k_zbuffer_pack_array4dPdS_: # @_Z37__device_stub__k_zbuffer_pack_array4dPdS_
	.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	$_Z22k_zbuffer_pack_array4dPdS_, %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_end0:
	.size	_Z37__device_stub__k_zbuffer_pack_array4dPdS_, .Lfunc_end0-_Z37__device_stub__k_zbuffer_pack_array4dPdS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_ # -- Begin function _Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_
	.type	_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_,@function
_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_: # @_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_
	.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	$_Z31k_zbuffer_pack_array_of_array3dPPdS_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_, .Lfunc_end1-_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI2_0:
	.long	0x447a0000                      # float 1000
	.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	$136, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r15
	movq	8(%rsi), %rsi
.Ltmp0:
	leaq	32(%rsp), %rdi
	leaq	16(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp1:
# %bb.1:
	movq	32(%rsp), %rbx
	callq	__errno_location
	movq	%rax, %r12
	movl	(%rax), %ebp
	movl	$0, (%rax)
	movq	%rsp, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%rbx, (%r14)
	je	.LBB2_2
# %bb.9:
	movq	%rax, %rbx
	movslq	%ebx, %rcx
	cmpq	%rax, %rcx
	jne	.LBB2_11
# %bb.10:
	movl	(%r12), %ecx
	cmpl	$34, %ecx
	je	.LBB2_11
# %bb.13:
	movq	%rax, 24(%rsp)                  # 8-byte Spill
	testl	%ecx, %ecx
	jne	.LBB2_15
# %bb.14:
	movl	%ebp, (%r12)
.LBB2_15:
	leaq	48(%rsp), %rbp
	movq	-16(%rbp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB2_17
# %bb.16:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB2_17:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movq	%rbx, 88(%rsp)                  # 8-byte Spill
	movq	16(%r15), %rsi
.Ltmp3:
	leaq	32(%rsp), %rdi
	leaq	16(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp4:
# %bb.18:
	movq	32(%rsp), %rbx
	movl	(%r12), %r13d
	movl	$0, (%r12)
	movq	%rsp, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%rbx, (%r14)
	je	.LBB2_19
# %bb.24:
	movabsq	$-4294967296, %rdx              # imm = 0xFFFFFFFF00000000
	leaq	-2147483648(%rax), %rcx
	cmpq	%rdx, %rcx
	jb	.LBB2_26
# %bb.25:
	movq	%rax, %rbx
	movl	(%r12), %eax
	cmpl	$34, %eax
	je	.LBB2_26
# %bb.28:
	testl	%eax, %eax
	jne	.LBB2_30
# %bb.29:
	movl	%r13d, (%r12)
.LBB2_30:
	movq	32(%rsp), %rdi
	cmpq	%rbp, %rdi
	je	.LBB2_32
# %bb.31:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i67
	callq	_ZdlPv
.LBB2_32:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit69
	movq	%rbx, 8(%rsp)                   # 8-byte Spill
	movl	%ebx, 84(%rsp)
	movq	24(%r15), %rsi
.Ltmp6:
	leaq	32(%rsp), %rdi
	leaq	16(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp7:
# %bb.33:
	movq	32(%rsp), %rbx
	movl	(%r12), %ebp
	movl	$0, (%r12)
	movq	%rsp, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%rbx, (%r14)
	je	.LBB2_34
# %bb.40:
	movq	%rax, %r13
	addq	$-2147483648, %rax              # imm = 0x80000000
	movabsq	$-4294967296, %rcx              # imm = 0xFFFFFFFF00000000
	cmpq	%rcx, %rax
	jb	.LBB2_42
# %bb.41:
	movl	(%r12), %eax
	cmpl	$34, %eax
	je	.LBB2_42
# %bb.44:
	testl	%eax, %eax
	jne	.LBB2_46
# %bb.45:
	movl	%ebp, (%r12)
.LBB2_46:
	movq	32(%rsp), %rdi
	leaq	48(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB2_48
# %bb.47:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i76
	callq	_ZdlPv
.LBB2_48:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit78
	movl	%r13d, 80(%rsp)
	movq	32(%r15), %rsi
.Ltmp9:
	leaq	32(%rsp), %rdi
	leaq	16(%rsp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp10:
# %bb.49:
	movq	32(%rsp), %rbx
	movl	(%r12), %ebp
	movl	$0, (%r12)
	movq	%rsp, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$10, %edx
	callq	__isoc23_strtol
	cmpq	%rbx, (%r14)
	je	.LBB2_50
# %bb.53:
	movq	%rax, %r15
	addq	$-2147483648, %rax              # imm = 0x80000000
	movabsq	$-4294967296, %rcx              # imm = 0xFFFFFFFF00000000
	cmpq	%rcx, %rax
	movq	88(%rsp), %r14                  # 8-byte Reload
	jb	.LBB2_55
# %bb.54:
	movl	(%r12), %eax
	cmpl	$34, %eax
	je	.LBB2_55
# %bb.57:
	testl	%eax, %eax
	jne	.LBB2_59
# %bb.58:
	movl	%ebp, (%r12)
.LBB2_59:
	movq	32(%rsp), %rdi
	leaq	48(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB2_61
# %bb.60:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i85
	callq	_ZdlPv
.LBB2_61:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit87
	movq	8(%rsp), %rbx                   # 8-byte Reload
	movl	%ebx, %eax
	imull	%ebx, %eax
	imull	%eax, %r13d
	imull	%eax, %ebx
	leaq	128(%rsp), %rsi
	movl	%ebx, (%rsi)
	leaq	124(%rsp), %r12
	movl	%eax, (%r12)
	leaq	76(%rsp), %rax
	movl	%r13d, (%rax)
	imull	%r14d, %r13d
	leal	127(%r13), %r14d
	testl	%r13d, %r13d
	cmovnsl	%r13d, %r14d
	sarl	$7, %r14d
	xorl	%ebp, %ebp
	movl	$c_n_side3, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$c_n_side2, %edi
	movl	$4, %edx
	movq	%r12, %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	84(%rsp), %rsi
	movl	$c_n_side, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movl	$c_n_side2n_buf, %edi
	movl	$4, %edx
	leaq	76(%rsp), %rsi
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	leaq	80(%rsp), %rsi
	movl	$c_n_buf, %edi
	movl	$4, %edx
	xorl	%ecx, %ecx
	movl	$1, %r8d
	callq	hipMemcpyToSymbol
	movslq	%r13d, %rsi
	shlq	$3, %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	movq	24(%rsp), %rsi                  # 8-byte Reload
	shlq	$3, %rsi
	movslq	%ebx, %rbx
	movq	%rsi, 24(%rsp)                  # 8-byte Spill
	imulq	%rbx, %rsi
	leaq	104(%rsp), %rdi
	callq	hipMalloc
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
	movq	%rsp, %rdi
	callq	hipEventCreate
	leal	(%r15,%r15), %r12d
	movl	%r14d, %eax
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	testl	%r15d, %r15d
	jle	.LBB2_68
# %bb.62:                               # %.lr.ph.i.preheader
	movq	8(%rsp), %r13                   # 8-byte Reload
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %r13
	leaq	128(%rax), %r14
.LBB2_63:                               # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	cmpl	%ebp, %r15d
	jne	.LBB2_65
# %bb.64:                               #   in Loop: Header=BB2_63 Depth=1
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
.LBB2_65:                               #   in Loop: Header=BB2_63 Depth=1
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_67
# %bb.66:                               #   in Loop: Header=BB2_63 Depth=1
	movq	104(%rsp), %rdi
	movq	16(%rsp), %rsi
	callq	_Z37__device_stub__k_zbuffer_pack_array4dPdS_
.LBB2_67:                               # %_ZZ4mainENKUlvE_clEv.exit.i
                                        #   in Loop: Header=BB2_63 Depth=1
	incl	%ebp
	cmpl	%ebp, %r12d
	jne	.LBB2_63
.LBB2_68:                               # %_Z20kernel_timer_wrapperIZ4mainEUlvE_EfiiT_.exit
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	leaq	96(%rsp), %r14
	movl	$0, (%r14)
	movq	32(%rsp), %rsi
	movq	(%rsp), %rdx
	movq	%r14, %rdi
	callq	hipEventElapsedTime
	movss	(%r14), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, 64(%rsp)                 # 4-byte Spill
	leaq	96(%rsp), %rdi
	movq	24(%rsp), %r14                  # 8-byte Reload
	movq	%r14, %rsi
	callq	hipMalloc
	movq	%r14, %rdi
	callq	malloc
	movq	%rax, %r13
	cmpl	$0, 88(%rsp)                    # 4-byte Folded Reload
	jle	.LBB2_71
# %bb.69:                               # %.lr.ph
	shlq	$3, %rbx
	movl	88(%rsp), %ebp                  # 4-byte Reload
	movq	%r13, %r14
.LBB2_70:                               # =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	addq	$8, %r14
	decq	%rbp
	jne	.LBB2_70
.LBB2_71:                               # %._crit_edge
	movss	64(%rsp), %xmm0                 # 4-byte Reload
                                        # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI2_0(%rip), %xmm0
	movss	%xmm0, 64(%rsp)                 # 4-byte Spill
	movq	96(%rsp), %rdi
	movq	%r13, %rsi
	movq	24(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
	movq	%rsp, %rdi
	callq	hipEventCreate
	testl	%r15d, %r15d
	movq	88(%rsp), %r14                  # 8-byte Reload
	movabsq	$4294967296, %rbp               # imm = 0x100000000
	jle	.LBB2_78
# %bb.72:                               # %.lr.ph.i88.preheader
	orq	%rbp, 8(%rsp)                   # 8-byte Folded Spill
	xorl	%ebx, %ebx
	subq	$-128, %rbp
.LBB2_73:                               # %.lr.ph.i88
                                        # =>This Inner Loop Header: Depth=1
	cmpl	%ebx, %r15d
	jne	.LBB2_75
# %bb.74:                               #   in Loop: Header=BB2_73 Depth=1
	movq	32(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
.LBB2_75:                               #   in Loop: Header=BB2_73 Depth=1
	movq	8(%rsp), %rdi                   # 8-byte Reload
	movl	$1, %esi
	movq	%rbp, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_77
# %bb.76:                               #   in Loop: Header=BB2_73 Depth=1
	movq	96(%rsp), %rdi
	movq	16(%rsp), %rsi
	callq	_Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_
.LBB2_77:                               # %_ZZ4mainENKUlvE0_clEv.exit.i
                                        #   in Loop: Header=BB2_73 Depth=1
	incl	%ebx
	cmpl	%ebx, %r12d
	jne	.LBB2_73
.LBB2_78:                               # %_Z20kernel_timer_wrapperIZ4mainEUlvE0_EfiiT_.exit
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	leaq	132(%rsp), %rbx
	movl	$0, (%rbx)
	movq	32(%rsp), %rsi
	movq	(%rsp), %rdx
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	movss	(%rbx), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	divss	.LCPI2_0(%rip), %xmm0
	cvtsi2sdl	76(%rsp), %xmm1
	cvtss2sd	%xmm0, %xmm2
	movsd	%xmm2, 112(%rsp)                # 8-byte Spill
	xorps	%xmm0, %xmm0
	cvtsi2sd	%r15d, %xmm0
	mulsd	%xmm1, %xmm0
	cvtss2sd	64(%rsp), %xmm3                 # 4-byte Folded Reload
	movsd	%xmm3, 64(%rsp)                 # 8-byte Spill
	movapd	%xmm0, %xmm1
	divsd	%xmm3, %xmm1
	movsd	%xmm1, 24(%rsp)                 # 8-byte Spill
	divsd	%xmm2, %xmm0
	movsd	%xmm0, 8(%rsp)                  # 8-byte Spill
	movl	$_ZSt4cout, %edi
	movl	%r14d, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	84(%rsp), %esi
	movq	%rbx, %rdi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	80(%rsp), %esi
	movq	%rbx, %rdi
	callq	_ZNSolsEi
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	64(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	112(%rsp), %xmm0                # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movl	$.L.str, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rbx, %rdi
	movsd	8(%rsp), %xmm0                  # 8-byte Reload
                                        # xmm0 = mem[0],zero
	callq	_ZNSo9_M_insertIdEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	testl	%r14d, %r14d
	jle	.LBB2_81
# %bb.79:                               # %.lr.ph116.preheader
	movl	%r14d, %r14d
	movq	%r13, %rbx
.LBB2_80:                               # %.lr.ph116
                                        # =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	hipFree
	addq	$8, %rbx
	decq	%r14
	jne	.LBB2_80
.LBB2_81:                               # %._crit_edge117
	movq	%r13, %rdi
	callq	free
	movq	96(%rsp), %rdi
	callq	hipFree
	movq	104(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	xorl	%eax, %eax
	addq	$136, %rsp
	.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
.LBB2_2:
	.cfi_def_cfa_offset 192
.Ltmp29:
	movl	$.L.str.1, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp30:
# %bb.3:
.LBB2_11:                               # %.critedge.i.i
.Ltmp27:
	movl	$.L.str.1, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp28:
# %bb.12:
.LBB2_19:
.Ltmp24:
	movl	$.L.str.1, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp25:
# %bb.20:
.LBB2_26:                               # %.critedge.i.i62
.Ltmp22:
	movl	$.L.str.1, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp23:
# %bb.27:
.LBB2_34:
.Ltmp19:
	movl	$.L.str.1, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp20:
# %bb.35:
.LBB2_42:                               # %.critedge.i.i71
.Ltmp17:
	movl	$.L.str.1, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp18:
# %bb.43:
.LBB2_50:
.Ltmp14:
	movl	$.L.str.1, %edi
	callq	_ZSt24__throw_invalid_argumentPKc
.Ltmp15:
# %bb.51:
.LBB2_55:                               # %.critedge.i.i80
.Ltmp12:
	movl	$.L.str.1, %edi
	callq	_ZSt20__throw_out_of_rangePKc
.Ltmp13:
# %bb.56:
.LBB2_85:
.Ltmp11:
	jmp	.LBB2_86
.LBB2_84:
.Ltmp8:
	jmp	.LBB2_86
.LBB2_83:
.Ltmp5:
	jmp	.LBB2_86
.LBB2_82:
.Ltmp2:
.LBB2_86:
	movq	%rax, %rbx
	jmp	.LBB2_87
.LBB2_52:
.Ltmp16:
	jmp	.LBB2_37
.LBB2_36:
.Ltmp21:
.LBB2_37:
	movq	%rax, %rbx
	cmpl	$0, (%r12)
	jne	.LBB2_39
# %bb.38:
	movl	%ebp, (%r12)
.LBB2_39:                               # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i72
	movq	32(%rsp), %rdi
	leaq	48(%rsp), %rax
	jmp	.LBB2_7
.LBB2_21:
.Ltmp26:
	movq	%rax, %rbx
	cmpl	$0, (%r12)
	jne	.LBB2_23
# %bb.22:
	movl	%r13d, (%r12)
.LBB2_23:                               # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i63
	movq	32(%rsp), %rdi
	cmpq	%rbp, %rdi
	jne	.LBB2_8
	jmp	.LBB2_87
.LBB2_4:
.Ltmp31:
	movq	%rax, %rbx
	cmpl	$0, (%r12)
	jne	.LBB2_6
# %bb.5:
	movl	%ebp, (%r12)
.LBB2_6:                                # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i
	leaq	48(%rsp), %rax
	movq	-16(%rax), %rdi
.LBB2_7:                                # %_ZZN9__gnu_cxx6__stoaIlicJiEEET0_PFT_PKT1_PPS3_DpT2_EPKcS5_PmS9_EN11_Save_errnoD2Ev.exit.i.i
	cmpq	%rax, %rdi
	je	.LBB2_87
.LBB2_8:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i94
	callq	_ZdlPv
.LBB2_87:
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	main, .Lfunc_end2-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.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 2 <<
	.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 3 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin0          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp29-.Ltmp10                #   Call between .Ltmp10 and .Ltmp29
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp28-.Ltmp29                #   Call between .Ltmp29 and .Ltmp28
	.uleb128 .Ltmp31-.Lfunc_begin0          #     jumps to .Ltmp31
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp23-.Ltmp24                #   Call between .Ltmp24 and .Ltmp23
	.uleb128 .Ltmp26-.Lfunc_begin0          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp19-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp18-.Ltmp19                #   Call between .Ltmp19 and .Ltmp18
	.uleb128 .Ltmp21-.Lfunc_begin0          #     jumps to .Ltmp21
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp13-.Ltmp14                #   Call between .Ltmp14 and .Ltmp13
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Lfunc_end2-.Ltmp13            #   Call between .Ltmp13 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB3_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB3_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.2, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end3:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end3-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.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
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB4_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB4_3
.LBB4_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB4_3:
	testq	%r14, %r14
	je	.LBB4_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB4_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB4_7
.LBB4_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB4_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	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	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end4-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.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:
	subq	$32, %rsp
	.cfi_adjust_cfa_offset 32
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z22k_zbuffer_pack_array4dPdS_, %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	$_Z31k_zbuffer_pack_array_of_array3dPPdS_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	addq	$32, %rsp
	.cfi_adjust_cfa_offset -32
	movl	$c_n_side3, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$c_n_side2, %esi
	movl	$.L__unnamed_4, %edx
	movl	$.L__unnamed_4, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$c_n_side, %esi
	movl	$.L__unnamed_5, %edx
	movl	$.L__unnamed_5, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$c_n_side2n_buf, %esi
	movl	$.L__unnamed_6, %edx
	movl	$.L__unnamed_6, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$c_n_buf, %esi
	movl	$.L__unnamed_7, %edx
	movl	$.L__unnamed_7, %ecx
	movl	$4, %r9d
	movq	%rbx, %rdi
	xorl	%r8d, %r8d
	pushq	$0
	.cfi_adjust_cfa_offset 8
	pushq	$1
	.cfi_adjust_cfa_offset 8
	callq	__hipRegisterVar
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	movl	$__hip_module_dtor, %edi
	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	c_n_side3,@object               # @c_n_side3
	.local	c_n_side3
	.comm	c_n_side3,4,4
	.type	c_n_side2,@object               # @c_n_side2
	.local	c_n_side2
	.comm	c_n_side2,4,4
	.type	c_n_side,@object                # @c_n_side
	.local	c_n_side
	.comm	c_n_side,4,4
	.type	c_n_side2n_buf,@object          # @c_n_side2n_buf
	.local	c_n_side2n_buf
	.comm	c_n_side2n_buf,4,4
	.type	c_n_buf,@object                 # @c_n_buf
	.local	c_n_buf
	.comm	c_n_buf,4,4
	.type	_Z22k_zbuffer_pack_array4dPdS_,@object # @_Z22k_zbuffer_pack_array4dPdS_
	.section	.rodata,"a",@progbits
	.globl	_Z22k_zbuffer_pack_array4dPdS_
	.p2align	3, 0x0
_Z22k_zbuffer_pack_array4dPdS_:
	.quad	_Z37__device_stub__k_zbuffer_pack_array4dPdS_
	.size	_Z22k_zbuffer_pack_array4dPdS_, 8

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

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

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.2, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z22k_zbuffer_pack_array4dPdS_"
	.size	.L__unnamed_1, 31

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z31k_zbuffer_pack_array_of_array3dPPdS_"
	.size	.L__unnamed_2, 41

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"c_n_side3"
	.size	.L__unnamed_3, 10

	.type	.L__unnamed_4,@object           # @3
.L__unnamed_4:
	.asciz	"c_n_side2"
	.size	.L__unnamed_4, 10

	.type	.L__unnamed_5,@object           # @4
.L__unnamed_5:
	.asciz	"c_n_side"
	.size	.L__unnamed_5, 9

	.type	.L__unnamed_6,@object           # @5
.L__unnamed_6:
	.asciz	"c_n_side2n_buf"
	.size	.L__unnamed_6, 15

	.type	.L__unnamed_7,@object           # @6
.L__unnamed_7:
	.asciz	"c_n_buf"
	.size	.L__unnamed_7, 8

	.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 _Z37__device_stub__k_zbuffer_pack_array4dPdS_
	.addrsig_sym _Z46__device_stub__k_zbuffer_pack_array_of_array3dPPdS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym c_n_side3
	.addrsig_sym c_n_side2
	.addrsig_sym c_n_side
	.addrsig_sym c_n_side2n_buf
	.addrsig_sym c_n_buf
	.addrsig_sym _Z22k_zbuffer_pack_array4dPdS_
	.addrsig_sym _Z31k_zbuffer_pack_array_of_array3dPPdS_
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z22k_zbuffer_pack_array4dPdS_ ; -- Begin function _Z22k_zbuffer_pack_array4dPdS_
	.globl	_Z22k_zbuffer_pack_array4dPdS_
	.p2align	8
	.type	_Z22k_zbuffer_pack_array4dPdS_,@function
_Z22k_zbuffer_pack_array4dPdS_:         ; @_Z22k_zbuffer_pack_array4dPdS_
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, c_n_side2n_buf@rel32@lo+4
	s_addc_u32 s3, s3, c_n_side2n_buf@rel32@hi+12
	s_load_b32 s6, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_ashr_i32 s7, s6, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s2, s6, s7
	s_xor_b32 s8, s2, s7
	s_load_b32 s2, s[0:1], 0x1c
	v_cvt_f32_u32_e32 v1, s8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_4) | instid1(VALU_DEP_1)
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	v_cvt_u32_f32_e32 v3, v1
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	s_sub_i32 s2, 0, s8
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_mul_lo_u32 v0, s2, v3
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, c_n_side3@rel32@lo+4
	s_addc_u32 s3, s3, c_n_side3@rel32@hi+12
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, c_n_side2@rel32@lo+4
	s_addc_u32 s5, s5, c_n_side2@rel32@hi+12
	s_load_b32 s9, s[2:3], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, c_n_buf@rel32@lo+4
	s_addc_u32 s3, s3, c_n_buf@rel32@hi+12
	s_load_b32 s4, s[4:5], 0x0
	s_load_b32 s5, s[2:3], 0x0
	v_mul_hi_u32 v0, v3, v0
	v_add_nc_u32_e32 v4, v1, v2
	s_load_b128 s[0:3], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_xor_b32_e32 v4, v4, v2
	v_add_nc_u32_e32 v0, v3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mul_hi_u32 v0, v4, v0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s5, s5, s4
	v_mul_lo_u32 v3, v0, s8
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_nc_u32_e32 v3, v4, v3
	v_add_nc_u32_e32 v4, 1, v0
	v_subrev_nc_u32_e32 v5, s8, v3
	v_cmp_le_u32_e32 vcc_lo, s8, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_dual_cndmask_b32 v3, v3, v5 :: v_dual_cndmask_b32 v0, v0, v4
	v_xor_b32_e32 v5, s7, v2
	v_cmp_le_u32_e32 vcc_lo, s8, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, 1, v0
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_xor_b32_e32 v0, v0, v5
	v_sub_nc_u32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v3, v0, s6
	v_mul_lo_u32 v0, s9, v0
	v_sub_nc_u32_e32 v3, v1, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add3_u32 v3, v0, v3, s5
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	v_ashrrev_i32_e32 v4, 31, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 3, v[3:4]
	v_add_co_u32 v3, vcc_lo, s0, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s1, v4, vcc_lo
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	s_waitcnt vmcnt(0)
	global_store_b64 v[0:1], v[3:4], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z22k_zbuffer_pack_array4dPdS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.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	_Z22k_zbuffer_pack_array4dPdS_, .Lfunc_end0-_Z22k_zbuffer_pack_array4dPdS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 452
; 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
	.protected	_Z31k_zbuffer_pack_array_of_array3dPPdS_ ; -- Begin function _Z31k_zbuffer_pack_array_of_array3dPPdS_
	.globl	_Z31k_zbuffer_pack_array_of_array3dPPdS_
	.p2align	8
	.type	_Z31k_zbuffer_pack_array_of_array3dPPdS_,@function
_Z31k_zbuffer_pack_array_of_array3dPPdS_: ; @_Z31k_zbuffer_pack_array_of_array3dPPdS_
; %bb.0:
	s_getpc_b64 s[2:3]
	s_add_u32 s2, s2, c_n_side2n_buf@rel32@lo+4
	s_addc_u32 s3, s3, c_n_side2n_buf@rel32@hi+12
	s_load_b32 s4, s[0:1], 0x1c
	s_load_b32 s6, s[2:3], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_ashr_i32 s2, s6, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s3, s6, s2
	s_xor_b32 s3, s3, s2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v1, s3
	v_rcp_iflag_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v1, 0x4f7ffffe, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cvt_u32_f32_e32 v3, v1
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	s_sub_i32 s4, 0, s3
	s_delay_alu instid0(VALU_DEP_2) | instid1(SALU_CYCLE_1)
	v_mul_lo_u32 v0, s4, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v2, 31, v1
	v_mul_hi_u32 v0, v3, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v4, v1, v2
	v_xor_b32_e32 v4, v4, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v0, v3, v0
	v_mul_hi_u32 v0, v4, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mul_lo_u32 v3, v0, s3
	v_sub_nc_u32_e32 v3, v4, v3
	v_add_nc_u32_e32 v4, 1, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_subrev_nc_u32_e32 v5, s3, v3
	v_cmp_le_u32_e32 vcc_lo, s3, v3
	v_dual_cndmask_b32 v3, v3, v5 :: v_dual_cndmask_b32 v0, v0, v4
	v_xor_b32_e32 v5, s2, v2
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cmp_le_u32_e32 vcc_lo, s3, v3
	v_add_nc_u32_e32 v4, 1, v0
	s_load_b128 s[0:3], s[0:1], 0x0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_cndmask_b32_e32 v0, v0, v4, vcc_lo
	v_xor_b32_e32 v0, v0, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v3, v0, v5
	v_ashrrev_i32_e32 v4, 31, v3
	v_mul_lo_u32 v0, v3, s6
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[4:5], 3, v[3:4]
	v_sub_nc_u32_e32 v0, v1, v0
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v4, vcc_lo, s0, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s1, v5, vcc_lo
	s_getpc_b64 s[0:1]
	s_add_u32 s0, s0, c_n_side2@rel32@lo+4
	s_addc_u32 s1, s1, c_n_side2@rel32@hi+12
	s_getpc_b64 s[4:5]
	s_add_u32 s4, s4, c_n_buf@rel32@lo+4
	s_addc_u32 s5, s5, c_n_buf@rel32@hi+12
	global_load_b64 v[4:5], v[4:5], off
	s_load_b32 s0, s[0:1], 0x0
	s_load_b32 s1, s[4:5], 0x0
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[6:7], null, s1, s0, v[0:1]
	v_lshlrev_b64 v[0:1], 3, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v7, 31, v6
	v_lshlrev_b64 v[6:7], 3, v[6:7]
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, v4, v6
	v_add_co_ci_u32_e32 v4, vcc_lo, v5, v7, vcc_lo
	v_add_co_u32 v0, vcc_lo, s2, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	global_load_b64 v[3:4], v[3:4], off
	s_waitcnt vmcnt(0)
	global_store_b64 v[0:1], v[3:4], off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z31k_zbuffer_pack_array_of_array3dPPdS_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 272
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z31k_zbuffer_pack_array_of_array3dPPdS_, .Lfunc_end1-_Z31k_zbuffer_pack_array_of_array3dPPdS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 460
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 1
; 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
	.protected	c_n_side3               ; @c_n_side3
	.type	c_n_side3,@object
	.section	.bss,"aw",@nobits
	.globl	c_n_side3
	.p2align	2, 0x0
c_n_side3:
	.long	0                               ; 0x0
	.size	c_n_side3, 4

	.protected	c_n_side2               ; @c_n_side2
	.type	c_n_side2,@object
	.globl	c_n_side2
	.p2align	2, 0x0
c_n_side2:
	.long	0                               ; 0x0
	.size	c_n_side2, 4

	.protected	c_n_side                ; @c_n_side
	.type	c_n_side,@object
	.globl	c_n_side
	.p2align	2, 0x0
c_n_side:
	.long	0                               ; 0x0
	.size	c_n_side, 4

	.protected	c_n_side2n_buf          ; @c_n_side2n_buf
	.type	c_n_side2n_buf,@object
	.globl	c_n_side2n_buf
	.p2align	2, 0x0
c_n_side2n_buf:
	.long	0                               ; 0x0
	.size	c_n_side2n_buf, 4

	.protected	c_n_buf                 ; @c_n_buf
	.type	c_n_buf,@object
	.globl	c_n_buf
	.p2align	2, 0x0
c_n_buf:
	.long	0                               ; 0x0
	.size	c_n_buf, 4

	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.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 c_n_side3
	.addrsig_sym c_n_side2
	.addrsig_sym c_n_side
	.addrsig_sym c_n_side2n_buf
	.addrsig_sym c_n_buf
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z22k_zbuffer_pack_array4dPdS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z22k_zbuffer_pack_array4dPdS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .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
      - .offset:         16
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         20
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         24
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         28
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         30
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         32
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         34
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         36
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         38
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         56
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         64
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         80
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 272
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z31k_zbuffer_pack_array_of_array3dPPdS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z31k_zbuffer_pack_array_of_array3dPPdS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
