#include "math.h"
#include <fstream>
#include <sstream>
#include <float.h>

__device__
double euclideanDistance(double *training, double *test, int trainingIndexStart, int testIndexStart, int size) {
    double temporary = 0;
    for(unsigned i = 0; i < size; i++) {
        temporary += (training[trainingIndexStart + i] - training[testIndexStart + i]) * (training[trainingIndexStart + i] - training[testIndexStart + i]);
    }

    return sqrt(temporary);
}

__global__
void runAlgorithm(double* result, double *training, double *test, int rowsTraining, int rowsTest, int columns) {
    int currentTrainingRow = 0;
    int minDistanceLabel = 0;
    double minDistance = DBL_MAX;
    int stride = blockDim.x * gridDim.x;
    for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < rowsTraining * columns; i += stride, currentTrainingRow++) {
        for (int j = 0; j < rowsTest * columns; j += columns) {
            double distance = euclideanDistance(training, test, i, j, columns-1);
            if (distance < minDistance) {
                minDistance = distance;
                minDistanceLabel = test[j+columns-1];
            }
        }
        minDistance = DBL_MAX;
        result[currentTrainingRow] = minDistanceLabel;
    }
}

__host__
double showAccuracy(double *data, double* predictions, int rows, int columns) {
    double count = 0;
    int row = 0;
    for(int i = columns-1; i < rows * columns; i += columns, row++) {
        if (data[i] == predictions[row]) {
            count++;
        }
    }
    return (count / rows) * 100;
}

__host__
int countWords(const std::string& text, char delimiter) {
    std::stringstream stream(text);
    std::string temp;
    int counter = 0;
    while(getline(stream, temp, delimiter)) {
        counter++;
    }

    return counter;
}

__host__
void countRowsAndColumns(std::string filename, int* rows, int* columns) {
    std::ifstream featuresFile(filename);
    std::string line;
    std::getline(featuresFile, line);

    *columns = countWords(line, ',');

    *rows = 1;
    while (std::getline(featuresFile, line))
        (*rows)++;

    featuresFile.close();
}

__host__
void readFeaturesFromCsv(std::string filename, double* result, int rows, int columns) {
    std::ifstream featuresFile(filename);
    std::string line;
    int i = 0;

    while(std::getline(featuresFile, line))
    {
        std::stringstream ss(line);
        double value;
        while(ss >> value){
            result[i] = value;
            if(ss.peek() == ',') ss.ignore();
            i++;
        }
    }
    featuresFile.close();
}

__host__
void splitForTestAndTrainingData(double *data, int columns, double *training, double*test, int rowsTraining, int rowsTest)
{
    int counter = 0;
    int dataCounter = 0;
    while(++counter < rowsTest)
    {
        for(int j = 0; j < columns; j++, dataCounter++)
            test[dataCounter] = data[dataCounter];
    }

    counter = 0;
    int i = 0;
    while(++counter < rowsTraining)
    {
        for(int j = 0; j < columns; j++, dataCounter++, i++)
            training[i] = data[dataCounter];
    }
}

int main(int argc, char* argv[]) {
    int rows, columns;
    std::string fileName("./data.csv");
    countRowsAndColumns(fileName, &rows, &columns);

    double *input = new double[rows * columns];
    readFeaturesFromCsv(fileName, input, rows, columns);

    int rowsTraining = rows * 0.8;
    int rowsTest = rows - rowsTraining;

    double *test = new double[rowsTest*columns];
    double *training = new double[rowsTraining*columns];
    double *predictions = new double[rowsTraining * columns];
    double *cudaTraining;
    double *cudaTest;
    double *cudaPrediction;  

    splitForTestAndTrainingData(input, columns, training, test, rowsTraining, rowsTest);

    cudaMalloc((void **) &cudaTraining, rowsTraining * columns * sizeof(double));
    cudaMemcpy(cudaTraining, training, rowsTraining * columns * sizeof(double), cudaMemcpyHostToDevice);

    cudaMalloc((void **) &cudaTest, rowsTest * columns * sizeof(double));
    cudaMemcpy(cudaTest, test, rowsTest * columns * sizeof(double), cudaMemcpyHostToDevice);

    cudaMalloc((void **) &cudaPrediction, rowsTraining * sizeof(double));
    cudaMemcpy(cudaPrediction, predictions, rowsTraining * sizeof(double), cudaMemcpyHostToDevice);
    
    cudaEvent_t startTime, stopTime;
    cudaEventCreate(&startTime);
    cudaEventCreate(&stopTime);
    cudaEventRecord(startTime);

    runAlgorithm<<<1, 1>>>(cudaPrediction, cudaTraining, cudaTest, rowsTraining, rowsTest, columns);

    float resultTime;
    cudaEventRecord(stopTime);
    cudaEventSynchronize(stopTime);
    cudaEventElapsedTime(&resultTime, startTime, stopTime);

    cudaMemcpy(predictions, cudaPrediction, rowsTraining * sizeof(double), cudaMemcpyDeviceToHost);

    cudaFree(cudaTraining);
    cudaFree(cudaTest);
    cudaFree(cudaPrediction);

    printf("Algorithm took: %f (ms)\n", resultTime);

    double accuracy = showAccuracy(training, predictions, rowsTraining, columns);
    printf("Accuracy: %f\n", accuracy);
}
	.file	"tmpxft_002b0271_00000000-6_knn.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3833:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3833:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z17euclideanDistancePdS_iii
	.type	_Z17euclideanDistancePdS_iii, @function
_Z17euclideanDistancePdS_iii:
.LFB3823:
	.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
.LFE3823:
	.size	_Z17euclideanDistancePdS_iii, .-_Z17euclideanDistancePdS_iii
	.globl	_Z12showAccuracyPdS_ii
	.type	_Z12showAccuracyPdS_ii, @function
_Z12showAccuracyPdS_ii:
.LFB3824:
	.cfi_startproc
	endbr64
	movl	%ecx, %eax
	movslq	%ecx, %r8
	movsd	.LC1(%rip), %xmm1
	decl	%ecx
	imull	%edx, %eax
	movslq	%ecx, %rcx
	xorps	%xmm0, %xmm0
.L5:
	cmpl	%ecx, %eax
	jle	.L11
	movsd	(%rdi,%rcx,8), %xmm2
	ucomisd	(%rsi), %xmm2
	jp	.L6
	jne	.L6
	addsd	%xmm1, %xmm0
.L6:
	addq	%r8, %rcx
	addq	$8, %rsi
	jmp	.L5
.L11:
	cvtsi2sdl	%edx, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	.LC2(%rip), %xmm0
	ret
	.cfi_endproc
.LFE3824:
	.size	_Z12showAccuracyPdS_ii, .-_Z12showAccuracyPdS_ii
	.globl	_Z27splitForTestAndTrainingDataPdiS_S_ii
	.type	_Z27splitForTestAndTrainingDataPdiS_S_ii, @function
_Z27splitForTestAndTrainingDataPdiS_S_ii:
.LFB3829:
	.cfi_startproc
	endbr64
	movl	%esi, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdx, %r10
	xorl	%esi, %esi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	xorl	%edx, %edx
	xorl	%ebx, %ebx
	testl	%eax, %eax
	cmovns	%eax, %ebx
	movq	%rcx, %r11
.L13:
	incl	%esi
	cmpl	%r9d, %esi
	jge	.L20
	movslq	%edx, %rcx
.L16:
	movl	%ecx, %ebp
	subl	%edx, %ebp
	cmpl	%ebp, %eax
	jle	.L22
	movsd	(%rdi,%rcx,8), %xmm0
	movsd	%xmm0, (%r11,%rcx,8)
	incq	%rcx
	jmp	.L16
.L22:
	addl	%ebx, %edx
	jmp	.L13
.L20:
	xorl	%esi, %esi
	xorl	%r9d, %r9d
	xorl	%r11d, %r11d
	testl	%eax, %eax
	cmovns	%eax, %esi
.L15:
	incl	%r11d
	cmpl	%r8d, %r11d
	jge	.L12
	movslq	%edx, %rcx
	leaq	(%rdi,%rcx,8), %rbp
	movslq	%r9d, %rcx
	leaq	(%r10,%rcx,8), %rbx
	xorl	%ecx, %ecx
