#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<random>

#define cudaCheck(x) _cudaCheck(x, #x ,__FILE__, __LINE__)

template<typename T>
void _cudaCheck(T e, const char* func, const char* call, const int line){
  if(e != cudaSuccess){
    printf("\"%s\" at %d in %s\n\treturned %d\n-> %s\n", func, line, call, (int)e, cudaGetErrorString(e));
    exit(EXIT_FAILURE);
  }
}

// Number of elements worked by one thread
long nelem;

// Each threads work on nelem-elements in a pair of sz-long vector
__global__ void add_krnl(float *x, float *y, long sz, long nelem) {
  // PARAMETER: 0 means adjacent, 1 means cyclical
  int pattern = 1;

  long i;
  long inc = (sz + nelem-1) / nelem;
  long start = blockIdx.x*1024 + threadIdx.x;
  
  if (pattern == 0) {
    start = start*nelem;
    long end = start+nelem;
    for(i = start; i < end && i < sz; i++) {
      x[i] += y[i];
    }
  } else {
    for (i = start; i < sz; i += inc) {
      x[i] += y[i];
    }
  }
}

long func_add(float *x, float *y, long sz) {
  long i;

  // CPU Calculation
  for (i = 0; i < sz; i++)
    x[i] += y[i];

  // GPU Calculation
  float *dx, *dy;
  cudaMalloc((float **) &dx, sz*sizeof(float));
  cudaMalloc((float **) &dy, sz*sizeof(float));
  cudaMemcpy(dx, x, sz*sizeof(float), cudaMemcpyHostToDevice);
  
  // Timing using cudaEvent
  cudaEvent_t start, stop;
  float et;
  cudaCheck(cudaEventCreate(&start));
  cudaCheck(cudaEventCreate(&stop));

  // Time event start
  cudaCheck(cudaEventRecord(start));
  
  {
    long n_threads = (sz + nelem-1) / nelem;
    long n_blocks = (n_threads + 1023) / 1024;

    add_krnl<<<n_blocks, 1024>>>(dx, dy, sz, nelem);
  }

  cudaCheck(cudaGetLastError());

  // Time event end
  cudaCheck(cudaEventRecord(stop));
  cudaCheck(cudaEventSynchronize(stop));
  cudaCheck(cudaEventElapsedTime(&et, start, stop));
  cudaCheck(cudaEventDestroy(start));
  cudaCheck(cudaEventDestroy(stop));

  printf("\t%0.3f", et);

  // Copy data back to d_x and free GPU memory
  float * d_x = (float *) malloc(sz * sizeof(float));
  cudaMemcpy(d_x, dx, sz*sizeof(float), cudaMemcpyDeviceToHost);
  cudaFree(dx);
  cudaFree(dy);

  // Compare CPU and GPU output to see if it is within error tolerance
  for (i = 0; i < sz; i++) {
    if (fabsf(d_x[i] - x[i]) > 1e-5) {
      free(d_x);
      return 0;
    }
  }
  free(d_x);
  return 1;
}


int main(int argc, char **argv) {
  float *a, *b;
  long j;
  long i;

  std::random_device rd;
  std::mt19937_64 mt(rd());
  std::uniform_real_distribution<float> u(0, 1);

  // Print title
  printf("sz");
  for (nelem = 1; nelem < 513; nelem *= 2)
    printf("\t%d", nelem);
  printf("\n");

  for (j = 10; j <= 1000000000; j *= 10) {
    a = (float *) malloc(sizeof(float) * j);
    b = (float *) malloc(sizeof(float) * j);

    // Initialize with random number generator
    for (i = 0; i < j; i++) {
      a[i] = u(mt);
      b[i] = u(mt);
    }

    printf("%d", j);

    for (nelem = 1; nelem < 513; nelem *= 2)
      if (!func_add(a, b, j))
        printf("failed to add\n");

    printf("\n");

    free(a);
    free(b);
  }

  return 0;
}

	.file	"tmpxft_003721d5_00000000-6_driver.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4113:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4113:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z31__device_stub__Z8add_krnlPfS_llPfS_ll
	.type	_Z31__device_stub__Z8add_krnlPfS_llPfS_ll, @function
