#include<bits/stdc++.h>
using namespace std;
#define BLOCK_SIZE 256

__global__ void type1(int n, double lr, double lambda, double * W) {
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    for (int i=index;i<n;i+=stride) {
        W[i] = (1.0 - lr* lambda) * W[i];
    }
}

__global__ void type2(int n, double lr, double lambda, double * W, int rand_choice, double * X, double * Y) {
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    for (int i=index;i<n;i+=stride) {
        W[i] = (1.0 - lr* lambda) * W[i] + (lr * Y[rand_choice])*X[rand_choice * n + i];
    }
}

__device__ double atomicAddDouble(double* address, double val)
{
    unsigned long long int* address_as_ull = (unsigned long long int*)address;
    unsigned long long int old = *address_as_ull, assumed;
    do {
        assumed = old;
	    old = atomicCAS(address_as_ull, assumed,
        __double_as_longlong(val + __longlong_as_double(assumed)));
    } while (assumed != old);
    return __longlong_as_double(old);
}

__global__ void dot(int n, double * W, double *X, int rand_choice, double * res) {
   __shared__ double temp[BLOCK_SIZE];
   int index = blockIdx.x * blockDim.x + threadIdx.x;
   if (index < n)   temp[threadIdx.x] = W[index] * X[rand_choice * n + index];
   else             temp[threadIdx.x] = 0;
   __syncthreads();
   if (threadIdx.x == 0){
       double sum = 0;
       for (int i=0;i<BLOCK_SIZE;i++) sum += temp[i];
       atomicAddDouble(res, sum);
   }
}