.L19:
	cmpl	%ecx, %eax
	jle	.L23
	movsd	0(%rbp,%rcx,8), %xmm0
	movsd	%xmm0, (%rbx,%rcx,8)
	incq	%rcx
	jmp	.L19
.L23:
	addl	%esi, %r9d
	addl	%esi, %edx
	jmp	.L15
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3829:
	.size	_Z27splitForTestAndTrainingDataPdiS_S_ii, .-_Z27splitForTestAndTrainingDataPdiS_S_ii
	.globl	_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii
	.type	_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii, @function
_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii:
.LFB3855:
	.cfi_startproc
	endbr64
	subq	$184, %rsp
	.cfi_def_cfa_offset 192
	movq	%rdi, 40(%rsp)
	leaq	72(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	84(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	56(%rsp), %rdx
	movl	%ecx, 20(%rsp)
	leaq	64(%rsp), %rcx
	movl	%r8d, 16(%rsp)
	movl	%r9d, 12(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 80(%rsp)
	movq	%rax, 120(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	20(%rsp), %rax
	movq	%rax, 144(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 152(%rsp)
	leaq	12(%rsp), %rax
	movq	%rax, 160(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 72(%rsp)
	movq	%rax, 84(%rsp)
	movl	$1, 92(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L24
	pushq	64(%rsp)
	.cfi_def_cfa_offset 200
	leaq	_Z12runAlgorithmPdS_S_iii(%rip), %rdi
	pushq	64(%rsp)
	.cfi_def_cfa_offset 208
	movq	100(%rsp), %rcx
	movl	108(%rsp), %r8d
	movq	88(%rsp), %rsi
	movl	96(%rsp), %edx
	leaq	136(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 200
	popq	%rdx
	.cfi_def_cfa_offset 192
.L24:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	addq	$184, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3855:
	.size	_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii, .-_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii
	.globl	_Z12runAlgorithmPdS_S_iii
	.type	_Z12runAlgorithmPdS_S_iii, @function
_Z12runAlgorithmPdS_S_iii:
.LFB3856:
	.cfi_startproc
	endbr64
	jmp	_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii
	.cfi_endproc
.LFE3856:
	.size	_Z12runAlgorithmPdS_S_iii, .-_Z12runAlgorithmPdS_S_iii
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"_Z12runAlgorithmPdS_S_iii"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3858:
	.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	.LC3(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z12runAlgorithmPdS_S_iii(%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
.LFE3858:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.text
	.globl	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
	.type	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc, @function
_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc:
.LFB3825:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3825
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$24, %edx
	movl	%esi, %r13d
	movq	%rdi, %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rbx
	movq	%rsp, %r12
	movq	%rbx, %rdi
.LEHB0:
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode@PLT
.LEHE0:
	leaq	16(%rsp), %rax
	movb	$0, 16(%rsp)
	movq	%rax, (%rsp)
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
.L32:
	movsbl	%r13b, %edx
	movq	%r12, %rsi
	movq	%rbx, %rdi
.LEHB1:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_@PLT
.LEHE1:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L40
	incl	%ebp
	jmp	.L32
.L40:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	je	.L36
	jmp	.L38
.L37:
	endbr64
	movq	%rax, %rbp
.L34:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	movq	%rbp, %rdi
.LEHB2:
	call	_Unwind_Resume@PLT
.LEHE2:
.L38:
	call	__stack_chk_fail@PLT
.L36:
	addq	$440, %rsp
	.cfi_def_cfa_offset 40
	movl	%ebp, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3825:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3825:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3825-.LLSDACSB3825
.LLSDACSB3825:
	.uleb128 .LEHB0-.LFB3825
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3825
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L37-.LFB3825
	.uleb128 0
	.uleb128 .LEHB2-.LFB3825
	.uleb128 .LEHE2-.LEHB2
	.uleb128 0
	.uleb128 0
.LLSDACSE3825:
	.text
	.size	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc, .-_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
	.globl	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.type	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, @function
_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_:
.LFB3827:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3827
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdx, %r13
	movl	$8, %edx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rsi, %r12
	movq	%rdi, %rsi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$568, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rbx
	movq	%rsp, %rbp
	movq	%rbx, %rdi
.LEHB3:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE3:
	leaq	16(%rsp), %rax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	movq	%rax, (%rsp)
	xorl	%eax, %eax
	movq	%rax, 8(%rsp)
	movb	$0, 16(%rsp)
.LEHB4:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movl	$44, %esi
	movq	%rbp, %rdi
	call	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
	movl	%eax, 0(%r13)
	movl	$1, %eax
.L42:
	movl	%eax, (%r12)
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L50
	movl	(%r12), %eax
	incl	%eax
	jmp	.L42
.L50:
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE4:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L46
	jmp	.L48
.L47:
	endbr64
	movq	%rax, %r12
.L44:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbx, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	movq	%r12, %rdi
.LEHB5:
	call	_Unwind_Resume@PLT
.LEHE5:
.L48:
	call	__stack_chk_fail@PLT
.L46:
	addq	$568, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3827:
	.section	.gcc_except_table
.LLSDA3827:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3827-.LLSDACSB3827
.LLSDACSB3827:
	.uleb128 .LEHB3-.LFB3827
	.uleb128 .LEHE3-.LEHB3
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB4-.LFB3827
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L47-.LFB3827
	.uleb128 0
	.uleb128 .LEHB5-.LFB3827
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
.LLSDACSE3827:
	.text
	.size	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, .-_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.globl	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.type	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, @function
_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii:
.LFB3828:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3828
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$8, %edx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rsi, %r14
	movq	%rdi, %rsi
	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
	xorl	%ebx, %ebx
	subq	$968, %rsp
	.cfi_def_cfa_offset 1024
	movq	%fs:40, %rax
	movq	%rax, 952(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	8(%rsp), %r12
	movq	%rbp, %rdi
.LEHB6:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode@PLT
.LEHE6:
	leaq	24(%rsp), %rax
	movb	$0, 24(%rsp)
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rax, 16(%rsp)
.L52:
	movq	%r12, %rsi
	movq	%rbp, %rdi
.LEHB7:
	call	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L66
	leaq	40(%rsp), %r13
	movl	$24, %edx
	movq	%r12, %rsi
	movq	%r13, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode@PLT
.LEHE7:
	movslq	%ebx, %rbx
	movq	%rsp, %r15
.L53:
	movq	%r15, %rsi
	movq	%r13, %rdi
.LEHB8:
	call	_ZNSi10_M_extractIdEERSiRT_@PLT
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	jne	.L67
	movsd	(%rsp), %xmm0
	movq	%r13, %rdi
	movsd	%xmm0, (%r14,%rbx,8)
	call	_ZNSi4peekEv@PLT
	cmpl	$44, %eax
	je	.L54
.L55:
	incq	%rbx
	jmp	.L53
.L54:
	movq	%r13, %rdi
	call	_ZNSi6ignoreEv@PLT
.LEHE8:
	jmp	.L55
.L67:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L52
.L66:
	movq	%rbp, %rdi
.LEHB9:
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE9:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	952(%rsp), %rax
	subq	%fs:40, %rax
	je	.L61
	jmp	.L64
.L62:
	endbr64
	movq	%rax, %rbx
.L58:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L59
.L63:
	endbr64
	movq	%rax, %rbx
.L59:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	call	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	952(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L64
	movq	%rbx, %rdi
.LEHB10:
	call	_Unwind_Resume@PLT
.LEHE10:
.L64:
	call	__stack_chk_fail@PLT
.L61:
	addq	$968, %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
.LFE3828:
	.section	.gcc_except_table
.LLSDA3828:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3828-.LLSDACSB3828
.LLSDACSB3828:
	.uleb128 .LEHB6-.LFB3828
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB7-.LFB3828
	.uleb128 .LEHE7-.LEHB7
	.uleb128 .L63-.LFB3828
	.uleb128 0
	.uleb128 .LEHB8-.LFB3828
	.uleb128 .LEHE8-.LEHB8
	.uleb128 .L62-.LFB3828
	.uleb128 0
	.uleb128 .LEHB9-.LFB3828
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L63-.LFB3828
	.uleb128 0
	.uleb128 .LEHB10-.LFB3828
	.uleb128 .LEHE10-.LEHB10
	.uleb128 0
	.uleb128 0
.LLSDACSE3828:
	.text
	.size	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, .-_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.section	.rodata.str1.1
.LC4:
	.string	"./data.csv"
.LC6:
	.string	"Algorithm took: %f (ms)\n"
.LC7:
	.string	"Accuracy: %f\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3830:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3830
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	10+.LC4(%rip), %rdx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	-10(%rdx), %rsi
	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	120(%rsp), %rdi
	leaq	104(%rsp), %rax
	movq	%rax, 24(%rsp)
	leaq	136(%rsp), %r12
	movq	%rdi, 104(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	104(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	%r12, %rdi
	movq	$10, 112(%rsp)
	movb	$0, 10(%rax)
.LEHB11:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
.LEHE11:
	leaq	36(%rsp), %rdx
	leaq	32(%rsp), %rsi
	movq	%r12, %rdi
.LEHB12:
	call	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.LEHE12:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movl	32(%rsp), %ebx
	movl	36(%rsp), %ebp
	movabsq	$1152921504606846975, %rax
	movl	%ebx, %edi
	imull	%ebp, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %rax
	jb	.L69
	salq	$3, %rdi
.LEHB13:
	call	_Znam@PLT
	movq	24(%rsp), %rsi
	movq	%r12, %rdi
	movq	%rax, %r15
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_@PLT
	jmp	.L97
.L69:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L93
	call	__cxa_throw_bad_array_new_length@PLT
.LEHE13:
.L97:
	movl	%ebp, %ecx
	movl	%ebx, %edx
	movq	%r15, %rsi
	movq	%r12, %rdi
.LEHB14:
	call	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.LEHE14:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	cvtsi2sdl	%ebx, %xmm0
	movl	%ebp, %eax
	movabsq	$1152921504606846975, %rdx
	mulsd	.LC5(%rip), %xmm0
	cvttsd2sil	%xmm0, %r12d
	subl	%r12d, %ebx
	imull	%ebx, %eax
	cltq
	cmpq	%rax, %rdx
	jb	.L72
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
.LEHB15:
	call	_Znam@PLT
	movabsq	$1152921504606846975, %rdx
	movq	%rax, %r14
	movl	%ebp, %eax
	imull	%r12d, %eax
	cltq
	cmpq	%rax, %rdx
	jnb	.L90
	jmp	.L98
.L72:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L93
	call	__cxa_throw_bad_array_new_length@PLT
.L90:
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, (%rsp)
	call	_Znam@PLT
	movq	(%rsp), %rdi
	movq	%rax, 16(%rsp)
	call	_Znam@PLT
	jmp	.L99
.L98:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L93
	call	__cxa_throw_bad_array_new_length@PLT
.L99:
	movq	16(%rsp), %rdx
	movl	%ebp, %esi
	movq	%r15, %rdi
	movl	%ebx, %r9d
	movl	%r12d, %r8d
	movq	%r14, %rcx
	movq	%rax, %r13
	call	_Z27splitForTestAndTrainingDataPdiS_S_ii
	movq	(%rsp), %rsi
	leaq	40(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	(%rsp), %rdx
	movq	16(%rsp), %rsi
	movl	$1, %ecx
	movq	40(%rsp), %rdi
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rsi
	leaq	48(%rsp), %rdi
	call	cudaMalloc@PLT
	movq	8(%rsp), %rdx
	movq	48(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rsi
	call	cudaMemcpy@PLT
	movslq	%r12d, %rax
	leaq	56(%rsp), %rdi
	leaq	0(,%rax,8), %r14
	movq	%r14, %rsi
	call	cudaMalloc@PLT
	movq	56(%rsp), %rdi
	movl	$1, %ecx
	movq	%r14, %rdx
	movq	%r13, %rsi
	call	cudaMemcpy@PLT
	leaq	64(%rsp), %rdi
	call	cudaEventCreate@PLT
	leaq	72(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	64(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$1, %ecx
	movl	$1, %esi
	movabsq	$4294967297, %rdi
	movl	$1, 100(%rsp)
	movq	%rdi, %rdx
	movq	%rdi, 92(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	je	.L78
.L80:
	movq	72(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	jmp	.L100
.L78:
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	movl	%ebp, %r9d
	movl	%ebx, %r8d
	movq	56(%rsp), %rdi
	movl	%r12d, %ecx
	call	_Z39__device_stub__Z12runAlgorithmPdS_S_iiiPdS_S_iii
	jmp	.L80
.L100:
	movq	72(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	leaq	92(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	movq	56(%rsp), %rsi
	movl	$2, %ecx
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	cudaMemcpy@PLT
	movq	40(%rsp), %rdi
	call	cudaFree@PLT
	movq	48(%rsp), %rdi
	call	cudaFree@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	leaq	.LC6(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	92(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	movq	%r13, %rsi
	movl	%ebp, %ecx
	movl	%r12d, %edx
	call	_Z12showAccuracyPdS_ii
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	call	__printf_chk@PLT
.LEHE15:
	leaq	104(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	je	.L85
	jmp	.L93
.L86:
	endbr64
	jmp	.L96
.L88:
	endbr64
.L96:
	movq	%rax, %rbx
.L83:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L82
.L87:
	endbr64
	movq	%rax, %rbx
.L82:
	movq	24(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L93
	movq	%rbx, %rdi
.LEHB16:
	call	_Unwind_Resume@PLT
.LEHE16:
.L93:
	call	__stack_chk_fail@PLT
.L85:
	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
.LFE3830:
	.section	.gcc_except_table
.LLSDA3830:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3830-.LLSDACSB3830
.LLSDACSB3830:
	.uleb128 .LEHB11-.LFB3830
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L87-.LFB3830
	.uleb128 0
	.uleb128 .LEHB12-.LFB3830
	.uleb128 .LEHE12-.LEHB12
	.uleb128 .L86-.LFB3830
	.uleb128 0
	.uleb128 .LEHB13-.LFB3830
	.uleb128 .LEHE13-.LEHB13
	.uleb128 .L87-.LFB3830
	.uleb128 0
	.uleb128 .LEHB14-.LFB3830
	.uleb128 .LEHE14-.LEHB14
	.uleb128 .L88-.LFB3830
	.uleb128 0
	.uleb128 .LEHB15-.LFB3830
	.uleb128 .LEHE15-.LEHB15
	.uleb128 .L87-.LFB3830
	.uleb128 0
	.uleb128 .LEHB16-.LFB3830
	.uleb128 .LEHE16-.LEHB16
	.uleb128 0
	.uleb128 0
.LLSDACSE3830:
	.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
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1079574528
	.align 8
.LC5:
	.long	-1717986918
	.long	1072273817
	.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 "math.h"
#include <fstream>
#include <sstream>
#include <float.h>

__device__
double euclideanDistance(double *training, double *test, int trainingIndexStart, int testIndexStart, int size) {
    double temporary = 0;
    for(unsigned i = 0; i < size; i++) {
        temporary += (training[trainingIndexStart + i] - training[testIndexStart + i]) * (training[trainingIndexStart + i] - training[testIndexStart + i]);
    }

    return sqrt(temporary);
}

__global__
void runAlgorithm(double* result, double *training, double *test, int rowsTraining, int rowsTest, int columns) {
    int currentTrainingRow = 0;
    int minDistanceLabel = 0;
    double minDistance = DBL_MAX;
    int stride = blockDim.x * gridDim.x;
    for(int i = blockIdx.x * blockDim.x + threadIdx.x; i < rowsTraining * columns; i += stride, currentTrainingRow++) {
        for (int j = 0; j < rowsTest * columns; j += columns) {
            double distance = euclideanDistance(training, test, i, j, columns-1);
            if (distance < minDistance) {
                minDistance = distance;
                minDistanceLabel = test[j+columns-1];
            }
        }
        minDistance = DBL_MAX;
        result[currentTrainingRow] = minDistanceLabel;
    }
}

__host__
double showAccuracy(double *data, double* predictions, int rows, int columns) {
    double count = 0;
    int row = 0;
    for(int i = columns-1; i < rows * columns; i += columns, row++) {
        if (data[i] == predictions[row]) {
            count++;
        }
    }
    return (count / rows) * 100;
}

__host__
int countWords(const std::string& text, char delimiter) {
    std::stringstream stream(text);
    std::string temp;
    int counter = 0;
    while(getline(stream, temp, delimiter)) {
        counter++;
    }

    return counter;
}

__host__
void countRowsAndColumns(std::string filename, int* rows, int* columns) {
    std::ifstream featuresFile(filename);
    std::string line;
    std::getline(featuresFile, line);

    *columns = countWords(line, ',');

    *rows = 1;
    while (std::getline(featuresFile, line))
        (*rows)++;

    featuresFile.close();
}

__host__
void readFeaturesFromCsv(std::string filename, double* result, int rows, int columns) {
    std::ifstream featuresFile(filename);
    std::string line;
    int i = 0;

    while(std::getline(featuresFile, line))
    {
        std::stringstream ss(line);
        double value;
        while(ss >> value){
            result[i] = value;
            if(ss.peek() == ',') ss.ignore();
            i++;
        }
    }
    featuresFile.close();
}

__host__
void splitForTestAndTrainingData(double *data, int columns, double *training, double*test, int rowsTraining, int rowsTest)
{
    int counter = 0;
    int dataCounter = 0;
    while(++counter < rowsTest)
    {
        for(int j = 0; j < columns; j++, dataCounter++)
            test[dataCounter] = data[dataCounter];
    }

    counter = 0;
    int i = 0;
    while(++counter < rowsTraining)
    {
        for(int j = 0; j < columns; j++, dataCounter++, i++)
            training[i] = data[dataCounter];
    }
}

int main(int argc, char* argv[]) {
    int rows, columns;
    std::string fileName("./data.csv");
    countRowsAndColumns(fileName, &rows, &columns);

    double *input = new double[rows * columns];
    readFeaturesFromCsv(fileName, input, rows, columns);

    int rowsTraining = rows * 0.8;
    int rowsTest = rows - rowsTraining;

    double *test = new double[rowsTest*columns];
    double *training = new double[rowsTraining*columns];
    double *predictions = new double[rowsTraining * columns];
    double *cudaTraining;
    double *cudaTest;
    double *cudaPrediction;  

    splitForTestAndTrainingData(input, columns, training, test, rowsTraining, rowsTest);

    hipMalloc((void **) &cudaTraining, rowsTraining * columns * sizeof(double));
    hipMemcpy(cudaTraining, training, rowsTraining * columns * sizeof(double), hipMemcpyHostToDevice);

    hipMalloc((void **) &cudaTest, rowsTest * columns * sizeof(double));
    hipMemcpy(cudaTest, test, rowsTest * columns * sizeof(double), hipMemcpyHostToDevice);

    hipMalloc((void **) &cudaPrediction, rowsTraining * sizeof(double));
    hipMemcpy(cudaPrediction, predictions, rowsTraining * sizeof(double), hipMemcpyHostToDevice);
    
    hipEvent_t startTime, stopTime;
    hipEventCreate(&startTime);
    hipEventCreate(&stopTime);
    hipEventRecord(startTime);

    runAlgorithm<<<1, 1>>>(cudaPrediction, cudaTraining, cudaTest, rowsTraining, rowsTest, columns);

    float resultTime;
    hipEventRecord(stopTime);
    hipEventSynchronize(stopTime);
    hipEventElapsedTime(&resultTime, startTime, stopTime);

    hipMemcpy(predictions, cudaPrediction, rowsTraining * sizeof(double), hipMemcpyDeviceToHost);

    hipFree(cudaTraining);
    hipFree(cudaTest);
    hipFree(cudaPrediction);

    printf("Algorithm took: %f (ms)\n", resultTime);

    double accuracy = showAccuracy(training, predictions, rowsTraining, columns);
    printf("Accuracy: %f\n", accuracy);
}
	.text
	.file	"knn.hip"
	.globl	_Z27__device_stub__runAlgorithmPdS_S_iii # -- Begin function _Z27__device_stub__runAlgorithmPdS_S_iii
	.type	_Z27__device_stub__runAlgorithmPdS_S_iii,@function
_Z27__device_stub__runAlgorithmPdS_S_iii: # @_Z27__device_stub__runAlgorithmPdS_S_iii
	.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	20(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	16(%rsp), %rcx
	movl	%r8d, (%rcx)
	leaq	12(%rsp), %r8
	movl	%r9d, (%r8)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	movq	%r8, 40(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	32(%rsp), %r12
	leaq	24(%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	$_Z12runAlgorithmPdS_S_iii, %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	_Z27__device_stub__runAlgorithmPdS_S_iii, .Lfunc_end0-_Z27__device_stub__runAlgorithmPdS_S_iii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z12showAccuracyPdS_ii
.LCPI1_0:
	.quad	0x3ff0000000000000              # double 1
.LCPI1_1:
	.quad	0x4059000000000000              # double 100
	.text
	.globl	_Z12showAccuracyPdS_ii
	.type	_Z12showAccuracyPdS_ii,@function
_Z12showAccuracyPdS_ii:                 # @_Z12showAccuracyPdS_ii
	.cfi_startproc
# %bb.0:
                                        # kill: def $ecx killed $ecx def $rcx
	movl	%ecx, %r8d
	imull	%edx, %r8d
	xorpd	%xmm0, %xmm0
	cmpl	%ecx, %r8d
	jl	.LBB1_3
# %bb.1:                                # %.lr.ph.preheader
	leal	-1(%rcx), %eax
	cltq
	movslq	%ecx, %rcx
	movslq	%r8d, %r8
	xorpd	%xmm2, %xmm2
	movsd	.LCPI1_0(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB1_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%rsi), %xmm0                   # xmm0 = mem[0],zero
	movapd	%xmm2, %xmm3
	cmpeqsd	(%rdi,%rax,8), %xmm0
	addsd	%xmm1, %xmm3
	andpd	%xmm0, %xmm3
	andnpd	%xmm2, %xmm0
	orpd	%xmm3, %xmm0
	addq	%rcx, %rax
	addq	$8, %rsi
	movapd	%xmm0, %xmm2
	cmpq	%r8, %rax
	jl	.LBB1_2
.LBB1_3:                                # %._crit_edge
	xorps	%xmm1, %xmm1
	cvtsi2sd	%edx, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	.LCPI1_1(%rip), %xmm0
	retq
.Lfunc_end1:
	.size	_Z12showAccuracyPdS_ii, .Lfunc_end1-_Z12showAccuracyPdS_ii
	.cfi_endproc
                                        # -- End function
	.globl	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc # -- Begin function _Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
	.type	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc,@function
_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc: # @_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$432, %rsp                      # imm = 0x1B0
	.cfi_def_cfa_offset 480
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, %rsi
	leaq	40(%rsp), %r14
	movq	%r14, %rdi
	movl	$24, %edx
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode
	leaq	24(%rsp), %r12
	movq	%r12, -16(%r12)
	movq	$0, -8(%r12)
	movb	$0, (%r12)
	xorl	%ebx, %ebx
	movsbl	%bpl, %ebp
	leaq	8(%rsp), %r15
.LBB2_1:                                # =>This Inner Loop Header: Depth=1
.Ltmp0:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebp, %edx
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp1:
# %bb.2:                                #   in Loop: Header=BB2_1 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB2_7
# %bb.3:                                #   in Loop: Header=BB2_1 Depth=1
	incl	%ebx
	jmp	.LBB2_1
.LBB2_7:
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB2_9
# %bb.8:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i5
	callq	_ZdlPv
.LBB2_9:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit7
	leaq	40(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	168(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movl	%ebx, %eax
	addq	$432, %rsp                      # imm = 0x1B0
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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_4:
	.cfi_def_cfa_offset 480
.Ltmp2:
	movq	%rax, %rbx
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB2_6
# %bb.5:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB2_6:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	40(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	168(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end2:
	.size	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc, .Lfunc_end2-_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table2:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp1-.Lfunc_begin0           # >> Call Site 3 <<
	.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
	.text
	.globl	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_ # -- Begin function _Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.type	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_,@function
_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_: # @_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 592
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	leaq	32(%rsp), %r14
	movq	%r14, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	leaq	16(%rsp), %r12
	movq	%r12, -16(%r12)
	movq	$0, -8(%r12)
	movb	$0, (%r12)
	movq	(%r14), %rax
	addq	-24(%rax), %r14
.Ltmp3:
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp4:
# %bb.1:                                # %.noexc
.Ltmp5:
	movsbl	%al, %edx
	leaq	32(%rsp), %r14
	movq	%rsp, %rsi
	movq	%r14, %rdi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp6:
# %bb.2:                                # %_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
.Ltmp7:
	movq	%rsp, %rdi
	movl	$44, %esi
	callq	_Z10countWordsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEc
.Ltmp8:
# %bb.3:
	movl	%eax, (%r15)
	movl	$1, %eax
	movq	%rsp, %r15
.LBB3_4:                                # =>This Inner Loop Header: Depth=1
	movl	%eax, (%rbx)
	movq	32(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp9:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp10:
# %bb.5:                                # %.noexc5
                                        #   in Loop: Header=BB3_4 Depth=1
.Ltmp11:
	movsbl	%al, %edx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp12:
# %bb.6:                                #   in Loop: Header=BB3_4 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB3_13
# %bb.7:                                #   in Loop: Header=BB3_4 Depth=1
	movl	(%rbx), %eax
	incl	%eax
	jmp	.LBB3_4
.LBB3_13:
.Ltmp14:
	leaq	32(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp15:
# %bb.14:
	movq	(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB3_16
# %bb.15:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i8
	callq	_ZdlPv
.LBB3_16:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit10
	leaq	32(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB3_9:                                # %.loopexit.split-lp
	.cfi_def_cfa_offset 592
.Ltmp16:
	jmp	.LBB3_10
.LBB3_8:                                # %.loopexit
.Ltmp13:
.LBB3_10:
	movq	%rax, %rbx
	movq	(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB3_12
# %bb.11:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB3_12:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	32(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end3:
	.size	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_, .Lfunc_end3-_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
	.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 .Ltmp8-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp8
	.uleb128 .Ltmp16-.Lfunc_begin1          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp9-.Lfunc_begin1           # >> Call Site 3 <<
	.uleb128 .Ltmp12-.Ltmp9                 #   Call between .Ltmp9 and .Ltmp12
	.uleb128 .Ltmp13-.Lfunc_begin1          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp15-.Ltmp14                #   Call between .Ltmp14 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin1          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Lfunc_end3-.Ltmp15            #   Call between .Ltmp15 and .Lfunc_end3
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii # -- Begin function _Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.type	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii,@function
_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii: # @_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.Lfunc_begin2:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception2
# %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	$952, %rsp                      # imm = 0x3B8
	.cfi_def_cfa_offset 1008
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %r14
	movq	%rdi, %rsi
	leaq	432(%rsp), %r15
	movq	%r15, %rdi
	movl	$8, %edx
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1ERKNSt7__cxx1112basic_stringIcS1_SaIcEEESt13_Ios_Openmode
	leaq	24(%rsp), %rax
	movq	%rax, -16(%rax)
	movq	$0, -8(%rax)
	movb	$0, (%rax)
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r12
	leaq	40(%rsp), %r13
	movq	%rsp, %rbp
.LBB4_1:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_6 Depth 2
	movq	432(%rsp), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp17:
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp18:
# %bb.2:                                # %.noexc
                                        #   in Loop: Header=BB4_1 Depth=1
.Ltmp19:
	movsbl	%al, %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ZSt7getlineIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EES4_
.Ltmp20:
# %bb.3:                                #   in Loop: Header=BB4_1 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB4_16
# %bb.4:                                #   in Loop: Header=BB4_1 Depth=1
.Ltmp25:
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	$24, %edx
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1ERKNS_12basic_stringIcS2_S3_EESt13_Ios_Openmode
.Ltmp26:
# %bb.5:                                #   in Loop: Header=BB4_1 Depth=1
	movslq	%ebx, %rbx
.LBB4_6:                                #   Parent Loop BB4_1 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp28:
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	_ZNSi10_M_extractIdEERSiRT_
.Ltmp29:
# %bb.7:                                #   in Loop: Header=BB4_6 Depth=2
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB4_15
# %bb.8:                                #   in Loop: Header=BB4_6 Depth=2
	movsd	(%rsp), %xmm0                   # xmm0 = mem[0],zero
	movsd	%xmm0, (%r14,%rbx,8)
.Ltmp30:
	movq	%r13, %rdi
	callq	_ZNSi4peekEv
.Ltmp31:
# %bb.9:                                #   in Loop: Header=BB4_6 Depth=2
	cmpl	$44, %eax
	jne	.LBB4_11
# %bb.10:                               #   in Loop: Header=BB4_6 Depth=2
.Ltmp32:
	movq	%r13, %rdi
	callq	_ZNSi6ignoreEv
.Ltmp33:
.LBB4_11:                               #   in Loop: Header=BB4_6 Depth=2
	incq	%rbx
	jmp	.LBB4_6
.LBB4_15:                               #   in Loop: Header=BB4_1 Depth=1
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	movq	%r13, %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	168(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	jmp	.LBB4_1
.LBB4_16:
.Ltmp22:
	leaq	432(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEE5closeEv
.Ltmp23:
# %bb.17:
	movq	8(%rsp), %rdi
	leaq	24(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_19
# %bb.18:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB4_19:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	432(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	addq	$952, %rsp                      # imm = 0x3B8
	.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
.LBB4_12:                               # %.loopexit.split-lp
	.cfi_def_cfa_offset 1008
.Ltmp24:
	jmp	.LBB4_21
.LBB4_13:
.Ltmp27:
	jmp	.LBB4_21
.LBB4_20:                               # %.loopexit
.Ltmp21:
.LBB4_21:
	movq	%rax, %r14
	jmp	.LBB4_22
.LBB4_14:
.Ltmp34:
	movq	%rax, %r14
	leaq	40(%rsp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	leaq	168(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
.LBB4_22:
	movq	8(%rsp), %rdi
	leaq	24(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_24
# %bb.23:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i13
	callq	_ZdlPv
.LBB4_24:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit15
	leaq	432(%rsp), %rdi
	callq	_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev
	movq	%r14, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii, .Lfunc_end4-_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception2:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end2-.Lcst_begin2
.Lcst_begin2:
	.uleb128 .Lfunc_begin2-.Lfunc_begin2    # >> Call Site 1 <<
	.uleb128 .Ltmp17-.Lfunc_begin2          #   Call between .Lfunc_begin2 and .Ltmp17
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin2          # >> Call Site 2 <<
	.uleb128 .Ltmp20-.Ltmp17                #   Call between .Ltmp17 and .Ltmp20
	.uleb128 .Ltmp21-.Lfunc_begin2          #     jumps to .Ltmp21
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp25-.Lfunc_begin2          # >> Call Site 3 <<
	.uleb128 .Ltmp26-.Ltmp25                #   Call between .Ltmp25 and .Ltmp26
	.uleb128 .Ltmp27-.Lfunc_begin2          #     jumps to .Ltmp27
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp28-.Lfunc_begin2          # >> Call Site 4 <<
	.uleb128 .Ltmp33-.Ltmp28                #   Call between .Ltmp28 and .Ltmp33
	.uleb128 .Ltmp34-.Lfunc_begin2          #     jumps to .Ltmp34
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp22-.Lfunc_begin2          # >> Call Site 5 <<
	.uleb128 .Ltmp23-.Ltmp22                #   Call between .Ltmp22 and .Ltmp23
	.uleb128 .Ltmp24-.Lfunc_begin2          #     jumps to .Ltmp24
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp23-.Lfunc_begin2          # >> Call Site 6 <<
	.uleb128 .Lfunc_end4-.Ltmp23            #   Call between .Ltmp23 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end2:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z27splitForTestAndTrainingDataPdiS_S_ii # -- Begin function _Z27splitForTestAndTrainingDataPdiS_S_ii
	.type	_Z27splitForTestAndTrainingDataPdiS_S_ii,@function
_Z27splitForTestAndTrainingDataPdiS_S_ii: # @_Z27splitForTestAndTrainingDataPdiS_S_ii
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	xorl	%eax, %eax
	cmpl	$2, %r9d
	jl	.LBB5_7
# %bb.1:                                # %.preheader29.lr.ph
	movl	%esi, %r10d
	xorl	%eax, %eax
	movl	$1, %r11d
.LBB5_4:                                # %.preheader29
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_6 Depth 2
	testl	%esi, %esi
	jle	.LBB5_3
# %bb.5:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB5_4 Depth=1
	movslq	%eax, %rbx
	leaq	(%rdi,%rbx,8), %r14
	leaq	(%rcx,%rbx,8), %r15
	xorl	%ebx, %ebx
.LBB5_6:                                # %.lr.ph
                                        #   Parent Loop BB5_4 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%r14,%rbx,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, (%r15,%rbx,8)
	incq	%rbx
	cmpl	%ebx, %r10d
	jne	.LBB5_6
# %bb.2:                                # %.loopexit30.loopexit
                                        #   in Loop: Header=BB5_4 Depth=1
	addl	%ebx, %eax
.LBB5_3:                                # %.loopexit30
                                        #   in Loop: Header=BB5_4 Depth=1
	incl	%r11d
	cmpl	%r9d, %r11d
	jne	.LBB5_4
.LBB5_7:                                # %.preheader28
	cmpl	$2, %r8d
	jl	.LBB5_14
# %bb.8:                                # %.preheader.lr.ph
	movl	%esi, %ecx
	negl	%ecx
	xorl	%r9d, %r9d
	movl	$1, %r10d
.LBB5_11:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_13 Depth 2
	testl	%esi, %esi
	jle	.LBB5_10
# %bb.12:                               # %.lr.ph38.preheader
                                        #   in Loop: Header=BB5_11 Depth=1
	movslq	%r9d, %r11
	movslq	%eax, %rbx
	leaq	(%rdi,%rbx,8), %rbx
	leaq	(%rdx,%r11,8), %r14
	xorl	%r11d, %r11d
	xorl	%r15d, %r15d
.LBB5_13:                               # %.lr.ph38
                                        #   Parent Loop BB5_11 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movsd	(%rbx,%r15), %xmm0              # xmm0 = mem[0],zero
	movsd	%xmm0, (%r14,%r15)
	addq	$8, %r15
	decl	%r11d
	cmpl	%r11d, %ecx
	jne	.LBB5_13
# %bb.9:                                # %.loopexit.loopexit
                                        #   in Loop: Header=BB5_11 Depth=1
	subl	%r11d, %eax
	subl	%r11d, %r9d
.LBB5_10:                               # %.loopexit
                                        #   in Loop: Header=BB5_11 Depth=1
	incl	%r10d
	cmpl	%r8d, %r10d
	jne	.LBB5_11
.LBB5_14:                               # %._crit_edge
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end5:
	.size	_Z27splitForTestAndTrainingDataPdiS_S_ii, .Lfunc_end5-_Z27splitForTestAndTrainingDataPdiS_S_ii
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function main
.LCPI6_0:
	.quad	0x3fe999999999999a              # double 0.80000000000000004
.LCPI6_1:
	.quad	0x3ff0000000000000              # double 1
.LCPI6_2:
	.quad	0x4059000000000000              # double 100
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
.Lfunc_begin3:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception3
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leaq	104(%rsp), %rax
	movq	%rax, -16(%rax)
	leaq	88(%rsp), %rbx
	movl	$.L.str, %esi
	movl	$.L.str+10, %edx
	movq	%rbx, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	leaq	168(%rsp), %r14
	movq	%r14, -16(%r14)
	movq	(%rbx), %rsi
	movq	8(%rbx), %rdx
	addq	%rsi, %rdx
.Ltmp35:
	leaq	152(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp36:
# %bb.1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit
.Ltmp38:
	leaq	152(%rsp), %rdi
	leaq	52(%rsp), %rsi
	leaq	48(%rsp), %rdx
	callq	_Z19countRowsAndColumnsNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPiS5_
.Ltmp39:
# %bb.2:
	movq	152(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB6_4
# %bb.3:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	callq	_ZdlPv
.LBB6_4:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	movslq	52(%rsp), %r15
	movslq	48(%rsp), %rbx
	movq	%rbx, %rax
	imulq	%r15, %rax
	movq	%rax, %rcx
	shlq	$3, %rcx
	testl	%eax, %eax
	movq	$-1, %rdi
	cmovnsq	%rcx, %rdi
.Ltmp41:
	callq	_Znam
.Ltmp42:
# %bb.5:
	movq	%rax, %r12
	leaq	136(%rsp), %r14
	movq	%r14, -16(%r14)
	movq	88(%rsp), %rsi
	movq	96(%rsp), %rdx
	addq	%rsi, %rdx
.Ltmp43:
	leaq	120(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
.Ltmp44:
# %bb.6:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ERKS4_.exit47
.Ltmp46:
	leaq	120(%rsp), %rdi
	movq	%r12, %rsi
	callq	_Z19readFeaturesFromCsvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPdii
.Ltmp47:
# %bb.7:
	movq	120(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB6_9
# %bb.8:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i48
	callq	_ZdlPv
.LBB6_9:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit50
	movq	%r12, 80(%rsp)                  # 8-byte Spill
	cvtsi2sd	%r15d, %xmm0
	mulsd	.LCPI6_0(%rip), %xmm0
	cvttsd2si	%xmm0, %ebp
	subl	%ebp, %r15d
	movq	%r15, 56(%rsp)                  # 8-byte Spill
	movl	%r15d, %eax
	imull	%ebx, %eax
	cltq
	leaq	(,%rax,8), %r13
	testl	%eax, %eax
	movq	$-1, %r15
	movq	%r13, %rdi
	cmovsq	%r15, %rdi
.Ltmp49:
	callq	_Znam
	movq	%rax, 64(%rsp)                  # 8-byte Spill
.Ltmp50:
# %bb.10:
	movl	%ebx, %eax
	movl	%ebp, 4(%rsp)                   # 4-byte Spill
	imull	%ebp, %eax
	movl	%eax, 40(%rsp)                  # 4-byte Spill
	movslq	%eax, %rbp
	leaq	(,%rbp,8), %r12
	testl	%ebp, %ebp
	cmovnsq	%r12, %r15
.Ltmp52:
	movq	%r15, %rdi
	callq	_Znam
.Ltmp53:
# %bb.11:
.Ltmp55:
	movq	%rax, %r14
	movq	%r15, %rdi
	callq	_Znam
.Ltmp56:
# %bb.12:
	movq	%rax, %r15
	movq	80(%rsp), %rdi                  # 8-byte Reload
	movl	%ebx, %esi
	movq	%r14, %rdx
	movq	64(%rsp), %rcx                  # 8-byte Reload
	movl	4(%rsp), %r8d                   # 4-byte Reload
	movq	56(%rsp), %r9                   # 8-byte Reload
                                        # kill: def $r9d killed $r9d killed $r9
	callq	_Z27splitForTestAndTrainingDataPdiS_S_ii
.Ltmp58:
	leaq	32(%rsp), %rdi
	movq	%r12, %rsi
	callq	hipMalloc
.Ltmp59:
# %bb.13:
	movq	32(%rsp), %rdi
.Ltmp60:
	movq	%r14, %rsi
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp61:
# %bb.14:
.Ltmp62:
	leaq	24(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
.Ltmp63:
# %bb.15:
	movq	24(%rsp), %rdi
.Ltmp64:
	movq	64(%rsp), %rsi                  # 8-byte Reload
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp65:
# %bb.16:
	movslq	4(%rsp), %r13                   # 4-byte Folded Reload
	shlq	$3, %r13
.Ltmp66:
	leaq	8(%rsp), %rdi
	movq	%r13, %rsi
	callq	hipMalloc
.Ltmp67:
# %bb.17:
	movq	8(%rsp), %rdi
.Ltmp68:
	movq	%r15, %rsi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
.Ltmp69:
# %bb.18:
.Ltmp71:
	leaq	72(%rsp), %rdi
	callq	hipEventCreate
.Ltmp72:
	movl	4(%rsp), %r12d                  # 4-byte Reload
# %bb.19:
.Ltmp73:
	leaq	16(%rsp), %rdi
	callq	hipEventCreate
.Ltmp74:
# %bb.20:
	movq	72(%rsp), %rdi
.Ltmp75:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp76:
# %bb.21:
.Ltmp77:
	movabsq	$4294967297, %rdi               # imm = 0x100000001
	movl	$1, %esi
	movq	%rdi, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
.Ltmp78:
# %bb.22:
	testl	%eax, %eax
	jne	.LBB6_24
# %bb.23:
	movq	8(%rsp), %rdi
	movq	32(%rsp), %rsi
	movq	24(%rsp), %rdx
.Ltmp79:
	movl	%r12d, %ecx
	movq	56(%rsp), %r8                   # 8-byte Reload
                                        # kill: def $r8d killed $r8d killed $r8
	movl	%ebx, %r9d
	callq	_Z27__device_stub__runAlgorithmPdS_S_iii
.Ltmp80:
.LBB6_24:
	movq	16(%rsp), %rdi
.Ltmp82:
	xorl	%esi, %esi
	callq	hipEventRecord
.Ltmp83:
# %bb.25:
	movq	16(%rsp), %rdi
.Ltmp84:
	callq	hipEventSynchronize
.Ltmp85:
# %bb.26:
	movq	72(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp86:
	leaq	44(%rsp), %rdi
	callq	hipEventElapsedTime
.Ltmp87:
# %bb.27:
	movq	8(%rsp), %rsi
.Ltmp88:
	movq	%r15, %rdi
	movq	%r13, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
.Ltmp89:
# %bb.28:
	movq	32(%rsp), %rdi
.Ltmp90:
	callq	hipFree
.Ltmp91:
# %bb.29:
	movq	24(%rsp), %rdi
.Ltmp92:
	callq	hipFree
.Ltmp93:
# %bb.30:
	movq	8(%rsp), %rdi
.Ltmp94:
	callq	hipFree
.Ltmp95:
# %bb.31:
	cvtss2sd	44(%rsp), %xmm0
	movl	$.L.str.1, %edi
	movb	$1, %al
	callq	printf
	xorps	%xmm0, %xmm0
	cmpl	%ebx, 40(%rsp)                  # 4-byte Folded Reload
	jl	.LBB6_34
# %bb.32:                               # %.lr.ph.preheader.i
	leal	-1(%rbx), %eax
	cltq
	xorpd	%xmm2, %xmm2
	movsd	.LCPI6_1(%rip), %xmm1           # xmm1 = mem[0],zero
.LBB6_33:                               # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movsd	(%r15), %xmm0                   # xmm0 = mem[0],zero
	movapd	%xmm2, %xmm3
	cmpeqsd	(%r14,%rax,8), %xmm0
	addsd	%xmm1, %xmm3
	andpd	%xmm0, %xmm3
	andnpd	%xmm2, %xmm0
	orpd	%xmm3, %xmm0
	addq	%rbx, %rax
	addq	$8, %r15
	movapd	%xmm0, %xmm2
	cmpq	%rbp, %rax
	jl	.LBB6_33
.LBB6_34:                               # %_Z12showAccuracyPdS_ii.exit
	xorps	%xmm1, %xmm1
	cvtsi2sd	%r12d, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	.LCPI6_2(%rip), %xmm0
	movl	$.L.str.2, %edi
	movb	$1, %al
	callq	printf
	movq	88(%rsp), %rdi
	leaq	104(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB6_36
# %bb.35:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i57
	callq	_ZdlPv
.LBB6_36:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit59
	xorl	%eax, %eax
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB6_45:
	.cfi_def_cfa_offset 240
.Ltmp57:
	jmp	.LBB6_49
.LBB6_44:
.Ltmp54:
	jmp	.LBB6_49
.LBB6_43:
.Ltmp51:
	jmp	.LBB6_49
.LBB6_42:
.Ltmp48:
	movq	%rax, %rbx
	movq	120(%rsp), %rdi
	jmp	.LBB6_39
.LBB6_38:
.Ltmp40:
	movq	%rax, %rbx
	movq	152(%rsp), %rdi
.LBB6_39:
	cmpq	%r14, %rdi
	je	.LBB6_50
# %bb.40:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i51
	callq	_ZdlPv
	jmp	.LBB6_50
.LBB6_37:
.Ltmp37:
	jmp	.LBB6_49
.LBB6_41:
.Ltmp45:
	jmp	.LBB6_49
.LBB6_47:
.Ltmp81:
	jmp	.LBB6_49
.LBB6_46:
.Ltmp70:
	jmp	.LBB6_49
.LBB6_48:
.Ltmp96:
.LBB6_49:
	movq	%rax, %rbx
.LBB6_50:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit53
	movq	88(%rsp), %rdi
	leaq	104(%rsp), %rax
	cmpq	%rax, %rdi
	je	.LBB6_52
# %bb.51:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i60
	callq	_ZdlPv
.LBB6_52:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit62
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end6:
	.size	main, .Lfunc_end6-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table6:
.Lexception3:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end3-.Lcst_begin3
.Lcst_begin3:
	.uleb128 .Lfunc_begin3-.Lfunc_begin3    # >> Call Site 1 <<
	.uleb128 .Ltmp35-.Lfunc_begin3          #   Call between .Lfunc_begin3 and .Ltmp35
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp35-.Lfunc_begin3          # >> Call Site 2 <<
	.uleb128 .Ltmp36-.Ltmp35                #   Call between .Ltmp35 and .Ltmp36
	.uleb128 .Ltmp37-.Lfunc_begin3          #     jumps to .Ltmp37
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp38-.Lfunc_begin3          # >> Call Site 3 <<
	.uleb128 .Ltmp39-.Ltmp38                #   Call between .Ltmp38 and .Ltmp39
	.uleb128 .Ltmp40-.Lfunc_begin3          #     jumps to .Ltmp40
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp41-.Lfunc_begin3          # >> Call Site 4 <<
	.uleb128 .Ltmp44-.Ltmp41                #   Call between .Ltmp41 and .Ltmp44
	.uleb128 .Ltmp45-.Lfunc_begin3          #     jumps to .Ltmp45
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp46-.Lfunc_begin3          # >> Call Site 5 <<
	.uleb128 .Ltmp47-.Ltmp46                #   Call between .Ltmp46 and .Ltmp47
	.uleb128 .Ltmp48-.Lfunc_begin3          #     jumps to .Ltmp48
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp49-.Lfunc_begin3          # >> Call Site 6 <<
	.uleb128 .Ltmp50-.Ltmp49                #   Call between .Ltmp49 and .Ltmp50
	.uleb128 .Ltmp51-.Lfunc_begin3          #     jumps to .Ltmp51
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp52-.Lfunc_begin3          # >> Call Site 7 <<
	.uleb128 .Ltmp53-.Ltmp52                #   Call between .Ltmp52 and .Ltmp53
	.uleb128 .Ltmp54-.Lfunc_begin3          #     jumps to .Ltmp54
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp55-.Lfunc_begin3          # >> Call Site 8 <<
	.uleb128 .Ltmp56-.Ltmp55                #   Call between .Ltmp55 and .Ltmp56
	.uleb128 .Ltmp57-.Lfunc_begin3          #     jumps to .Ltmp57
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp58-.Lfunc_begin3          # >> Call Site 9 <<
	.uleb128 .Ltmp69-.Ltmp58                #   Call between .Ltmp58 and .Ltmp69
	.uleb128 .Ltmp70-.Lfunc_begin3          #     jumps to .Ltmp70
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp71-.Lfunc_begin3          # >> Call Site 10 <<
	.uleb128 .Ltmp80-.Ltmp71                #   Call between .Ltmp71 and .Ltmp80
	.uleb128 .Ltmp81-.Lfunc_begin3          #     jumps to .Ltmp81
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp82-.Lfunc_begin3          # >> Call Site 11 <<
	.uleb128 .Ltmp95-.Ltmp82                #   Call between .Ltmp82 and .Ltmp95
	.uleb128 .Ltmp96-.Lfunc_begin3          #     jumps to .Ltmp96
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp95-.Lfunc_begin3          # >> Call Site 12 <<
	.uleb128 .Lfunc_end6-.Ltmp95            #   Call between .Ltmp95 and .Lfunc_end6
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end3:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB7_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB7_3
.LBB7_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB7_3:
	testq	%r14, %r14
	je	.LBB7_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB7_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB7_7
.LBB7_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB7_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end7:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end7-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB8_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB8_3
.LBB8_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB8_3:
	testq	%r14, %r14
	je	.LBB8_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB8_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB8_7
.LBB8_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB8_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag, .Lfunc_end8-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z12runAlgorithmPdS_S_iii, %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_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__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	.LBB10_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
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z12runAlgorithmPdS_S_iii,@object # @_Z12runAlgorithmPdS_S_iii
	.section	.rodata,"a",@progbits
	.globl	_Z12runAlgorithmPdS_S_iii
	.p2align	3, 0x0
_Z12runAlgorithmPdS_S_iii:
	.quad	_Z27__device_stub__runAlgorithmPdS_S_iii
	.size	_Z12runAlgorithmPdS_S_iii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"./data.csv"
	.size	.L.str, 11

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"Algorithm took: %f (ms)\n"
	.size	.L.str.1, 25

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z12runAlgorithmPdS_S_iii ; -- Begin function _Z12runAlgorithmPdS_S_iii
	.globl	_Z12runAlgorithmPdS_S_iii
	.p2align	8
	.type	_Z12runAlgorithmPdS_S_iii,@function
_Z12runAlgorithmPdS_S_iii:              ; @_Z12runAlgorithmPdS_S_iii
; %bb.0:
	s_clause 0x1
	s_load_b32 s8, s[0:1], 0x34
	s_load_b128 s[4:7], s[0:1], 0x18
	s_add_u32 s2, s0, 40
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s10, s8, 0xffff
	s_mul_i32 s7, s6, s4
	v_mad_u64_u32 v[1:2], null, s15, s10, v[0:1]
	s_mov_b32 s4, exec_lo
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_gt_i32_e64 s7, v1
	s_cbranch_execz .LBB0_11
; %bb.1:                                ; %.preheader.lr.ph
	s_load_b32 s19, s[2:3], 0x0
	s_clause 0x1
	s_load_b64 s[12:13], s[0:1], 0x10
	s_load_b128 s[0:3], s[0:1], 0x0
	s_mul_i32 s14, s6, s5
	v_dual_mov_b32 v3, 0 :: v_dual_mov_b32 v0, 0
	s_cmp_gt_i32 s14, 0
	v_mov_b32_e32 v8, 0
	s_cselect_b32 s16, -1, 0
	s_add_i32 s17, s6, -1
	s_mov_b32 s5, 0
	s_cmp_lg_u32 s17, 0
	s_mov_b32 s8, -1
	s_cselect_b32 s18, -1, 0
	s_mov_b32 s9, 0x7fefffff
	s_mov_b32 s15, 0
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s19, s19, s10
	s_add_u32 s20, s12, -8
	s_addc_u32 s21, s13, -1
	s_mov_b32 s10, s5
.LBB0_2:                                ; %.preheader
                                        ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
                                        ;       Child Loop BB0_6 Depth 3
	s_and_not1_b32 vcc_lo, exec_lo, s16
	s_cbranch_vccnz .LBB0_10
; %bb.3:                                ; %.lr.ph.preheader
                                        ;   in Loop: Header=BB0_2 Depth=1
	v_dual_mov_b32 v4, s8 :: v_dual_mov_b32 v5, s9
	s_mov_b32 s12, 0
.LBB0_4:                                ; %.lr.ph
                                        ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_6 Depth 3
	v_mov_b32_e32 v6, 0
	v_mov_b32_e32 v7, 0
	s_and_not1_b32 vcc_lo, exec_lo, s18
	s_cbranch_vccnz .LBB0_7
; %bb.5:                                ; %.lr.ph.i.preheader
                                        ;   in Loop: Header=BB0_4 Depth=2
	s_mov_b32 s11, 0
.LBB0_6:                                ; %.lr.ph.i
                                        ;   Parent Loop BB0_2 Depth=1
                                        ;     Parent Loop BB0_4 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_add_nc_u32_e32 v2, s11, v1
	s_add_i32 s4, s12, s11
	s_lshl_b64 s[22:23], s[4:5], 3
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_add_u32 s22, s2, s22
	v_lshlrev_b64 v[9:10], 3, v[2:3]
	s_addc_u32 s23, s3, s23
	s_add_i32 s11, s11, 1
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_cmp_lg_u32 s17, s11
	v_add_co_u32 v9, vcc_lo, s2, v9
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v10, vcc_lo, s3, v10, vcc_lo
	s_clause 0x1
	global_load_b64 v[9:10], v[9:10], off
	global_load_b64 v[11:12], v0, s[22:23]
	s_waitcnt vmcnt(0)
	v_add_f64 v[9:10], v[9:10], -v[11:12]
	s_delay_alu instid0(VALU_DEP_1)
	v_fma_f64 v[6:7], v[9:10], v[9:10], v[6:7]
	s_cbranch_scc1 .LBB0_6
.LBB0_7:                                ; %_Z17euclideanDistancePdS_iii.exit
                                        ;   in Loop: Header=BB0_4 Depth=2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_cmp_gt_f64_e32 vcc_lo, 0x10000000, v[6:7]
	s_add_i32 s12, s12, s6
	s_mov_b32 s4, exec_lo
	v_cndmask_b32_e64 v2, 0, 1, vcc_lo
	v_lshlrev_b32_e32 v2, 8, v2
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_ldexp_f64 v[6:7], v[6:7], v2
	v_cndmask_b32_e64 v2, 0, 0xffffff80, vcc_lo
	v_rsq_f64_e32 v[9:10], v[6:7]
	v_cmp_class_f64_e64 vcc_lo, v[6:7], 0x260
	s_waitcnt_depctr 0xfff
	v_mul_f64 v[11:12], v[6:7], v[9:10]
	v_mul_f64 v[9:10], v[9:10], 0.5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[13:14], -v[9:10], v[11:12], 0.5
	v_fma_f64 v[11:12], v[11:12], v[13:14], v[11:12]
	v_fma_f64 v[9:10], v[9:10], v[13:14], v[9:10]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[13:14], -v[11:12], v[11:12], v[6:7]
	v_fma_f64 v[11:12], v[13:14], v[9:10], v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f64 v[13:14], -v[11:12], v[11:12], v[6:7]
	v_fma_f64 v[9:10], v[13:14], v[9:10], v[11:12]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ldexp_f64 v[9:10], v[9:10], v2
	v_dual_cndmask_b32 v7, v10, v7 :: v_dual_cndmask_b32 v6, v9, v6
	s_delay_alu instid0(VALU_DEP_1)
	v_cmpx_lt_f64_e32 v[6:7], v[4:5]
	s_cbranch_execz .LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=2
	s_ashr_i32 s13, s12, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_lshl_b64 s[22:23], s[12:13], 3
	s_add_u32 s22, s20, s22
	s_addc_u32 s23, s21, s23
	global_load_b64 v[4:5], v0, s[22:23]
	s_waitcnt vmcnt(0)
	v_cvt_i32_f64_e32 v8, v[4:5]
	v_dual_mov_b32 v4, v6 :: v_dual_mov_b32 v5, v7
.LBB0_9:                                ; %_Z17euclideanDistancePdS_iii.exit._crit_edge
                                        ;   in Loop: Header=BB0_4 Depth=2
	s_or_b32 exec_lo, exec_lo, s4
	s_cmp_ge_i32 s12, s14
	s_cbranch_scc0 .LBB0_4
.LBB0_10:                               ; %._crit_edge
                                        ;   in Loop: Header=BB0_2 Depth=1
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_cvt_f64_i32_e32 v[4:5], v8
	v_add_nc_u32_e32 v1, s19, v1
	s_mov_b32 s11, s5
	s_lshl_b64 s[12:13], s[10:11], 3
	s_delay_alu instid0(VALU_DEP_1)
	v_cmp_le_i32_e32 vcc_lo, s7, v1
	s_add_u32 s12, s0, s12
	s_addc_u32 s13, s1, s13
	s_add_i32 s10, s10, 1
	s_or_b32 s15, vcc_lo, s15
	global_store_b64 v0, v[4:5], s[12:13]
	s_and_not1_b32 exec_lo, exec_lo, s15
	s_cbranch_execnz .LBB0_2
.LBB0_11:                               ; %._crit_edge40
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z12runAlgorithmPdS_S_iii
		.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 15
		.amdhsa_next_free_sgpr 24
		.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	_Z12runAlgorithmPdS_S_iii, .Lfunc_end0-_Z12runAlgorithmPdS_S_iii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 648
; NumSgprs: 26
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 3
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 26
; NumVGPRsForWavesPerEU: 15
; 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:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .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:           _Z12runAlgorithmPdS_S_iii
    .private_segment_fixed_size: 0
    .sgpr_count:     26
    .sgpr_spill_count: 0
    .symbol:         _Z12runAlgorithmPdS_S_iii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     15
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