_Z31__device_stub__Z8add_krnlPfS_llPfS_ll:
.LFB4135:
	.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
	movq	%rcx, (%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)
	movq	%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	.L2
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z8add_krnlPfS_ll(%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
.L2:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4135:
	.size	_Z31__device_stub__Z8add_krnlPfS_llPfS_ll, .-_Z31__device_stub__Z8add_krnlPfS_llPfS_ll
	.globl	_Z8add_krnlPfS_ll
	.type	_Z8add_krnlPfS_ll, @function
_Z8add_krnlPfS_ll:
.LFB4136:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z8add_krnlPfS_llPfS_ll
	.cfi_endproc
.LFE4136:
	.size	_Z8add_krnlPfS_ll, .-_Z8add_krnlPfS_ll
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z8add_krnlPfS_ll"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4138:
	.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	_Z8add_krnlPfS_ll(%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
.LFE4138:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._Z10_cudaCheckI9cudaErrorEvT_PKcS3_i.str1.1,"aMS",@progbits,1
.LC1:
	.string	"\"%s\" at %d in %s\n\treturned %d\n-> %s\n"
	.section	.text._Z10_cudaCheckI9cudaErrorEvT_PKcS3_i,"axG",@progbits,_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i,comdat
	.weak	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	.type	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i, @function
_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i:
.LFB4450:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	je	.L10
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rsi, %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%rdx, (%rsp)
	movl	%ecx, 12(%rsp)
	movl	%edi, 8(%rsp)
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	leaq	.LC1(%rip), %rsi
	pushq	%rdx
	.cfi_def_cfa_offset 40
	movq	%rbx, %rdx
	pushq	%rax
	.cfi_def_cfa_offset 48
	movl	24(%rsp), %r9d
	xorl	%eax, %eax
	movq	16(%rsp), %r8
	movl	28(%rsp), %ecx
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE4450:
	.size	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i, .-_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	.section	.rodata.str1.1
.LC2:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/kyledpierson/gpu-programming/master/gpu-add/driver.cu"
.LC3:
	.string	"cudaEventCreate(&start)"
.LC4:
	.string	"cudaEventCreate(&stop)"
.LC5:
	.string	"cudaEventRecord(start)"
.LC6:
	.string	"cudaGetLastError()"
.LC7:
	.string	"cudaEventRecord(stop)"
.LC8:
	.string	"cudaEventSynchronize(stop)"
.LC9:
	.string	"cudaEventElapsedTime(&et, start, stop)"
.LC10:
	.string	"cudaEventDestroy(start)"
.LC11:
	.string	"cudaEventDestroy(stop)"
.LC12:
	.string	"\t%0.3f"
	.text
	.globl	_Z8func_addPfS_l
	.type	_Z8func_addPfS_l, @function
_Z8func_addPfS_l:
.LFB4109:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$72, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
.L16:
	cmpq	%rbp, %rax
	jge	.L28
	movss	(%r12,%rax,4), %xmm0
	addss	(%rsi,%rax,4), %xmm0
	movss	%xmm0, (%r12,%rax,4)
	incq	%rax
	jmp	.L16
.L28:
	leaq	0(,%rbp,4), %r13
	movq	%rsp, %rdi
	leaq	.LC2(%rip), %rbx
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdi
	movq	%r13, %rdx
	movq	%r12, %rsi
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	leaq	16(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$57, %ecx
	movq	%rbx, %rdx
	leaq	.LC3(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	$58, %ecx
	movq	%rbx, %rdx
	leaq	.LC4(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$61, %ecx
	movq	%rbx, %rdx
	leaq	.LC5(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movl	$4194305, %esi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	nelem(%rip), %rcx
	salq	$10, %rsi
	movl	$1, 52(%rsp)
	movq	%rsi, 44(%rsp)
	leaq	-1(%rcx,%rbp), %rax
	cqto
	idivq	%rcx
	movl	$1024, %ecx
	addq	$1023, %rax
	cqto
	idivq	%rcx
	movq	%rsi, %rdx
	movl	$1, %ecx
	movl	%eax, 32(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 36(%rsp)
	movq	32(%rsp), %rdi
	movl	40(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L18
	movq	nelem(%rip), %rcx
	movq	8(%rsp), %rsi
	movq	%rbp, %rdx
	movq	(%rsp), %rdi
	call	_Z31__device_stub__Z8add_krnlPfS_llPfS_ll
.L18:
	call	cudaGetLastError@PLT
	movq	%rbx, %rdx
	movl	$70, %ecx
	leaq	.LC6(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	%rbx, %rdx
	movl	$73, %ecx
	leaq	.LC7(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movl	$74, %ecx
	movq	%rbx, %rdx
	leaq	.LC8(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	leaq	44(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	%rbx, %rdx
	movl	$75, %ecx
	leaq	.LC9(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	16(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	%rbx, %rdx
	movl	$76, %ecx
	leaq	.LC10(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	movq	24(%rsp), %rdi
	call	cudaEventDestroy@PLT
	movq	%rbx, %rdx
	movl	$77, %ecx
	leaq	.LC11(%rip), %rsi
	movl	%eax, %edi
	call	_Z10_cudaCheckI9cudaErrorEvT_PKcS3_i
	leaq	.LC12(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	44(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	malloc@PLT
	movq	(%rsp), %rsi
	movl	$2, %ecx
	movq	%r13, %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	call	cudaMemcpy@PLT
	movq	(%rsp), %rdi
	call	cudaFree@PLT
	movq	8(%rsp), %rdi
	call	cudaFree@PLT
	movsd	.LC14(%rip), %xmm2
	xorl	%eax, %eax
	movss	.LC13(%rip), %xmm1
.L19:
	cmpq	%rbp, %rax
	jge	.L29
	movss	(%rbx,%rax,4), %xmm0
	subss	(%r12,%rax,4), %xmm0
	andps	%xmm1, %xmm0
	cvtss2sd	%xmm0, %xmm0
	comisd	%xmm2, %xmm0
	jbe	.L26
	movq	%rbx, %rdi
	call	free@PLT
	xorl	%eax, %eax
	jmp	.L15
.L26:
	incq	%rax
	jmp	.L19
.L29:
	movq	%rbx, %rdi
	call	free@PLT
	movl	$1, %eax
.L15:
	movq	56(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	addq	$72, %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
.LFE4109:
	.size	_Z8func_addPfS_l, .-_Z8func_addPfS_l
	.section	.text._ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv,comdat
	.align 2
	.weak	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	.type	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv, @function
_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv:
.LFB4807:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	xorl	%edx, %edx
	movabsq	$-5403634167711393303, %rdi
.L32:
	movq	(%rax,%rdx,8), %rsi
	incq	%rdx
	movq	(%rax,%rdx,8), %rcx
	andq	$-2147483648, %rsi
	andl	$2147483647, %ecx
	orq	%rsi, %rcx
	movq	%rcx, %rsi
	shrq	%rsi
	xorq	1240(%rax,%rdx,8), %rsi
	andl	$1, %ecx
	je	.L31
	movq	%rdi, %rcx
.L31:
	xorq	%rsi, %rcx
	movq	%rcx, -8(%rax,%rdx,8)
	cmpq	$156, %rdx
	jne	.L32
	movabsq	$-5403634167711393303, %rdi
.L34:
	movq	(%rax,%rdx,8), %rsi
	incq	%rdx
	movq	(%rax,%rdx,8), %rcx
	andq	$-2147483648, %rsi
	andl	$2147483647, %ecx
	orq	%rsi, %rcx
	movq	%rcx, %rsi
	shrq	%rsi
	xorq	-1256(%rax,%rdx,8), %rsi
	andl	$1, %ecx
	je	.L33
	movq	%rdi, %rcx
.L33:
	xorq	%rsi, %rcx
	movq	%rcx, -8(%rax,%rdx,8)
	cmpq	$311, %rdx
	jne	.L34
	movq	2488(%rax), %rdx
	movq	(%rax), %rcx
	andq	$-2147483648, %rdx
	andl	$2147483647, %ecx
	orq	%rcx, %rdx
	movq	%rdx, %rcx
	shrq	%rcx
	xorq	1240(%rax), %rcx
	andl	$1, %edx
	je	.L35
	movabsq	$-5403634167711393303, %rdx
.L35:
	xorq	%rcx, %rdx
	movq	%rdx, 2488(%rax)
	xorl	%edx, %edx
	movq	%rdx, 2496(%rax)
	ret
	.cfi_endproc
.LFE4807:
	.size	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv, .-_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	.section	.text._ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_,"axG",@progbits,_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_,comdat
	.weak	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	.type	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_, @function
_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_:
.LFB4773:
	.cfi_startproc
	endbr64
	cmpq	$311, 2496(%rdi)
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	jbe	.L48
	call	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
.L48:
	movq	2496(%rbx), %rax
	movaps	.LC19(%rip), %xmm2
	movq	(%rbx,%rax,8), %xmm0
	leaq	1(%rax), %rdx
	movq	%rdx, 2496(%rbx)
	movaps	%xmm0, %xmm3
	psrlq	$29, %xmm3
	movaps	%xmm3, %xmm1
	andps	%xmm2, %xmm1
	movaps	.LC20(%rip), %xmm2
	xorps	%xmm1, %xmm0
	movaps	%xmm0, %xmm4
	psllq	$17, %xmm4
	movaps	%xmm4, %xmm1
	andps	%xmm2, %xmm1
	movaps	.LC21(%rip), %xmm2
	xorps	%xmm1, %xmm0
	movaps	%xmm0, %xmm5
	psllq	$37, %xmm5
	movaps	%xmm5, %xmm1
	andps	%xmm2, %xmm1
	xorps	%xmm1, %xmm0
	movq	%xmm0, %rdx
	psrlq	$43, %xmm0
	movq	%xmm0, %rax
	xorq	%rdx, %rax
	js	.L49
	cvtsi2ssq	%rax, %xmm0
	jmp	.L50
.L49:
	movq	%rax, %rdx
	andl	$1, %eax
	shrq	%rdx
	orq	%rax, %rdx
	cvtsi2ssq	%rdx, %xmm0
	addss	%xmm0, %xmm0
.L50:
	xorps	%xmm1, %xmm1
	addss	%xmm1, %xmm0
	mulss	.LC17(%rip), %xmm0
	comiss	.LC18(%rip), %xmm0
	jb	.L47
	movss	.LC15(%rip), %xmm0
.L47:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4773:
	.size	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_, .-_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	.section	.rodata.str1.1
.LC22:
	.string	"default"
.LC23:
	.string	"sz"
.LC24:
	.string	"\t%d"
.LC25:
	.string	"\n"
.LC26:
	.string	"%d"
.LC27:
	.string	"failed to add\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4110:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4110
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$3448, %rsp
	.cfi_def_cfa_offset 7600
	leaq	7+.LC22(%rip), %rdx
	leaq	-7(%rdx), %rsi
	movq	%fs:40, %rax
	movq	%rax, 7528(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rdi
	leaq	24(%rsp), %rbx
	movq	%rdi, 24(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	24(%rsp), %rax
	movq	%rbx, %rsi
	movq	$7, 32(%rsp)
	movb	$0, 7(%rax)
	leaq	2528(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@PLT
.LEHE0:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	8(%rsp), %rdi
.LEHB1:
	call	_ZNSt13random_device9_M_getvalEv@PLT
	movl	%eax, %eax
	movl	$1, %edx
	movabsq	$6364136223846793005, %rcx
	movq	%rax, 24(%rsp)
	jmp	.L58
.L74:
	endbr64
	movq	%rax, %rbp
.L56:
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	movq	7528(%rsp), %rax
	subq	%fs:40, %rax
	je	.L82
	jmp	.L79
.L58:
	movq	-8(%rbx,%rdx,8), %rax
	movq	%rax, %rsi
	shrq	$62, %rsi
	xorq	%rsi, %rax
	imulq	%rcx, %rax
	addq	%rdx, %rax
	movq	%rax, (%rbx,%rdx,8)
	incq	%rdx
	cmpq	$312, %rdx
	jne	.L58
	leaq	.LC23(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	movq	$312, 2520(%rsp)
	call	__printf_chk@PLT
	movl	$1, %edx
	leaq	.LC24(%rip), %rbp
.L59:
	movq	%rdx, nelem(%rip)
	cmpq	$512, %rdx
	jg	.L83
	movq	%rbp, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	nelem(%rip), %rdx
	addq	%rdx, %rdx
	jmp	.L59
.L83:
	leaq	.LC25(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$9, %r14d
	movl	$10, %ebp
.L67:
	leaq	0(,%rbp,4), %r12
	xorl	%r15d, %r15d
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%rax, %r12
.L61:
	cmpq	%rbp, %r15
	jge	.L84
	movq	%rbx, %rdi
	call	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	xorps	%xmm1, %xmm1
	movq	%rbx, %rdi
	addss	%xmm1, %xmm0
	movss	%xmm0, 0(%r13,%r15,4)
	call	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	xorps	%xmm2, %xmm2
	addss	%xmm2, %xmm0
	movss	%xmm0, (%r12,%r15,4)
	incq	%r15
	jmp	.L61
.L84:
	movq	%rbp, %rdx
	leaq	.LC26(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %eax
	leaq	.LC27(%rip), %r15
.L63:
	movq	%rax, nelem(%rip)
	cmpq	$512, %rax
	jg	.L85
	movq	%rbp, %rdx
	movq	%r12, %rsi
	movq	%r13, %rdi
	call	_Z8func_addPfS_l
	testq	%rax, %rax
	je	.L64
.L65:
	movq	nelem(%rip), %rax
	addq	%rax, %rax
	jmp	.L63
.L64:
	movq	%r15, %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L65
.L85:
	leaq	.LC25(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.LEHE1:
	movq	%r13, %rdi
	imulq	$10, %rbp, %rbp
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	decl	%r14d
	jne	.L67
	movq	8(%rsp), %rdi
	call	_ZNSt13random_device7_M_finiEv@PLT
	movq	7528(%rsp), %rax
	subq	%fs:40, %rax
	je	.L70
	jmp	.L79
.L73:
	endbr64
	movq	%rax, %rbx
.L68:
	movq	8(%rsp), %rdi
	call	_ZNSt13random_device7_M_finiEv@PLT
	movq	%rbx, %rdi
	movq	7528(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L79
.L82:
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L79:
	call	__stack_chk_fail@PLT
.L70:
	addq	$7544, %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
.LFE4110:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4110:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4110-.LLSDACSB4110
.LLSDACSB4110:
	.uleb128 .LEHB0-.LFB4110
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L74-.LFB4110
	.uleb128 0
	.uleb128 .LEHB1-.LFB4110
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L73-.LFB4110
	.uleb128 0
	.uleb128 .LEHB2-.LFB4110
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE4110:
	.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
	.globl	nelem
	.bss
	.align 8
	.type	nelem, @object
	.size	nelem, 8
nelem:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC13:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	-1998362383
	.long	1055193269
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC15:
	.long	1065353215
	.align 4
.LC17:
	.long	528482304
	.align 4
.LC18:
	.long	1065353216
	.section	.rodata.cst16
	.align 16
.LC19:
	.quad	6148914691236517205
	.quad	0
	.align 16
.LC20:
	.quad	8202884508482404352
	.quad	0
	.align 16
.LC21:
	.quad	-2270628950310912
	.quad	0
	.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<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<random>

#define cudaCheck(x) _cudaCheck(x, #x ,__FILE__, __LINE__)

template<typename T>
void _cudaCheck(T e, const char* func, const char* call, const int line){
  if(e != hipSuccess){
    printf("\"%s\" at %d in %s\n\treturned %d\n-> %s\n", func, line, call, (int)e, hipGetErrorString(e));
    exit(EXIT_FAILURE);
  }
}

// Number of elements worked by one thread
long nelem;

// Each threads work on nelem-elements in a pair of sz-long vector
__global__ void add_krnl(float *x, float *y, long sz, long nelem) {
  // PARAMETER: 0 means adjacent, 1 means cyclical
  int pattern = 1;

  long i;
  long inc = (sz + nelem-1) / nelem;
  long start = blockIdx.x*1024 + threadIdx.x;
  
  if (pattern == 0) {
    start = start*nelem;
    long end = start+nelem;
    for(i = start; i < end && i < sz; i++) {
      x[i] += y[i];
    }
  } else {
    for (i = start; i < sz; i += inc) {
      x[i] += y[i];
    }
  }
}

long func_add(float *x, float *y, long sz) {
  long i;

  // CPU Calculation
  for (i = 0; i < sz; i++)
    x[i] += y[i];

  // GPU Calculation
  float *dx, *dy;
  hipMalloc((float **) &dx, sz*sizeof(float));
  hipMalloc((float **) &dy, sz*sizeof(float));
  hipMemcpy(dx, x, sz*sizeof(float), hipMemcpyHostToDevice);
  
  // Timing using cudaEvent
  hipEvent_t start, stop;
  float et;
  cudaCheck(hipEventCreate(&start));
  cudaCheck(hipEventCreate(&stop));

  // Time event start
  cudaCheck(hipEventRecord(start));
  
  {
    long n_threads = (sz + nelem-1) / nelem;
    long n_blocks = (n_threads + 1023) / 1024;

    add_krnl<<<n_blocks, 1024>>>(dx, dy, sz, nelem);
  }

  cudaCheck(hipGetLastError());

  // Time event end
  cudaCheck(hipEventRecord(stop));
  cudaCheck(hipEventSynchronize(stop));
  cudaCheck(hipEventElapsedTime(&et, start, stop));
  cudaCheck(hipEventDestroy(start));
  cudaCheck(hipEventDestroy(stop));

  printf("\t%0.3f", et);

  // Copy data back to d_x and free GPU memory
  float * d_x = (float *) malloc(sz * sizeof(float));
  hipMemcpy(d_x, dx, sz*sizeof(float), hipMemcpyDeviceToHost);
  hipFree(dx);
  hipFree(dy);

  // Compare CPU and GPU output to see if it is within error tolerance
  for (i = 0; i < sz; i++) {
    if (fabsf(d_x[i] - x[i]) > 1e-5) {
      free(d_x);
      return 0;
    }
  }
  free(d_x);
  return 1;
}


int main(int argc, char **argv) {
  float *a, *b;
  long j;
  long i;

  std::random_device rd;
  std::mt19937_64 mt(rd());
  std::uniform_real_distribution<float> u(0, 1);

  // Print title
  printf("sz");
  for (nelem = 1; nelem < 513; nelem *= 2)
    printf("\t%d", nelem);
  printf("\n");

  for (j = 10; j <= 1000000000; j *= 10) {
    a = (float *) malloc(sizeof(float) * j);
    b = (float *) malloc(sizeof(float) * j);

    // Initialize with random number generator
    for (i = 0; i < j; i++) {
      a[i] = u(mt);
      b[i] = u(mt);
    }

    printf("%d", j);

    for (nelem = 1; nelem < 513; nelem *= 2)
      if (!func_add(a, b, j))
        printf("failed to add\n");

    printf("\n");

    free(a);
    free(b);
  }

  return 0;
}

	.text
	.file	"driver.hip"
	.globl	_Z23__device_stub__add_krnlPfS_ll # -- Begin function _Z23__device_stub__add_krnlPfS_ll
	.type	_Z23__device_stub__add_krnlPfS_ll,@function
_Z23__device_stub__add_krnlPfS_ll:      # @_Z23__device_stub__add_krnlPfS_ll
	.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	16(%rsp), %rdx
	movq	%rcx, (%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	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	$_Z8add_krnlPfS_ll, %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__add_krnlPfS_ll, .Lfunc_end0-_Z23__device_stub__add_krnlPfS_ll
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function _Z8func_addPfS_l
.LCPI1_0:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI1_1:
	.quad	0x3ee4f8b588e368f1              # double 1.0000000000000001E-5
	.text
	.globl	_Z8func_addPfS_l
	.type	_Z8func_addPfS_l,@function
_Z8func_addPfS_l:                       # @_Z8func_addPfS_l
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %rbx
	movq	%rdi, %r14
	testq	%rdx, %rdx
	jle	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%eax, %eax
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movss	(%rsi,%rax,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addss	(%r14,%rax,4), %xmm0
	movss	%xmm0, (%r14,%rax,4)
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB1_2
.LBB1_3:                                # %._crit_edge
	leaq	(,%rbx,4), %r15
	leaq	8(%rsp), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	leaq	24(%rsp), %rdi
	movq	%r15, %rsi
	callq	hipMalloc
	movq	(%r12), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	16(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventCreate
	movl	$.L.str, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$59, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	%rsp, %rdi
	callq	hipEventCreate
	movl	$.L.str.2, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$60, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	(%r12), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$.L.str.3, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$63, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	nelem(%rip), %rcx
	leaq	(%rbx,%rcx), %rax
	decq	%rax
	cqto
	idivq	%rcx
	leaq	1023(%rax), %rcx
	addq	$2046, %rax                     # imm = 0x7FE
	testq	%rcx, %rcx
	cmovnsq	%rcx, %rax
	shrq	$10, %rax
	movl	%eax, %edi
	btsq	$32, %rdi
	movabsq	$4294967296, %rdx               # imm = 0x100000000
	orq	$1024, %rdx                     # imm = 0x400
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_5
# %bb.4:
	movq	8(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	nelem(%rip), %rcx
	movq	%rbx, %rdx
	callq	_Z23__device_stub__add_krnlPfS_ll
.LBB1_5:
	callq	hipGetLastError
	movl	$.L.str.4, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$72, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	(%rsp), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movl	$.L.str.5, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$75, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	(%rsp), %rdi
	callq	hipEventSynchronize
	movl	$.L.str.6, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$76, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdx
	leaq	36(%rsp), %r12
	movq	%r12, %rdi
	callq	hipEventElapsedTime
	movl	$.L.str.7, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$77, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	16(%rsp), %rdi
	callq	hipEventDestroy
	movl	$.L.str.8, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$78, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	movq	(%rsp), %rdi
	callq	hipEventDestroy
	movl	$.L.str.9, %esi
	movl	$.L.str.1, %edx
	movl	%eax, %edi
	movl	$79, %ecx
	callq	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	cvtss2sd	(%r12), %xmm0
	movl	$.L.str.10, %edi
	movb	$1, %al
	callq	printf
	movq	%r15, %rdi
	callq	malloc
	movq	%rax, %r12
	movq	8(%rsp), %rsi
	movq	%rax, %rdi
	movq	%r15, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	testq	%rbx, %rbx
	jle	.LBB1_10
# %bb.6:                                # %.lr.ph37.preheader
	xorl	%eax, %eax
	movaps	.LCPI1_0(%rip), %xmm0           # xmm0 = [NaN,NaN,NaN,NaN]
	movsd	.LCPI1_1(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB1_8:                                # %.lr.ph37
                                        # =>This Inner Loop Header: Depth=1
	movss	(%r12,%rax,4), %xmm2            # xmm2 = mem[0],zero,zero,zero
	subss	(%r14,%rax,4), %xmm2
	andps	%xmm0, %xmm2
	cvtss2sd	%xmm2, %xmm2
	ucomisd	%xmm1, %xmm2
	ja	.LBB1_9
# %bb.7:                                #   in Loop: Header=BB1_8 Depth=1
	incq	%rax
	cmpq	%rax, %rbx
	jne	.LBB1_8
.LBB1_10:                               # %._crit_edge38
	movq	%r12, %rdi
	callq	free
	movl	$1, %eax
	jmp	.LBB1_11
.LBB1_9:
	movq	%r12, %rdi
	callq	free
	xorl	%eax, %eax
.LBB1_11:
	addq	$40, %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_end1:
	.size	_Z8func_addPfS_l, .Lfunc_end1-_Z8func_addPfS_l
	.cfi_endproc
                                        # -- End function
	.section	.text._Z10_cudaCheckI10hipError_tEvT_PKcS3_i,"axG",@progbits,_Z10_cudaCheckI10hipError_tEvT_PKcS3_i,comdat
	.weak	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i # -- Begin function _Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	.type	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i,@function
_Z10_cudaCheckI10hipError_tEvT_PKcS3_i: # @_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	.cfi_startproc
# %bb.0:
	testl	%edi, %edi
	jne	.LBB2_2
# %bb.1:
	retq
.LBB2_2:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%ecx, %ebp
	movq	%rdx, %rbx
	movq	%rsi, %r15
	movl	%edi, %r14d
	callq	hipGetErrorString
	movl	$.L.str.18, %edi
	movq	%r15, %rsi
	movl	%ebp, %edx
	movq	%rbx, %rcx
	movl	%r14d, %r8d
	movq	%rax, %r9
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z10_cudaCheckI10hipError_tEvT_PKcS3_i, .Lfunc_end2-_Z10_cudaCheckI10hipError_tEvT_PKcS3_i
	.cfi_endproc
                                        # -- End function
	.text
	.globl	main                            # -- Begin function 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	$7512, %rsp                     # imm = 0x1D58
	.cfi_def_cfa_offset 7568
	.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	2512(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt13random_deviceC2Ev
.Ltmp0:
	movq	%rbx, %rdi
	callq	_ZNSt13random_device9_M_getvalEv
.Ltmp1:
# %bb.1:                                # %_ZNSt13random_deviceclEv.exit
	movl	%eax, %esi
	movq	%rsi, 8(%rsp)
	movl	$1, %eax
	movabsq	$6364136223846793005, %rcx      # imm = 0x5851F42D4C957F2D
	movq	%rsi, %rdx
.LBB3_2:                                # =>This Inner Loop Header: Depth=1
	shrq	$62, %rdx
	xorq	%rsi, %rdx
	imulq	%rcx, %rdx
	addq	%rax, %rdx
	movq	%rdx, 8(%rsp,%rax,8)
	incq	%rax
	movq	%rdx, %rsi
	cmpq	$312, %rax                      # imm = 0x138
	jne	.LBB3_2
# %bb.3:
	movq	$312, 2504(%rsp)                # imm = 0x138
	movl	$.L.str.11, %edi
	xorl	%eax, %eax
	callq	printf
	movq	$1, nelem(%rip)
	movl	$1, %esi
.LBB3_4:                                # =>This Inner Loop Header: Depth=1
	movl	$.L.str.12, %edi
	xorl	%eax, %eax
	callq	printf
	movq	nelem(%rip), %rax
	leaq	(%rax,%rax), %rsi
	movq	%rsi, nelem(%rip)
	cmpq	$257, %rax                      # imm = 0x101
	jl	.LBB3_4
# %bb.5:
	movl	$10, %edi
	callq	putchar@PLT
	movl	$10, %ebx
	leaq	8(%rsp), %r14
.LBB3_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_7 Depth 2
                                        #     Child Loop BB3_11 Depth 2
	leaq	(,%rbx,4), %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r15
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, %r12
	cmpq	$1, %rbx
	movq	%rbx, %r13
	adcq	$0, %r13
	xorl	%ebp, %ebp
.LBB3_7:                                #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp3:
	movq	%r14, %rdi
	callq	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
.Ltmp4:
	xorps	%xmm1, %xmm1
# %bb.8:                                #   in Loop: Header=BB3_7 Depth=2
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r15,%rbp,4)
.Ltmp5:
	movq	%r14, %rdi
	callq	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	xorps	%xmm1, %xmm1
.Ltmp6:
# %bb.9:                                #   in Loop: Header=BB3_7 Depth=2
	addss	%xmm1, %xmm0
	movss	%xmm0, (%r12,%rbp,4)
	incq	%rbp
	cmpq	%rbp, %r13
	jne	.LBB3_7
# %bb.10:                               #   in Loop: Header=BB3_6 Depth=1
	movl	$.L.str.14, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	$1, nelem(%rip)
.LBB3_11:                               #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp8:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%rbx, %rdx
	callq	_Z8func_addPfS_l
.Ltmp9:
# %bb.12:                               #   in Loop: Header=BB3_11 Depth=2
	testq	%rax, %rax
	jne	.LBB3_14
# %bb.13:                               #   in Loop: Header=BB3_11 Depth=2
	movl	$.Lstr, %edi
	callq	puts@PLT
.LBB3_14:                               #   in Loop: Header=BB3_11 Depth=2
	movq	nelem(%rip), %rax
	leaq	(%rax,%rax), %rcx
	movq	%rcx, nelem(%rip)
	cmpq	$257, %rax                      # imm = 0x101
	jl	.LBB3_11
# %bb.15:                               #   in Loop: Header=BB3_6 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	movq	%r15, %rdi
	callq	free
	movq	%r12, %rdi
	callq	free
	leaq	(%rbx,%rbx), %rax
	leaq	(%rax,%rax,4), %rax
	cmpq	$100000001, %rbx                # imm = 0x5F5E101
	movq	%rax, %rbx
	jb	.LBB3_6
# %bb.16:
.Ltmp14:
	leaq	2512(%rsp), %rdi
	callq	_ZNSt13random_device7_M_finiEv
.Ltmp15:
# %bb.17:                               # %_ZNSt13random_deviceD2Ev.exit
	xorl	%eax, %eax
	addq	$7512, %rsp                     # imm = 0x1D58
	.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
.LBB3_18:
	.cfi_def_cfa_offset 7568
.Ltmp16:
	jmp	.LBB3_19
.LBB3_20:
.Ltmp2:
	jmp	.LBB3_23
.LBB3_21:                               # %.loopexit
.Ltmp10:
	jmp	.LBB3_23
.LBB3_22:                               # %.loopexit.split-lp
.Ltmp7:
.LBB3_23:
	movq	%rax, %rbx
.Ltmp11:
	leaq	2512(%rsp), %rdi
	callq	_ZNSt13random_device7_M_finiEv
.Ltmp12:
# %bb.24:                               # %_ZNSt13random_deviceD2Ev.exit27
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.LBB3_25:
.Ltmp13:
.LBB3_19:
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.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 .Ltmp6-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp6
	.uleb128 .Ltmp7-.Lfunc_begin0           #     jumps to .Ltmp7
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp8-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp9-.Ltmp8                  #   Call between .Ltmp8 and .Ltmp9
	.uleb128 .Ltmp10-.Lfunc_begin0          #     jumps to .Ltmp10
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp15-.Ltmp14                #   Call between .Ltmp14 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp12-.Ltmp11                #   Call between .Ltmp11 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp12-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Lfunc_end3-.Ltmp12            #   Call between .Ltmp12 and .Lfunc_end3
	.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._ZNSt13random_deviceC2Ev,"axG",@progbits,_ZNSt13random_deviceC2Ev,comdat
	.weak	_ZNSt13random_deviceC2Ev        # -- Begin function _ZNSt13random_deviceC2Ev
	.p2align	1, 0x90
	.type	_ZNSt13random_deviceC2Ev,@function
_ZNSt13random_deviceC2Ev:               # @_ZNSt13random_deviceC2Ev
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdi, %rbx
	leaq	16(%rsp), %r15
	movq	%r15, -16(%r15)
	movq	%rsp, %r14
	movl	$.L.str.16, %esi
	movl	$.L.str.16+7, %edx
	movq	%r14, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
.Ltmp17:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNSt13random_device7_M_initERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
.Ltmp18:
# %bb.1:
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB4_3
# %bb.2:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB4_3:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	addq	$32, %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
.LBB4_4:
	.cfi_def_cfa_offset 64
.Ltmp19:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	cmpq	%r15, %rdi
	je	.LBB4_6
# %bb.5:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i4
	callq	_ZdlPv
.LBB4_6:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit6
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	_ZNSt13random_deviceC2Ev, .Lfunc_end4-_ZNSt13random_deviceC2Ev
	.cfi_endproc
	.section	.gcc_except_table._ZNSt13random_deviceC2Ev,"aG",@progbits,_ZNSt13random_deviceC2Ev,comdat
	.p2align	2, 0x0
GCC_except_table4:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp17-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp17
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp18-.Ltmp17                #   Call between .Ltmp17 and .Ltmp18
	.uleb128 .Ltmp19-.Lfunc_begin1          #     jumps to .Ltmp19
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp18-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Lfunc_end4-.Ltmp18            #   Call between .Ltmp18 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- 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	.LBB5_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	.LBB5_3
.LBB5_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB5_3:
	testq	%r14, %r14
	je	.LBB5_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB5_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB5_7
.LBB5_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB5_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_end5:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end5-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.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_end6:
	.size	__clang_call_terminate, .Lfunc_end6-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
.LCPI7_0:
	.long	0x5f800000                      # float 1.84467441E+19
.LCPI7_1:
	.long	0x40000000                      # float 2
.LCPI7_2:
	.long	0x5f000000                      # float 9.22337203E+18
.LCPI7_3:
	.long	0x3f800000                      # float 1
	.section	.text._ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_,"axG",@progbits,_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_,comdat
	.weak	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	.type	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_,@function
_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_: # @_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movq	%rdi, %rbx
	flds	.LCPI7_0(%rip)
	fstpt	(%rsp)
	callq	logl
	fstpt	36(%rsp)                        # 10-byte Folded Spill
	flds	.LCPI7_1(%rip)
	fstpt	(%rsp)
	callq	logl
	fldt	36(%rsp)                        # 10-byte Folded Reload
	fdivp	%st, %st(1)
	flds	.LCPI7_2(%rip)
	xorl	%ecx, %ecx
	fxch	%st(1)
	fucomi	%st(1), %st
	fldz
	fcmovnb	%st(2), %st
	fstp	%st(2)
	fsubp	%st, %st(1)
	setae	%cl
	fnstcw	28(%rsp)
	movzwl	28(%rsp), %eax
	orl	$3072, %eax                     # imm = 0xC00
	movw	%ax, 30(%rsp)
	fldcw	30(%rsp)
	fistpll	48(%rsp)
	fldcw	28(%rsp)
	shlq	$63, %rcx
	xorq	48(%rsp), %rcx
	leaq	23(%rcx), %rax
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %r14
	cmpq	$1, %rax
	adcq	$0, %r14
	xorps	%xmm0, %xmm0
	movss	.LCPI7_3(%rip), %xmm2           # xmm2 = mem[0],zero,zero,zero
.LBB7_1:                                # %select.unfold
                                        # =>This Inner Loop Header: Depth=1
	movss	%xmm2, 32(%rsp)                 # 4-byte Spill
	movss	%xmm0, 36(%rsp)                 # 4-byte Spill
	movq	%rbx, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv
	testq	%rax, %rax
	js	.LBB7_2
# %bb.3:                                # %select.unfold
                                        #   in Loop: Header=BB7_1 Depth=1
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	jmp	.LBB7_4
.LBB7_2:                                #   in Loop: Header=BB7_1 Depth=1
	movq	%rax, %rcx
	shrq	%rcx
	andl	$1, %eax
	orq	%rcx, %rax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%rax, %xmm0
	addss	%xmm0, %xmm0
.LBB7_4:                                # %select.unfold
                                        #   in Loop: Header=BB7_1 Depth=1
	movss	32(%rsp), %xmm2                 # 4-byte Reload
                                        # xmm2 = mem[0],zero,zero,zero
	mulss	%xmm2, %xmm0
	movss	36(%rsp), %xmm1                 # 4-byte Reload
                                        # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
	movaps	%xmm1, %xmm0
	mulss	.LCPI7_0(%rip), %xmm2
	decq	%r14
	jne	.LBB7_1
# %bb.5:
	divss	%xmm2, %xmm0
	ucomiss	.LCPI7_3(%rip), %xmm0
	jae	.LBB7_7
# %bb.6:
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB7_7:
	.cfi_def_cfa_offset 80
	movss	.LCPI7_3(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	xorps	%xmm1, %xmm1
	addq	$56, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	nextafterf                      # TAILCALL
.Lfunc_end7:
	.size	_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_, .Lfunc_end7-_ZSt18generate_canonicalIfLm24ESt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEET_RT1_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv,comdat
	.weak	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv # -- Begin function _ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv
	.p2align	1, 0x90
	.type	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv,@function
_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv: # @_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset %rbx, -16
	movq	%rdi, %rbx
	movq	2496(%rdi), %rax
	cmpq	$312, %rax                      # imm = 0x138
	jb	.LBB8_2
# %bb.1:
	movq	%rbx, %rdi
	callq	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	movq	2496(%rbx), %rax
.LBB8_2:
	leaq	1(%rax), %rcx
	movq	%rcx, 2496(%rbx)
	movq	(%rbx,%rax,8), %rax
	movq	%rax, %rcx
	shrq	$29, %rcx
	movabsq	$22906492245, %rdx              # imm = 0x555555555
	andq	%rcx, %rdx
	xorq	%rax, %rdx
	movq	%rdx, %rax
	shlq	$17, %rax
	movabsq	$8202884508482404352, %rcx      # imm = 0x71D67FFFEDA60000
	andq	%rax, %rcx
	xorq	%rdx, %rcx
	movl	%ecx, %edx
	andl	$134201207, %edx                # imm = 0x7FFBF77
	shlq	$37, %rdx
	xorq	%rcx, %rdx
	movq	%rdx, %rax
	shrq	$43, %rax
	xorq	%rdx, %rax
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv, .Lfunc_end8-_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEclEv
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv,"axG",@progbits,_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv,comdat
	.weak	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv # -- Begin function _ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	.p2align	1, 0x90
	.type	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv,@function
_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv: # @_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	.cfi_startproc
# %bb.0:
	movabsq	$-5403634167711393303, %rax     # imm = 0xB5026F5AA96619E9
	movq	(%rdi), %rdx
	xorl	%ecx, %ecx
.LBB9_1:                                # =>This Inner Loop Header: Depth=1
	andq	$-2147483648, %rdx              # imm = 0x80000000
	movq	8(%rdi,%rcx,8), %rsi
	movl	%esi, %r8d
	andl	$2147483646, %r8d               # imm = 0x7FFFFFFE
	orq	%rdx, %r8
	shrq	%r8
	xorq	1248(%rdi,%rcx,8), %r8
	movq	%rsi, %rdx
                                        # kill: def $esi killed $esi killed $rsi def $rsi
	andl	$1, %esi
	negq	%rsi
	andq	%rax, %rsi
	xorq	%r8, %rsi
	movq	%rsi, (%rdi,%rcx,8)
	leaq	1(%rcx), %rsi
	movq	%rsi, %rcx
	cmpq	$156, %rsi
	jne	.LBB9_1
# %bb.2:                                # %.preheader.preheader
	movq	1248(%rdi), %rdx
	movl	$157, %ecx
.LBB9_3:                                # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	andq	$-2147483648, %rdx              # imm = 0x80000000
	movq	(%rdi,%rcx,8), %rsi
	movl	%esi, %r8d
	andl	$2147483646, %r8d               # imm = 0x7FFFFFFE
	orq	%rdx, %r8
	shrq	%r8
	xorq	-1256(%rdi,%rcx,8), %r8
	movq	%rsi, %rdx
                                        # kill: def $esi killed $esi killed $rsi def $rsi
	andl	$1, %esi
	negq	%rsi
	andq	%rax, %rsi
	xorq	%r8, %rsi
	movq	%rsi, -8(%rdi,%rcx,8)
	incq	%rcx
	cmpq	$312, %rcx                      # imm = 0x138
	jne	.LBB9_3
# %bb.4:
	movq	$-2147483648, %rcx              # imm = 0x80000000
	andq	2488(%rdi), %rcx
	movq	(%rdi), %rdx
	movl	%edx, %esi
	andl	$2147483646, %esi               # imm = 0x7FFFFFFE
	orq	%rcx, %rsi
	shrq	%rsi
	xorq	1240(%rdi), %rsi
	andl	$1, %edx
	negq	%rdx
	andq	%rax, %rdx
	xorq	%rsi, %rdx
	movq	%rdx, 2488(%rdi)
	movq	$0, 2496(%rdi)
	retq
.Lfunc_end9:
	.size	_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv, .Lfunc_end9-_ZNSt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EE11_M_gen_randEv
	.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	.LBB10_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB10_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z8add_krnlPfS_ll, %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_end10:
	.size	__hip_module_ctor, .Lfunc_end10-__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	.LBB11_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
.LBB11_2:
	retq
.Lfunc_end11:
	.size	__hip_module_dtor, .Lfunc_end11-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	nelem,@object                   # @nelem
	.bss
	.globl	nelem
	.p2align	3, 0x0
nelem:
	.quad	0                               # 0x0
	.size	nelem, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"hipEventCreate(&start)"
	.size	.L.str, 23

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/kyledpierson/gpu-programming/master/gpu-add/driver.hip"
	.size	.L.str.1, 117

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"hipEventCreate(&stop)"
	.size	.L.str.2, 22

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"hipEventRecord(start)"
	.size	.L.str.3, 22

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"hipGetLastError()"
	.size	.L.str.4, 18

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"hipEventRecord(stop)"
	.size	.L.str.5, 21

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipEventSynchronize(stop)"
	.size	.L.str.6, 26

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"hipEventElapsedTime(&et, start, stop)"
	.size	.L.str.7, 38

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"hipEventDestroy(start)"
	.size	.L.str.8, 23

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"hipEventDestroy(stop)"
	.size	.L.str.9, 22

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"\t%0.3f"
	.size	.L.str.10, 7

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"sz"
	.size	.L.str.11, 3

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"\t%d"
	.size	.L.str.12, 4

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

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	"default"
	.size	.L.str.16, 8

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	"\"%s\" at %d in %s\n\treturned %d\n-> %s\n"
	.size	.L.str.18, 37

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z8add_krnlPfS_ll"
	.size	.L__unnamed_1, 18

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"failed to add"
	.size	.Lstr, 14

	.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__add_krnlPfS_ll
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z8add_krnlPfS_ll
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z8add_krnlPfS_ll       ; -- Begin function _Z8add_krnlPfS_ll
	.globl	_Z8add_krnlPfS_ll
	.p2align	8
	.type	_Z8add_krnlPfS_ll,@function
_Z8add_krnlPfS_ll:                      ; @_Z8add_krnlPfS_ll
; %bb.0:
	s_load_b256 s[4:11], s[0:1], 0x0
	v_lshl_or_b32 v0, s15, 10, v0
	v_mov_b32_e32 v1, 0
	s_mov_b32 s0, exec_lo
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i64_e64 s[8:9], v[0:1]
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph.preheader
	s_add_u32 s0, s8, s10
	s_addc_u32 s1, s9, s11
	s_add_u32 s12, s0, -1
	s_addc_u32 s13, s1, -1
	s_ashr_i32 s0, s11, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	s_add_u32 s2, s10, s0
	s_mov_b32 s1, s0
	s_addc_u32 s3, s11, s0
	s_xor_b64 s[2:3], s[2:3], s[0:1]
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_cvt_f32_u32_e32 v2, s2
	v_cvt_f32_u32_e32 v3, s3
	s_sub_u32 s14, 0, s2
	s_subb_u32 s15, 0, s3
	v_fmamk_f32 v2, v3, 0x4f800000, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v2, v2
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v2, 0x5f7ffffc, v2
	v_mul_f32_e32 v3, 0x2f800000, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_trunc_f32_e32 v3, v3
	v_fmamk_f32 v2, v3, 0xcf800000, v2
	v_cvt_u32_f32_e32 v3, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_cvt_u32_f32_e32 v2, v2
	v_readfirstlane_b32 s10, v3
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_readfirstlane_b32 s11, v2
	s_mul_i32 s16, s14, s10
	s_delay_alu instid0(VALU_DEP_1)
	s_mul_hi_u32 s18, s14, s11
	s_mul_i32 s17, s15, s11
	s_add_i32 s16, s18, s16
	s_mul_i32 s19, s14, s11
	s_add_i32 s16, s16, s17
	s_mul_hi_u32 s18, s11, s19
	s_mul_hi_u32 s20, s10, s19
	s_mul_i32 s17, s10, s19
	s_mul_hi_u32 s19, s11, s16
	s_mul_i32 s11, s11, s16
	s_mul_hi_u32 s21, s10, s16
	s_add_u32 s11, s18, s11
	s_addc_u32 s18, 0, s19
	s_add_u32 s11, s11, s17
	s_mul_i32 s16, s10, s16
	s_addc_u32 s11, s18, s20
	s_addc_u32 s17, s21, 0
	s_add_u32 s11, s11, s16
	s_addc_u32 s16, 0, s17
	v_add_co_u32 v2, s11, v2, s11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s11, 0
	s_addc_u32 s10, s10, s16
	v_readfirstlane_b32 s11, v2
	s_mul_i32 s16, s14, s10
	s_delay_alu instid0(VALU_DEP_1)
	s_mul_hi_u32 s17, s14, s11
	s_mul_i32 s15, s15, s11
	s_add_i32 s16, s17, s16
	s_mul_i32 s14, s14, s11
	s_add_i32 s16, s16, s15
	s_mul_hi_u32 s17, s10, s14
	s_mul_i32 s18, s10, s14
	s_mul_hi_u32 s14, s11, s14
	s_mul_hi_u32 s19, s11, s16
	s_mul_i32 s11, s11, s16
	s_mul_hi_u32 s15, s10, s16
	s_add_u32 s11, s14, s11
	s_addc_u32 s14, 0, s19
	s_add_u32 s11, s11, s18
	s_mul_i32 s16, s10, s16
	s_addc_u32 s11, s14, s17
	s_addc_u32 s14, s15, 0
	s_add_u32 s11, s11, s16
	s_addc_u32 s14, 0, s14
	v_add_co_u32 v2, s11, v2, s11
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s11, 0
	s_addc_u32 s14, s10, s14
	s_ashr_i32 s10, s13, 31
	v_readfirstlane_b32 s15, v2
	s_add_u32 s12, s12, s10
	s_mov_b32 s11, s10
	s_addc_u32 s13, s13, s10
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_xor_b64 s[12:13], s[12:13], s[10:11]
	s_mul_i32 s17, s12, s14
	s_mul_hi_u32 s18, s12, s15
	s_mul_hi_u32 s16, s12, s14
	s_mul_hi_u32 s20, s13, s15
	s_mul_i32 s15, s13, s15
	s_add_u32 s17, s18, s17
	s_addc_u32 s16, 0, s16
	s_mul_hi_u32 s19, s13, s14
	s_add_u32 s15, s17, s15
	s_mul_i32 s14, s13, s14
	s_addc_u32 s15, s16, s20
	s_addc_u32 s16, s19, 0
	s_add_u32 s14, s15, s14
	s_addc_u32 s15, 0, s16
	s_mul_i32 s19, s2, s14
	s_mul_hi_u32 s16, s2, s14
	s_mul_i32 s18, s2, s15
	v_sub_co_u32 v2, s12, s12, s19
	s_mul_i32 s17, s3, s14
	s_add_i32 s16, s16, s18
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_add_i32 s16, s16, s17
	v_sub_co_u32 v3, s18, v2, s2
	s_sub_i32 s17, s13, s16
	s_cmp_lg_u32 s12, 0
	s_subb_u32 s17, s17, s3
	s_cmp_lg_u32 s18, 0
	v_readfirstlane_b32 s18, v3
	s_subb_u32 s17, s17, 0
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_cmp_ge_u32 s17, s3
	s_cselect_b32 s19, -1, 0
	s_cmp_ge_u32 s18, s2
	s_cselect_b32 s18, -1, 0
	s_cmp_eq_u32 s17, s3
	s_cselect_b32 s17, s18, s19
	s_add_u32 s18, s14, 1
	s_addc_u32 s19, s15, 0
	s_add_u32 s20, s14, 2
	s_addc_u32 s21, s15, 0
	s_cmp_lg_u32 s17, 0
	s_cselect_b32 s17, s20, s18
	s_cselect_b32 s18, s21, s19
	s_cmp_lg_u32 s12, 0
	v_readfirstlane_b32 s12, v2
	s_subb_u32 s13, s13, s16
	v_lshlrev_b64 v[2:3], 2, v[0:1]
	s_cmp_ge_u32 s13, s3
	s_cselect_b32 s16, -1, 0
	s_cmp_ge_u32 s12, s2
	s_cselect_b32 s2, -1, 0
	s_cmp_eq_u32 s13, s3
	s_cselect_b32 s2, s2, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(SALU_CYCLE_1)
	s_cmp_lg_u32 s2, 0
	s_cselect_b32 s3, s18, s15
	s_cselect_b32 s2, s17, s14
	s_xor_b64 s[0:1], s[10:11], s[0:1]
	s_xor_b64 s[2:3], s[2:3], s[0:1]
	s_delay_alu instid0(SALU_CYCLE_1)
	s_sub_u32 s2, s2, s0
	s_subb_u32 s3, s3, s1
	s_mov_b32 s1, 0
	s_lshl_b64 s[10:11], s[2:3], 2
.LBB0_2:                                ; %.lr.ph
                                        ; =>This Inner Loop Header: Depth=1
	v_add_co_u32 v4, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v3, vcc_lo
	v_add_co_u32 v6, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v7, vcc_lo, s5, v3, vcc_lo
	v_add_co_u32 v0, vcc_lo, v0, s2
	global_load_b32 v4, v[4:5], off
	global_load_b32 v5, v[6:7], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s3, v1, vcc_lo
	v_add_co_u32 v2, s0, v2, s10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v3, s0, s11, v3, s0
	v_cmp_le_i64_e32 vcc_lo, s[8:9], v[0:1]
	s_or_b32 s1, vcc_lo, s1
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v4, v4, v5
	global_store_b32 v[6:7], v4, off
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %._crit_edge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z8add_krnlPfS_ll
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 32
		.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 22
		.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	_Z8add_krnlPfS_ll, .Lfunc_end0-_Z8add_krnlPfS_ll
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 804
; NumSgprs: 24
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 24
; NumVGPRsForWavesPerEU: 8
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           8
        .value_kind:     by_value
      - .offset:         24
        .size:           8
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 32
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z8add_krnlPfS_ll
    .private_segment_fixed_size: 0
    .sgpr_count:     24
    .sgpr_spill_count: 0
    .symbol:         _Z8add_krnlPfS_ll.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
