/*
This is the function you need to implement. Quick reference:
- input rows: 0 <= y < ny
- input columns: 0 <= x < nx
- element at row y and column x is stored in data[x + y*nx]
- correlation between rows i and row j has to be stored in result[i + j*ny]
- only parts with 0 <= j <= i < ny need to be filled
*/
#include <cuda_runtime.h>
#include "device_launch_parameters.h"
#include <iostream>
#include <math.h>
#include <vector>



static inline void check(cudaError_t err, const char* context) {
  if (err != cudaSuccess) {
      std::cerr << "CUDA error: " << context << ": "
          << cudaGetErrorString(err) << std::endl;
      std::exit(EXIT_FAILURE);
  }
}

#define CHECK(x) check(x, #x)

template <class T>
void cuda_memcpy(T* target, const T* source, std::size_t num, cudaMemcpyKind direction) {
  CHECK(cudaMemcpy(target, source, num * sizeof(T), direction));
}

  // params: 
  //         data : transposed padding data
  

__global__ void correlate_gpu(int ny, int nx, const float*data, float *result, int new_ny){
  const int nd=16;//         nd:    nd==blockDim.x==blockDim.y
                  //                compute nd*nd results each thread.

  int step=nd*nd;// each block will compute step*step results.
  int ia=threadIdx.x;
  int ja=threadIdx.y;
  int ic=blockIdx.x;
  int jc=blockIdx.y;

  // int i=threadIdx.x+blockIdx.x*blockDim.x;
  // int j=threadIdx.y+blockIdx.y*blockDim.y;

  // if(i>=ny || j>=ny) return;
  // if (i>j){
  //   result[i*ny+j]=0;
  //   return;
  // }

  float v[nd][nd];
  // double temp=0;
  for(int ib=0; ib<nd; ib++){
    for(int jb=0; jb<nd; jb++){
      v[ib][jb]=0;
    }
  }

  for (int k=0; k<nx; ++k){

    float x[nd];
    float y[nd];

    for(int ib=0; ib<nd; ib++){
      int i=ic*step+ib*nd+ia;
      x[ib]=data[k*new_ny +i];
    }

    for(int jb=0; jb<nd; jb++){
      int j=jc*step+jb*nd+ja;
      y[jb]=data[k*new_ny+j];
    }

    for(int ib=0; ib<nd; ib++){
      for(int jb=0; jb<nd; jb++){
        v[ib][jb]+=x[ib]*y[jb];
      }
    }
  }
  for(int ib=0; ib<nd; ib++){
    for(int jb=0; jb<nd; jb++){
      int i=ic*step+ib*nd+ia;
      int j=jc*step+jb*nd+ja;
      if(i<ny&&j<ny&&i<=j){
        result[ny*i+j]=v[ib][jb];
      }
    }
  }

  // result[i*ny+j]=temp;
}




__global__ void padding_transpose(int ny, int nx, const float*data, float* result, int new_ny){
  //result is padding and transpose data
  int ja=threadIdx.x;
  int i=blockIdx.y;

  for (int jb=0; jb<nx; jb+=blockDim.x){
    int j=jb+ja;
    if (j>=nx) break;
    float v=i<ny?data[i*ny+j]:0; //padding
    result[new_ny*j+i]=v; //transpose
  }
}






static inline int divup(int a, int b) {
  return (a + b - 1)/b;
}
static inline int roundup(int a, int b) {
  return divup(a, b) * b;
}
void correlate(int ny, int nx, const float *data, float *result) {


  // const int nd=16;//compute nd*nd results each thread. could not less than 
  const int block_size=16; //16*16 threads
  const int step=block_size*block_size; // each block will compute step*step results.

  int new_ny=roundup(ny,step);
  
  //allocate memory & copy data to GPU
  float *dGPU=NULL;
  CHECK(cudaMalloc((void**)&dGPU,ny*nx*sizeof(float)));

  float *padding=NULL;
  CHECK(cudaMalloc((void**)&padding,new_ny*nx*sizeof(float)));

  float *rGPU=NULL;
  CHECK(cudaMalloc((void**)&rGPU,ny*ny*sizeof(float)));


  // float *avg=new float[ny]{0};
  // float *normalized=new float[ny*nx]{0};
  // float *sqrtSqureSum=new float[ny]{0};



  std::vector<float> avg(ny,0);
  std::vector<float> normalized(ny*nx,0);
  std::vector<float> sqrtSqureSum(ny,0);
  std::vector<float> transposed(nx*new_ny,0);

  for (int y=0; y<ny; ++y){
    double temp=0;
    for (int x=0; x<nx; ++x){
      temp+=data[y*nx+x];
    }
    avg[y]=temp/nx;
  }
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      normalized[y*nx+x]=data[y*nx+x]-avg[y];
    }
  }
  // delete[] avg;
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      sqrtSqureSum[y]+=pow(normalized[y*nx+x],2);
    }
    sqrtSqureSum[y]=sqrt(sqrtSqureSum[y]);
  }
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      normalized[y*nx+x]/=sqrtSqureSum[y];
    }
  }

  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      std::cout << normalized[y*nx+x] << " ";
    }
    std::cout<< std::endl ;
  }

  cuda_memcpy(dGPU,normalized.data(),ny*nx,cudaMemcpyHostToDevice);

  // Run kernel to padding and transpose
  {
    dim3 dimBlock(64,1);
    dim3 dimGrid(1,new_ny);
    padding_transpose<<<dimGrid,dimBlock>>>(ny,nx,dGPU,padding,new_ny);
    CHECK(cudaGetLastError());
  }


  cuda_memcpy(transposed.data(), padding, new_ny * nx, cudaMemcpyDeviceToHost);
  std::cout << new_ny<<std::endl;
  std::cout << transposed.size()<<std::endl;
  for(int x=0;x<nx;x++){
    for(int y=0;y<new_ny;y++){
      std::cout<< transposed[x*new_ny+y] << " ";
    }
    std::cout<< std::endl<< "----"<< std::endl;
  }
  
  // for (int x=0;x<nx;++x){
  //   for (int y=0; y<ny; ++y){
  //     transposed[x*ny+y]=normalized[y*nx+x];
  //   }
  // }

  // Run kernel to calculate cp
  {
    dim3 dimBlock(block_size,block_size);
    dim3 dimGrid(new_ny/step,new_ny/step);
    correlate_gpu<<<dimGrid,dimBlock>>>(ny,nx,padding,rGPU,new_ny);
    CHECK(cudaGetLastError());
  }
  


  
  
  cuda_memcpy(result, rGPU, ny * ny, cudaMemcpyDeviceToHost);
  // CHECK(cudaMemcpy(result, rGPU, ny * ny * sizeof(float), cudaMemcpyDeviceToHost));
  CHECK(cudaFree(dGPU));
  CHECK(cudaFree(padding));
  CHECK(cudaFree(rGPU));
  // delete[] normalized;
}

int main(){

  int ny=3;
  int nx=2;
  // float data[]={+0.81472367, +0.90579194,
  // +0.45150527, +0.49610928}; //result: 1 1 0 1
  

  float data[]={
    -1.00000000, +1.00000000,
  +1.00000000, -1.00000000,
  -1.00000000, +1.00000000
  };

  // float data[]={-1.0, 1.0, 1.0, -1.0, -1.0,1.0, -1.0, -1.0, 1.0, 1.0,
  //               -1.0, 1.0, 1.0, -1.0, -1.0,1.0, -1.0, -1.0, 1.0, 1.0,};
  float result[9];
  correlate(ny, nx, data, result);
  std::cout<<"result"<<std::endl;


  for (int i=0;i<4;i++){

    std::cout<<result[i]<<" ";
  }

// int nc=20;
// std::vector<std::tuple<int,int,int>> rows((1+nc)*nc/2);

// // #pragma omp parallel for
//   for (int ia = 0; ia < nc; ++ia) {
//       for (int ja = ia; ja < nc; ++ja) {
//           int ija = _pdep_u32(ia, 0x55555555) | _pdep_u32(ja, 0xAAAAAAAA);
//           int p= ia*nc-(ia-1)*ia/2;
//           std::cout<<p+ja-ia<<std::endl;
//           rows[p+(ja-ia)]=std::make_tuple(ija, ia, ja) ;
//       }
//   }
//   std::sort(rows.begin(), rows.end());
//   int i=0;
//   std::cout<<"result"<<std::endl;
//   for(auto row:rows){
    
//     std::cout<< i << ","<<std::get<0>(row) << ":"
//               << std::get<1>(row) << ","
//               << std::get<2>(row) << std::endl;
//     i++;
//   }

  // double4_t test={0,1,2,3};
  // double4_t sw1=swap1(test);
  // double4_t sw2=swap2(test);
  // for (int i=0;i<4;i++){
  //     std::cout<<test[i]<<" ";
  //   }
  //   std::cout<<"result"<<std::endl;
  //   for (int i=0;i<4;i++){
  //     std::cout<<sw1[i]<<" ";
  //   }
  //   std::cout<<"result"<<std::endl;
  //   for (int i=0;i<4;i++){
  //     std::cout<<sw2[i]<<" ";
  //   }
  
  return 0;
}
	.file	"tmpxft_0023e57f_00000000-6_test.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4006:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4006:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"CUDA error: "
.LC1:
	.string	": "
	.text
	.type	_ZL5check9cudaErrorPKc, @function
