// matrix vector multiplecation
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std::chrono;

#define NUM_THREADS_PERBLOCK 128

// the macro to check the cudaAPI return code
#define cudaCheck(error)                                                      \
  if (error != cudaSuccess) {                                                 \
    printf("Fatal error: %s at %s:%d\n", cudaGetErrorString(error), __FILE__, \
           __LINE__);                                                         \
    exit(1);                                                                  \
  }

// the kernel operation executed by each thread
// the m and n is the size of input
__global__ void MVfunc(float* dMatrix, float* dVector, float* dAns, size_t m,
                       size_t n) {
  // for each thread
  size_t threadIndex = threadIdx.x + (blockIdx.x * blockDim.x);
  // elem num is more than thread number in all blocks

  size_t elemid = 0;
  size_t loopCount = 0;

  // it becomes to the naive case if there is enough numbers of block
  // and every thread access one data point
  //if (threadIndex < 10) {
  //  printf("loopCount1 %ld", loopCount);
  //}

  size_t elemAllBlocks = gridDim.x * blockDim.x;

  while (true) {

    //if (threadIndex < 10) {
    //  printf("loopCount2 %ld", loopCount);
    //}

    // add parathesis explicitly
    elemid = (loopCount * elemAllBlocks) + threadIndex;
    //if (threadIndex < 10) {
    //  printf(
    //      "threadIndex %ld elemid %ld loopCount %ld gridDim.x %d blockDim.x "
    //      "%d\n",
    //      threadIndex, elemid, loopCount, gridDim.x, blockDim.x);
    //}

    if (elemid >= m * n) {
      break;
    }

    size_t rowIndex = elemid / n;
    size_t columnIndx = elemid % n;

    // float a1 = dMatrix[rowIndex * n + columnIndx];

    float a1 = dMatrix[elemid];
    float a2 = dVector[columnIndx];
    float v = a1 * a2;

    // printf("n gindex %ld rowindex %ld columnIndx %ld a1 %lf a2 %lf\n",
    // gindex,
    //       rowindex, columnIndx, a1, a2);
    // put it into the dAns vector
    // using atomicAdd to avoid the race condition
    atomicAdd(&dAns[rowIndex], v);

    loopCount++;
  }

  return;
}

// do the memory copy and the data partition
void gpuMV(std::vector<float>& matrix, std::vector<float>& vector,
           std::vector<float>& ans, size_t m, size_t n) {
  float* dMatrix;
  float* dVector;
  float* dAns;

  // set the device id
  cudaSetDevice(0);

  // allocate memory on gpu
  cudaCheck(cudaMalloc((void**)&dMatrix, m * n * sizeof(float)));
  cudaCheck(cudaMalloc((void**)&dVector, n * sizeof(float)));
  cudaCheck(cudaMalloc((void**)&dAns, m * sizeof(float)));
  // set the memory to zero
  cudaCheck(cudaMemset(dAns, 0, m * sizeof(float)));

  // std::cout << "debug input  " << matrix[1 * n + 1] << std::endl;

  // init the data on the device
  // copy the data from the cpu into the device

  auto memcpy1start = high_resolution_clock::now();

  cudaCheck(cudaMemcpy(dMatrix, matrix.data(), m * n * sizeof(float),
                       cudaMemcpyHostToDevice));
  cudaCheck(cudaMemcpy(dVector, vector.data(), n * sizeof(float),
                       cudaMemcpyHostToDevice));
  auto memcpy1end = high_resolution_clock::now();
  auto memcpy1DurationMicro =
      duration_cast<microseconds>(memcpy1end - memcpy1start);

  std::cout << "memcpy to device time " << memcpy1DurationMicro.count()
            << std::endl;

  // do computation
  auto kernelstart = high_resolution_clock::now();

  // size_t blockSize =
  //     (elementsNum + NUM_THREADS_PERBLOCK - 1) / NUM_THREADS_PERBLOCK;

  size_t blockSize = 64;

  MVfunc<<<blockSize, NUM_THREADS_PERBLOCK>>>(dMatrix, dVector, dAns, m, n);

  // MVfunc<<<(elementsNum + NUM_THREADS_PERBLOCK - 1) / NUM_THREADS_PERBLOCK,
  //         NUM_THREADS_PERBLOCK>>>(dMatrix, dVector, dAns, m, n);

  auto kernelstop = high_resolution_clock::now();
  auto kernelDurationMicro =
      duration_cast<microseconds>(kernelstop - kernelstart);
  std::cout << "kernel time " << kernelDurationMicro.count() << std::endl;

  auto memcpy2start = high_resolution_clock::now();

  // copy results back, set it into the vector direactly
  cudaCheck(cudaMemcpy((float*)ans.data(), dAns, m * sizeof(float),
                       cudaMemcpyDeviceToHost));

  auto memcpy2end = high_resolution_clock::now();
  auto memcpy2Macro = duration_cast<microseconds>(memcpy2end - memcpy2start);

  std::cout << "memcpy to host time " << memcpy2Macro.count() << std::endl;
}

std::vector<float> cpuMV(std::vector<float>& matrix, std::vector<float>& vector,
                         size_t m, size_t n) {
  std::vector<float> ans;
  // the position of (0,0) is at the top left corner
  float tempv = 0;

  for (size_t i = 0; i < m; i++) {
    tempv = 0;
    for (size_t j = 0; j < n; j++) {
      tempv = tempv + (matrix[i * n + j] * vector[j]);
      // printf("i %ld j %ld m %f v %f tempv %f\n", i, j, matrix[i * n + j],
      //       vector[j], tempv);
    }
    ans.push_back(tempv);
  }
  return ans;
}

int main(int argc, char** argv) {
  // int matrix size m*n
  size_t m = 100;
  size_t n = 200;

  // matrix (it is unnecessary to use the insert vector here)
  std::vector<float> matrix(m * n);

  // vector is n*1
  std::vector<float> vector(n);

  // init matrix and vector
  srand(static_cast<unsigned>(time(0)));

  for (size_t i = 0; i < m; i++) {
    for (size_t j = 0; j < n; j++) {
      // matrix[i * m + j] =
      //    static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
      matrix[i * n + j] = (i * 10 + j) * 0.1;
    }
  }

  // init vector
  for (size_t j = 0; j < n; j++) {
    // vector[j] = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
    vector[j] = j * 0.1;
  }

  // std::cout << "debug input 1  " << matrix[1 * n + 1] << std::endl;

  // ans is m*1
  std::vector<float> ansCPU;

  std::vector<float> ansGPU(m);

  auto cpustart = high_resolution_clock::now();
  ansCPU = cpuMV(matrix, vector, m, n);
  auto cpuend = high_resolution_clock::now();
  auto cputime = duration_cast<microseconds>(cpuend - cpustart);
  std::cout << "cputime time " << cputime.count() << std::endl;

  std::cout << "gputime time: " << std::endl;
  gpuMV(matrix, vector, ansGPU, m, n);

  // compare the difference
  // the max diff is around 0.25 in this case
  float epsilon = 0.1;
  for (int j = 0; j < m; j++) {
    float diff = fabs(ansCPU[j] - ansGPU[j]);
    if (diff > epsilon) {
      std::cout << "error " << j << " " << ansCPU[j] << ", " << ansGPU[j]
                << " diff " << diff << std::endl;
    }
  }

  return 0;
}
	.file	"tmpxft_0037f606_00000000-6_main_warp.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB4124:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE4124:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4953:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4953:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm
	.type	_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm, @function