int main() {
    srand(time(NULL));
    ifstream  trainfile ("train.txt");
    ifstream labelfile ("labels.txt");
    int n_samples=200;
    int n_features=50000;

    double *W, *X, *Y, *res;
    double *d_W, *d_X, *d_Y, *d_res;
    cudaEvent_t start, stop;
    float elapsedTime;
    
    W = (double *) malloc(n_features * sizeof(double));
    X = (double *) malloc(n_samples * n_features * sizeof(double));
    Y = (double *) malloc(n_samples * sizeof(double));
    res = (double *) malloc(sizeof(double));

    cudaMalloc(&d_W, n_features * sizeof(double));
    cudaMalloc(&d_X, n_samples * n_features * sizeof(double));
    cudaMalloc(&d_Y, n_samples * sizeof(double));
    cudaMalloc(&d_res, sizeof(double));
    
    for (int i=0;i<n_samples;i++) {
		for (int j=0;j<n_features;j++)
			trainfile >> X[i*n_features + j];
    }
	for (int i=0;i<n_samples;i++) {
		labelfile >> Y[i];
		if (Y[i] == 0) {
			Y[i] = -1;
		}
	}
    for (int i=0;i<n_features;i++)  W[i] = 0;

    cudaMemcpy(d_X, X, n_samples * n_features * sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(d_W, W, n_features * sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(d_Y, Y, n_samples * sizeof(double), cudaMemcpyHostToDevice);
    cudaMemcpy(d_W, W, n_features * sizeof(double), cudaMemcpyHostToDevice);

    int num_iters = 100;
    double lambda = 1.0;
    cudaEventCreate(&start);
    cudaEventRecord(start,0);
    for (int iters=1;iters<=num_iters;iters++) {
    	int numBlocks = (n_features + BLOCK_SIZE - 1) / BLOCK_SIZE;
        double lr = 1.0 / (lambda * iters);
        int rand_choice = rand() % n_samples;
        cout << rand_choice << endl;
 	   	*res = 0;
 	    cudaMemcpy(d_res, res, sizeof(double), cudaMemcpyHostToDevice);
 	    dot<<<numBlocks, BLOCK_SIZE>>>(n_features, d_W, d_X, rand_choice, d_res);
 	    cudaMemcpy(res, d_res, sizeof(double), cudaMemcpyDeviceToHost);
	    if (Y[rand_choice] * res[0] >= 1.0)
	        type1<<<numBlocks, BLOCK_SIZE>>>(n_features, lr, lambda, d_W);
	    else
	        type2<<<numBlocks, BLOCK_SIZE>>>(n_features, lr, lambda, d_W, rand_choice, d_X, d_Y);
        cudaMemcpy(W, d_W, n_features * sizeof(double), cudaMemcpyDeviceToHost);
    }
    cudaMemcpy(W, d_W, n_features * sizeof(double), cudaMemcpyDeviceToHost);
    
    cudaEventCreate(&stop);
    cudaEventRecord(stop,0);
    cudaEventSynchronize(stop);
    cudaEventElapsedTime(&elapsedTime, start,stop);

    cout << "Train time " << elapsedTime << endl;
    double correct = 0.0;
    for (int i=0;i<n_samples;i++) {
        double val = 0.0;
        for (int j=0;j<n_features;j++)
            val += W[j] * X[i * n_features + j];
        if (val * Y[i] >= 0)
            correct += 1;
    }
    cout << "Correct " << correct << endl;
    printf("Accuracy %lf\n", correct / n_samples);
    return 0;
}

	.file	"tmpxft_00256c69_00000000-6_cuda.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB10829:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE10829:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z15atomicAddDoublePdd
	.type	_Z15atomicAddDoublePdd, @function
_Z15atomicAddDoublePdd:
.LFB10825:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE10825:
	.size	_Z15atomicAddDoublePdd, .-_Z15atomicAddDoublePdd
	.globl	_Z27__device_stub__Z5type1iddPdiddPd
	.type	_Z27__device_stub__Z5type1iddPdiddPd, @function
_Z27__device_stub__Z5type1iddPdiddPd:
.LFB10851:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	48(%rsp), %rcx
	leaq	40(%rsp), %rdx
	movq	%rsi, (%rsp)
	leaq	56(%rsp), %rdi
	leaq	68(%rsp), %rsi
	movsd	%xmm0, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L4
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z5type1iddPd(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L4:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE10851:
	.size	_Z27__device_stub__Z5type1iddPdiddPd, .-_Z27__device_stub__Z5type1iddPdiddPd
	.globl	_Z5type1iddPd
	.type	_Z5type1iddPd, @function
_Z5type1iddPd:
.LFB10852:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z5type1iddPdiddPd
	.cfi_endproc
.LFE10852:
	.size	_Z5type1iddPd, .-_Z5type1iddPd
	.globl	_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_
	.type	_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_, @function
_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_:
.LFB10853:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movl	%edi, 44(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	76(%rsp), %rsi
	movl	%edx, 40(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 8(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, (%rsp)
	movsd	%xmm0, 32(%rsp)
	movsd	%xmm1, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	44(%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	40(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	%rsp, %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L10
	pushq	56(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z5type2iddPdiS_S_(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 208
	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 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L10:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE10853:
	.size	_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_, .-_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_
	.globl	_Z5type2iddPdiS_S_
	.type	_Z5type2iddPdiS_S_, @function
_Z5type2iddPdiS_S_:
.LFB10854:
	.cfi_startproc
	endbr64
	jmp	_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_
	.cfi_endproc
.LFE10854:
	.size	_Z5type2iddPdiS_S_, .-_Z5type2iddPdiS_S_
	.globl	_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_
	.type	_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_, @function
_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_:
.LFB10855:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movl	%edi, 28(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, 24(%rsp)
	leaq	40(%rsp), %rcx
	movq	%r8, (%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	16(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%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	.L15
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z3dotiPdS_iS_(%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
.L15:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE10855:
	.size	_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_, .-_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_
	.globl	_Z3dotiPdS_iS_
	.type	_Z3dotiPdS_iS_, @function
_Z3dotiPdS_iS_:
.LFB10856:
	.cfi_startproc
	endbr64
	jmp	_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_
	.cfi_endproc
.LFE10856:
	.size	_Z3dotiPdS_iS_, .-_Z3dotiPdS_iS_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z3dotiPdS_iS_"
.LC1:
	.string	"_Z5type2iddPdiS_S_"
.LC2:
	.string	"_Z5type1iddPd"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB10858:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z3dotiPdS_iS_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC1(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z5type2iddPdiS_S_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC2(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z5type1iddPd(%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
.LFE10858:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata.str1.1
.LC4:
	.string	"train.txt"
.LC5:
	.string	"labels.txt"
.LC8:
	.string	"Train time "
.LC9:
	.string	"Correct "
.LC11:
	.string	"Accuracy %lf\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB10826:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA10826
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%edi, %edi
	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	$1160, %rsp
	.cfi_def_cfa_offset 1216
	movq	%fs:40, %rax
	movq	%rax, 1144(%rsp)
	xorl	%eax, %eax
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
	leaq	104(%rsp), %rax
	movl	$8, %edx
	leaq	.LC4(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB0:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE0:
	leaq	624(%rsp), %rax
	movl	$8, %edx
	leaq	.LC5(%rip), %rsi
	movq	%rax, %rdi
	movq	%rax, 16(%rsp)
.LEHB1:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode@PLT
.LEHE1:
	movl	$400000, %edi
	call	malloc@PLT
	movl	$80000000, %edi
	movq	%rax, %r14
	call	malloc@PLT
	movl	$1600, %edi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movl	$8, %edi
	movq	%rax, %rbx
	call	malloc@PLT
	leaq	32(%rsp), %rdi
	movl	$400000, %esi
	movq	%rax, %rbp
.LEHB2:
	call	cudaMalloc@PLT
	leaq	40(%rsp), %rdi
	movl	$80000000, %esi
	call	cudaMalloc@PLT
	leaq	48(%rsp), %rdi
	movl	$1600, %esi
	call	cudaMalloc@PLT
	leaq	56(%rsp), %rdi
	movl	$8, %esi
	call	cudaMalloc@PLT
	movq	(%rsp), %r12
	xorl	%r15d, %r15d
.L23:
	movl	$50000, 28(%rsp)
	movq	%r12, %r13
.L24:
	movq	8(%rsp), %rdi
	movq	%r13, %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	addq	$8, %r13
	decl	28(%rsp)
	jne	.L24
	addl	$50000, %r15d
	addq	$400000, %r12
	cmpl	$10000000, %r15d
	jne	.L23
	movq	%rbx, %r12
	leaq	1600(%rbx), %r13
.L28:
	movq	16(%rsp), %rdi
	movq	%r12, %rsi
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	xorps	%xmm0, %xmm0
	ucomisd	(%r12), %xmm0
	jp	.L26
	jne	.L26
	movq	.LC6(%rip), %rax
	movq	%rax, (%r12)
.L26:
	addq	$8, %r12
	cmpq	%r12, %r13
	jne	.L28
	movl	$100000, %ecx
	xorl	%eax, %eax
	movq	%r14, %rdi
	movq	(%rsp), %rsi
	rep stosl
	movq	40(%rsp), %rdi
	movl	$1, %ecx
	movl	$80000000, %edx
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movl	$400000, %edx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movl	$1600, %edx
	movq	%rbx, %rsi
	call	cudaMemcpy@PLT
	movq	32(%rsp), %rdi
	movl	$1, %ecx
	movl	$400000, %edx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movl	$1, %r12d
.L35:
	cvtsi2sdl	%r12d, %xmm0
	movsd	.LC7(%rip), %xmm3
	divsd	%xmm0, %xmm3
	movq	%xmm3, %r15
	call	rand@PLT
	movl	$200, %ecx
	leaq	_ZSt4cout(%rip), %rdi
	cltd
	idivl	%ecx
	movl	%edx, %esi
	movl	%edx, %r13d
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	movq	$0x000000000, 0(%rbp)
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%rbp, %rsi
	movl	$8, %edx
	call	cudaMemcpy@PLT
	movl	$16777217, %edx
	movl	$1073741873, %edi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$8, %rdx
	salq	$2, %rdi
	movl	$1, %ecx
	movl	$1, %esi
	movq	%rdx, 88(%rsp)
	movl	$1, 96(%rsp)
	movq	%rdi, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPushCallConfiguration@PLT
	movq	56(%rsp), %r8
	testl	%eax, %eax
	jne	.L29
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	movl	%r13d, %ecx
	movl	$50000, %edi
	call	_Z28__device_stub__Z3dotiPdS_iS_iPdS_iS_
.L29:
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movl	$8, %edx
	movq	%rbp, %rdi
	call	cudaMemcpy@PLT
	movslq	%r13d, %rax
	movl	$1, 96(%rsp)
	movabsq	$4294967552, %rdx
	movabsq	$4294967492, %rdi
	movsd	(%rbx,%rax,8), %xmm0
	mulsd	0(%rbp), %xmm0
	movq	%rdx, 88(%rsp)
	movl	$0, %r9d
	movq	%rdi, 76(%rsp)
	movl	$1, %ecx
	movl	$1, %esi
	movl	$0, %r8d
	comisd	.LC7(%rip), %xmm0
	movl	$1, 84(%rsp)
	jb	.L55
	call	__cudaPushCallConfiguration@PLT
	movq	32(%rsp), %rsi
	testl	%eax, %eax
	jne	.L33
	movsd	.LC7(%rip), %xmm1
	movq	%r15, %xmm0
	movl	$50000, %edi
	call	_Z27__device_stub__Z5type1iddPdiddPd
	jmp	.L33
.L55:
	call	__cudaPushCallConfiguration@PLT
	movq	32(%rsp), %rsi
	testl	%eax, %eax
	jne	.L33
	movq	48(%rsp), %r8
	movq	40(%rsp), %rcx
	movl	%r13d, %edx
	movq	%r15, %xmm0
	movsd	.LC7(%rip), %xmm1
	movl	$50000, %edi
	call	_Z32__device_stub__Z5type2iddPdiS_S_iddPdiS_S_
.L33:
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movl	$400000, %edx
	movq	%r14, %rdi
	call	cudaMemcpy@PLT
	incl	%r12d
	cmpl	$101, %r12d
	jne	.L35
	movq	32(%rsp), %rsi
	movl	$2, %ecx
	movl	$400000, %edx
	movq	%r14, %rdi
	call	cudaMemcpy@PLT
	leaq	88(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	88(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	88(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	88(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	76(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	_ZSt4cout(%rip), %rbp
	leaq	.LC8(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	cvtss2sd	76(%rsp), %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	xorl	%edx, %edx
	xorl	%r12d, %r12d
	xorps	%xmm2, %xmm2
.L36:
	imulq	$400000, %rdx, %rcx
	movq	(%rsp), %rax
	xorps	%xmm0, %xmm0
	addq	%rax, %rcx
	xorl	%eax, %eax
.L37:
	movsd	(%r14,%rax), %xmm1
	mulsd	(%rcx,%rax), %xmm1
	addq	$8, %rax
	addsd	%xmm1, %xmm0
	cmpq	$400000, %rax
	jne	.L37
	mulsd	(%rbx,%rdx,8), %xmm0
	comisd	%xmm2, %xmm0
	jb	.L38
	movq	%r12, %xmm4
	addsd	.LC7(%rip), %xmm4
	movq	%xmm4, %r12
.L38:
	incq	%rdx
	cmpq	$200, %rdx
	jne	.L36
	leaq	.LC9(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movq	%r12, %xmm0
	call	_ZNSo9_M_insertIdEERSoT_@PLT
	movq	%rax, %rdi
	call	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@PLT
	leaq	.LC11(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	movq	%r12, %xmm0
	divsd	.LC10(%rip), %xmm0
	call	__printf_chk@PLT
.LEHE2:
	leaq	624(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	leaq	104(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1144(%rsp), %rax
	subq	%fs:40, %rax
	je	.L44
	jmp	.L57
.L47:
	endbr64
	movq	%rax, %rbx
.L41:
	movq	16(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	jmp	.L42
.L46:
	endbr64
	movq	%rax, %rbx
.L42:
	movq	8(%rsp), %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	1144(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L57
	movq	%rbx, %rdi
.LEHB3:
	call	_Unwind_Resume@PLT
.LEHE3:
.L57:
	call	__stack_chk_fail@PLT
.L44:
	addq	$1160, %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
.LFE10826:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA10826:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE10826-.LLSDACSB10826
.LLSDACSB10826:
	.uleb128 .LEHB0-.LFB10826
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB10826
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L46-.LFB10826
	.uleb128 0
	.uleb128 .LEHB2-.LFB10826
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L47-.LFB10826
	.uleb128 0
	.uleb128 .LEHB3-.LFB10826
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
.LLSDACSE10826:
	.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
.LC6:
	.long	0
	.long	-1074790400
	.align 8
.LC7:
	.long	0
	.long	1072693248
	.align 8
.LC10:
	.long	0
	.long	1080623104
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include<bits/stdc++.h>
using namespace std;
#define BLOCK_SIZE 256

__global__ void type1(int n, double lr, double lambda, double * W) {
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    for (int i=index;i<n;i+=stride) {
        W[i] = (1.0 - lr* lambda) * W[i];
    }
}

__global__ void type2(int n, double lr, double lambda, double * W, int rand_choice, double * X, double * Y) {
    int index = blockIdx.x * blockDim.x + threadIdx.x;
    int stride = blockDim.x * gridDim.x;
    for (int i=index;i<n;i+=stride) {
        W[i] = (1.0 - lr* lambda) * W[i] + (lr * Y[rand_choice])*X[rand_choice * n + i];
    }
}

__device__ double atomicAddDouble(double* address, double val)
{
    unsigned long long int* address_as_ull = (unsigned long long int*)address;
    unsigned long long int old = *address_as_ull, assumed;
    do {
        assumed = old;
	    old = atomicCAS(address_as_ull, assumed,
        __double_as_longlong(val + __longlong_as_double(assumed)));
    } while (assumed != old);
    return __longlong_as_double(old);
}

__global__ void dot(int n, double * W, double *X, int rand_choice, double * res) {
   __shared__ double temp[BLOCK_SIZE];
   int index = blockIdx.x * blockDim.x + threadIdx.x;
   if (index < n)   temp[threadIdx.x] = W[index] * X[rand_choice * n + index];
   else             temp[threadIdx.x] = 0;
   __syncthreads();
   if (threadIdx.x == 0){
       double sum = 0;
       for (int i=0;i<BLOCK_SIZE;i++) sum += temp[i];
       atomicAddDouble(res, sum);
   }
}


int main() {
    srand(time(NULL));
    ifstream  trainfile ("train.txt");
    ifstream labelfile ("labels.txt");
    int n_samples=200;
    int n_features=50000;

    double *W, *X, *Y, *res;
    double *d_W, *d_X, *d_Y, *d_res;
    hipEvent_t start, stop;
    float elapsedTime;
    
    W = (double *) malloc(n_features * sizeof(double));
    X = (double *) malloc(n_samples * n_features * sizeof(double));
    Y = (double *) malloc(n_samples * sizeof(double));
    res = (double *) malloc(sizeof(double));

    hipMalloc(&d_W, n_features * sizeof(double));
    hipMalloc(&d_X, n_samples * n_features * sizeof(double));
    hipMalloc(&d_Y, n_samples * sizeof(double));
    hipMalloc(&d_res, sizeof(double));
    
    for (int i=0;i<n_samples;i++) {
		for (int j=0;j<n_features;j++)
			trainfile >> X[i*n_features + j];
    }
	for (int i=0;i<n_samples;i++) {
		labelfile >> Y[i];
		if (Y[i] == 0) {
			Y[i] = -1;
		}
	}
    for (int i=0;i<n_features;i++)  W[i] = 0;

    hipMemcpy(d_X, X, n_samples * n_features * sizeof(double), hipMemcpyHostToDevice);
    hipMemcpy(d_W, W, n_features * sizeof(double), hipMemcpyHostToDevice);
    hipMemcpy(d_Y, Y, n_samples * sizeof(double), hipMemcpyHostToDevice);
    hipMemcpy(d_W, W, n_features * sizeof(double), hipMemcpyHostToDevice);

    int num_iters = 100;
    double lambda = 1.0;
    hipEventCreate(&start);
    hipEventRecord(start,0);
    for (int iters=1;iters<=num_iters;iters++) {
    	int numBlocks = (n_features + BLOCK_SIZE - 1) / BLOCK_SIZE;
        double lr = 1.0 / (lambda * iters);
        int rand_choice = rand() % n_samples;
        cout << rand_choice << endl;
 	   	*res = 0;
 	    hipMemcpy(d_res, res, sizeof(double), hipMemcpyHostToDevice);
 	    dot<<<numBlocks, BLOCK_SIZE>>>(n_features, d_W, d_X, rand_choice, d_res);
 	    hipMemcpy(res, d_res, sizeof(double), hipMemcpyDeviceToHost);
	    if (Y[rand_choice] * res[0] >= 1.0)
	        type1<<<numBlocks, BLOCK_SIZE>>>(n_features, lr, lambda, d_W);
	    else
	        type2<<<numBlocks, BLOCK_SIZE>>>(n_features, lr, lambda, d_W, rand_choice, d_X, d_Y);
        hipMemcpy(W, d_W, n_features * sizeof(double), hipMemcpyDeviceToHost);
    }
    hipMemcpy(W, d_W, n_features * sizeof(double), hipMemcpyDeviceToHost);
    
    hipEventCreate(&stop);
    hipEventRecord(stop,0);
    hipEventSynchronize(stop);
    hipEventElapsedTime(&elapsedTime, start,stop);

    cout << "Train time " << elapsedTime << endl;
    double correct = 0.0;
    for (int i=0;i<n_samples;i++) {
        double val = 0.0;
        for (int j=0;j<n_features;j++)
            val += W[j] * X[i * n_features + j];
        if (val * Y[i] >= 0)
            correct += 1;
    }
    cout << "Correct " << correct << endl;
    printf("Accuracy %lf\n", correct / n_samples);
    return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z20__device_stub__type1iddPd   # -- Begin function _Z20__device_stub__type1iddPd
	.type	_Z20__device_stub__type1iddPd,@function
_Z20__device_stub__type1iddPd:          # @_Z20__device_stub__type1iddPd
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rcx
	movsd	%xmm0, (%rcx)
	leaq	32(%rsp), %rdx
	movsd	%xmm1, (%rdx)
	leaq	24(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rcx, 8(%rbx)
	movq	%rdx, 16(%rbx)
	movq	%rdi, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z5type1iddPd, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z20__device_stub__type1iddPd, .Lfunc_end0-_Z20__device_stub__type1iddPd
	.cfi_endproc
                                        # -- End function
	.globl	_Z20__device_stub__type2iddPdiS_S_ # -- Begin function _Z20__device_stub__type2iddPdiS_S_
	.type	_Z20__device_stub__type2iddPdiS_S_,@function
_Z20__device_stub__type2iddPdiS_S_:     # @_Z20__device_stub__type2iddPdiS_S_
	.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	$160, %rsp
	.cfi_def_cfa_offset 208
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	56(%rsp), %rdi
	movsd	%xmm0, (%rdi)
	leaq	48(%rsp), %r9
	movsd	%xmm1, (%r9)
	leaq	40(%rsp), %r10
	movq	%rsi, (%r10)
	movq	%rsp, %rsi
	movl	%edx, (%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	%r9, 16(%rbx)
	movq	%r10, 24(%rbx)
	movq	%rsi, 32(%rbx)
	movq	%rdx, 40(%rbx)
	movq	%rcx, 48(%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	$_Z5type2iddPdiS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$176, %rsp
	.cfi_adjust_cfa_offset -176
	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	_Z20__device_stub__type2iddPdiS_S_, .Lfunc_end1-_Z20__device_stub__type2iddPdiS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z18__device_stub__dotiPdS_iS_  # -- Begin function _Z18__device_stub__dotiPdS_iS_
	.type	_Z18__device_stub__dotiPdS_iS_,@function
_Z18__device_stub__dotiPdS_iS_:         # @_Z18__device_stub__dotiPdS_iS_
	.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	4(%rsp), %rax
	movl	%edi, (%rax)
	leaq	40(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	32(%rsp), %rsi
	movq	%rdx, (%rsi)
	movq	%rsp, %rdx
	movl	%ecx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%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	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	$_Z3dotiPdS_iS_, %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_end2:
	.size	_Z18__device_stub__dotiPdS_iS_, .Lfunc_end2-_Z18__device_stub__dotiPdS_iS_
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI3_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI3_1:
	.quad	0x4069000000000000              # double 200
.LCPI3_2:
	.quad	0x0000000000000000              # double 0
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$1128, %rsp                     # imm = 0x468
	.cfi_def_cfa_offset 1184
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	leaq	608(%rsp), %rdi
	movl	$.L.str, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp0:
	leaq	88(%rsp), %rdi
	movl	$.L.str.1, %esi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode
.Ltmp1:
# %bb.1:
	movl	$400000, %edi                   # imm = 0x61A80
	callq	malloc
	movq	%rax, %rbx
	movl	$80000000, %edi                 # imm = 0x4C4B400
	callq	malloc
	movq	%rax, %r14
	movl	$1600, %edi                     # imm = 0x640
	callq	malloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	movl	$8, %edi
	callq	malloc
	movq	%rax, %r15
.Ltmp3:
	movq	%rsp, %rdi
	movl	$400000, %esi                   # imm = 0x61A80
	callq	hipMalloc
.Ltmp4:
# %bb.2:                                # %_ZL9hipMallocIdE10hipError_tPPT_m.exit
.Ltmp5:
	leaq	48(%rsp), %rdi
	movl	$80000000, %esi                 # imm = 0x4C4B400
	callq	hipMalloc
.Ltmp6:
# %bb.3:                                # %_ZL9hipMallocIdE10hipError_tPPT_m.exit122
.Ltmp7:
	leaq	72(%rsp), %rdi
	movl	$1600, %esi                     # imm = 0x640
	callq	hipMalloc
.Ltmp8:
# %bb.4:                                # %_ZL9hipMallocIdE10hipError_tPPT_m.exit123
.Ltmp9:
	leaq	40(%rsp), %rdi
	movl	$8, %esi
	callq	hipMalloc
.Ltmp10:
# %bb.5:                                # %.preheader157.preheader
	movq	%r15, 80(%rsp)                  # 8-byte Spill
	xorl	%r15d, %r15d
	leaq	608(%rsp), %r13
	movq	%r14, %rbp
.LBB3_6:                                # %.preheader157
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_7 Depth 2
	xorl	%r12d, %r12d
.LBB3_7:                                #   Parent Loop BB3_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	leaq	(%r12,%rbp), %rsi
.Ltmp11:
	movq	%r13, %rdi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp12:
# %bb.8:                                # %_ZNSirsERd.exit
                                        #   in Loop: Header=BB3_7 Depth=2
	addq	$8, %r12
	cmpq	$400000, %r12                   # imm = 0x61A80
	jne	.LBB3_7
# %bb.9:                                # %_ZL9hipMallocIdE10hipError_tPPT_m.exit124
                                        #   in Loop: Header=BB3_6 Depth=1
	incq	%r15
	addq	$400000, %rbp                   # imm = 0x61A80
	cmpq	$200, %r15
	jne	.LBB3_6
# %bb.10:                               # %.preheader156.preheader
	xorl	%r15d, %r15d
	leaq	88(%rsp), %r13
	movq	80(%rsp), %r12                  # 8-byte Reload
.LBB3_11:                               # %.preheader156
                                        # =>This Inner Loop Header: Depth=1
	movq	8(%rsp), %rax                   # 8-byte Reload
	leaq	(%rax,%r15), %rbp
.Ltmp14:
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp15:
# %bb.12:                               # %_ZNSirsERd.exit125
                                        #   in Loop: Header=BB3_11 Depth=1
	movsd	(%rbp), %xmm0                   # xmm0 = mem[0],zero
	ucomisd	.LCPI3_2(%rip), %xmm0
	jne	.LBB3_14
	jp	.LBB3_14
# %bb.13:                               #   in Loop: Header=BB3_11 Depth=1
	movabsq	$-4616189618054758400, %rax     # imm = 0xBFF0000000000000
	movq	%rax, (%rbp)
.LBB3_14:                               #   in Loop: Header=BB3_11 Depth=1
	addq	$8, %r15
	cmpq	$1600, %r15                     # imm = 0x640
	jne	.LBB3_11
# %bb.15:                               # %.preheader155.preheader
	movl	$400000, %edx                   # imm = 0x61A80
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	memset@PLT
	movq	48(%rsp), %rdi
.Ltmp17:
	movl	$80000000, %edx                 # imm = 0x4C4B400
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp18:
# %bb.16:
	movq	(%rsp), %rdi
.Ltmp19:
	movl	$400000, %edx                   # imm = 0x61A80
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp20:
# %bb.17:
	movq	72(%rsp), %rdi
.Ltmp21:
	movl	$1600, %edx                     # imm = 0x640
	movq	8(%rsp), %rsi                   # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp22:
# %bb.18:
	movq	(%rsp), %rdi
.Ltmp23:
	movl	$400000, %edx                   # imm = 0x61A80
	movq	%rbx, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp24:
# %bb.19:
.Ltmp26:
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
.Ltmp27:
# %bb.20:
	movq	64(%rsp), %rdi
.Ltmp28:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp29:
# %bb.21:                               # %.preheader154.preheader
	movl	$1, %r15d
.LBB3_22:                               # %.preheader154
                                        # =>This Inner Loop Header: Depth=1
	callq	rand
	movslq	%eax, %r13
	imulq	$1374389535, %r13, %rax         # imm = 0x51EB851F
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$38, %rax
	addl	%ecx, %eax
	imull	$200, %eax, %eax
	subl	%eax, %r13d
.Ltmp30:
	movl	$_ZSt4cout, %edi
	movl	%r13d, %esi
	callq	_ZNSolsEi
.Ltmp31:
# %bb.23:                               #   in Loop: Header=BB3_22 Depth=1
	movq	%rax, %rbp
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbp, %rdi
.Ltmp32:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp33:
# %bb.24:                               # %.noexc
                                        #   in Loop: Header=BB3_22 Depth=1
.Ltmp34:
	movsbl	%al, %esi
	movq	%rbp, %rdi
	callq	_ZNSo3putEc
.Ltmp35:
# %bb.25:                               # %.noexc129
                                        #   in Loop: Header=BB3_22 Depth=1
.Ltmp36:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp37:
# %bb.26:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB3_22 Depth=1
	movq	$0, (%r12)
	movq	40(%rsp), %rdi
.Ltmp38:
	movl	$8, %edx
	movq	%r12, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp39:
# %bb.27:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp40:
	movabsq	$4294967492, %rdi               # imm = 0x1000000C4
	movl	$1, %esi
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp41:
# %bb.28:                               #   in Loop: Header=BB3_22 Depth=1
	testl	%eax, %eax
	jne	.LBB3_30
# %bb.29:                               #   in Loop: Header=BB3_22 Depth=1
	movq	(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	40(%rsp), %r8
.Ltmp42:
	movl	$50000, %edi                    # imm = 0xC350
	movl	%r13d, %ecx
	callq	_Z18__device_stub__dotiPdS_iS_
.Ltmp43:
.LBB3_30:                               #   in Loop: Header=BB3_22 Depth=1
	movq	40(%rsp), %rsi
.Ltmp44:
	movl	$8, %edx
	movq	%r12, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp45:
# %bb.31:                               #   in Loop: Header=BB3_22 Depth=1
	cvtsi2sd	%r15d, %xmm0
	movsd	.LCPI3_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movapd	%xmm1, %xmm2
	divsd	%xmm0, %xmm2
	movsd	%xmm2, 16(%rsp)                 # 8-byte Spill
	movslq	%r13d, %rax
	movq	8(%rsp), %rcx                   # 8-byte Reload
	movsd	(%rcx,%rax,8), %xmm0            # xmm0 = mem[0],zero
	mulsd	(%r12), %xmm0
	ucomisd	%xmm1, %xmm0
	jae	.LBB3_32
# %bb.37:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp50:
	movabsq	$4294967492, %rdi               # imm = 0x1000000C4
	movl	$1, %esi
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp51:
# %bb.38:                               #   in Loop: Header=BB3_22 Depth=1
	testl	%eax, %eax
	jne	.LBB3_40
# %bb.39:                               #   in Loop: Header=BB3_22 Depth=1
	movq	(%rsp), %rsi
	movq	48(%rsp), %rcx
	movq	72(%rsp), %r8
.Ltmp52:
	movl	$50000, %edi                    # imm = 0xC350
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	.LCPI3_0(%rip), %xmm1           # xmm1 = mem[0],zero
	movl	%r13d, %edx
	callq	_Z20__device_stub__type2iddPdiS_S_
.Ltmp53:
	jmp	.LBB3_40
.LBB3_32:                               #   in Loop: Header=BB3_22 Depth=1
.Ltmp46:
	movabsq	$4294967492, %rdi               # imm = 0x1000000C4
	movl	$1, %esi
	movabsq	$4294967552, %rdx               # imm = 0x100000100
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp47:
# %bb.33:                               #   in Loop: Header=BB3_22 Depth=1
	testl	%eax, %eax
	jne	.LBB3_40
# %bb.34:                               #   in Loop: Header=BB3_22 Depth=1
	movq	(%rsp), %rsi
.Ltmp48:
	movl	$50000, %edi                    # imm = 0xC350
	movsd	16(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movsd	.LCPI3_0(%rip), %xmm1           # xmm1 = mem[0],zero
	callq	_Z20__device_stub__type1iddPd
.Ltmp49:
.LBB3_40:                               #   in Loop: Header=BB3_22 Depth=1
	movq	(%rsp), %rsi
.Ltmp54:
	movl	$400000, %edx                   # imm = 0x61A80
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp55:
# %bb.41:                               #   in Loop: Header=BB3_22 Depth=1
	incl	%r15d
	cmpl	$101, %r15d
	jne	.LBB3_22
# %bb.42:
	movq	(%rsp), %rsi
.Ltmp57:
	movl	$400000, %edx                   # imm = 0x61A80
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp58:
# %bb.43:
.Ltmp59:
	leaq	32(%rsp), %rdi
	callq	hipEventCreate
.Ltmp60:
# %bb.44:
	movq	32(%rsp), %rdi
.Ltmp61:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp62:
# %bb.45:
	movq	32(%rsp), %rdi
.Ltmp63:
	callq	hipEventSynchronize
.Ltmp64:
# %bb.46:
	movq	64(%rsp), %rsi
	movq	32(%rsp), %rdx
.Ltmp65:
	leaq	60(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp66:
# %bb.47:
.Ltmp67:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.2, %esi
	movl	$11, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp68:
# %bb.48:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	xorps	%xmm0, %xmm0
	cvtss2sd	60(%rsp), %xmm0
.Ltmp69:
	movl	$_ZSt4cout, %edi
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp70:
# %bb.49:                               # %_ZNSolsEf.exit
	movq	%rax, %r12
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp71:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp72:
# %bb.50:                               # %.noexc131
.Ltmp73:
	movsbl	%al, %esi
	movq	%r12, %rdi
	callq	_ZNSo3putEc
.Ltmp74:
# %bb.51:                               # %.noexc132
.Ltmp75:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp76:
# %bb.52:                               # %.preheader.preheader
	xorps	%xmm0, %xmm0
	movaps	%xmm0, 16(%rsp)                 # 16-byte Spill
	xorl	%eax, %eax
.LBB3_53:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_54 Depth 2
	xorl	%ecx, %ecx
	xorps	%xmm0, %xmm0
.LBB3_54:                               #   Parent Loop BB3_53 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rbx,%rcx,8), %xmm1            # xmm1 = mem[0],zero
	mulsd	(%r14,%rcx,8), %xmm1
	addsd	%xmm1, %xmm0
	incq	%rcx
	cmpq	$50000, %rcx                    # imm = 0xC350
	jne	.LBB3_54
# %bb.55:                               # %_ZNSolsEPFRSoS_E.exit126
                                        #   in Loop: Header=BB3_53 Depth=1
	movq	8(%rsp), %rcx                   # 8-byte Reload
	mulsd	(%rcx,%rax,8), %xmm0
	movapd	16(%rsp), %xmm3                 # 16-byte Reload
	movapd	%xmm3, %xmm1
	addsd	.LCPI3_0(%rip), %xmm1
	xorpd	%xmm2, %xmm2
	cmpnlesd	%xmm0, %xmm2
	andpd	%xmm2, %xmm3
	andnpd	%xmm1, %xmm2
	orpd	%xmm2, %xmm3
	movapd	%xmm3, 16(%rsp)                 # 16-byte Spill
	incq	%rax
	addq	$400000, %r14                   # imm = 0x61A80
	cmpq	$200, %rax
	jne	.LBB3_53
# %bb.56:
.Ltmp78:
	movl	$_ZSt4cout, %edi
	movl	$.L.str.3, %esi
	movl	$8, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp79:
# %bb.57:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit127
.Ltmp80:
	movl	$_ZSt4cout, %edi
	movaps	16(%rsp), %xmm0                 # 16-byte Reload
	callq	_ZNSo9_M_insertIdEERSoT_
.Ltmp81:
# %bb.58:                               # %_ZNSolsEd.exit
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp82:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp83:
# %bb.59:                               # %.noexc135
.Ltmp84:
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp85:
# %bb.60:                               # %.noexc136
.Ltmp86:
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp87:
# %bb.61:                               # %_ZNSolsEPFRSoS_E.exit128
	movapd	16(%rsp), %xmm0                 # 16-byte Reload
	divsd	.LCPI3_1(%rip), %xmm0
	movl	$.L.str.4, %edi
	movb	$1, %al
	callq	printf
	leaq	88(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	leaq	608(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	xorl	%eax, %eax
	addq	$1128, %rsp                     # imm = 0x468
	.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:
	.cfi_def_cfa_offset 1184
.Ltmp2:
	movq	%rax, %rbx
	jmp	.LBB3_64
.LBB3_62:
.Ltmp88:
	jmp	.LBB3_63
.LBB3_36:
.Ltmp25:
	jmp	.LBB3_63
.LBB3_67:
.Ltmp77:
	jmp	.LBB3_63
.LBB3_66:
.Ltmp16:
	jmp	.LBB3_63
.LBB3_68:
.Ltmp56:
	jmp	.LBB3_63
.LBB3_65:
.Ltmp13:
.LBB3_63:
	movq	%rax, %rbx
	leaq	88(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
.LBB3_64:
	leaq	608(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %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:
.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 .Ltmp10-.Ltmp3                 #   Call between .Ltmp3 and .Ltmp10
	.uleb128 .Ltmp25-.Lfunc_begin0          #     jumps to .Ltmp25
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp12-.Ltmp11                #   Call between .Ltmp11 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp15-.Ltmp14                #   Call between .Ltmp14 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp17-.Ltmp15                #   Call between .Ltmp15 and .Ltmp17
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp24-.Ltmp17                #   Call between .Ltmp17 and .Ltmp24
	.uleb128 .Ltmp25-.Lfunc_begin0          #     jumps to .Ltmp25
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp26-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp29-.Ltmp26                #   Call between .Ltmp26 and .Ltmp29
	.uleb128 .Ltmp77-.Lfunc_begin0          #     jumps to .Ltmp77
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp55-.Ltmp30                #   Call between .Ltmp30 and .Ltmp55
	.uleb128 .Ltmp56-.Lfunc_begin0          #     jumps to .Ltmp56
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp57-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp76-.Ltmp57                #   Call between .Ltmp57 and .Ltmp76
	.uleb128 .Ltmp77-.Lfunc_begin0          #     jumps to .Ltmp77
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp78-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp87-.Ltmp78                #   Call between .Ltmp78 and .Ltmp87
	.uleb128 .Ltmp88-.Lfunc_begin0          #     jumps to .Ltmp88
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp87-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Lfunc_end3-.Ltmp87            #   Call between .Ltmp87 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- 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	.LBB4_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB4_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z5type1iddPd, %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	$_Z5type2iddPdiS_S_, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z3dotiPdS_iS_, %esi
	movl	$.L__unnamed_3, %edx
	movl	$.L__unnamed_3, %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_end4:
	.size	__hip_module_ctor, .Lfunc_end4-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB5_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB5_2:
	retq
.Lfunc_end5:
	.size	__hip_module_dtor, .Lfunc_end5-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z5type1iddPd,@object           # @_Z5type1iddPd
	.section	.rodata,"a",@progbits
	.globl	_Z5type1iddPd
	.p2align	3, 0x0
_Z5type1iddPd:
	.quad	_Z20__device_stub__type1iddPd
	.size	_Z5type1iddPd, 8

	.type	_Z5type2iddPdiS_S_,@object      # @_Z5type2iddPdiS_S_
	.globl	_Z5type2iddPdiS_S_
	.p2align	3, 0x0
_Z5type2iddPdiS_S_:
	.quad	_Z20__device_stub__type2iddPdiS_S_
	.size	_Z5type2iddPdiS_S_, 8

	.type	_Z3dotiPdS_iS_,@object          # @_Z3dotiPdS_iS_
	.globl	_Z3dotiPdS_iS_
	.p2align	3, 0x0
_Z3dotiPdS_iS_:
	.quad	_Z18__device_stub__dotiPdS_iS_
	.size	_Z3dotiPdS_iS_, 8

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

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"labels.txt"
	.size	.L.str.1, 11

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Train time "
	.size	.L.str.2, 12

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Accuracy %lf\n"
	.size	.L.str.4, 14

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z5type1iddPd"
	.size	.L__unnamed_1, 14

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z5type2iddPdiS_S_"
	.size	.L__unnamed_2, 19

	.type	.L__unnamed_3,@object           # @2
.L__unnamed_3:
	.asciz	"_Z3dotiPdS_iS_"
	.size	.L__unnamed_3, 15

	.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 _Z20__device_stub__type1iddPd
	.addrsig_sym _Z20__device_stub__type2iddPdiS_S_
	.addrsig_sym _Z18__device_stub__dotiPdS_iS_
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z5type1iddPd
	.addrsig_sym _Z5type2iddPdiS_S_
	.addrsig_sym _Z3dotiPdS_iS_
	.addrsig_sym _ZSt4cout
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z5type1iddPd           ; -- Begin function _Z5type1iddPd
	.globl	_Z5type1iddPd
	.p2align	8
	.type	_Z5type1iddPd,@function
_Z5type1iddPd:                          ; @_Z5type1iddPd
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x2c
	s_load_b32 s6, s[0:1], 0x0
	s_add_u32 s2, s0, 32
	s_addc_u32 s3, s1, 0
	s_mov_b32 s5, exec_lo
	s_waitcnt lgkmcnt(0)
	s_and_b32 s4, s4, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s4, v[0:1]
	v_cmpx_gt_i32_e64 s6, v1
	s_cbranch_execz .LBB0_3
; %bb.1:                                ; %.lr.ph
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x8
	s_load_b64 s[0:1], s[0:1], 0x18
	s_load_b32 s2, s[2:3], 0x0
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_2) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[5:6], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_fma_f64 v[3:4], -s[8:9], s[10:11], 1.0
	v_add_co_u32 v5, vcc_lo, s0, v5
	s_mul_i32 s2, s2, s4
	s_delay_alu instid0(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s1, v6, vcc_lo
	s_ashr_i32 s3, s2, 31
	s_mov_b32 s1, 0
	s_lshl_b64 s[4:5], s[2:3], 3
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[7:8], v[5:6], off
	v_add_nc_u32_e32 v1, s2, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_le_i32_e32 vcc_lo, s6, v1
	s_or_b32 s1, vcc_lo, s1
	s_waitcnt vmcnt(0)
	v_mul_f64 v[7:8], v[3:4], v[7:8]
	global_store_b64 v[5:6], v[7:8], off
	v_add_co_u32 v5, s0, v5, s4
	s_delay_alu instid0(VALU_DEP_1)
	v_add_co_ci_u32_e64 v6, s0, s5, v6, s0
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB0_2
.LBB0_3:                                ; %Flow23
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5type1iddPd
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 9
		.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	_Z5type1iddPd, .Lfunc_end0-_Z5type1iddPd
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 240
; NumSgprs: 18
; NumVgprs: 9
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 9
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z5type2iddPdiS_S_      ; -- Begin function _Z5type2iddPdiS_S_
	.globl	_Z5type2iddPdiS_S_
	.p2align	8
	.type	_Z5type2iddPdiS_S_,@function
_Z5type2iddPdiS_S_:                     ; @_Z5type2iddPdiS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s4, s[0:1], 0x44
	s_load_b32 s10, s[0:1], 0x0
	s_add_u32 s2, s0, 56
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s8, s4, 0xffff
	s_mov_b32 s4, exec_lo
	s_mul_i32 s15, s15, s8
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_add_nc_u32_e32 v1, s15, v0
	v_cmpx_gt_i32_e64 s10, v1
	s_cbranch_execz .LBB1_3
; %bb.1:                                ; %.lr.ph
	s_clause 0x2
	s_load_b128 s[4:7], s[0:1], 0x8
	s_load_b32 s12, s[0:1], 0x20
	s_load_b64 s[20:21], s[0:1], 0x18
	s_load_b32 s9, s[2:3], 0x0
	s_load_b128 s[16:19], s[0:1], 0x28
	v_ashrrev_i32_e32 v2, 31, v1
	s_delay_alu instid0(VALU_DEP_1)
	v_lshlrev_b64 v[7:8], 3, v[1:2]
	s_waitcnt lgkmcnt(0)
	v_fma_f64 v[3:4], -s[4:5], s[6:7], 1.0
	s_mul_i32 s0, s12, s10
	s_ashr_i32 s13, s12, 31
	v_add3_u32 v5, s15, s0, v0
	s_lshl_b64 s[2:3], s[12:13], 3
	s_mul_i32 s0, s9, s8
	s_add_u32 s2, s18, s2
	s_addc_u32 s3, s19, s3
	v_ashrrev_i32_e32 v6, 31, v5
	s_ashr_i32 s1, s0, 31
	s_mov_b64 s[8:9], 0
	s_lshl_b64 s[6:7], s[0:1], 3
	s_mov_b32 s1, 0
	v_lshlrev_b64 v[5:6], 3, v[5:6]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s16, v5
	v_add_co_ci_u32_e32 v2, vcc_lo, s17, v6, vcc_lo
	v_add_co_u32 v5, vcc_lo, s20, v7
	v_add_co_ci_u32_e32 v6, vcc_lo, s21, v8, vcc_lo
	v_mov_b32_e32 v7, 0
.LBB1_2:                                ; =>This Inner Loop Header: Depth=1
	global_load_b64 v[8:9], v7, s[2:3]
	v_add_co_u32 v10, vcc_lo, v0, s8
	v_add_co_ci_u32_e32 v11, vcc_lo, s9, v2, vcc_lo
	v_add_co_u32 v12, vcc_lo, v5, s8
	v_add_co_ci_u32_e32 v13, vcc_lo, s9, v6, vcc_lo
	global_load_b64 v[10:11], v[10:11], off
	v_add_nc_u32_e32 v1, s0, v1
	s_add_u32 s8, s8, s6
	global_load_b64 v[14:15], v[12:13], off
	s_addc_u32 s9, s9, s7
	v_cmp_le_i32_e32 vcc_lo, s10, v1
	s_or_b32 s1, vcc_lo, s1
	s_waitcnt vmcnt(2)
	v_mul_f64 v[8:9], v[8:9], s[4:5]
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mul_f64 v[8:9], v[8:9], v[10:11]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[8:9], v[3:4], v[14:15], v[8:9]
	global_store_b64 v[12:13], v[8:9], off
	s_and_not1_b32 exec_lo, exec_lo, s1
	s_cbranch_execnz .LBB1_2
.LBB1_3:                                ; %Flow43
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5type2iddPdiS_S_
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 312
		.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 22
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z5type2iddPdiS_S_, .Lfunc_end1-_Z5type2iddPdiS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 368
; NumSgprs: 24
; NumVgprs: 16
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 24
; 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
	.protected	_Z3dotiPdS_iS_          ; -- Begin function _Z3dotiPdS_iS_
	.globl	_Z3dotiPdS_iS_
	.p2align	8
	.type	_Z3dotiPdS_iS_,@function
_Z3dotiPdS_iS_:                         ; @_Z3dotiPdS_iS_
; %bb.0:
	s_clause 0x1
	s_load_b32 s2, s[0:1], 0x34
	s_load_b32 s3, s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_mov_b32_e32 v2, 0
	v_mov_b32_e32 v3, 0
	s_mov_b32 s2, exec_lo
	v_cmpx_gt_i32_e64 s3, v1
	s_cbranch_execz .LBB2_2
; %bb.1:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x8
	v_ashrrev_i32_e32 v2, 31, v1
	s_waitcnt lgkmcnt(0)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, s8, s3, v[1:2]
	v_lshlrev_b64 v[1:2], 3, v[1:2]
	v_add_co_u32 v1, vcc_lo, s4, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_ashrrev_i32_e32 v4, 31, v3
	v_add_co_ci_u32_e32 v2, vcc_lo, s5, v2, vcc_lo
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[3:4], 3, v[3:4]
	v_add_co_u32 v3, vcc_lo, s6, v3
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v4, vcc_lo, s7, v4, vcc_lo
	global_load_b64 v[1:2], v[1:2], off
	global_load_b64 v[3:4], v[3:4], off
	s_waitcnt vmcnt(0)
	v_mul_f64 v[2:3], v[1:2], v[3:4]
.LBB2_2:
	s_or_b32 exec_lo, exec_lo, s2
	v_lshlrev_b32_e32 v1, 3, v0
	s_mov_b32 s2, 0
	s_mov_b32 s3, exec_lo
	ds_store_b64 v1, v[2:3]
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
	v_cmpx_eq_u32_e32 0, v0
	s_cbranch_execz .LBB2_7
; %bb.3:                                ; %.preheader.preheader
	v_mov_b32_e32 v4, 0
	v_mov_b32_e32 v5, 0
.LBB2_4:                                ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	v_mov_b32_e32 v0, s2
	s_add_i32 s2, s2, 8
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmpk_eq_i32 s2, 0x800
	ds_load_b64 v[0:1], v0
	s_waitcnt lgkmcnt(0)
	v_add_f64 v[4:5], v[4:5], v[0:1]
	s_cbranch_scc0 .LBB2_4
; %bb.5:
	s_load_b64 s[0:1], s[0:1], 0x20
	v_mov_b32_e32 v6, 0
	s_waitcnt lgkmcnt(0)
	s_load_b64 s[2:3], s[0:1], 0x0
	s_waitcnt lgkmcnt(0)
	v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
	s_mov_b32 s2, 0
.LBB2_6:                                ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1)
	v_add_f64 v[0:1], v[4:5], v[2:3]
	global_atomic_cmpswap_b64 v[0:1], v6, v[0:3], s[0:1] glc
	s_waitcnt vmcnt(0)
	v_cmp_eq_u64_e32 vcc_lo, v[2:3], v[0:1]
	v_dual_mov_b32 v3, v1 :: v_dual_mov_b32 v2, v0
	s_or_b32 s2, vcc_lo, s2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_and_not1_b32 exec_lo, exec_lo, s2
	s_cbranch_execnz .LBB2_6
.LBB2_7:                                ; %_Z15atomicAddDoublePdd.exit
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z3dotiPdS_iS_
		.amdhsa_group_segment_fixed_size 2048
		.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 7
		.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_end2:
	.size	_Z3dotiPdS_iS_, .Lfunc_end2-_Z3dotiPdS_iS_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 384
; NumSgprs: 18
; NumVgprs: 7
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 2048 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 7
; 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:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           8
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .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:           _Z5type1iddPd
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z5type1iddPd.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     9
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .size:           4
        .value_kind:     by_value
      - .offset:         8
        .size:           8
        .value_kind:     by_value
      - .offset:         16
        .size:           8
        .value_kind:     by_value
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           4
        .value_kind:     by_value
      - .address_space:  global
        .offset:         40
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         48
        .size:           8
        .value_kind:     global_buffer
      - .offset:         56
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         60
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         64
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         68
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         70
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         72
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         74
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         76
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         78
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         104
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         112
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         120
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 312
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5type2iddPdiS_S_
    .private_segment_fixed_size: 0
    .sgpr_count:     24
    .sgpr_spill_count: 0
    .symbol:         _Z5type2iddPdiS_S_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     16
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .offset:         0
        .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
      - .address_space:  global
        .offset:         32
        .size:           8
        .value_kind:     global_buffer
      - .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: 2048
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z3dotiPdS_iS_
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z3dotiPdS_iS_.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     7
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