_ZL5check9cudaErrorPKc:
.LFB3998:
	.cfi_startproc
	testl	%edi, %edi
	je	.L2
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %rbp
	leaq	.LC0(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movl	%edi, %ebx
	leaq	_ZSt4cerr(%rip), %rdi
	pushq	%rax
	.cfi_def_cfa_offset 32
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE3998:
	.size	_ZL5check9cudaErrorPKc, .-_ZL5check9cudaErrorPKc
	.globl	_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi
	.type	_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi, @function
_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi:
.LFB4028:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 24(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movq	%rcx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L8
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z13correlate_gpuiiPKfPfi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L8:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4028:
	.size	_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi, .-_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi
	.globl	_Z13correlate_gpuiiPKfPfi
	.type	_Z13correlate_gpuiiPKfPfi, @function
_Z13correlate_gpuiiPKfPfi:
.LFB4029:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi
	.cfi_endproc
.LFE4029:
	.size	_Z13correlate_gpuiiPKfPfi, .-_Z13correlate_gpuiiPKfPfi
	.globl	_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi
	.type	_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi, @function
_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi:
.LFB4030:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	48(%rsp), %rdi
	movl	%esi, 24(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 16(%rsp)
	leaq	32(%rsp), %rdx
	movq	%rcx, 8(%rsp)
	leaq	40(%rsp), %rcx
	movl	%r8d, 4(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 56(%rsp)
	movq	%rax, 96(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 48(%rsp)
	movq	%rax, 60(%rsp)
	movl	$1, 68(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17padding_transposeiiPKfPfi(%rip), %rdi
	pushq	40(%rsp)
	.cfi_def_cfa_offset 176
	movq	76(%rsp), %rcx
	movl	84(%rsp), %r8d
	movq	64(%rsp), %rsi
	movl	72(%rsp), %edx
	leaq	112(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L13:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4030:
	.size	_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi, .-_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi
	.globl	_Z17padding_transposeiiPKfPfi
	.type	_Z17padding_transposeiiPKfPfi, @function
_Z17padding_transposeiiPKfPfi:
.LFB4031:
	.cfi_startproc
	endbr64
	jmp	_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi
	.cfi_endproc
.LFE4031:
	.size	_Z17padding_transposeiiPKfPfi, .-_Z17padding_transposeiiPKfPfi
	.section	.rodata.str1.1
.LC2:
	.string	"_Z17padding_transposeiiPKfPfi"
.LC3:
	.string	"_Z13correlate_gpuiiPKfPfi"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4033:
	.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	.LC2(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z17padding_transposeiiPKfPfi(%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	.LC3(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z13correlate_gpuiiPKfPfi(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4033:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt6vectorIfSaIfEEC2EmRKfRKS0_.str1.1,"aMS",@progbits,1
.LC4:
	.string	"cannot create std::vector larger than max_size()"
	.section	.text._ZNSt6vectorIfSaIfEEC2EmRKfRKS0_,"axG",@progbits,_ZNSt6vectorIfSaIfEEC5EmRKfRKS0_,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.type	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_, @function
_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_:
.LFB4343:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rax
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	pushq	%rcx
	.cfi_def_cfa_offset 48
	cmpq	%rsi, %rax
	jnb	.L21
	leaq	.LC4(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L21:
	movq	%rdx, %r13
	xorl	%edx, %edx
	movq	%rdi, %rbx
	movq	%rsi, %rbp
	movq	%rdx, (%rdi)
	leaq	0(,%rsi,4), %r12
	xorl	%eax, %eax
	movq	%rdx, 8(%rdi)
	movq	%rdx, 16(%rdi)
	testq	%rsi, %rsi
	je	.L22
	movq	%r12, %rdi
	call	_Znwm@PLT
.L22:
	addq	%rax, %r12
	movq	%rax, (%rbx)
	movq	%r12, 16(%rbx)
	testq	%rbp, %rbp
	je	.L23
	movss	0(%r13), %xmm0
.L24:
	cmpq	%rax, %r12
	je	.L23
	movss	%xmm0, (%rax)
	addq	$4, %rax
	jmp	.L24
.L23:
	movq	%rax, 8(%rbx)
	popq	%rax
	.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
.LFE4343:
	.size	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_, .-_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.weak	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_
	.set	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_,_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.section	.text._ZNSt6vectorIfSaIfEED2Ev,"axG",@progbits,_ZNSt6vectorIfSaIfEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEED2Ev
	.type	_ZNSt6vectorIfSaIfEED2Ev, @function
_ZNSt6vectorIfSaIfEED2Ev:
.LFB4346:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L32
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L32:
	ret
	.cfi_endproc
.LFE4346:
	.size	_ZNSt6vectorIfSaIfEED2Ev, .-_ZNSt6vectorIfSaIfEED2Ev
	.weak	_ZNSt6vectorIfSaIfEED1Ev
	.set	_ZNSt6vectorIfSaIfEED1Ev,_ZNSt6vectorIfSaIfEED2Ev
	.section	.rodata._Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind.str1.1,"aMS",@progbits,1
.LC5:
	.string	"cudaMemcpy(target, source, num * sizeof(T), direction)"
	.section	.text._Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind,"axG",@progbits,_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind,comdat
	.weak	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind
	.type	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind, @function
_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind:
.LFB4352:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	leaq	.LC5(%rip), %rsi
	popq	%rdx
	.cfi_def_cfa_offset 8
	movl	%eax, %edi
	jmp	_ZL5check9cudaErrorPKc
	.cfi_endproc
.LFE4352:
	.size	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind, .-_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind
	.section	.rodata.str1.1
.LC7:
	.string	"cudaMalloc((void**)&dGPU,ny*nx*sizeof(float))"
.LC8:
	.string	"cudaMalloc((void**)&padding,new_ny*nx*sizeof(float))"
.LC9:
	.string	"cudaMalloc((void**)&rGPU,ny*ny*sizeof(float))"
.LC11:
	.string	" "
.LC12:
	.string	"cudaGetLastError()"
.LC13:
	.string	"----"
.LC14:
	.string	"cudaFree(dGPU)"
.LC15:
	.string	"cudaFree(padding)"
.LC16:
	.string	"cudaFree(rGPU)"
	.text
	.globl	_Z9correlateiiPKfPf
	.type	_Z9correlateiiPKfPf, @function
_Z9correlateiiPKfPf:
.LFB4002:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4002
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movslq	%edi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rdx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r14, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movq	%rcx, 40(%rsp)
	movl	$256, %ecx
	leaq	56(%rsp), %rdi
	leaq	152(%rsp), %r15
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	leal	255(%r14), %eax
	cltd
	idivl	%ecx
	movl	%eax, 28(%rsp)
	sall	$8, %eax
	movl	%eax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rax, 56(%rsp)
	movl	%r14d, %eax
	imull	%esi, %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	cudaMalloc@PLT
	leaq	.LC7(%rip), %rsi
	movl	%eax, %edi
	call	_ZL5check9cudaErrorPKc
	movl	24(%rsp), %eax
	xorl	%edx, %edx
	leaq	64(%rsp), %rdi
	movq	%rdx, 64(%rsp)
	imull	%ebx, %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	leaq	.LC8(%rip), %rsi
	movl	%eax, %edi
	call	_ZL5check9cudaErrorPKc
	movl	%r14d, %eax
	xorl	%ecx, %ecx
	leaq	72(%rsp), %rdi
	imull	%r14d, %eax
	movq	%rcx, 72(%rsp)
	cltq
	leaq	0(,%rax,4), %rsi
	movq	%rax, 32(%rsp)
	call	cudaMalloc@PLT
	leaq	.LC9(%rip), %rsi
	movl	%eax, %edi
	call	_ZL5check9cudaErrorPKc
	leaq	104(%rsp), %rdi
	movq	%r15, %rcx
	movq	%r14, %rsi
	leaq	176(%rsp), %rax
	movl	$0x00000000, 176(%rsp)
	movq	%rax, %rdx
	movq	%rax, (%rsp)
	call	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_
.LEHE0:
	movq	(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	%r15, %rcx
	leaq	128(%rsp), %rdi
	movl	$0x00000000, 176(%rsp)
.LEHB1:
	call	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_
.LEHE1:
	leaq	92(%rsp), %r12
	movq	(%rsp), %rdx
	movq	%r14, %rsi
	movq	%r15, %rdi
	movl	$0x00000000, 176(%rsp)
	movq	%r12, %rcx
.LEHB2:
	call	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_
.LEHE2:
	movq	16(%rsp), %rsi
	movq	(%rsp), %rdi
	leaq	80(%rsp), %rcx
	movq	%r12, %rdx
	movl	$0x00000000, 92(%rsp)
.LEHB3:
	call	_ZNSt6vectorIfSaIfEEC1EmRKfRKS0_
.LEHE3:
	movq	104(%rsp), %rsi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.L37:
	cmpl	%edx, %ebp
	jle	.L39
	movslq	%ecx, %rax
	xorps	%xmm0, %xmm0
	leaq	0(%r13,%rax,4), %rdi
	xorl	%eax, %eax
.L40:
	cmpl	%eax, %ebx
	jle	.L77
	cvtss2sd	(%rdi,%rax,4), %xmm1
	incq	%rax
	addsd	%xmm1, %xmm0
	jmp	.L40
.L77:
	cvtsi2sdl	%ebx, %xmm1
	addl	%ebx, %ecx
	divsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rsi,%rdx,4)
	incq	%rdx
	jmp	.L37
.L39:
	movq	128(%rsp), %r12
	xorl	%edi, %edi
	xorl	%edx, %edx
.L41:
	cmpl	%edx, %ebp
	jle	.L66
	movslq	%edi, %rax
	xorl	%ecx, %ecx
	salq	$2, %rax
.L44:
	cmpl	%ebx, %ecx
	jge	.L78
	movss	0(%r13,%rax), %xmm0
	subss	(%rsi,%rdx,4), %xmm0
	incl	%ecx
	movss	%xmm0, (%r12,%rax)
	addq	$4, %rax
	jmp	.L44
.L78:
	incq	%rdx
	addl	%ebx, %edi
	jmp	.L41
.L66:
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
.L43:
	movq	152(%rsp), %rdi
	cmpl	%r13d, %ebp
	jle	.L67
	movslq	%r14d, %rax
	leaq	(%rdi,%r13,4), %r15
	leaq	(%r12,%rax,4), %rdx
	xorl	%eax, %eax
.L47:
	movss	(%r15), %xmm0
	cmpl	%eax, %ebx
	jle	.L79
	cvtss2sd	(%rdx,%rax,4), %xmm1
	mulsd	%xmm1, %xmm1
	cvtss2sd	%xmm0, %xmm0
	incq	%rax
	addsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, (%r15)
	jmp	.L47
.L79:
	call	sqrtf@PLT
	incq	%r13
	addl	%ebx, %r14d
	movss	%xmm0, (%r15)
	jmp	.L43
.L67:
	xorl	%esi, %esi
	xorl	%edx, %edx
.L46:
	cmpl	%edx, %ebp
	jle	.L68
	movslq	%esi, %rax
	xorl	%ecx, %ecx
	leaq	(%r12,%rax,4), %rax
.L50:
	cmpl	%ebx, %ecx
	jge	.L80
	movss	(%rax), %xmm0
	incl	%ecx
	divss	(%rdi,%rdx,4), %xmm0
	addq	$4, %rax
	movss	%xmm0, -4(%rax)
	jmp	.L50
.L80:
	incq	%rdx
	addl	%ebx, %esi
	jmp	.L46
.L68:
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.L49:
	cmpl	%ebp, %r15d
	jge	.L52
	movslq	%r14d, %rax
	xorl	%r13d, %r13d
	leaq	(%r12,%rax,4), %rax
	movq	%rax, (%rsp)
.L53:
	cmpl	%r13d, %ebx
	jle	.L81
	movq	(%rsp), %rax
	leaq	_ZSt4cout(%rip), %rdi
	cvtss2sd	(%rax,%r13,4), %xmm0
.LEHB4:
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC11(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%r13
	jmp	.L53
.L81:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	incl	%r15d
	addl	%ebx, %r14d
	jmp	.L49
.L52:
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%r12, %rsi
	call	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind
	movl	24(%rsp), %eax
	movl	$67108865, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$6, %rdx
	movl	$1, %ecx
	movl	$1, 92(%rsp)
	movl	$1, %esi
	movl	%eax, 96(%rsp)
	movq	92(%rsp), %rdi
	movq	%rdx, 80(%rsp)
	movl	$1, 88(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L54
	movl	24(%rsp), %r8d
	movq	64(%rsp), %rcx
	movl	%ebx, %esi
	movl	%ebp, %edi
	movq	56(%rsp), %rdx
	call	_Z43__device_stub__Z17padding_transposeiiPKfPfiiiPKfPfi
.L54:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	leaq	.LC12(%rip), %rsi
	call	_ZL5check9cudaErrorPKc
	movq	16(%rsp), %rdx
	movq	64(%rsp), %rsi
	movl	$2, %ecx
	movq	176(%rsp), %r13
	movq	%r13, %rdi
	call	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind
	movl	24(%rsp), %esi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	184(%rsp), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	subq	%r13, %rsi
	sarq	$2, %rsi
	call	_ZNSo9_M_insertImEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
.L55:
	cmpl	%ebx, %r15d
	jge	.L57
	movslq	%r14d, %rax
	xorl	%r12d, %r12d
	leaq	0(%r13,%rax,4), %rax
	movq	%rax, (%rsp)
.L58:
	cmpl	%r12d, 24(%rsp)
	jle	.L82
	movq	(%rsp), %rax
	leaq	_ZSt4cout(%rip), %rdi
	cvtss2sd	(%rax,%r12,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC11(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	incq	%r12
	jmp	.L58
.L82:
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movq	%rax, %rdi
	leaq	.LC13(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
	movl	24(%rsp), %eax
	incl	%r15d
	addl	%eax, %r14d
	jmp	.L55
.L57:
	movl	28(%rsp), %eax
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movabsq	$68719476752, %rdx
	movl	$1, %esi
	movl	$1, 88(%rsp)
	movl	%eax, 92(%rsp)
	movl	%eax, 96(%rsp)
	movq	92(%rsp), %rdi
	movq	%rdx, 80(%rsp)
	movl	$1, 100(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L59
	movl	24(%rsp), %r8d
	movq	72(%rsp), %rcx
	movl	%ebx, %esi
	movl	%ebp, %edi
	movq	64(%rsp), %rdx
	call	_Z39__device_stub__Z13correlate_gpuiiPKfPfiiiPKfPfi
.L59:
	call	cudaGetLastError@PLT
	movl	%eax, %edi
	leaq	.LC12(%rip), %rsi
	call	_ZL5check9cudaErrorPKc
	movq	32(%rsp), %rdx
	movq	72(%rsp), %rsi
	movl	$2, %ecx
	movq	40(%rsp), %rdi
	call	_Z11cuda_memcpyIfEvPT_PKS0_m14cudaMemcpyKind
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	leaq	.LC14(%rip), %rsi
	call	_ZL5check9cudaErrorPKc
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	leaq	.LC15(%rip), %rsi
	call	_ZL5check9cudaErrorPKc
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movl	%eax, %edi
	leaq	.LC16(%rip), %rsi
	call	_ZL5check9cudaErrorPKc
.LEHE4:
	leaq	176(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	leaq	152(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	leaq	128(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	leaq	104(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	je	.L65
	jmp	.L75
.L73:
	endbr64
	movq	%rax, %rbx
.L60:
	leaq	176(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L61
.L72:
	endbr64
	movq	%rax, %rbx
.L61:
	leaq	152(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L62
.L71:
	endbr64
	movq	%rax, %rbx
.L62:
	leaq	128(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L63
.L70:
	endbr64
	movq	%rax, %rbx
.L63:
	leaq	104(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	movq	%rbx, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L75:
	call	__stack_chk_fail@PLT
.L65:
	addq	$216, %rsp
	.cfi_def_cfa_offset 56
	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
.LFE4002:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4002:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4002-.LLSDACSB4002
.LLSDACSB4002:
	.uleb128 .LEHB0-.LFB4002
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB4002
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L70-.LFB4002
	.uleb128 0
	.uleb128 .LEHB2-.LFB4002
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L71-.LFB4002
	.uleb128 0
	.uleb128 .LEHB3-.LFB4002
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L72-.LFB4002
	.uleb128 0
	.uleb128 .LEHB4-.LFB4002
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L73-.LFB4002
	.uleb128 0
	.uleb128 .LEHB5-.LFB4002
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE4002:
	.text
	.size	_Z9correlateiiPKfPf, .-_Z9correlateiiPKfPf
	.section	.rodata.str1.1
.LC17:
	.string	"result"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4003:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$2, %esi
	movabsq	$-4647714814380998656, %rcx
	movl	$3, %edi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC11(%rip), %r13
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	_ZSt4cout(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	xorl	%ebx, %ebx
	subq	$88, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	movabsq	$4575657224621260800, %rax
	leaq	36(%rsp), %r12
	leaq	12(%rsp), %rdx
	movq	%rcx, 20(%rsp)
	movq	%r12, %rcx
	movq	%rax, 12(%rsp)
	movq	%rax, 28(%rsp)
	call	_Z9correlateiiPKfPf
	leaq	.LC17(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E@PLT
.L84:
	movq	%rbp, %rdi
	cvtss2sd	(%r12,%rbx,4), %xmm0
	incq	%rbx
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%r13, %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	cmpq	$4, %rbx
	jne	.L84
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	je	.L85
	call	__stack_chk_fail@PLT
.L85:
	addq	$88, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.LFE4003:
	.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
	.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:

/*
This is the function you need to implement. Quick reference:
- input rows: 0 <= y < ny
- input columns: 0 <= x < nx
- element at row y and column x is stored in data[x + y*nx]
- correlation between rows i and row j has to be stored in result[i + j*ny]
- only parts with 0 <= j <= i < ny need to be filled
*/
#include <hip/hip_runtime.h>

#include <iostream>
#include <math.h>
#include <vector>



static inline void check(hipError_t err, const char* context) {
  if (err != hipSuccess) {
      std::cerr << "CUDA error: " << context << ": "
          << hipGetErrorString(err) << std::endl;
      std::exit(EXIT_FAILURE);
  }
}

#define CHECK(x) check(x, #x)

template <class T>
void cuda_memcpy(T* target, const T* source, std::size_t num, hipMemcpyKind direction) {
  CHECK(hipMemcpy(target, source, num * sizeof(T), direction));
}

  // params: 
  //         data : transposed padding data
  

__global__ void correlate_gpu(int ny, int nx, const float*data, float *result, int new_ny){
  const int nd=16;//         nd:    nd==blockDim.x==blockDim.y
                  //                compute nd*nd results each thread.

  int step=nd*nd;// each block will compute step*step results.
  int ia=threadIdx.x;
  int ja=threadIdx.y;
  int ic=blockIdx.x;
  int jc=blockIdx.y;

  // int i=threadIdx.x+blockIdx.x*blockDim.x;
  // int j=threadIdx.y+blockIdx.y*blockDim.y;

  // if(i>=ny || j>=ny) return;
  // if (i>j){
  //   result[i*ny+j]=0;
  //   return;
  // }

  float v[nd][nd];
  // double temp=0;
  for(int ib=0; ib<nd; ib++){
    for(int jb=0; jb<nd; jb++){
      v[ib][jb]=0;
    }
  }

  for (int k=0; k<nx; ++k){

    float x[nd];
    float y[nd];

    for(int ib=0; ib<nd; ib++){
      int i=ic*step+ib*nd+ia;
      x[ib]=data[k*new_ny +i];
    }

    for(int jb=0; jb<nd; jb++){
      int j=jc*step+jb*nd+ja;
      y[jb]=data[k*new_ny+j];
    }

    for(int ib=0; ib<nd; ib++){
      for(int jb=0; jb<nd; jb++){
        v[ib][jb]+=x[ib]*y[jb];
      }
    }
  }
  for(int ib=0; ib<nd; ib++){
    for(int jb=0; jb<nd; jb++){
      int i=ic*step+ib*nd+ia;
      int j=jc*step+jb*nd+ja;
      if(i<ny&&j<ny&&i<=j){
        result[ny*i+j]=v[ib][jb];
      }
    }
  }

  // result[i*ny+j]=temp;
}




__global__ void padding_transpose(int ny, int nx, const float*data, float* result, int new_ny){
  //result is padding and transpose data
  int ja=threadIdx.x;
  int i=blockIdx.y;

  for (int jb=0; jb<nx; jb+=blockDim.x){
    int j=jb+ja;
    if (j>=nx) break;
    float v=i<ny?data[i*ny+j]:0; //padding
    result[new_ny*j+i]=v; //transpose
  }
}






static inline int divup(int a, int b) {
  return (a + b - 1)/b;
}
static inline int roundup(int a, int b) {
  return divup(a, b) * b;
}
void correlate(int ny, int nx, const float *data, float *result) {


  // const int nd=16;//compute nd*nd results each thread. could not less than 
  const int block_size=16; //16*16 threads
  const int step=block_size*block_size; // each block will compute step*step results.

  int new_ny=roundup(ny,step);
  
  //allocate memory & copy data to GPU
  float *dGPU=NULL;
  CHECK(hipMalloc((void**)&dGPU,ny*nx*sizeof(float)));

  float *padding=NULL;
  CHECK(hipMalloc((void**)&padding,new_ny*nx*sizeof(float)));

  float *rGPU=NULL;
  CHECK(hipMalloc((void**)&rGPU,ny*ny*sizeof(float)));


  // float *avg=new float[ny]{0};
  // float *normalized=new float[ny*nx]{0};
  // float *sqrtSqureSum=new float[ny]{0};



  std::vector<float> avg(ny,0);
  std::vector<float> normalized(ny*nx,0);
  std::vector<float> sqrtSqureSum(ny,0);
  std::vector<float> transposed(nx*new_ny,0);

  for (int y=0; y<ny; ++y){
    double temp=0;
    for (int x=0; x<nx; ++x){
      temp+=data[y*nx+x];
    }
    avg[y]=temp/nx;
  }
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      normalized[y*nx+x]=data[y*nx+x]-avg[y];
    }
  }
  // delete[] avg;
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      sqrtSqureSum[y]+=pow(normalized[y*nx+x],2);
    }
    sqrtSqureSum[y]=sqrt(sqrtSqureSum[y]);
  }
  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      normalized[y*nx+x]/=sqrtSqureSum[y];
    }
  }

  for (int y=0; y<ny; ++y){
    for (int x=0; x<nx; ++x){
      std::cout << normalized[y*nx+x] << " ";
    }
    std::cout<< std::endl ;
  }

  cuda_memcpy(dGPU,normalized.data(),ny*nx,hipMemcpyHostToDevice);

  // Run kernel to padding and transpose
  {
    dim3 dimBlock(64,1);
    dim3 dimGrid(1,new_ny);
    padding_transpose<<<dimGrid,dimBlock>>>(ny,nx,dGPU,padding,new_ny);
    CHECK(hipGetLastError());
  }


  cuda_memcpy(transposed.data(), padding, new_ny * nx, hipMemcpyDeviceToHost);
  std::cout << new_ny<<std::endl;
  std::cout << transposed.size()<<std::endl;
  for(int x=0;x<nx;x++){
    for(int y=0;y<new_ny;y++){
      std::cout<< transposed[x*new_ny+y] << " ";
    }
    std::cout<< std::endl<< "----"<< std::endl;
  }
  
  // for (int x=0;x<nx;++x){
  //   for (int y=0; y<ny; ++y){
  //     transposed[x*ny+y]=normalized[y*nx+x];
  //   }
  // }

  // Run kernel to calculate cp
  {
    dim3 dimBlock(block_size,block_size);
    dim3 dimGrid(new_ny/step,new_ny/step);
    correlate_gpu<<<dimGrid,dimBlock>>>(ny,nx,padding,rGPU,new_ny);
    CHECK(hipGetLastError());
  }
  


  
  
  cuda_memcpy(result, rGPU, ny * ny, hipMemcpyDeviceToHost);
  // CHECK(cudaMemcpy(result, rGPU, ny * ny * sizeof(float), cudaMemcpyDeviceToHost));
  CHECK(hipFree(dGPU));
  CHECK(hipFree(padding));
  CHECK(hipFree(rGPU));
  // delete[] normalized;
}

int main(){

  int ny=3;
  int nx=2;
  // float data[]={+0.81472367, +0.90579194,
  // +0.45150527, +0.49610928}; //result: 1 1 0 1
  

  float data[]={
    -1.00000000, +1.00000000,
  +1.00000000, -1.00000000,
  -1.00000000, +1.00000000
  };

  // float data[]={-1.0, 1.0, 1.0, -1.0, -1.0,1.0, -1.0, -1.0, 1.0, 1.0,
  //               -1.0, 1.0, 1.0, -1.0, -1.0,1.0, -1.0, -1.0, 1.0, 1.0,};
  float result[9];
  correlate(ny, nx, data, result);
  std::cout<<"result"<<std::endl;


  for (int i=0;i<4;i++){

    std::cout<<result[i]<<" ";
  }

// int nc=20;
// std::vector<std::tuple<int,int,int>> rows((1+nc)*nc/2);

// // #pragma omp parallel for
//   for (int ia = 0; ia < nc; ++ia) {
//       for (int ja = ia; ja < nc; ++ja) {
//           int ija = _pdep_u32(ia, 0x55555555) | _pdep_u32(ja, 0xAAAAAAAA);
//           int p= ia*nc-(ia-1)*ia/2;
//           std::cout<<p+ja-ia<<std::endl;
//           rows[p+(ja-ia)]=std::make_tuple(ija, ia, ja) ;
//       }
//   }
//   std::sort(rows.begin(), rows.end());
//   int i=0;
//   std::cout<<"result"<<std::endl;
//   for(auto row:rows){
    
//     std::cout<< i << ","<<std::get<0>(row) << ":"
//               << std::get<1>(row) << ","
//               << std::get<2>(row) << std::endl;
//     i++;
//   }

  // double4_t test={0,1,2,3};
  // double4_t sw1=swap1(test);
  // double4_t sw2=swap2(test);
  // for (int i=0;i<4;i++){
  //     std::cout<<test[i]<<" ";
  //   }
  //   std::cout<<"result"<<std::endl;
  //   for (int i=0;i<4;i++){
  //     std::cout<<sw1[i]<<" ";
  //   }
  //   std::cout<<"result"<<std::endl;
  //   for (int i=0;i<4;i++){
  //     std::cout<<sw2[i]<<" ";
  //   }
  
  return 0;
}
	.text
	.file	"test.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z28__device_stub__correlate_gpuiiPKfPfi # -- Begin function _Z28__device_stub__correlate_gpuiiPKfPfi
	.type	_Z28__device_stub__correlate_gpuiiPKfPfi,@function
_Z28__device_stub__correlate_gpuiiPKfPfi: # @_Z28__device_stub__correlate_gpuiiPKfPfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	8(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z13correlate_gpuiiPKfPfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z28__device_stub__correlate_gpuiiPKfPfi, .Lfunc_end0-_Z28__device_stub__correlate_gpuiiPKfPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z32__device_stub__padding_transposeiiPKfPfi # -- Begin function _Z32__device_stub__padding_transposeiiPKfPfi
	.type	_Z32__device_stub__padding_transposeiiPKfPfi,@function
_Z32__device_stub__padding_transposeiiPKfPfi: # @_Z32__device_stub__padding_transposeiiPKfPfi
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$128, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	12(%rsp), %rax
	movl	%edi, (%rax)
	leaq	8(%rsp), %rdi
	movl	%esi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	4(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	24(%rsp), %r12
	leaq	16(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17padding_transposeiiPKfPfi, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z32__device_stub__padding_transposeiiPKfPfi, .Lfunc_end1-_Z32__device_stub__padding_transposeiiPKfPfi
	.cfi_endproc
                                        # -- End function
	.globl	_Z9correlateiiPKfPf             # -- Begin function _Z9correlateiiPKfPf
	.type	_Z9correlateiiPKfPf,@function
_Z9correlateiiPKfPf:                    # @_Z9correlateiiPKfPf
.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	$184, %rsp
	.cfi_def_cfa_offset 240
	.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	%rcx, %rbx
	movq	%rdx, %r15
	movl	%esi, %ebp
	movl	%edi, %r14d
	leal	255(%r14), %eax
	leal	510(%r14), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	leaq	40(%rsp), %rdi
	movq	$0, (%rdi)
	movl	%esi, %eax
	imull	%r14d, %eax
	cltq
	movq	%rax, 64(%rsp)                  # 8-byte Spill
	leaq	(,%rax,4), %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_1
# %bb.2:                                # %_ZL5check10hipError_tPKc.exit
	movl	%r13d, 48(%rsp)                 # 4-byte Spill
	movl	%r13d, %eax
	andl	$-256, %eax
	leaq	24(%rsp), %rdi
	movq	$0, (%rdi)
	movq	%rax, 8(%rsp)                   # 8-byte Spill
                                        # kill: def $eax killed $eax killed $rax
	movl	%ebp, (%rsp)                    # 4-byte Spill
	imull	%ebp, %eax
	cltq
	movq	%rax, 56(%rsp)                  # 8-byte Spill
	leaq	(,%rax,4), %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_3
# %bb.6:                                # %_ZL5check10hipError_tPKc.exit152
	movq	%rbx, 152(%rsp)                 # 8-byte Spill
	leaq	32(%rsp), %rdi
	movq	$0, (%rdi)
	movl	%r14d, %r12d
	imull	%r12d, %r12d
	leaq	(,%r12,4), %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_7
# %bb.8:                                # %_ZL5check10hipError_tPKc.exit154
	movslq	%r14d, %r13
	xorl	%ebp, %ebp
	leaq	96(%rsp), %rdx
	movl	%ebp, (%rdx)
	leaq	160(%rsp), %rdi
	leaq	120(%rsp), %rbx
	movq	%r13, %rsi
	movq	%rbx, %rcx
	callq	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	movl	%ebp, (%rbx)
.Ltmp0:
	leaq	96(%rsp), %rdi
	leaq	120(%rsp), %rdx
	leaq	72(%rsp), %rcx
	movq	64(%rsp), %rsi                  # 8-byte Reload
	callq	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
.Ltmp1:
# %bb.9:
	leaq	72(%rsp), %rdx
	movl	$0, (%rdx)
.Ltmp3:
	leaq	120(%rsp), %rdi
	leaq	52(%rsp), %rcx
	movq	%r13, %rsi
	callq	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
.Ltmp4:
# %bb.10:
	movq	%r12, 144(%rsp)                 # 8-byte Spill
	leaq	52(%rsp), %rdx
	movl	$0, (%rdx)
.Ltmp6:
	leaq	72(%rsp), %rdi
	leaq	7(%rsp), %rcx
	movq	56(%rsp), %rsi                  # 8-byte Reload
	callq	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
.Ltmp7:
	movl	(%rsp), %r13d                   # 4-byte Reload
# %bb.11:
	movl	%r13d, %ebp
	testl	%r14d, %r14d
	movq	%r14, 16(%rsp)                  # 8-byte Spill
	jle	.LBB2_46
# %bb.12:                               # %.preheader286.lr.ph
	cvtsi2sd	%r13d, %xmm0
	movq	160(%rsp), %rax
	movl	%r14d, %ebx
	xorl	%ecx, %ecx
	xorl	%edx, %edx
.LBB2_13:                               # %.preheader286
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_31 Depth 2
	testl	%r13d, %r13d
	jle	.LBB2_14
# %bb.30:                               # %.lr.ph
                                        #   in Loop: Header=BB2_13 Depth=1
	movl	%ecx, %esi
	leaq	(%r15,%rsi,4), %rsi
	xorpd	%xmm1, %xmm1
	xorl	%edi, %edi
.LBB2_31:                               #   Parent Loop BB2_13 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm2, %xmm2
	cvtss2sd	(%rsi,%rdi,4), %xmm2
	addsd	%xmm2, %xmm1
	incq	%rdi
	cmpq	%rdi, %rbp
	jne	.LBB2_31
	jmp	.LBB2_32
.LBB2_14:                               #   in Loop: Header=BB2_13 Depth=1
	xorpd	%xmm1, %xmm1
.LBB2_32:                               # %._crit_edge
                                        #   in Loop: Header=BB2_13 Depth=1
	divsd	%xmm0, %xmm1
	cvtsd2ss	%xmm1, %xmm1
	movss	%xmm1, (%rax,%rdx,4)
	incq	%rdx
	addl	%r13d, %ecx
	cmpq	%rbx, %rdx
	jne	.LBB2_13
# %bb.15:                               # %.preheader285
	testl	%r14d, %r14d
	jle	.LBB2_46
# %bb.16:                               # %.preheader284.lr.ph
	movq	160(%rsp), %rax
	movq	96(%rsp), %rcx
	xorl	%edx, %edx
	xorl	%esi, %esi
.LBB2_17:                               # %.preheader284
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_19 Depth 2
	testl	%r13d, %r13d
	jle	.LBB2_20
# %bb.18:                               # %.lr.ph291
                                        #   in Loop: Header=BB2_17 Depth=1
	movl	%edx, %r8d
	leaq	(%rcx,%r8,4), %rdi
	leaq	(%r15,%r8,4), %r8
	xorl	%r9d, %r9d
.LBB2_19:                               #   Parent Loop BB2_17 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r8,%r9,4), %xmm0              # xmm0 = mem[0],zero,zero,zero
	subss	(%rax,%rsi,4), %xmm0
	movss	%xmm0, (%rdi,%r9,4)
	incq	%r9
	cmpq	%r9, %rbp
	jne	.LBB2_19
.LBB2_20:                               # %._crit_edge292
                                        #   in Loop: Header=BB2_17 Depth=1
	incq	%rsi
	addl	%r13d, %edx
	cmpq	%rbx, %rsi
	jne	.LBB2_17
# %bb.21:                               # %.preheader283
	testl	%r14d, %r14d
	jle	.LBB2_46
# %bb.22:                               # %.preheader282.lr.ph
	xorl	%r14d, %r14d
	xorps	%xmm2, %xmm2
	xorl	%r15d, %r15d
.LBB2_23:                               # %.preheader282
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_62 Depth 2
	movq	120(%rsp), %rax
	testl	%r13d, %r13d
	jle	.LBB2_24
# %bb.61:                               # %.lr.ph295
                                        #   in Loop: Header=BB2_23 Depth=1
	movl	%r14d, %ecx
	shlq	$2, %rcx
	movss	(%rax,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	addq	96(%rsp), %rcx
	xorl	%edx, %edx
.LBB2_62:                               #   Parent Loop BB2_23 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm1, %xmm1
	cvtss2sd	(%rcx,%rdx,4), %xmm1
	mulsd	%xmm1, %xmm1
	cvtss2sd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rax,%r15,4)
	incq	%rdx
	cmpq	%rdx, %rbp
	jne	.LBB2_62
	jmp	.LBB2_25
.LBB2_24:                               # %.preheader282.._crit_edge296_crit_edge
                                        #   in Loop: Header=BB2_23 Depth=1
	movss	(%rax,%r15,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
.LBB2_25:                               # %._crit_edge296
                                        #   in Loop: Header=BB2_23 Depth=1
	ucomiss	%xmm2, %xmm0
	jb	.LBB2_59
# %bb.26:                               #   in Loop: Header=BB2_23 Depth=1
	sqrtss	%xmm0, %xmm0
	jmp	.LBB2_60
.LBB2_59:                               # %call.sqrt
                                        #   in Loop: Header=BB2_23 Depth=1
	callq	sqrtf
	xorps	%xmm2, %xmm2
.LBB2_60:                               # %._crit_edge296.split
                                        #   in Loop: Header=BB2_23 Depth=1
	movq	120(%rsp), %rax
	movss	%xmm0, (%rax,%r15,4)
	incq	%r15
	addl	%r13d, %r14d
	cmpq	%rbx, %r15
	jne	.LBB2_23
# %bb.33:                               # %.preheader281
	movq	16(%rsp), %r14                  # 8-byte Reload
	testl	%r14d, %r14d
	jle	.LBB2_46
# %bb.34:                               # %.preheader280.lr.ph
	movq	120(%rsp), %rax
	movq	96(%rsp), %rcx
	xorl	%edx, %edx
	xorl	%esi, %esi
.LBB2_35:                               # %.preheader280
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_37 Depth 2
	testl	%r13d, %r13d
	jle	.LBB2_38
# %bb.36:                               # %.lr.ph299
                                        #   in Loop: Header=BB2_35 Depth=1
	movl	%edx, %edi
	leaq	(%rcx,%rdi,4), %rdi
	xorl	%r8d, %r8d
.LBB2_37:                               #   Parent Loop BB2_35 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rdi,%r8,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	divss	(%rax,%rsi,4), %xmm0
	movss	%xmm0, (%rdi,%r8,4)
	incq	%r8
	cmpq	%r8, %rbp
	jne	.LBB2_37
.LBB2_38:                               # %._crit_edge300
                                        #   in Loop: Header=BB2_35 Depth=1
	incq	%rsi
	addl	%r13d, %edx
	cmpq	%rbx, %rsi
	jne	.LBB2_35
# %bb.39:                               # %.preheader279
	testl	%r14d, %r14d
	jle	.LBB2_46
# %bb.40:                               # %.preheader278.lr.ph
	xorl	%r15d, %r15d
	xorl	%r12d, %r12d
.LBB2_41:                               # %.preheader278
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_63 Depth 2
	movl	%r15d, %r15d
	movl	%r13d, %eax
	movq	%rbp, %r13
	movq	%r15, %r14
	testl	%eax, %eax
	jle	.LBB2_42
.LBB2_63:                               #   Parent Loop BB2_41 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	96(%rsp), %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rax,%r14,4), %xmm0
.Ltmp9:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp10:
# %bb.64:                               # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB2_63 Depth=2
.Ltmp11:
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp12:
# %bb.65:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB2_63 Depth=2
	incq	%r14
	decq	%r13
	jne	.LBB2_63
.LBB2_42:                               # %._crit_edge304
                                        #   in Loop: Header=BB2_41 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp14:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp15:
# %bb.43:                               # %.noexc223
                                        #   in Loop: Header=BB2_41 Depth=1
.Ltmp16:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp17:
# %bb.44:                               # %.noexc224
                                        #   in Loop: Header=BB2_41 Depth=1
.Ltmp18:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp19:
# %bb.45:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB2_41 Depth=1
	incq	%r12
	movl	(%rsp), %r13d                   # 4-byte Reload
	addl	%r13d, %r15d
	cmpq	%rbx, %r12
	movq	16(%rsp), %r14                  # 8-byte Reload
	jne	.LBB2_41
.LBB2_46:                               # %._crit_edge306
	movq	40(%rsp), %rdi
	movq	96(%rsp), %rsi
.Ltmp21:
	movq	64(%rsp), %rdx                  # 8-byte Reload
	movl	$1, %ecx
	callq	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
.Ltmp22:
# %bb.47:
	movq	8(%rsp), %rdi                   # 8-byte Reload
	shlq	$32, %rdi
	orq	$1, %rdi
.Ltmp23:
	movabsq	$4294967360, %rdx               # imm = 0x100000040
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp24:
# %bb.48:
	testl	%eax, %eax
	jne	.LBB2_50
# %bb.49:
	movq	40(%rsp), %rdx
	movq	24(%rsp), %rcx
.Ltmp25:
	movl	%r14d, %edi
	movl	%r13d, %esi
	movq	8(%rsp), %r8                    # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8
	callq	_Z32__device_stub__padding_transposeiiPKfPfi
.Ltmp26:
.LBB2_50:
.Ltmp27:
	callq	hipGetLastError
.Ltmp28:
# %bb.51:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB2_52
# %bb.69:                               # %_ZL5check10hipError_tPKc.exit161
	movq	72(%rsp), %rdi
	movq	24(%rsp), %rsi
.Ltmp42:
	movq	56(%rsp), %rdx                  # 8-byte Reload
	movl	$2, %ecx
	callq	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
.Ltmp43:
# %bb.70:
.Ltmp44:
	movl	$_ZSt4cout, %edi
	movq	8(%rsp), %rsi                   # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_ZNSolsEi
.Ltmp45:
# %bb.71:
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp46:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp47:
# %bb.72:                               # %.noexc232
.Ltmp48:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp49:
# %bb.73:                               # %.noexc233
.Ltmp50:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp51:
# %bb.74:                               # %_ZNSolsEPFRSoS_E.exit163
	movq	80(%rsp), %rsi
	subq	72(%rsp), %rsi
	sarq	$2, %rsi
.Ltmp52:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertImEERSoT_
.Ltmp53:
# %bb.75:                               # %_ZNSolsEm.exit
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp54:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp55:
# %bb.76:                               # %.noexc236
.Ltmp56:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp57:
# %bb.77:                               # %.noexc237
.Ltmp58:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp59:
# %bb.78:                               # %_ZNSolsEPFRSoS_E.exit166.preheader
	testl	%r13d, %r13d
	jle	.LBB2_89
# %bb.79:                               # %.preheader.lr.ph
	movq	8(%rsp), %rax                   # 8-byte Reload
	cmpl	$2, %eax
	movl	$1, %r15d
	cmovgel	%eax, %r15d
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
.LBB2_80:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_100 Depth 2
	movl	%r12d, %r12d
	movq	%r15, %rbx
	movq	%r12, %r13
	cmpl	$0, 16(%rsp)                    # 4-byte Folded Reload
	jle	.LBB2_81
.LBB2_100:                              #   Parent Loop BB2_80 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	72(%rsp), %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rax,%r13,4), %xmm0
.Ltmp60:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp61:
# %bb.101:                              # %_ZNSolsEf.exit170
                                        #   in Loop: Header=BB2_100 Depth=2
.Ltmp62:
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp63:
# %bb.102:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit172
                                        #   in Loop: Header=BB2_100 Depth=2
	incq	%r13
	decq	%rbx
	jne	.LBB2_100
.LBB2_81:                               # %._crit_edge309
                                        #   in Loop: Header=BB2_80 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp65:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp66:
# %bb.82:                               # %.noexc240
                                        #   in Loop: Header=BB2_80 Depth=1
.Ltmp67:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp68:
# %bb.83:                               # %.noexc241
                                        #   in Loop: Header=BB2_80 Depth=1
.Ltmp69:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp70:
# %bb.84:                               # %_ZNSolsEPFRSoS_E.exit168
                                        #   in Loop: Header=BB2_80 Depth=1
.Ltmp71:
	movq	%rax, %rbx
	movl	$.L.str.5, %esi
	movl	$4, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp72:
# %bb.85:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit174
                                        #   in Loop: Header=BB2_80 Depth=1
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp73:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp74:
# %bb.86:                               # %.noexc244
                                        #   in Loop: Header=BB2_80 Depth=1
.Ltmp75:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp76:
# %bb.87:                               # %.noexc245
                                        #   in Loop: Header=BB2_80 Depth=1
.Ltmp77:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp78:
# %bb.88:                               # %_ZNSolsEPFRSoS_E.exit176
                                        #   in Loop: Header=BB2_80 Depth=1
	incq	%r14
	addl	8(%rsp), %r12d                  # 4-byte Folded Reload
	cmpq	%rbp, %r14
	jne	.LBB2_80
.LBB2_89:                               # %_ZNSolsEPFRSoS_E.exit166._crit_edge
	movl	48(%rsp), %eax                  # 4-byte Reload
	sarl	$8, %eax
	movl	%eax, %eax
	movq	%rax, %rdi
	shlq	$32, %rdi
	orq	%rax, %rdi
.Ltmp80:
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp81:
# %bb.90:
	testl	%eax, %eax
	jne	.LBB2_92
# %bb.91:
	movq	24(%rsp), %rdx
	movq	32(%rsp), %rcx
.Ltmp82:
	movq	16(%rsp), %rdi                  # 8-byte Reload
                                        # kill: def $edi killed $edi killed $rdi
	movl	(%rsp), %esi                    # 4-byte Reload
	movq	8(%rsp), %r8                    # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8
	callq	_Z28__device_stub__correlate_gpuiiPKfPfi
.Ltmp83:
.LBB2_92:
.Ltmp84:
	callq	hipGetLastError
.Ltmp85:
# %bb.93:
	movl	%eax, %ebx
	testl	%eax, %eax
	movq	144(%rsp), %rdx                 # 8-byte Reload
	jne	.LBB2_94
# %bb.106:                              # %_ZL5check10hipError_tPKc.exit184
	movq	32(%rsp), %rsi
.Ltmp99:
	movq	152(%rsp), %rdi                 # 8-byte Reload
	movl	$2, %ecx
	callq	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
.Ltmp100:
# %bb.107:
	movq	40(%rsp), %rdi
.Ltmp101:
	callq	hipFree
.Ltmp102:
# %bb.108:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB2_109
# %bb.115:                              # %_ZL5check10hipError_tPKc.exit192
	movq	24(%rsp), %rdi
.Ltmp115:
	callq	hipFree
.Ltmp116:
# %bb.116:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB2_117
# %bb.123:                              # %_ZL5check10hipError_tPKc.exit200
	movq	32(%rsp), %rdi
.Ltmp129:
	callq	hipFree
.Ltmp130:
# %bb.124:
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.LBB2_125
# %bb.131:                              # %_ZL5check10hipError_tPKc.exit208
	movq	72(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_133
# %bb.132:
	callq	_ZdlPv
.LBB2_133:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit
	movq	120(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_135
# %bb.134:
	callq	_ZdlPv
.LBB2_135:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit210
	movq	96(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_137
# %bb.136:
	callq	_ZdlPv
.LBB2_137:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit212
	movq	160(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_139
# %bb.138:
	callq	_ZdlPv
.LBB2_139:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit214
	addq	$184, %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_1:
	.cfi_def_cfa_offset 240
	movl	%eax, %r12d
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.11, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rbx
	movl	%r12d, %edi
	jmp	.LBB2_5
.LBB2_3:
	movl	%eax, %r13d
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.1, %esi
	jmp	.LBB2_4
.LBB2_7:
	movl	%eax, %r13d
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.2, %esi
.LBB2_4:
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.11, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rbx
	movl	%r13d, %edi
.LBB2_5:
	callq	hipGetErrorString
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.LBB2_58:                               # %.noexc160
	movl	$1, %edi
	callq	exit
.LBB2_52:
.Ltmp29:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp30:
# %bb.53:                               # %.noexc
.Ltmp31:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.4, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp32:
# %bb.54:                               # %.noexc156
.Ltmp33:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp34:
# %bb.55:                               # %.noexc157
.Ltmp35:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp36:
# %bb.56:                               # %.noexc158
.Ltmp37:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp38:
# %bb.57:                               # %.noexc159
.Ltmp39:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp40:
	jmp	.LBB2_58
.LBB2_94:
.Ltmp86:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp87:
# %bb.95:                               # %.noexc178
.Ltmp88:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.4, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp89:
# %bb.96:                               # %.noexc179
.Ltmp90:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp91:
# %bb.97:                               # %.noexc180
.Ltmp92:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp93:
# %bb.98:                               # %.noexc181
.Ltmp94:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp95:
# %bb.99:                               # %.noexc182
.Ltmp96:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp97:
	jmp	.LBB2_58
.LBB2_109:
.Ltmp103:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp104:
# %bb.110:                              # %.noexc186
.Ltmp105:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.6, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp106:
# %bb.111:                              # %.noexc187
.Ltmp107:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp108:
# %bb.112:                              # %.noexc188
.Ltmp109:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp110:
# %bb.113:                              # %.noexc189
.Ltmp111:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp112:
# %bb.114:                              # %.noexc190
.Ltmp113:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp114:
	jmp	.LBB2_58
.LBB2_117:
.Ltmp117:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp118:
# %bb.118:                              # %.noexc194
.Ltmp119:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.7, %esi
	movl	$16, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp120:
# %bb.119:                              # %.noexc195
.Ltmp121:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp122:
# %bb.120:                              # %.noexc196
.Ltmp123:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp124:
# %bb.121:                              # %.noexc197
.Ltmp125:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp126:
# %bb.122:                              # %.noexc198
.Ltmp127:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp128:
	jmp	.LBB2_58
.LBB2_125:
.Ltmp131:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp132:
# %bb.126:                              # %.noexc202
.Ltmp133:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.8, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp134:
# %bb.127:                              # %.noexc203
.Ltmp135:
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.11, %esi
	movl	$2, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp136:
# %bb.128:                              # %.noexc204
.Ltmp137:
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp138:
# %bb.129:                              # %.noexc205
.Ltmp139:
	movl	$_ZSt4cerr, %edi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
.Ltmp140:
# %bb.130:                              # %.noexc206
.Ltmp141:
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
.Ltmp142:
	jmp	.LBB2_58
.LBB2_29:
.Ltmp8:
	movq	%rax, %rbx
	jmp	.LBB2_143
.LBB2_28:
.Ltmp5:
	movq	%rax, %rbx
	jmp	.LBB2_145
.LBB2_27:
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB2_147
.LBB2_105:
.Ltmp98:
	jmp	.LBB2_141
.LBB2_68:
.Ltmp41:
	jmp	.LBB2_141
.LBB2_66:
.Ltmp20:
	jmp	.LBB2_141
.LBB2_67:
.Ltmp143:
	jmp	.LBB2_141
.LBB2_140:
.Ltmp13:
	jmp	.LBB2_141
.LBB2_104:
.Ltmp79:
	jmp	.LBB2_141
.LBB2_103:
.Ltmp64:
.LBB2_141:
	movq	%rax, %rbx
	movq	72(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_143
# %bb.142:
	callq	_ZdlPv
.LBB2_143:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit216
	movq	120(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_145
# %bb.144:
	callq	_ZdlPv
.LBB2_145:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit218
	movq	96(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_147
# %bb.146:
	callq	_ZdlPv
.LBB2_147:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit220
	movq	160(%rsp), %rdi
	testq	%rdi, %rdi
	je	.LBB2_149
# %bb.148:
	callq	_ZdlPv
.LBB2_149:                              # %_ZNSt6vectorIfSaIfEED2Ev.exit222
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_Z9correlateiiPKfPf, .Lfunc_end2-_Z9correlateiiPKfPf
	.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 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .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 5 <<
	.uleb128 .Ltmp12-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp19-.Ltmp14                #   Call between .Ltmp14 and .Ltmp19
	.uleb128 .Ltmp20-.Lfunc_begin0          #     jumps to .Ltmp20
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp22-.Ltmp21                #   Call between .Ltmp21 and .Ltmp22
	.uleb128 .Ltmp143-.Lfunc_begin0         #     jumps to .Ltmp143
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp28-.Ltmp23                #   Call between .Ltmp23 and .Ltmp28
	.uleb128 .Ltmp41-.Lfunc_begin0          #     jumps to .Ltmp41
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp42-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp59-.Ltmp42                #   Call between .Ltmp42 and .Ltmp59
	.uleb128 .Ltmp143-.Lfunc_begin0         #     jumps to .Ltmp143
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp60-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp63-.Ltmp60                #   Call between .Ltmp60 and .Ltmp63
	.uleb128 .Ltmp64-.Lfunc_begin0          #     jumps to .Ltmp64
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp65-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp78-.Ltmp65                #   Call between .Ltmp65 and .Ltmp78
	.uleb128 .Ltmp79-.Lfunc_begin0          #     jumps to .Ltmp79
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp80-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp85-.Ltmp80                #   Call between .Ltmp80 and .Ltmp85
	.uleb128 .Ltmp98-.Lfunc_begin0          #     jumps to .Ltmp98
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp99-.Lfunc_begin0          # >> Call Site 13 <<
	.uleb128 .Ltmp130-.Ltmp99               #   Call between .Ltmp99 and .Ltmp130
	.uleb128 .Ltmp143-.Lfunc_begin0         #     jumps to .Ltmp143
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp130-.Lfunc_begin0         # >> Call Site 14 <<
	.uleb128 .Ltmp29-.Ltmp130               #   Call between .Ltmp130 and .Ltmp29
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp29-.Lfunc_begin0          # >> Call Site 15 <<
	.uleb128 .Ltmp40-.Ltmp29                #   Call between .Ltmp29 and .Ltmp40
	.uleb128 .Ltmp41-.Lfunc_begin0          #     jumps to .Ltmp41
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp86-.Lfunc_begin0          # >> Call Site 16 <<
	.uleb128 .Ltmp97-.Ltmp86                #   Call between .Ltmp86 and .Ltmp97
	.uleb128 .Ltmp98-.Lfunc_begin0          #     jumps to .Ltmp98
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp103-.Lfunc_begin0         # >> Call Site 17 <<
	.uleb128 .Ltmp142-.Ltmp103              #   Call between .Ltmp103 and .Ltmp142
	.uleb128 .Ltmp143-.Lfunc_begin0         #     jumps to .Ltmp143
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp142-.Lfunc_begin0         # >> Call Site 18 <<
	.uleb128 .Lfunc_end2-.Ltmp142           #   Call between .Ltmp142 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIfSaIfEEC2EmRKfRKS0_,"axG",@progbits,_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_,comdat
	.weak	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_ # -- Begin function _ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_,@function
_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_:       # @_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.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	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB3_6
# %bb.1:                                # %_ZNSt6vectorIfSaIfEE17_S_check_init_lenEmRKS0_.exit
	movq	%rsi, %r14
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rdi)
	movq	$0, 16(%rdi)
	testq	%rsi, %rsi
	je	.LBB3_2
# %bb.3:
	movq	%rdx, %r15
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIfE8allocateEmPKv
	movq	%rax, (%rbx)
	leaq	(%rax,%r14,4), %rcx
	movq	%rcx, 16(%rbx)
	movss	(%r15), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	shlq	$2, %r14
.LBB3_4:                                # %.lr.ph.i.i.i.i.i.i.i.i
                                        # =>This Inner Loop Header: Depth=1
	movss	%xmm0, (%rax,%r12)
	addq	$4, %r12
	cmpq	%r12, %r14
	jne	.LBB3_4
	jmp	.LBB3_5
.LBB3_2:                                # %_ZNSt12_Vector_baseIfSaIfEEC2EmRKS0_.exit.thread
	movups	%xmm0, (%rbx)
	movq	$0, 16(%rbx)
	xorl	%ecx, %ecx
.LBB3_5:                                # %.loopexit
	movq	%rcx, 8(%rbx)
	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
.LBB3_6:
	.cfi_def_cfa_offset 48
	movl	$.L.str.12, %edi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end3:
	.size	_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_, .Lfunc_end3-_ZNSt6vectorIfSaIfEEC2EmRKfRKS0_
	.cfi_endproc
                                        # -- End function
	.section	.text._Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind,"axG",@progbits,_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind,comdat
	.weak	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind # -- Begin function _Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
	.type	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind,@function
_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind: # @_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
	.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
	shlq	$2, %rdx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB4_2
# %bb.1:                                # %_ZL5check10hipError_tPKc.exit
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.LBB4_2:
	.cfi_def_cfa_offset 32
	movl	%eax, %ebx
	movl	$_ZSt4cerr, %edi
	movl	$.L.str.10, %esi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.13, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movl	$.L.str.11, %esi
	movq	%rax, %rdi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %r14
	movl	%ebx, %edi
	callq	hipGetErrorString
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
	movq	%rax, %rdi
	callq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
	movl	$1, %edi
	callq	exit
.Lfunc_end4:
	.size	_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind, .Lfunc_end4-_Z11cuda_memcpyIfEvPT_PKS0_m13hipMemcpyKind
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI5_0:
	.long	0xbf800000                      # float -1
	.long	0x3f800000                      # float 1
	.long	0x3f800000                      # float 1
	.long	0xbf800000                      # float -1
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$80, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -16
	movaps	.LCPI5_0(%rip), %xmm0           # xmm0 = [-1.0E+0,1.0E+0,1.0E+0,-1.0E+0]
	leaq	48(%rsp), %rdx
	movaps	%xmm0, (%rdx)
	movabsq	$4575657224621260800, %rax      # imm = 0x3F800000BF800000
	movq	%rax, 16(%rdx)
	movq	%rsp, %rcx
	movl	$3, %edi
	movl	$2, %esi
	callq	_Z9correlateiiPKfPf
	movl	$_ZSt4cout, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.9, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	xorl	%ebx, %ebx
.LBB5_1:                                # =>This Inner Loop Header: Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rsp,%rbx,4), %xmm0
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
	movl	$.L.str.3, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	incq	%rbx
	cmpq	$4, %rbx
	jne	.LBB5_1
# %bb.2:
	xorl	%eax, %eax
	addq	$80, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	main, .Lfunc_end5-main
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt15__new_allocatorIfE8allocateEmPKv,"axG",@progbits,_ZNSt15__new_allocatorIfE8allocateEmPKv,comdat
	.weak	_ZNSt15__new_allocatorIfE8allocateEmPKv # -- Begin function _ZNSt15__new_allocatorIfE8allocateEmPKv
	.p2align	1, 0x90
	.type	_ZNSt15__new_allocatorIfE8allocateEmPKv,@function
_ZNSt15__new_allocatorIfE8allocateEmPKv: # @_ZNSt15__new_allocatorIfE8allocateEmPKv
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rsi, %rax
	shrq	$61, %rax
	jne	.LBB6_1
# %bb.3:
	shlq	$2, %rsi
	movq	%rsi, %rdi
	popq	%rax
	.cfi_def_cfa_offset 8
	jmp	_Znwm                           # TAILCALL
.LBB6_1:
	.cfi_def_cfa_offset 16
	shrq	$62, %rsi
	je	.LBB6_2
# %bb.4:
	callq	_ZSt28__throw_bad_array_new_lengthv
.LBB6_2:
	callq	_ZSt17__throw_bad_allocv
.Lfunc_end6:
	.size	_ZNSt15__new_allocatorIfE8allocateEmPKv, .Lfunc_end6-_ZNSt15__new_allocatorIfE8allocateEmPKv
	.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
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z13correlate_gpuiiPKfPfi, %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	$_Z17padding_transposeiiPKfPfi, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB8_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z13correlate_gpuiiPKfPfi,@object # @_Z13correlate_gpuiiPKfPfi
	.section	.rodata,"a",@progbits
	.globl	_Z13correlate_gpuiiPKfPfi
	.p2align	3, 0x0
_Z13correlate_gpuiiPKfPfi:
	.quad	_Z28__device_stub__correlate_gpuiiPKfPfi
	.size	_Z13correlate_gpuiiPKfPfi, 8

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"hipMalloc((void**)&dGPU,ny*nx*sizeof(float))"
	.size	.L.str, 45

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"hipMalloc((void**)&padding,new_ny*nx*sizeof(float))"
	.size	.L.str.1, 52

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"hipMalloc((void**)&rGPU,ny*ny*sizeof(float))"
	.size	.L.str.2, 45

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

	.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	"----"
	.size	.L.str.5, 5

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"hipFree(dGPU)"
	.size	.L.str.6, 14

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"hipFree(padding)"
	.size	.L.str.7, 17

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"hipFree(rGPU)"
	.size	.L.str.8, 14

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"result"
	.size	.L.str.9, 7

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"CUDA error: "
	.size	.L.str.10, 13

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

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"cannot create std::vector larger than max_size()"
	.size	.L.str.12, 49

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"hipMemcpy(target, source, num * sizeof(T), direction)"
	.size	.L.str.13, 54

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z13correlate_gpuiiPKfPfi"
	.size	.L__unnamed_1, 26

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z17padding_transposeiiPKfPfi"
	.size	.L__unnamed_2, 30

	.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 _Z28__device_stub__correlate_gpuiiPKfPfi
	.addrsig_sym _Z32__device_stub__padding_transposeiiPKfPfi
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z13correlate_gpuiiPKfPfi
	.addrsig_sym _Z17padding_transposeiiPKfPfi
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z13correlate_gpuiiPKfPfi ; -- Begin function _Z13correlate_gpuiiPKfPfi
	.globl	_Z13correlate_gpuiiPKfPfi
	.p2align	8
	.type	_Z13correlate_gpuiiPKfPfi,@function
_Z13correlate_gpuiiPKfPfi:              ; @_Z13correlate_gpuiiPKfPfi
; %bb.0:
	v_dual_mov_b32 v1, 16 :: v_dual_mov_b32 v2, 0
	s_mov_b32 s2, 0
.LBB0_1:                                ; %.preheader88
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_2 Depth 2
	s_mov_b32 s3, 0
.LBB0_2:                                ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	v_add_nc_u32_e32 v3, s3, v1
	s_add_i32 s3, s3, 4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s3, 64
	scratch_store_b32 v3, v2, off
	s_cbranch_scc0 .LBB0_2
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	v_add_nc_u32_e32 v1, 64, v1
	s_add_i32 s2, s2, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s2, 16
	s_cbranch_scc0 .LBB0_1
; %bb.4:                                ; %.preheader87
	s_clause 0x1
	s_load_b64 s[2:3], s[0:1], 0x0
	s_load_b128 s[4:7], s[0:1], 0x8
	v_and_b32_e32 v1, 0x3ff, v0
	v_bfe_u32 v0, v0, 10, 10
	s_lshl_b32 s9, s15, 8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v34, s14, 8, v1
	v_add_nc_u32_e32 v35, s9, v0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s3, 1
	s_cbranch_scc1 .LBB0_15
; %bb.5:                                ; %.preheader86.preheader
	s_load_b32 s8, s[0:1], 0x18
	v_dual_mov_b32 v37, v34 :: v_dual_add_nc_u32 v36, s9, v0
	s_mov_b32 s9, 0
                                        ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3_vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14_vgpr15
                                        ; implicit-def: $vgpr16_vgpr17_vgpr18_vgpr19_vgpr20_vgpr21_vgpr22_vgpr23_vgpr24_vgpr25_vgpr26_vgpr27_vgpr28_vgpr29_vgpr30_vgpr31
.LBB0_6:                                ; %.preheader86
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;     Child Loop BB0_9 Depth 2
                                        ;     Child Loop BB0_11 Depth 2
                                        ;       Child Loop BB0_12 Depth 3
	s_delay_alu instid0(VALU_DEP_1)
	v_mov_b32_e32 v32, v37
	s_mov_b64 s[0:1], 0
.LBB0_7:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_ashrrev_i32_e32 v33, 31, v32
	s_mov_b32 m0, s0
	s_add_u32 s0, s0, 1
	s_addc_u32 s1, s1, 0
	s_cmp_eq_u32 s0, 16
	v_lshlrev_b64 v[38:39], 2, v[32:33]
	v_add_nc_u32_e32 v32, 16, v32
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v38, vcc_lo, s4, v38
	v_add_co_ci_u32_e32 v39, vcc_lo, s5, v39, vcc_lo
	global_load_b32 v33, v[38:39], off
	s_waitcnt vmcnt(0)
	v_movreld_b32_e32 v0, v33
	s_cbranch_scc0 .LBB0_7
; %bb.8:                                ; %.preheader85
                                        ;   in Loop: Header=BB0_6 Depth=1
	v_mov_b32_e32 v32, v36
	s_mov_b64 s[0:1], 0
.LBB0_9:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_ashrrev_i32_e32 v33, 31, v32
	s_mov_b32 m0, s0
	s_add_u32 s0, s0, 1
	s_addc_u32 s1, s1, 0
	s_cmp_lg_u32 s0, 16
	v_lshlrev_b64 v[38:39], 2, v[32:33]
	v_add_nc_u32_e32 v32, 16, v32
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v38, vcc_lo, s4, v38
	v_add_co_ci_u32_e32 v39, vcc_lo, s5, v39, vcc_lo
	global_load_b32 v33, v[38:39], off
	s_waitcnt vmcnt(0)
	v_movreld_b32_e32 v16, v33
	s_cbranch_scc1 .LBB0_9
; %bb.10:                               ; %.preheader83.preheader
                                        ;   in Loop: Header=BB0_6 Depth=1
	v_mov_b32_e32 v32, 16
	s_mov_b32 s10, 0
.LBB0_11:                               ; %.preheader83
                                        ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_12 Depth 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_mov_b32 m0, s10
	v_mov_b32_e32 v38, v32
	v_movrels_b32_e32 v33, v0
	s_mov_b64 s[0:1], 0
.LBB0_12:                               ;   Parent Loop BB0_6 Depth=1
                                        ;     Parent Loop BB0_11 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	scratch_load_b32 v39, v38, off
	s_mov_b32 m0, s0
	s_add_u32 s0, s0, 1
	v_movrels_b32_e32 v40, v16
	s_addc_u32 s1, s1, 0
	s_cmp_eq_u32 s0, 16
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_fmac_f32_e32 v39, v33, v40
	scratch_store_b32 v38, v39, off
	v_add_nc_u32_e32 v38, 4, v38
	s_cbranch_scc0 .LBB0_12
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=2
	v_add_nc_u32_e32 v32, 64, v32
	s_add_i32 s10, s10, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s10, 16
	s_cbranch_scc0 .LBB0_11
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	s_waitcnt lgkmcnt(0)
	v_add_nc_u32_e32 v37, s8, v37
	v_add_nc_u32_e32 v36, s8, v36
	s_add_i32 s9, s9, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s9, s3
	s_cbranch_scc0 .LBB0_6
.LBB0_15:                               ; %.preheader.preheader
	v_mul_lo_u32 v0, s2, v34
	v_mov_b32_e32 v1, 16
	s_lshl_b32 s1, s2, 4
	s_mov_b32 s3, 0
.LBB0_16:                               ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshl_add_u32 v2, s3, 4, v34
	v_mov_b32_e32 v3, v35
	s_mov_b32 s5, 0
	v_cmp_le_i32_e32 vcc_lo, s2, v2
	s_xor_b32 s4, vcc_lo, -1
.LBB0_17:                               ;   Parent Loop BB0_16 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_gt_i32_e32 vcc_lo, s2, v3
	v_cmp_le_i32_e64 s0, v2, v3
	s_and_b32 s8, s4, vcc_lo
	s_delay_alu instid0(VALU_DEP_1) | instid1(SALU_CYCLE_1)
	s_and_b32 s8, s8, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_saveexec_b32 s0, s8
	s_cbranch_execz .LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=2
	v_add_nc_u32_e32 v4, s5, v1
	scratch_load_b32 v6, v4, off
	v_add_nc_u32_e32 v4, v0, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v5, 31, v4
	v_lshlrev_b64 v[4:5], 2, v[4:5]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v4, vcc_lo, s6, v4
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v5, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[4:5], v6, off
.LBB0_19:                               ;   in Loop: Header=BB0_17 Depth=2
	s_or_b32 exec_lo, exec_lo, s0
	v_add_nc_u32_e32 v3, 16, v3
	s_add_i32 s5, s5, 4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s5, 64
	s_cbranch_scc0 .LBB0_17
; %bb.20:                               ;   in Loop: Header=BB0_16 Depth=1
	v_add_nc_u32_e32 v0, s1, v0
	v_add_nc_u32_e32 v1, 64, v1
	s_add_i32 s3, s3, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s3, 16
	s_cbranch_scc0 .LBB0_16
; %bb.21:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z13correlate_gpuiiPKfPfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 1040
		.amdhsa_kernarg_size 28
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 41
		.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	_Z13correlate_gpuiiPKfPfi, .Lfunc_end0-_Z13correlate_gpuiiPKfPfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 652
; NumSgprs: 18
; NumVgprs: 41
; ScratchSize: 1040
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 5
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 41
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 1
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.protected	_Z17padding_transposeiiPKfPfi ; -- Begin function _Z17padding_transposeiiPKfPfi
	.globl	_Z17padding_transposeiiPKfPfi
	.p2align	8
	.type	_Z17padding_transposeiiPKfPfi,@function
_Z17padding_transposeiiPKfPfi:          ; @_Z17padding_transposeiiPKfPfi
; %bb.0:
	s_load_b64 s[8:9], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s9, 1
	s_cbranch_scc1 .LBB1_7
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x8
	s_load_b32 s3, s[0:1], 0x18
	s_cmp_lt_i32 s15, s8
	s_mov_b32 s2, s15
	s_cselect_b32 s10, -1, 0
	s_add_u32 s0, s0, 32
	s_mul_i32 s8, s15, s8
	s_addc_u32 s1, s1, 0
	s_mov_b32 s11, 0
	s_mov_b32 s12, 0
                                        ; implicit-def: $sgpr13
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v1, s12, v0
	s_or_b32 s13, s13, exec_lo
	s_mov_b32 s14, exec_lo
	v_cmpx_gt_i32_e64 s9, v1
	s_cbranch_execz .LBB1_6
; %bb.3:                                ;   in Loop: Header=BB1_2 Depth=1
	v_mov_b32_e32 v2, 0
	s_and_not1_b32 vcc_lo, exec_lo, s10
	s_cbranch_vccnz .LBB1_5
; %bb.4:                                ;   in Loop: Header=BB1_2 Depth=1
	v_add_nc_u32_e32 v2, s8, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v3, vcc_lo
	global_load_b32 v2, v[2:3], off
.LBB1_5:                                ;   in Loop: Header=BB1_2 Depth=1
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[3:4], null, v1, s3, s[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v4, 31, v3
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s6, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v4, vcc_lo
	s_waitcnt vmcnt(0)
	global_store_b32 v[3:4], v2, off
	s_load_b32 s15, s[0:1], 0xc
	s_waitcnt lgkmcnt(0)
	s_and_b32 s15, s15, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s12, s12, s15
	s_cmp_ge_i32 s12, s9
	s_cselect_b32 s15, -1, 0
	s_and_not1_b32 s13, s13, exec_lo
	s_and_b32 s15, s15, exec_lo
	s_delay_alu instid0(SALU_CYCLE_1)
	s_or_b32 s13, s13, s15
.LBB1_6:                                ; %Flow
                                        ;   in Loop: Header=BB1_2 Depth=1
	s_or_b32 exec_lo, exec_lo, s14
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s14, exec_lo, s13
	s_or_b32 s11, s14, s11
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s11
	s_cbranch_execnz .LBB1_2
.LBB1_7:                                ; %.critedge
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17padding_transposeiiPKfPfi
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.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	_Z17padding_transposeiiPKfPfi, .Lfunc_end1-_Z17padding_transposeiiPKfPfi
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 308
; NumSgprs: 18
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; 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:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 28
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z13correlate_gpuiiPKfPfi
    .private_segment_fixed_size: 1040
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z13correlate_gpuiiPKfPfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     41
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         4
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17padding_transposeiiPKfPfi
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17padding_transposeiiPKfPfi.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