_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm:
.LFB4146:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L3
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z6MVfuncPfS_S_mm(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L3:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4146:
	.size	_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm, .-_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm
	.globl	_Z6MVfuncPfS_S_mm
	.type	_Z6MVfuncPfS_S_mm, @function
_Z6MVfuncPfS_S_mm:
.LFB4147:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm
	.cfi_endproc
.LFE4147:
	.size	_Z6MVfuncPfS_S_mm, .-_Z6MVfuncPfS_S_mm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/wangzhezhe/parallelBLK/master/cuda/MVM/main_warp.cu"
.LC1:
	.string	"Fatal error: %s at %s:%d\n"
.LC2:
	.string	"memcpy to device time "
.LC3:
	.string	"kernel time "
.LC4:
	.string	"memcpy to host time "
	.text
	.globl	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	.type	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm, @function
_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm:
.LFB4097:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rdi, %r14
	xorl	%edi, %edi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%rsi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r8, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rcx, %rbx
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %r15
	call	cudaSetDevice@PLT
	leaq	0(,%r12,4), %rax
	movq	%r15, %rdi
	movq	%rax, 24(%rsp)
	imulq	%rbx, %rax
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L10
	movq	16(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$89, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L10:
	leaq	48(%rsp), %r15
	movq	24(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L11
	movq	24(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$90, %r8d
	movq	%rax, %rdx
.L20:
	movl	$2, %edi
	leaq	.LC0(%rip), %rcx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L11:
	leaq	0(,%rbx,4), %rax
	leaq	56(%rsp), %r15
	movq	%rax, %rsi
	movq	%r15, %rdi
	movq	%rax, 8(%rsp)
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L12
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$91, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L12:
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaMemset@PLT
	testl	%eax, %eax
	je	.L13
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaMemset@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$93, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L13:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	16(%rsp), %rdx
	movq	(%r14), %rsi
	movl	$1, %ecx
	movq	40(%rsp), %rdi
	movq	%rax, %r15
	call	cudaMemcpy@PLT
	movl	$1, %ecx
	testl	%eax, %eax
	je	.L14
	movq	16(%rsp), %rdx
	movq	(%r14), %rsi
	movq	40(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$102, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L14:
	movq	24(%rsp), %rdx
	movq	0(%r13), %rsi
	movq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L15
	movq	24(%rsp), %rdx
	movq	0(%r13), %rsi
	movl	$1, %ecx
	movq	48(%rsp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$104, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L15:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$1000, %ecx
	leaq	_ZSt4cout(%rip), %r13
	leaq	.LC2(%rip), %rsi
	subq	%r15, %rax
	movq	%r13, %rdi
	cqto
	idivq	%rcx
	movq	%rax, %r14
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r14, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$33554433, %edx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$67108865, %edi
	salq	$7, %rdx
	movl	$1, %ecx
	movq	%rax, %r14
	salq	$6, %rdi
	movl	$1, %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L16
	movq	56(%rsp), %rdx
	movq	48(%rsp), %rsi
	movq	%r12, %r8
	movq	%rbx, %rcx
	movq	40(%rsp), %rdi
	call	_Z31__device_stub__Z6MVfuncPfS_S_mmPfS_S_mm
.L16:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$1000, %ebx
	leaq	.LC3(%rip), %rsi
	movq	%r13, %rdi
	subq	%r14, %rax
	cqto
	idivq	%rbx
	movq	%rax, %r12
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%r12, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	0(%rbp), %rdi
	movq	%rax, %r12
	call	cudaMemcpy@PLT
	testl	%eax, %eax
	je	.L17
	movq	8(%rsp), %rdx
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	0(%rbp), %rdi
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	movl	$134, %r8d
	movq	%rax, %rdx
	jmp	.L20
.L17:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	.LC4(%rip), %rsi
	movq	%r13, %rdi
	subq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rax, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	addq	$104, %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
.LFE4097:
	.size	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm, .-_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	.section	.rodata.str1.1
.LC5:
	.string	"_Z6MVfuncPfS_S_mm"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB4149:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC5(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z6MVfuncPfS_S_mm(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE4149:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZNSt6vectorIfSaIfEED2Ev,"axG",@progbits,_ZNSt6vectorIfSaIfEED5Ev,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEED2Ev
	.type	_ZNSt6vectorIfSaIfEED2Ev, @function
_ZNSt6vectorIfSaIfEED2Ev:
.LFB4494:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	testq	%rax, %rax
	je	.L23
	movq	16(%rdi), %rsi
	movq	%rax, %rdi
	subq	%rax, %rsi
	jmp	_ZdlPvm@PLT
.L23:
	ret
	.cfi_endproc
.LFE4494:
	.size	_ZNSt6vectorIfSaIfEED2Ev, .-_ZNSt6vectorIfSaIfEED2Ev
	.weak	_ZNSt6vectorIfSaIfEED1Ev
	.set	_ZNSt6vectorIfSaIfEED1Ev,_ZNSt6vectorIfSaIfEED2Ev
	.section	.rodata._ZNSt6vectorIfSaIfEEC2EmRKS0_.str1.1,"aMS",@progbits,1
.LC6:
	.string	"cannot create std::vector larger than max_size()"
	.section	.text._ZNSt6vectorIfSaIfEEC2EmRKS0_,"axG",@progbits,_ZNSt6vectorIfSaIfEEC5EmRKS0_,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEEC2EmRKS0_
	.type	_ZNSt6vectorIfSaIfEEC2EmRKS0_, @function
_ZNSt6vectorIfSaIfEEC2EmRKS0_:
.LFB4506:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rax
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	cmpq	%rsi, %rax
	jnb	.L26
	leaq	.LC6(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L26:
	xorl	%eax, %eax
	movq	%rdi, %rbx
	leaq	0(,%rsi,4), %r12
	movq	%rsi, %rbp
	movq	%rax, (%rdi)
	movq	%rax, 8(%rdi)
	movq	%rax, 16(%rdi)
	xorl	%eax, %eax
	testq	%rsi, %rsi
	je	.L27
	movq	%r12, %rdi
	call	_Znwm@PLT
.L27:
	addq	%rax, %r12
	movq	%rax, (%rbx)
	movq	%rax, 8(%rbx)
	movq	%r12, 16(%rbx)
	testq	%rbp, %rbp
	je	.L28
	movl	$0x00000000, (%rax)
	addq	$4, %rax
	decq	%rbp
	je	.L28
.L29:
	cmpq	%rax, %r12
	je	.L28
	movl	$0x00000000, (%rax)
	addq	$4, %rax
	jmp	.L29
.L28:
	movq	%rax, 8(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4506:
	.size	_ZNSt6vectorIfSaIfEEC2EmRKS0_, .-_ZNSt6vectorIfSaIfEEC2EmRKS0_
	.weak	_ZNSt6vectorIfSaIfEEC1EmRKS0_
	.set	_ZNSt6vectorIfSaIfEEC1EmRKS0_,_ZNSt6vectorIfSaIfEEC2EmRKS0_
	.section	.rodata._ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_.str1.1,"aMS",@progbits,1
.LC8:
	.string	"vector::_M_realloc_insert"
	.section	.text._ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_,comdat
	.align 2
	.weak	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
	.type	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_, @function
_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_:
.LFB4677:
	.cfi_startproc
	endbr64
	movabsq	$2305843009213693951, %rcx
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	8(%rdi), %rax
	movq	(%rdi), %r14
	movq	%rax, %rbx
	movq	%rax, (%rsp)
	subq	%r14, %rbx
	sarq	$2, %rbx
	cmpq	%rcx, %rbx
	jne	.L41
	leaq	.LC8(%rip), %rdi
	call	_ZSt20__throw_length_errorPKc@PLT
.L41:
	cmpq	%r14, (%rsp)
	movl	$1, %eax
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmovne	%rbx, %rax
	movq	%rsi, %rbp
	addq	%rax, %rbx
	setc	%al
	subq	%r14, %r15
	movzbl	%al, %eax
	testq	%rax, %rax
	jne	.L51
	xorl	%r12d, %r12d
	testq	%rbx, %rbx
	je	.L46
	movabsq	$2305843009213693951, %rax
	cmpq	%rax, %rbx
	cmova	%rax, %rbx
	jmp	.L45
.L51:
	movq	%rcx, %rbx
.L45:
	leaq	0(,%rbx,4), %rdi
	movq	%rdx, 8(%rsp)
	call	_Znwm@PLT
	movq	8(%rsp), %rdx
	movq	%rax, %r12
.L46:
	movss	(%rdx), %xmm0
	movss	%xmm0, (%r12,%r15)
	testq	%r15, %r15
	jle	.L47
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	memmove@PLT
.L47:
	movq	(%rsp), %rax
	leaq	4(%r12,%r15), %rdx
	subq	%rbp, %rax
	testq	%rax, %rax
	jle	.L48
	movq	%rdx, %rdi
	movq	%rbp, %rsi
	movq	%rax, %rcx
	rep movsb
.L48:
	leaq	(%rdx,%rax), %rbp
	testq	%r14, %r14
	je	.L49
	movq	16(%r13), %rsi
	movq	%r14, %rdi
	subq	%r14, %rsi
	call	_ZdlPvm@PLT
.L49:
	leaq	(%r12,%rbx,4), %rax
	movq	%r12, 0(%r13)
	movq	%rbp, 8(%r13)
	movq	%rax, 16(%r13)
	addq	$24, %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
.LFE4677:
	.size	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_, .-_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
	.text
	.globl	_Z5cpuMVRSt6vectorIfSaIfEES2_mm
	.type	_Z5cpuMVRSt6vectorIfSaIfEES2_mm, @function
_Z5cpuMVRSt6vectorIfSaIfEES2_mm:
.LFB4101:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4101
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r8, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rcx, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	xorl	%eax, %eax
	movq	%rax, (%rdi)
	movq	%rax, 8(%rdi)
	movq	%rax, 16(%rdi)
.L59:
	movq	8(%rsp), %rax
	cmpq	%rax, %r12
	je	.L76
	movl	$0x00000000, 20(%rsp)
	xorl	%ecx, %ecx
	xorps	%xmm0, %xmm0
	xorl	%eax, %eax
	leaq	0(,%r13,4), %rdx
.L60:
	cmpq	%rbp, %rax
	je	.L77
	movq	(%r14), %rcx
	movq	(%r15), %rsi
	movss	(%rsi,%rax,4), %xmm1
	mulss	(%rcx,%rdx), %xmm1
	incq	%rax
	movb	$1, %cl
	addq	$4, %rdx
	addss	%xmm1, %xmm0
	jmp	.L60
.L77:
	testb	%cl, %cl
	je	.L62
	movss	%xmm0, 20(%rsp)
.L62:
	movq	8(%rbx), %rsi
	cmpq	16(%rbx), %rsi
	je	.L63
	movss	20(%rsp), %xmm0
	addq	$4, %rsi
	movss	%xmm0, -4(%rsi)
	movq	%rsi, 8(%rbx)
	jmp	.L64
.L63:
	leaq	20(%rsp), %rdx
	movq	%rbx, %rdi
.LEHB0:
	call	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
.LEHE0:
.L64:
	incq	%r12
	addq	%rbp, %r13
	jmp	.L59
.L69:
	endbr64
	movq	%rax, %rbp
.L66:
	movq	%rbx, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L75
	movq	%rbp, %rdi
.LEHB1:
	call	_Unwind_Resume@PLT
.LEHE1:
.L76:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L68
.L75:
	call	__stack_chk_fail@PLT
.L68:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movq	%rbx, %rax
	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
.LFE4101:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA4101:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4101-.LLSDACSB4101
.LLSDACSB4101:
	.uleb128 .LEHB0-.LFB4101
	.uleb128 .LEHE0-.LEHB0
	.uleb128 .L69-.LFB4101
	.uleb128 0
	.uleb128 .LEHB1-.LFB4101
	.uleb128 .LEHE1-.LEHB1
	.uleb128 0
	.uleb128 0
.LLSDACSE4101:
	.text
	.size	_Z5cpuMVRSt6vectorIfSaIfEES2_mm, .-_Z5cpuMVRSt6vectorIfSaIfEES2_mm
	.section	.rodata.str1.1
.LC10:
	.string	"cputime time "
.LC11:
	.string	"gputime time: "
.LC14:
	.string	"error "
.LC15:
	.string	" "
.LC16:
	.string	", "
.LC17:
	.string	" diff "
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB4118:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA4118
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$20000, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	144(%rsp), %rbx
	leaq	24(%rsp), %rax
	movq	%rbx, %rdx
	movq	%rax, %rdi
	leaq	48(%rsp), %rbp
	movq	%rax, (%rsp)
.LEHB2:
	call	_ZNSt6vectorIfSaIfEEC1EmRKS0_
.LEHE2:
	movq	%rbx, %rdx
	movl	$200, %esi
	movq	%rbp, %rdi
.LEHB3:
	call	_ZNSt6vectorIfSaIfEEC1EmRKS0_
.LEHE3:
	xorl	%edi, %edi
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	movq	24(%rsp), %rsi
	movsd	.LC9(%rip), %xmm1
	xorl	%edx, %edx
.L79:
	imulq	$80, %rdx, %rcx
	xorl	%eax, %eax
	addq	%rsi, %rcx
.L80:
	leaq	(%rdx,%rax), %rdi
	cvtsi2sdq	%rdi, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rcx,%rax,4)
	incq	%rax
	cmpq	$200, %rax
	jne	.L80
	addq	$10, %rdx
	cmpq	$1000, %rdx
	jne	.L79
	movq	48(%rsp), %rdx
	xorl	%eax, %eax
.L82:
	cvtsi2sdq	%rax, %xmm0
	mulsd	%xmm1, %xmm0
	cvtsd2ss	%xmm0, %xmm0
	movss	%xmm0, (%rdx,%rax,4)
	incq	%rax
	cmpq	$200, %rax
	jne	.L82
	leaq	96(%rsp), %r12
	xorl	%ecx, %ecx
	movq	%rbx, %rdx
	movl	$100, %esi
	movq	%r12, %rdi
	movq	%rcx, 72(%rsp)
	movq	%rcx, 80(%rsp)
	movq	%rcx, 88(%rsp)
.LEHB4:
	call	_ZNSt6vectorIfSaIfEEC1EmRKS0_
.LEHE4:
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	leaq	120(%rsp), %r15
	movq	(%rsp), %rsi
	movq	%rbp, %rdx
	movl	$200, %r8d
	movl	$100, %ecx
	movq	%r15, %rdi
	movq	%rax, %r14
.LEHB5:
	call	_Z5cpuMVRSt6vectorIfSaIfEES2_mm
	xorl	%eax, %eax
	movq	120(%rsp), %r13
	xorl	%edx, %edx
	movq	%rbx, %rdi
	movq	%rax, 144(%rsp)
	movq	%rax, 152(%rsp)
	movq	%rax, 160(%rsp)
	movq	128(%rsp), %rax
	movq	%rdx, 120(%rsp)
	movq	%rax, 80(%rsp)
	movq	136(%rsp), %rax
	movq	%rdx, 128(%rsp)
	movq	%rdx, 136(%rsp)
	movq	%rax, 88(%rsp)
	movq	%r13, 72(%rsp)
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	%r15, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	call	_ZNSt6chrono3_V212system_clock3nowEv@PLT
	movl	$1000, %ecx
	leaq	.LC10(%rip), %rsi
	subq	%r14, %rax
	leaq	_ZSt4cout(%rip), %r14
	cqto
	movq	%r14, %rdi
	idivq	%rcx
	movq	%rax, %rbx
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%rbx, %rsi
	call	_ZNSo9_M_insertIlEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	.LC11(%rip), %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movq	(%rsp), %rdi
	movl	$200, %r8d
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movl	$100, %ecx
	call	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	xorl	%ebx, %ebx
.L84:
	movq	96(%rsp), %rax
	movss	0(%r13,%rbx,4), %xmm0
	leaq	(%rax,%rbx,4), %r15
	subss	(%r15), %xmm0
	andps	.LC12(%rip), %xmm0
	comiss	.LC13(%rip), %xmm0
	movss	%xmm0, 12(%rsp)
	ja	.L83
.L86:
	incq	%rbx
	cmpq	$100, %rbx
	jne	.L84
	jmp	.L101
.L83:
	leaq	.LC14(%rip), %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%ebx, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC15(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	0(%r13,%rbx,4), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC16(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	(%r15), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	leaq	.LC17(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	12(%rsp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE5:
	jmp	.L86
.L101:
	movq	%r12, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	%rbp, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L91
	jmp	.L99
.L94:
	endbr64
	movq	%rax, %rbx
.L87:
	movq	%r12, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L88
.L93:
	endbr64
	movq	%rax, %rbx
.L88:
	leaq	72(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	%rbp, %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	jmp	.L89
.L92:
	endbr64
	movq	%rax, %rbx
.L89:
	movq	(%rsp), %rdi
	call	_ZNSt6vectorIfSaIfEED1Ev
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L99
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L99:
	call	__stack_chk_fail@PLT
.L91:
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4118:
	.section	.gcc_except_table
.LLSDA4118:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE4118-.LLSDACSB4118
.LLSDACSB4118:
	.uleb128 .LEHB2-.LFB4118
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB3-.LFB4118
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L92-.LFB4118
	.uleb128 0
	.uleb128 .LEHB4-.LFB4118
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L93-.LFB4118
	.uleb128 0
	.uleb128 .LEHB5-.LFB4118
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L94-.LFB4118
	.uleb128 0
	.uleb128 .LEHB6-.LFB4118
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE4118:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC9:
	.long	-1717986918
	.long	1069128089
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC12:
	.long	2147483647
	.long	0
	.long	0
	.long	0
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC13:
	.long	1036831949
	.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:

// matrix vector multiplecation

#include <hip/hip_runtime.h>
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std::chrono;

#define NUM_THREADS_PERBLOCK 128

// the macro to check the cudaAPI return code
#define cudaCheck(error)                                                      \
  if (error != hipSuccess) {                                                 \
    printf("Fatal error: %s at %s:%d\n", hipGetErrorString(error), __FILE__, \
           __LINE__);                                                         \
    exit(1);                                                                  \
  }

// the kernel operation executed by each thread
// the m and n is the size of input
__global__ void MVfunc(float* dMatrix, float* dVector, float* dAns, size_t m,
                       size_t n) {
  // for each thread
  size_t threadIndex = threadIdx.x + (blockIdx.x * blockDim.x);
  // elem num is more than thread number in all blocks

  size_t elemid = 0;
  size_t loopCount = 0;

  // it becomes to the naive case if there is enough numbers of block
  // and every thread access one data point
  //if (threadIndex < 10) {
  //  printf("loopCount1 %ld", loopCount);
  //}

  size_t elemAllBlocks = gridDim.x * blockDim.x;

  while (true) {

    //if (threadIndex < 10) {
    //  printf("loopCount2 %ld", loopCount);
    //}

    // add parathesis explicitly
    elemid = (loopCount * elemAllBlocks) + threadIndex;
    //if (threadIndex < 10) {
    //  printf(
    //      "threadIndex %ld elemid %ld loopCount %ld gridDim.x %d blockDim.x "
    //      "%d\n",
    //      threadIndex, elemid, loopCount, gridDim.x, blockDim.x);
    //}

    if (elemid >= m * n) {
      break;
    }

    size_t rowIndex = elemid / n;
    size_t columnIndx = elemid % n;

    // float a1 = dMatrix[rowIndex * n + columnIndx];

    float a1 = dMatrix[elemid];
    float a2 = dVector[columnIndx];
    float v = a1 * a2;

    // printf("n gindex %ld rowindex %ld columnIndx %ld a1 %lf a2 %lf\n",
    // gindex,
    //       rowindex, columnIndx, a1, a2);
    // put it into the dAns vector
    // using atomicAdd to avoid the race condition
    atomicAdd(&dAns[rowIndex], v);

    loopCount++;
  }

  return;
}

// do the memory copy and the data partition
void gpuMV(std::vector<float>& matrix, std::vector<float>& vector,
           std::vector<float>& ans, size_t m, size_t n) {
  float* dMatrix;
  float* dVector;
  float* dAns;

  // set the device id
  hipSetDevice(0);

  // allocate memory on gpu
  cudaCheck(hipMalloc((void**)&dMatrix, m * n * sizeof(float)));
  cudaCheck(hipMalloc((void**)&dVector, n * sizeof(float)));
  cudaCheck(hipMalloc((void**)&dAns, m * sizeof(float)));
  // set the memory to zero
  cudaCheck(hipMemset(dAns, 0, m * sizeof(float)));

  // std::cout << "debug input  " << matrix[1 * n + 1] << std::endl;

  // init the data on the device
  // copy the data from the cpu into the device

  auto memcpy1start = high_resolution_clock::now();

  cudaCheck(hipMemcpy(dMatrix, matrix.data(), m * n * sizeof(float),
                       hipMemcpyHostToDevice));
  cudaCheck(hipMemcpy(dVector, vector.data(), n * sizeof(float),
                       hipMemcpyHostToDevice));
  auto memcpy1end = high_resolution_clock::now();
  auto memcpy1DurationMicro =
      duration_cast<microseconds>(memcpy1end - memcpy1start);

  std::cout << "memcpy to device time " << memcpy1DurationMicro.count()
            << std::endl;

  // do computation
  auto kernelstart = high_resolution_clock::now();

  // size_t blockSize =
  //     (elementsNum + NUM_THREADS_PERBLOCK - 1) / NUM_THREADS_PERBLOCK;

  size_t blockSize = 64;

  MVfunc<<<blockSize, NUM_THREADS_PERBLOCK>>>(dMatrix, dVector, dAns, m, n);

  // MVfunc<<<(elementsNum + NUM_THREADS_PERBLOCK - 1) / NUM_THREADS_PERBLOCK,
  //         NUM_THREADS_PERBLOCK>>>(dMatrix, dVector, dAns, m, n);

  auto kernelstop = high_resolution_clock::now();
  auto kernelDurationMicro =
      duration_cast<microseconds>(kernelstop - kernelstart);
  std::cout << "kernel time " << kernelDurationMicro.count() << std::endl;

  auto memcpy2start = high_resolution_clock::now();

  // copy results back, set it into the vector direactly
  cudaCheck(hipMemcpy((float*)ans.data(), dAns, m * sizeof(float),
                       hipMemcpyDeviceToHost));

  auto memcpy2end = high_resolution_clock::now();
  auto memcpy2Macro = duration_cast<microseconds>(memcpy2end - memcpy2start);

  std::cout << "memcpy to host time " << memcpy2Macro.count() << std::endl;
}

std::vector<float> cpuMV(std::vector<float>& matrix, std::vector<float>& vector,
                         size_t m, size_t n) {
  std::vector<float> ans;
  // the position of (0,0) is at the top left corner
  float tempv = 0;

  for (size_t i = 0; i < m; i++) {
    tempv = 0;
    for (size_t j = 0; j < n; j++) {
      tempv = tempv + (matrix[i * n + j] * vector[j]);
      // printf("i %ld j %ld m %f v %f tempv %f\n", i, j, matrix[i * n + j],
      //       vector[j], tempv);
    }
    ans.push_back(tempv);
  }
  return ans;
}

int main(int argc, char** argv) {
  // int matrix size m*n
  size_t m = 100;
  size_t n = 200;

  // matrix (it is unnecessary to use the insert vector here)
  std::vector<float> matrix(m * n);

  // vector is n*1
  std::vector<float> vector(n);

  // init matrix and vector
  srand(static_cast<unsigned>(time(0)));

  for (size_t i = 0; i < m; i++) {
    for (size_t j = 0; j < n; j++) {
      // matrix[i * m + j] =
      //    static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
      matrix[i * n + j] = (i * 10 + j) * 0.1;
    }
  }

  // init vector
  for (size_t j = 0; j < n; j++) {
    // vector[j] = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
    vector[j] = j * 0.1;
  }

  // std::cout << "debug input 1  " << matrix[1 * n + 1] << std::endl;

  // ans is m*1
  std::vector<float> ansCPU;

  std::vector<float> ansGPU(m);

  auto cpustart = high_resolution_clock::now();
  ansCPU = cpuMV(matrix, vector, m, n);
  auto cpuend = high_resolution_clock::now();
  auto cputime = duration_cast<microseconds>(cpuend - cpustart);
  std::cout << "cputime time " << cputime.count() << std::endl;

  std::cout << "gputime time: " << std::endl;
  gpuMV(matrix, vector, ansGPU, m, n);

  // compare the difference
  // the max diff is around 0.25 in this case
  float epsilon = 0.1;
  for (int j = 0; j < m; j++) {
    float diff = fabs(ansCPU[j] - ansGPU[j]);
    if (diff > epsilon) {
      std::cout << "error " << j << " " << ansCPU[j] << ", " << ansGPU[j]
                << " diff " << diff << std::endl;
    }
  }

  return 0;
}
	.text
	.file	"main_warp.hip"
                                        # Start of file scope inline assembly
	.globl	_ZSt21ios_base_library_initv

                                        # End of file scope inline assembly
	.globl	_Z21__device_stub__MVfuncPfS_S_mm # -- Begin function _Z21__device_stub__MVfuncPfS_S_mm
	.type	_Z21__device_stub__MVfuncPfS_S_mm,@function
_Z21__device_stub__MVfuncPfS_S_mm:      # @_Z21__device_stub__MVfuncPfS_S_mm
	.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	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z6MVfuncPfS_S_mm, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$160, %rsp
	.cfi_adjust_cfa_offset -160
	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	_Z21__device_stub__MVfuncPfS_S_mm, .Lfunc_end0-_Z21__device_stub__MVfuncPfS_S_mm
	.cfi_endproc
                                        # -- End function
	.globl	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm # -- Begin function _Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	.type	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm,@function
_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm:     # @_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	.cfi_startproc
# %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	$56, %rsp
	.cfi_def_cfa_offset 112
	.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	%r8, %r15
	movq	%rcx, %rbx
	movq	%rdx, 48(%rsp)                  # 8-byte Spill
	movq	%rsi, %r13
	movq	%rdi, %r12
	xorl	%edi, %edi
	callq	hipSetDevice
	movq	%rbx, 40(%rsp)                  # 8-byte Spill
	leaq	(,%rbx,4), %r14
	movq	%r14, %rbx
	imulq	%r15, %rbx
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_1
# %bb.3:
	leaq	(,%r15,4), %rbp
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_4
# %bb.5:
	leaq	8(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_6
# %bb.7:
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	hipMemset
	testl	%eax, %eax
	jne	.LBB1_8
# %bb.9:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r15
	movq	24(%rsp), %rdi
	movq	(%r12), %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_10
# %bb.11:
	movq	16(%rsp), %rdi
	movq	(%r13), %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_12
# %bb.13:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%r15, %rax
	movabsq	$2361183241434822607, %r15      # imm = 0x20C49BA5E353F7CF
	imulq	%r15
	movq	%rdx, %rbx
	shrq	$63, %rbx
	sarq	$7, %rdx
	addq	%rdx, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertIlEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	movabsq	$4294967360, %rdi               # imm = 0x100000040
	leaq	64(%rdi), %rdx
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	movq	48(%rsp), %r12                  # 8-byte Reload
	jne	.LBB1_15
# %bb.14:
	movq	24(%rsp), %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %rdx
	movq	40(%rsp), %rcx                  # 8-byte Reload
	movq	32(%rsp), %r8                   # 8-byte Reload
	callq	_Z21__device_stub__MVfuncPfS_S_mm
.LBB1_15:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%rbx, %rax
	imulq	%r15
	movq	%rdx, %rbx
	shrq	$63, %rbx
	sarq	$7, %rdx
	addq	%rdx, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$12, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertIlEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbx
	movq	(%r12), %rdi
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB1_16
# %bb.17:
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	subq	%rbx, %rax
	imulq	%r15
	movq	%rdx, %rbx
	shrq	$63, %rbx
	sarq	$7, %rdx
	addq	%rdx, %rbx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.4, %esi
	movl	$20, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	callq	_ZNSo9_M_insertIlEERSoT_
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	addq	$56, %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
.LBB1_1:
	.cfi_def_cfa_offset 112
	leaq	24(%rsp), %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$91, %ecx
	jmp	.LBB1_2
.LBB1_4:
	leaq	16(%rsp), %rdi
	movq	%rbp, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$92, %ecx
	jmp	.LBB1_2
.LBB1_6:
	leaq	8(%rsp), %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$93, %ecx
	jmp	.LBB1_2
.LBB1_8:
	movq	8(%rsp), %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	hipMemset
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$95, %ecx
	jmp	.LBB1_2
.LBB1_10:
	movq	24(%rsp), %rdi
	movq	(%r12), %rsi
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$105, %ecx
	jmp	.LBB1_2
.LBB1_12:
	movq	16(%rsp), %rdi
	movq	(%r13), %rsi
	movq	%rbp, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$107, %ecx
	jmp	.LBB1_2
.LBB1_16:
	movq	(%r12), %rdi
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	movl	%eax, %edi
	callq	hipGetErrorString
	movl	$.L.str, %edi
	movl	$.L.str.1, %edx
	movq	%rax, %rsi
	movl	$137, %ecx
.LBB1_2:
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm, .Lfunc_end1-_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
	.cfi_endproc
                                        # -- End function
	.globl	_Z5cpuMVRSt6vectorIfSaIfEES2_mm # -- Begin function _Z5cpuMVRSt6vectorIfSaIfEES2_mm
	.type	_Z5cpuMVRSt6vectorIfSaIfEES2_mm,@function
_Z5cpuMVRSt6vectorIfSaIfEES2_mm:        # @_Z5cpuMVRSt6vectorIfSaIfEES2_mm
.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	$24, %rsp
	.cfi_def_cfa_offset 80
	.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	%rdx, 16(%rsp)                  # 8-byte Spill
	movq	%rsi, 8(%rsp)                   # 8-byte Spill
	movq	%rdi, %rbx
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rdi)
	movq	$0, 16(%rdi)
	testq	%rcx, %rcx
	je	.LBB2_10
# %bb.1:                                # %.lr.ph19
	movq	%r8, %r14
	movq	%rcx, %r15
	leaq	(,%r8,4), %rbp
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
.LBB2_2:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_7 Depth 2
	movl	$0, 4(%rsp)
	testq	%r14, %r14
	je	.LBB2_3
# %bb.6:                                # %.lr.ph
                                        #   in Loop: Header=BB2_2 Depth=1
	movq	16(%rsp), %rax                  # 8-byte Reload
	movq	(%rax), %rax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movq	(%rcx), %rcx
	addq	%r12, %rcx
	xorps	%xmm0, %xmm0
	xorl	%edx, %edx
.LBB2_7:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rcx,%rdx,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%rax,%rdx,4), %xmm1
	addss	%xmm1, %xmm0
	movss	%xmm0, 4(%rsp)
	incq	%rdx
	cmpq	%rdx, %r14
	jne	.LBB2_7
	jmp	.LBB2_4
.LBB2_3:                                #   in Loop: Header=BB2_2 Depth=1
	xorps	%xmm0, %xmm0
.LBB2_4:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	movq	8(%rbx), %rsi
	cmpq	16(%rbx), %rsi
	je	.LBB2_8
# %bb.5:                                #   in Loop: Header=BB2_2 Depth=1
	movss	%xmm0, (%rsi)
	addq	$4, %rsi
	movq	%rsi, 8(%rbx)
	jmp	.LBB2_9
.LBB2_8:                                #   in Loop: Header=BB2_2 Depth=1
.Ltmp0:
	movq	%rbx, %rdi
	leaq	4(%rsp), %rdx
	callq	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
.Ltmp1:
.LBB2_9:                                # %_ZNSt6vectorIfSaIfEE9push_backERKf.exit
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r13
	addq	%rbp, %r12
	cmpq	%r15, %r13
	jne	.LBB2_2
.LBB2_10:                               # %._crit_edge20
	movq	%rbx, %rax
	addq	$24, %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_11:
	.cfi_def_cfa_offset 80
.Ltmp2:
	movq	%rax, %r14
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	.LBB2_13
# %bb.12:
	callq	_ZdlPv
.LBB2_13:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_Z5cpuMVRSt6vectorIfSaIfEES2_mm, .Lfunc_end2-_Z5cpuMVRSt6vectorIfSaIfEES2_mm
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 1 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp1-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Lfunc_end2-.Ltmp1             #   Call between .Ltmp1 and .Lfunc_end2
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.rodata.cst16,"aM",@progbits,16
	.p2align	4, 0x0                          # -- Begin function main
.LCPI3_0:
	.long	1127219200                      # 0x43300000
	.long	1160773632                      # 0x45300000
	.long	0                               # 0x0
	.long	0                               # 0x0
.LCPI3_1:
	.quad	0x4330000000000000              # double 4503599627370496
	.quad	0x4530000000000000              # double 1.9342813113834067E+25
.LCPI3_3:
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.long	0x7fffffff                      # float NaN
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI3_2:
	.quad	0x3fb999999999999a              # double 0.10000000000000001
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0
.LCPI3_4:
	.long	0x3dcccccd                      # float 0.100000001
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %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	$120, %rsp
	.cfi_def_cfa_offset 176
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$80000, %edi                    # imm = 0x13880
	callq	_Znwm
	movq	%rax, %rbx
	movq	%rax, 32(%rsp)
	leaq	80000(%rax), %r14
	movq	%r14, 48(%rsp)
	movl	$80000, %edx                    # imm = 0x13880
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%r14, 40(%rsp)
.Ltmp3:
	movl	$800, %edi                      # imm = 0x320
	callq	_Znwm
.Ltmp4:
# %bb.1:
	movq	%rax, %r14
	movq	%rax, 8(%rsp)
	movq	%rax, %r12
	addq	$800, %r12                      # imm = 0x320
	movq	%r12, 24(%rsp)
	xorl	%r15d, %r15d
	movl	$800, %edx                      # imm = 0x320
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%r12, 16(%rsp)
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movdqa	.LCPI3_0(%rip), %xmm0           # xmm0 = [1127219200,1160773632,0,0]
	movapd	.LCPI3_1(%rip), %xmm1           # xmm1 = [4.503599627370496E+15,1.9342813113834067E+25]
	movsd	.LCPI3_2(%rip), %xmm2           # xmm2 = mem[0],zero
	movq	%rbx, %rax
	xorl	%ecx, %ecx
.LBB3_2:                                # %.preheader108
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_3 Depth 2
	xorl	%edx, %edx
.LBB3_3:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r15,%rdx), %rsi
	movq	%rsi, %xmm3
	punpckldq	%xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
	subpd	%xmm1, %xmm3
	movapd	%xmm3, %xmm4
	unpckhpd	%xmm3, %xmm4                    # xmm4 = xmm4[1],xmm3[1]
	addsd	%xmm3, %xmm4
	mulsd	%xmm2, %xmm4
	xorps	%xmm3, %xmm3
	cvtsd2ss	%xmm4, %xmm3
	movss	%xmm3, (%rax,%rdx,4)
	incq	%rdx
	cmpq	$200, %rdx
	jne	.LBB3_3
# %bb.4:                                #   in Loop: Header=BB3_2 Depth=1
	incq	%rcx
	addq	$10, %r15
	addq	$800, %rax                      # imm = 0x320
	cmpq	$100, %rcx
	jne	.LBB3_2
# %bb.5:                                # %.preheader107.preheader
	xorl	%eax, %eax
.LBB3_6:                                # %.preheader107
                                        # =>This Inner Loop Header: Depth=1
	movq	%rax, %xmm3
	punpckldq	%xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0],xmm3[1],xmm0[1]
	subpd	%xmm1, %xmm3
	movapd	%xmm3, %xmm4
	unpckhpd	%xmm3, %xmm4                    # xmm4 = xmm4[1],xmm3[1]
	addsd	%xmm3, %xmm4
	mulsd	%xmm2, %xmm4
	xorps	%xmm3, %xmm3
	cvtsd2ss	%xmm4, %xmm3
	movss	%xmm3, (%r14,%rax,4)
	incq	%rax
	cmpq	$200, %rax
	jne	.LBB3_6
# %bb.7:
.Ltmp6:
	movl	$400, %edi                      # imm = 0x190
	callq	_Znwm
.Ltmp7:
# %bb.8:
	movq	%rax, %r15
	movq	%rax, 56(%rsp)
	movq	%rax, %r12
	addq	$400, %r12                      # imm = 0x190
	movq	%r12, 72(%rsp)
	movl	$400, %edx                      # imm = 0x190
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	%r12, 64(%rsp)
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %r13
.Ltmp9:
	leaq	96(%rsp), %rdi
	leaq	32(%rsp), %rsi
	leaq	8(%rsp), %rdx
	movl	$100, %ecx
	movl	$200, %r8d
	callq	_Z5cpuMVRSt6vectorIfSaIfEES2_mm
.Ltmp10:
# %bb.9:                                # %_ZNSt6vectorIfSaIfEEaSEOS1_.exit
	movq	96(%rsp), %r12
	callq	_ZNSt6chrono3_V212system_clock3nowEv
	movq	%rax, %rbp
.Ltmp12:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp13:
# %bb.10:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	subq	%r13, %rbp
	movabsq	$2361183241434822607, %rcx      # imm = 0x20C49BA5E353F7CF
	movq	%rbp, %rax
	imulq	%rcx
	movq	%rdx, %rsi
	shrq	$63, %rsi
	sarq	$7, %rdx
	addq	%rdx, %rsi
.Ltmp14:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIlEERSoT_
.Ltmp15:
# %bb.11:                               # %_ZNSolsEl.exit
	movq	%rax, %r13
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r13, %rdi
.Ltmp16:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp17:
# %bb.12:                               # %.noexc
.Ltmp18:
	movsbl	%al, %esi
	movq	%r13, %rdi
	callq	_ZNSo3putEc
.Ltmp19:
# %bb.13:                               # %.noexc82
.Ltmp20:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp21:
# %bb.14:                               # %_ZNSolsEPFRSoS_E.exit
.Ltmp22:
	movl	$_ZSt4cout, %r13d
	movl	$_ZSt4cout, %edi
	movl	$.L.str.6, %esi
	movl	$14, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp23:
# %bb.15:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit55
	movq	_ZSt4cout(%rip), %rax
	addq	-24(%rax), %r13
.Ltmp24:
	movq	%r13, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp25:
# %bb.16:                               # %.noexc84
.Ltmp26:
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp27:
# %bb.17:                               # %.noexc85
.Ltmp28:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp29:
# %bb.18:                               # %_ZNSolsEPFRSoS_E.exit56
.Ltmp30:
	leaq	32(%rsp), %rdi
	leaq	8(%rsp), %rsi
	leaq	56(%rsp), %rdx
	movl	$100, %ecx
	movl	$200, %r8d
	callq	_Z5gpuMVRSt6vectorIfSaIfEES2_S2_mm
.Ltmp31:
# %bb.19:                               # %.preheader.preheader
	xorl	%r13d, %r13d
.LBB3_20:                               # %.preheader
                                        # =>This Inner Loop Header: Depth=1
	movss	(%r12,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	subss	(%r15,%r13,4), %xmm0
	andps	.LCPI3_3(%rip), %xmm0
	movaps	%xmm0, 80(%rsp)                 # 16-byte Spill
	ucomiss	.LCPI3_4(%rip), %xmm0
	jbe	.LBB3_32
# %bb.21:                               #   in Loop: Header=BB3_20 Depth=1
.Ltmp33:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.7, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp34:
# %bb.22:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit65
                                        #   in Loop: Header=BB3_20 Depth=1
.Ltmp35:
	movl	$_ZSt4cout, %edi
	movl	%r13d, %esi
	callq	_ZNSolsEi
.Ltmp36:
# %bb.23:                               #   in Loop: Header=BB3_20 Depth=1
.Ltmp37:
	movq	%rax, %rbp
	movl	$.L.str.8, %esi
	movl	$1, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp38:
# %bb.24:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit66
                                        #   in Loop: Header=BB3_20 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r12,%r13,4), %xmm0
.Ltmp39:
	movq	%rbp, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp40:
# %bb.25:                               # %_ZNSolsEf.exit
                                        #   in Loop: Header=BB3_20 Depth=1
.Ltmp41:
	movq	%rax, %rbp
	movl	$.L.str.9, %esi
	movl	$2, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp42:
# %bb.26:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit67
                                        #   in Loop: Header=BB3_20 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%r13,4), %xmm0
.Ltmp43:
	movq	%rbp, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp44:
# %bb.27:                               # %_ZNSolsEf.exit68
                                        #   in Loop: Header=BB3_20 Depth=1
.Ltmp45:
	movq	%rax, %rbp
	movl	$.L.str.10, %esi
	movl	$6, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp46:
# %bb.28:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit69
                                        #   in Loop: Header=BB3_20 Depth=1
	xorps	%xmm0, %xmm0
	cvtss2sd	80(%rsp), %xmm0                 # 16-byte Folded Reload
.Ltmp47:
	movq	%rbp, %rdi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp48:
# %bb.29:                               # %_ZNSolsEf.exit70
                                        #   in Loop: Header=BB3_20 Depth=1
	movq	%rax, %rbp
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
.Ltmp49:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp50:
# %bb.30:                               # %.noexc88
                                        #   in Loop: Header=BB3_20 Depth=1
.Ltmp51:
	movsbl	%al, %esi
	movq	%rbp, %rdi
	callq	_ZNSo3putEc
.Ltmp52:
# %bb.31:                               # %.noexc89
                                        #   in Loop: Header=BB3_20 Depth=1
.Ltmp53:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp54:
.LBB3_32:                               # %_ZNSolsEPFRSoS_E.exit71
                                        #   in Loop: Header=BB3_20 Depth=1
	incq	%r13
	cmpq	$100, %r13
	jne	.LBB3_20
# %bb.33:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit64
	movq	%r15, %rdi
	callq	_ZdlPv
	movq	%r12, %rdi
	callq	_ZdlPv
	movq	%r14, %rdi
	callq	_ZdlPv
	movq	%rbx, %rdi
	callq	_ZdlPv
	xorl	%eax, %eax
	addq	$120, %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
.LBB3_35:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit73.thread117
	.cfi_def_cfa_offset 176
.Ltmp11:
	movq	%rax, %r13
	movq	%r15, %rdi
	jmp	.LBB3_39
.LBB3_34:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit73.thread
.Ltmp8:
	movq	%rax, %r13
	jmp	.LBB3_40
.LBB3_42:
.Ltmp5:
	movq	%rax, %r13
	jmp	.LBB3_41
.LBB3_37:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit73
.Ltmp32:
	movq	%rax, %r13
	movq	%r15, %rdi
	callq	_ZdlPv
	testq	%r12, %r12
	jne	.LBB3_38
	jmp	.LBB3_40
.LBB3_36:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit73.thread121
.Ltmp55:
	movq	%rax, %r13
	movq	%r15, %rdi
	callq	_ZdlPv
.LBB3_38:
	movq	%r12, %rdi
.LBB3_39:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit75
	callq	_ZdlPv
.LBB3_40:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit75
	movq	%r14, %rdi
	callq	_ZdlPv
.LBB3_41:                               # %_ZNSt6vectorIfSaIfEED2Ev.exit79
	movq	%rbx, %rdi
	callq	_ZdlPv
	movq	%r13, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	main, .Lfunc_end3-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table3:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp3-.Lfunc_begin1           #   Call between .Lfunc_begin1 and .Ltmp3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp3-.Lfunc_begin1           # >> Call Site 2 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin1           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp4-.Lfunc_begin1           # >> Call Site 3 <<
	.uleb128 .Ltmp6-.Ltmp4                  #   Call between .Ltmp4 and .Ltmp6
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin1           # >> Call Site 4 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin1           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp7-.Lfunc_begin1           # >> Call Site 5 <<
	.uleb128 .Ltmp9-.Ltmp7                  #   Call between .Ltmp7 and .Ltmp9
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin1           # >> Call Site 6 <<
	.uleb128 .Ltmp10-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp10
	.uleb128 .Ltmp11-.Lfunc_begin1          #     jumps to .Ltmp11
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp12-.Lfunc_begin1          # >> Call Site 7 <<
	.uleb128 .Ltmp31-.Ltmp12                #   Call between .Ltmp12 and .Ltmp31
	.uleb128 .Ltmp32-.Lfunc_begin1          #     jumps to .Ltmp32
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp33-.Lfunc_begin1          # >> Call Site 8 <<
	.uleb128 .Ltmp54-.Ltmp33                #   Call between .Ltmp33 and .Ltmp54
	.uleb128 .Ltmp55-.Lfunc_begin1          #     jumps to .Ltmp55
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp54-.Lfunc_begin1          # >> Call Site 9 <<
	.uleb128 .Lfunc_end3-.Ltmp54            #   Call between .Ltmp54 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_,"axG",@progbits,_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_,comdat
	.weak	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_ # -- Begin function _ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
	.p2align	1, 0x90
	.type	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_,@function
_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_: # @_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
	.cfi_startproc
# %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	$24, %rsp
	.cfi_def_cfa_offset 80
	.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	%rdx, (%rsp)                    # 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movl	$1, %esi
	movl	$.L.str.11, %edx
	callq	_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc
	movq	(%rbx), %r13
	movq	8(%rbx), %r15
	movq	%r12, 8(%rsp)                   # 8-byte Spill
	subq	%r13, %r12
	movq	%r12, %r14
	sarq	$2, %r14
	testq	%rax, %rax
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	je	.LBB4_1
# %bb.2:
	movq	%rbx, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_ZNSt15__new_allocatorIfE8allocateEmPKv
	movq	%rax, %rbp
	jmp	.LBB4_3
.LBB4_1:
	xorl	%ebp, %ebp
.LBB4_3:                                # %_ZNSt12_Vector_baseIfSaIfEE11_M_allocateEm.exit
	movq	(%rsp), %rax                    # 8-byte Reload
	movss	(%rax), %xmm0                   # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rbp,%r14,4)
	testq	%r12, %r12
	jle	.LBB4_5
# %bb.4:
	movq	%rbp, %rdi
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	memmove@PLT
.LBB4_5:                                # %_ZNSt6vectorIfSaIfEE11_S_relocateEPfS2_S2_RS0_.exit
	addq	%rbp, %r12
	addq	$4, %r12
	movq	8(%rsp), %rsi                   # 8-byte Reload
	subq	%rsi, %r15
	testq	%r15, %r15
	jle	.LBB4_7
# %bb.6:
	movq	%r12, %rdi
	movq	%r15, %rdx
	callq	memmove@PLT
.LBB4_7:                                # %_ZNSt6vectorIfSaIfEE11_S_relocateEPfS2_S2_RS0_.exit16
	testq	%r13, %r13
	je	.LBB4_9
# %bb.8:
	movq	%r13, %rdi
	callq	_ZdlPv
.LBB4_9:                                # %_ZNSt12_Vector_baseIfSaIfEE13_M_deallocateEPfm.exit
	addq	%r15, %r12
	movq	%rbp, (%rbx)
	movq	%r12, 8(%rbx)
	movq	16(%rsp), %rax                  # 8-byte Reload
	leaq	(,%rax,4), %rax
	addq	%rbp, %rax
	movq	%rax, 16(%rbx)
	addq	$24, %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
.Lfunc_end4:
	.size	_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_, .Lfunc_end4-_ZNSt6vectorIfSaIfEE17_M_realloc_insertIJRKfEEEvN9__gnu_cxx17__normal_iteratorIPfS1_EEDpOT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc,"axG",@progbits,_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc,comdat
	.weak	_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc # -- Begin function _ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc
	.p2align	1, 0x90
	.type	_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc,@function
_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc: # @_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc
	.cfi_startproc
# %bb.0:
	movabsq	$2305843009213693951, %rcx      # imm = 0x1FFFFFFFFFFFFFFF
	movq	8(%rdi), %r8
	subq	(%rdi), %r8
	sarq	$2, %r8
	movq	%rcx, %rax
	subq	%r8, %rax
	cmpq	%rsi, %rax
	jb	.LBB5_2
# %bb.1:
	cmpq	%rsi, %r8
	cmovaq	%r8, %rsi
	leaq	(%rsi,%r8), %rax
	cmpq	%rcx, %rax
	cmovaeq	%rcx, %rax
	addq	%r8, %rsi
	cmovbq	%rcx, %rax
	retq
.LBB5_2:
	pushq	%rax
	.cfi_def_cfa_offset 16
	movq	%rdx, %rdi
	callq	_ZSt20__throw_length_errorPKc
.Lfunc_end5:
	.size	_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc, .Lfunc_end5-_ZNKSt6vectorIfSaIfEE12_M_check_lenEmPKc
	.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:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z6MVfuncPfS_S_mm, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_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	_Z6MVfuncPfS_S_mm,@object       # @_Z6MVfuncPfS_S_mm
	.section	.rodata,"a",@progbits
	.globl	_Z6MVfuncPfS_S_mm
	.p2align	3, 0x0
_Z6MVfuncPfS_S_mm:
	.quad	_Z21__device_stub__MVfuncPfS_S_mm
	.size	_Z6MVfuncPfS_S_mm, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Fatal error: %s at %s:%d\n"
	.size	.L.str, 26

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/wangzhezhe/parallelBLK/master/cuda/MVM/main_warp.hip"
	.size	.L.str.1, 115

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"memcpy to device time "
	.size	.L.str.2, 23

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"kernel time "
	.size	.L.str.3, 13

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"memcpy to host time "
	.size	.L.str.4, 21

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"cputime time "
	.size	.L.str.5, 14

	.type	.L.str.6,@object                # @.str.6
.L.str.6:
	.asciz	"gputime time: "
	.size	.L.str.6, 15

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

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

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

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	" diff "
	.size	.L.str.10, 7

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"vector::_M_realloc_insert"
	.size	.L.str.11, 26

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

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

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

	.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 _Z21__device_stub__MVfuncPfS_S_mm
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z6MVfuncPfS_S_mm
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z6MVfuncPfS_S_mm       ; -- Begin function _Z6MVfuncPfS_S_mm
	.globl	_Z6MVfuncPfS_S_mm
	.p2align	8
	.type	_Z6MVfuncPfS_S_mm,@function
_Z6MVfuncPfS_S_mm:                      ; @_Z6MVfuncPfS_S_mm
; %bb.0:
	s_clause 0x3
	s_load_b64 s[2:3], s[0:1], 0x20
	s_load_b32 s12, s[0:1], 0x28
	s_load_b32 s13, s[0:1], 0x34
	s_load_b256 s[4:11], s[0:1], 0x0
	s_mov_b32 s1, 0
	s_waitcnt lgkmcnt(0)
	v_cvt_f32_u32_e32 v1, s2
	v_cvt_f32_u32_e32 v2, s3
	s_and_b32 s0, s13, 0xffff
	s_mul_i32 s11, s2, s11
	s_mul_hi_u32 s13, s2, s10
	s_mul_i32 s16, s3, s10
	v_fmac_f32_e32 v1, 0x4f800000, v2
	s_mul_i32 s14, s12, s0
	s_mul_i32 s10, s2, s10
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_rcp_f32_e32 v1, v1
	s_waitcnt_depctr 0xfff
	v_mul_f32_e32 v3, 0x5f7ffffc, v1
	v_mul_f32_e32 v1, 0x2f800000, v3
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_trunc_f32_e32 v4, v1
	v_mad_u64_u32 v[1:2], null, s15, s0, v[0:1]
	v_mov_b32_e32 v2, 0
	s_add_i32 s0, s13, s11
	v_fmac_f32_e32 v3, 0xcf800000, v4
	v_cvt_u32_f32_e32 v7, v4
	s_add_i32 s11, s0, s16
	s_mov_b64 s[12:13], 0
                                        ; implicit-def: $sgpr15
	s_delay_alu instid0(VALU_DEP_2)
	v_cvt_u32_f32_e32 v0, v3
.LBB0_1:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	v_mad_u64_u32 v[3:4], null, s12, s14, v[1:2]
	s_or_b32 s15, s15, exec_lo
	s_mov_b32 s16, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[5:6], null, s13, s14, v[4:5]
	v_mov_b32_e32 v4, v5
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_u64_e64 s[10:11], v[3:4]
	s_cbranch_execz .LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	s_sub_u32 s0, 0, s2
	s_subb_u32 s17, 0, s3
	v_mul_hi_u32 v5, s0, v0
	v_mul_lo_u32 v6, s0, v7
	v_mul_lo_u32 v8, s17, v0
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v5, v5, v6
	v_mul_lo_u32 v6, s0, v0
	v_add_nc_u32_e32 v5, v5, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v8, v0, v6
	v_mul_lo_u32 v9, v0, v5
	v_mul_hi_u32 v10, v0, v5
	v_mul_hi_u32 v11, v7, v6
	v_mul_lo_u32 v6, v7, v6
	v_mul_hi_u32 v12, v7, v5
	v_mul_lo_u32 v5, v7, v5
	v_add_co_u32 v8, vcc_lo, v8, v9
	v_add_co_ci_u32_e32 v9, vcc_lo, 0, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v6, vcc_lo, v8, v6
	v_add_co_ci_u32_e32 v6, vcc_lo, v9, v11, vcc_lo
	v_add_co_ci_u32_e32 v8, vcc_lo, 0, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, v6, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, v0, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, v7, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v8, s0, v5
	v_mul_lo_u32 v10, s17, v5
	v_mul_lo_u32 v9, s0, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_add_nc_u32_e32 v8, v8, v9
	v_mul_lo_u32 v9, s0, v5
	v_add_nc_u32_e32 v8, v8, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_hi_u32 v10, v5, v9
	v_mul_lo_u32 v11, v5, v8
	v_mul_hi_u32 v12, v5, v8
	v_mul_hi_u32 v13, v6, v9
	v_mul_lo_u32 v9, v6, v9
	v_mul_hi_u32 v14, v6, v8
	v_mul_lo_u32 v8, v6, v8
	v_add_co_u32 v10, vcc_lo, v10, v11
	v_add_co_ci_u32_e32 v11, vcc_lo, 0, v12, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v9, vcc_lo, v10, v9
	v_add_co_ci_u32_e32 v9, vcc_lo, v11, v13, vcc_lo
	v_add_co_ci_u32_e32 v10, vcc_lo, 0, v14, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, v9, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, 0, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v10, vcc_lo, v5, v8
	v_add_co_ci_u32_e32 v12, vcc_lo, v6, v9, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_hi_u32 v13, v3, v10
	v_mad_u64_u32 v[8:9], null, v4, v10, 0
	v_mad_u64_u32 v[5:6], null, v3, v12, 0
	v_mad_u64_u32 v[10:11], null, v4, v12, 0
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v5, vcc_lo, v13, v5
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v5, vcc_lo, v5, v8
	v_add_co_ci_u32_e32 v5, vcc_lo, v6, v9, vcc_lo
	v_add_co_ci_u32_e32 v6, vcc_lo, 0, v11, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v8, vcc_lo, v5, v10
	v_add_co_ci_u32_e32 v9, vcc_lo, 0, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_mul_lo_u32 v10, s3, v8
	v_mad_u64_u32 v[5:6], null, s2, v8, 0
	v_mul_lo_u32 v11, s2, v9
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_sub_co_u32 v5, vcc_lo, v3, v5
	v_add3_u32 v6, v6, v11, v10
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_sub_nc_u32_e32 v10, v4, v6
	v_subrev_co_ci_u32_e64 v10, s0, s3, v10, vcc_lo
	v_add_co_u32 v11, s0, v8, 2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e64 v12, s0, 0, v9, s0
	v_sub_co_u32 v13, s0, v5, s2
	v_sub_co_ci_u32_e32 v6, vcc_lo, v4, v6, vcc_lo
	v_subrev_co_ci_u32_e64 v10, s0, 0, v10, s0
	v_cmp_le_u32_e32 vcc_lo, s2, v13
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_cmp_eq_u32_e64 s0, s3, v6
	v_cndmask_b32_e64 v13, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s3, v10
	v_cndmask_b32_e64 v14, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s2, v5
	v_cndmask_b32_e64 v5, 0, -1, vcc_lo
	v_cmp_le_u32_e32 vcc_lo, s3, v6
	v_cndmask_b32_e64 v15, 0, -1, vcc_lo
	v_cmp_eq_u32_e32 vcc_lo, s3, v10
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_cndmask_b32_e64 v5, v15, v5, s0
	v_cndmask_b32_e32 v10, v14, v13, vcc_lo
	v_add_co_u32 v13, vcc_lo, v8, 1
	v_add_co_ci_u32_e32 v14, vcc_lo, 0, v9, vcc_lo
	v_cmp_ne_u32_e32 vcc_lo, 0, v10
	s_mov_b32 s0, 0
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v10, v13, v11, vcc_lo
	v_cndmask_b32_e32 v6, v14, v12, vcc_lo
	v_cmp_ne_u32_e32 vcc_lo, 0, v5
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_cndmask_b32_e32 v5, v8, v10, vcc_lo
	v_cndmask_b32_e32 v6, v9, v6, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mul_lo_u32 v11, v5, s3
	v_mul_lo_u32 v10, v6, s2
	v_mad_u64_u32 v[8:9], null, v5, s2, 0
	v_lshlrev_b64 v[5:6], 2, v[5:6]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add3_u32 v9, v9, v11, v10
	v_sub_co_u32 v8, vcc_lo, v3, v8
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_sub_co_ci_u32_e32 v9, vcc_lo, v4, v9, vcc_lo
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	v_lshlrev_b64 v[8:9], 2, v[8:9]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_u32 v3, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v8, vcc_lo, s6, v8
	v_add_co_ci_u32_e32 v9, vcc_lo, s7, v9, vcc_lo
	global_load_b32 v10, v[3:4], off
	global_load_b32 v8, v[8:9], off
	v_add_co_u32 v3, vcc_lo, s8, v5
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v6, vcc_lo
	global_load_b32 v6, v[3:4], off
	s_waitcnt vmcnt(1)
	v_mul_f32_e32 v8, v10, v8
.LBB0_3:                                ; %atomicrmw.start
                                        ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	s_waitcnt vmcnt(0)
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f32_e32 v5, v6, v8
	global_atomic_cmpswap_b32 v5, v[3:4], v[5:6], off glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u32_e32 vcc_lo, v5, v6
	v_mov_b32_e32 v6, v5
	s_or_b32 s0, vcc_lo, s0
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s0
	s_cbranch_execnz .LBB0_3
; %bb.4:                                ; %atomicrmw.end
                                        ;   in Loop: Header=BB0_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s0
	s_add_u32 s12, s12, 1
	s_addc_u32 s13, s13, 0
	s_and_not1_b32 s15, s15, exec_lo
.LBB0_5:                                ; %Flow
                                        ;   in Loop: Header=BB0_1 Depth=1
	s_or_b32 exec_lo, exec_lo, s16
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s0, exec_lo, s15
	s_or_b32 s1, s0, s1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB0_1
; %bb.6:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z6MVfuncPfS_S_mm
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 296
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 16
		.amdhsa_next_free_sgpr 18
		.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	_Z6MVfuncPfS_S_mm, .Lfunc_end0-_Z6MVfuncPfS_S_mm
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 1136
; NumSgprs: 20
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 20
; NumVGPRsForWavesPerEU: 16
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           8
        .value_kind:     by_value
      - .offset:         32
        .size:           8
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z6MVfuncPfS_S_mm
    .private_segment_fixed_size: 0
    .sgpr_count:     20
    .sgpr_spill_count: 0
    .symbol:         _Z6MVfuncPfS_S_mm.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
