
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <float.h>

__global__  void vector_sub(double *out, const double *a, double c, int m, int n) {
    int tid =threadIdx.x;

    if (tid >= m && tid < n) {
        out[tid] -= a[tid] * c;
    }
}

void printMatrix(double **matrix, const int *SIZE) {
    for (int i = 0; i < *SIZE; ++i) {
        for (int j = 0; j < *SIZE; ++j) {
            printf("%f ", matrix[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}

double diagonalMultiplication(double **matrix, const int *SIZE) {
    double rez = 1;
    for (int i = 0; i < *SIZE; ++i) rez *= matrix[i][i];
    return rez;
}

int zeroesCheck(const double *range, const int *SIZE) {
    int count = 0, flag = 1;
    for (int i = 0; i < *SIZE; ++i)
        if (range[i] == 0 && flag) {
            count++;
        } else flag = 0;
    return count;
}

int power(int a, int b) {
    int rez = 1;
    for (int i = 0; i < b; ++i) rez *= a;
    return rez;
}

int sort(double **matrix, int *SIZE) {
    int i, j, count = 0;
    double *temp;
    for (i = 0; i < *SIZE - 1; i++)
        for (j = 0; j < *SIZE - i - 1; j++) {
            if (zeroesCheck(matrix[j], SIZE) > zeroesCheck(matrix[j + 1], SIZE)) {
                count++;
                temp = matrix[j];
                matrix[j] = matrix[j + 1];
                matrix[j + 1] = temp;
            }
        }
    return power(-1, count);
}


double gaussianDeterminant(double **matrix, int* SIZE) {
    int size = *SIZE;
    double first, factor;
    double *d_a, *d_out;

    cudaMalloc((void **) &d_a, sizeof(double) * *SIZE);
    cudaMalloc((void **) &d_out, sizeof(double) * *SIZE);

    while (size > 1) {
        if (matrix[*SIZE - size][*SIZE - size] == 0) return 0;
        first = matrix[*SIZE - size][*SIZE - size];
        for (int i = *SIZE - size + 1; i < *SIZE; ++i) {

            factor = matrix[i][*SIZE - size] / first;
            cudaMemcpy(d_out, matrix[i], sizeof(double) * *SIZE, cudaMemcpyHostToDevice);
            cudaMemcpy(d_a, matrix[*SIZE - size], sizeof(double) * *SIZE, cudaMemcpyHostToDevice);

            vector_sub <<< 1, *SIZE >>>(d_out, d_a, factor, *SIZE - size, *SIZE);
            cudaMemcpy(matrix[i], d_out, sizeof(double) * *SIZE, cudaMemcpyDeviceToHost);
            cudaDeviceSynchronize();
        }

        size--;
    }
    cudaFree(d_a);
    cudaFree(d_out);
    return diagonalMultiplication(matrix, SIZE);
}

void init() {
    FILE *fp1, *fp2;
    if ((fp1 = fopen("read.txt", "r")) == nullptr) {
        printf("Can't open file 'read.txt'\n");
        exit(-1);
    }
    if ((fp2 = fopen("write.txt", "w")) == nullptr) {
        printf("Can't open file 'write.txt'\n");
        exit(-1);
    }
    double **matrix;
    double determinant;
    int SIZE, sign;
    clock_t time_start, time_finish;

    while (fscanf(fp1, "%d", &SIZE) == 1) {
        matrix = (double **) malloc(SIZE * sizeof(double *));
        for (int i = 0; i < SIZE; ++i) {
            matrix[i] = (double *) malloc(SIZE * sizeof(double));
            for (int j = 0; j < SIZE; ++j) {
                fscanf(fp1, "%lf", &matrix[i][j]);
            }
        }
        time_start = clock();
        sign = sort(matrix, &SIZE);
        determinant = gaussianDeterminant(matrix, &SIZE) * (double) sign;
        time_finish = clock();
        fprintf(fp2, "%ld %f\n", time_finish - time_start, determinant);
        for (int i = 0; i < SIZE; ++i) free(matrix[i]);
        free(matrix);
        if (determinant > DBL_MAX) exit(-2);
    }
    fclose(fp1);
    fclose(fp2);
}

int main() {
    init();
    return 0;
}





	.file	"tmpxft_0031b0a1_00000000-6_main.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2037:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2037:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%f "
.LC1:
	.string	"\n"
	.text
	.globl	_Z11printMatrixPPdPKi
	.type	_Z11printMatrixPPdPKi, @function
_Z11printMatrixPPdPKi:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	xorl	%ebx, %ebx
.L3:
	cmpl	%ebx, 0(%rbp)
	jle	.L9
	xorl	%r12d, %r12d
.L5:
	cmpl	%r12d, 0(%rbp)
	jle	.L10
	movq	0(%r13,%rbx,8), %rax
	movq	%r14, %rsi
	movl	$2, %edi
	movsd	(%rax,%r12,8), %xmm0
	movb	$1, %al
	incq	%r12
	call	__printf_chk@PLT
	jmp	.L5
.L10:
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%rbx
	call	__printf_chk@PLT
	jmp	.L3
.L9:
	popq	%rbx
	.cfi_def_cfa_offset 40
	leaq	.LC1(%rip), %rsi
	popq	%rbp
	.cfi_def_cfa_offset 32
	movl	$2, %edi
	popq	%r12
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.cfi_endproc
.LFE2027:
	.size	_Z11printMatrixPPdPKi, .-_Z11printMatrixPPdPKi
	.globl	_Z22diagonalMultiplicationPPdPKi
	.type	_Z22diagonalMultiplicationPPdPKi, @function
_Z22diagonalMultiplicationPPdPKi:
.LFB2028:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movsd	.LC2(%rip), %xmm0
	xorl	%eax, %eax
.L12:
	cmpl	%eax, %edx
	jle	.L14
	movq	(%rdi,%rax,8), %rcx
	mulsd	(%rcx,%rax,8), %xmm0
	incq	%rax
	jmp	.L12
.L14:
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z22diagonalMultiplicationPPdPKi, .-_Z22diagonalMultiplicationPPdPKi
	.globl	_Z11zeroesCheckPKdPKi
	.type	_Z11zeroesCheckPKdPKi, @function
_Z11zeroesCheckPKdPKi:
.LFB2029:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	xorl	%eax, %eax
	movl	$1, %ecx
	xorl	%edx, %edx
	xorps	%xmm0, %xmm0
	xorl	%r9d, %r9d
.L16:
	cmpl	%eax, %r8d
	jle	.L26
	ucomisd	(%rdi,%rax,8), %xmm0
	setnp	%sil
	cmovne	%r9d, %esi
	testb	%sil, %sil
	je	.L19
	testl	%ecx, %ecx
	je	.L19
	incl	%edx
	movl	$1, %ecx
	jmp	.L17
.L19:
	xorl	%ecx, %ecx
.L17:
	incq	%rax
	jmp	.L16
.L26:
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z11zeroesCheckPKdPKi, .-_Z11zeroesCheckPKdPKi
	.globl	_Z5powerii
	.type	_Z5powerii, @function
_Z5powerii:
.LFB2030:
	.cfi_startproc
	endbr64
	xorl	%edx, %edx
	movl	$1, %eax
.L28:
	cmpl	%esi, %edx
	jge	.L30
	imull	%edi, %eax
	incl	%edx
	jmp	.L28
.L30:
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z5powerii, .-_Z5powerii
	.globl	_Z4sortPPdPi
	.type	_Z4sortPPdPi, @function
_Z4sortPPdPi:
.LFB2031:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	pushq	%rcx
	.cfi_def_cfa_offset 64
	movl	(%rsi), %eax
	leal	-1(%rax), %r12d
.L32:
	cmpl	%ebp, %r12d
	jle	.L40
	movl	%r12d, %eax
	xorl	%r10d, %r10d
	subl	%ebp, %eax
	movl	%eax, 4(%rsp)
.L35:
	cmpl	%r10d, 4(%rsp)
	jle	.L41
	movq	(%r11,%r10,8), %r15
	movq	%rbx, %rsi
	movq	%r15, %rdi
	call	_Z11zeroesCheckPKdPKi
	movq	8(%r11,%r10,8), %rdi
	movq	%rbx, %rsi
	movl	%eax, %r14d
	call	_Z11zeroesCheckPKdPKi
	cmpl	%eax, %r14d
	jle	.L33
	movq	%rdi, (%r11,%r10,8)
	incl	%r13d
	movq	%r15, 8(%r11,%r10,8)
.L33:
	incq	%r10
	jmp	.L35
.L41:
	incl	%ebp
	jmp	.L32
.L40:
	xorl	%edx, %edx
	movl	$1, %eax
.L36:
	cmpl	%edx, %r13d
	jle	.L42
	negl	%eax
	incl	%edx
	jmp	.L36
.L42:
	popq	%rdx
	.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
.LFE2031:
	.size	_Z4sortPPdPi, .-_Z4sortPPdPi
	.globl	_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii
	.type	_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii, @function
_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii:
.LFB2059:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	48(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	60(%rsp), %rsi
	movl	%edx, 4(%rsp)
	leaq	32(%rsp), %rdx
	movl	%ecx, (%rsp)
	leaq	40(%rsp), %rcx
	movsd	%xmm0, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%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	4(%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	.L43
	pushq	40(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z10vector_subPdPKddii(%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
.L43:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2059:
	.size	_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii, .-_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii
	.globl	_Z10vector_subPdPKddii
	.type	_Z10vector_subPdPKddii, @function
_Z10vector_subPdPKddii:
.LFB2060:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii
	.cfi_endproc
.LFE2060:
	.size	_Z10vector_subPdPKddii, .-_Z10vector_subPdPKddii
	.globl	_Z19gaussianDeterminantPPdPi
	.type	_Z19gaussianDeterminantPPdPi, @function
_Z19gaussianDeterminantPPdPi:
.LFB2032:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movabsq	$4294967297, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movslq	(%rsi), %rsi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdi
	movq	%rsi, %r12
	salq	$3, %rsi
	call	cudaMalloc@PLT
	movslq	0(%rbp), %rsi
	leaq	24(%rsp), %rdi
	salq	$3, %rsi
	call	cudaMalloc@PLT
.L49:
	cmpl	$1, %r12d
	jle	.L60
	movl	0(%rbp), %ebx
	xorps	%xmm0, %xmm0
	subl	%r12d, %ebx
	movslq	%ebx, %rax
	movq	0(%r13,%rax,8), %rdx
	movsd	(%rdx,%rax,8), %xmm1
	ucomisd	%xmm0, %xmm1
	movsd	%xmm1, (%rsp)
	jp	.L58
	je	.L57
.L58:
	incl	%ebx
	movslq	%ebx, %rbx
.L52:
	movslq	0(%rbp), %rdx
	cmpl	%ebx, %edx
	jle	.L61
	movl	%edx, %eax
	movq	0(%r13,%rbx,8), %rsi
	movq	24(%rsp), %rdi
	salq	$3, %rdx
	subl	%r12d, %eax
	movl	$1, %ecx
	cltq
	movsd	(%rsi,%rax,8), %xmm0
	movsd	%xmm0, 8(%rsp)
	call	cudaMemcpy@PLT
	movslq	0(%rbp), %rdx
	movq	16(%rsp), %rdi
	movl	$1, %ecx
	movq	%rdx, %rax
	salq	$3, %rdx
	subl	%r12d, %eax
	cltq
	movq	0(%r13,%rax,8), %rsi
	call	cudaMemcpy@PLT
	movl	0(%rbp), %eax
	movq	%r14, 48(%rsp)
	xorl	%r9d, %r9d
	movl	52(%rsp), %ecx
	xorl	%r8d, %r8d
	movq	%r14, %rdi
	movl	$1, %esi
	movl	%eax, 44(%rsp)
	movq	44(%rsp), %rdx
	movq	%r14, 32(%rsp)
	movl	$1, 40(%rsp)
	call	__cudaPushCallConfiguration@PLT
	movsd	8(%rsp), %xmm0
	testl	%eax, %eax
	jne	.L53
	movl	0(%rbp), %ecx
	movq	16(%rsp), %rsi
	divsd	(%rsp), %xmm0
	movq	24(%rsp), %rdi
	movl	%ecx, %edx
	subl	%r12d, %edx
	call	_Z36__device_stub__Z10vector_subPdPKddiiPdPKddii
.L53:
	movslq	0(%rbp), %rdx
	movq	0(%r13,%rbx,8), %rdi
	movl	$2, %ecx
	incq	%rbx
	movq	24(%rsp), %rsi
	salq	$3, %rdx
	call	cudaMemcpy@PLT
	call	cudaDeviceSynchronize@PLT
	jmp	.L52
.L61:
	decl	%r12d
	jmp	.L49
.L60:
	movq	16(%rsp), %rdi
	call	cudaFree@PLT
	movq	24(%rsp), %rdi
	call	cudaFree@PLT
	movq	%rbp, %rsi
	movq	%r13, %rdi
	call	_Z22diagonalMultiplicationPPdPKi
	jmp	.L48
.L57:
	xorps	%xmm0, %xmm0
.L48:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L56
	call	__stack_chk_fail@PLT
.L56:
	addq	$64, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z19gaussianDeterminantPPdPi, .-_Z19gaussianDeterminantPPdPi
	.section	.rodata.str1.1
.LC4:
	.string	"r"
.LC5:
	.string	"read.txt"
.LC6:
	.string	"Can't open file 'read.txt'\n"
.LC7:
	.string	"w"
.LC8:
	.string	"write.txt"
.LC9:
	.string	"Can't open file 'write.txt'\n"
.LC10:
	.string	"%lf"
.LC11:
	.string	"%ld %f\n"
.LC13:
	.string	"%d"
	.text
	.globl	_Z4initv
	.type	_Z4initv, @function
_Z4initv:
.LFB2033:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC4(%rip), %rsi
	leaq	.LC5(%rip), %rdi
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	fopen@PLT
	leaq	.LC6(%rip), %rsi
	testq	%rax, %rax
	je	.L77
	leaq	.LC7(%rip), %rsi
	leaq	.LC8(%rip), %rdi
	movq	%rax, %rbp
	call	fopen@PLT
	movq	%rax, %r12
	testq	%rax, %rax
	jne	.L64
	leaq	.LC9(%rip), %rsi
.L77:
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	orl	$-1, %edi
.L78:
	call	exit@PLT
.L64:
	leaq	20(%rsp), %rax
	leaq	.LC13(%rip), %rsi
	movq	%rbp, %rdi
	movq	%rax, (%rsp)
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__isoc23_fscanf@PLT
	decl	%eax
	jne	.L79
	movslq	20(%rsp), %rdi
	xorl	%r13d, %r13d
	leaq	.LC10(%rip), %r15
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
.L65:
	movslq	20(%rsp), %rdi
	cmpl	%r13d, %edi
	jle	.L80
	salq	$3, %rdi
	xorl	%r14d, %r14d
	call	malloc@PLT
	movq	%rax, (%rbx,%r13,8)
	movq	%rax, %rdx
.L66:
	cmpl	%r14d, 20(%rsp)
	jle	.L81
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	%rdx, 8(%rsp)
	call	__isoc23_fscanf@PLT
	movq	8(%rsp), %rdx
	incl	%r14d
	addq	$8, %rdx
	jmp	.L66
.L81:
	incq	%r13
	jmp	.L65
.L80:
	call	clock@PLT
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	movq	%rax, %r15
	call	_Z4sortPPdPi
	movq	(%rsp), %rsi
	movq	%rbx, %rdi
	movl	%eax, 8(%rsp)
	call	_Z19gaussianDeterminantPPdPi
	movl	8(%rsp), %eax
	cvtsi2sdl	%eax, %xmm1
	mulsd	%xmm0, %xmm1
	movq	%xmm1, %r13
	call	clock@PLT
	movq	%r13, %xmm0
	movl	$2, %esi
	movq	%r12, %rdi
	subq	%r15, %rax
	leaq	.LC11(%rip), %rdx
	xorl	%r15d, %r15d
	movq	%rax, %rcx
	movb	$1, %al
	call	__fprintf_chk@PLT
.L69:
	cmpl	%r15d, 20(%rsp)
	jle	.L82
	movq	(%rbx,%r15,8), %rdi
	incq	%r15
	call	free@PLT
	jmp	.L69
.L82:
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r13, %xmm2
	comisd	.LC12(%rip), %xmm2
	jbe	.L64
	movl	$-2, %edi
	jmp	.L78
.L79:
	movq	%rbp, %rdi
	call	fclose@PLT
	movq	%r12, %rdi
	call	fclose@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L73
	call	__stack_chk_fail@PLT
.L73:
	addq	$40, %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
.LFE2033:
	.size	_Z4initv, .-_Z4initv
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2034:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	_Z4initv
	xorl	%eax, %eax
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2034:
	.size	main, .-main
	.section	.rodata.str1.1
.LC14:
	.string	"_Z10vector_subPdPKddii"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2062:
	.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	.LC14(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z10vector_subPdPKddii(%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
.LFE2062:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.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
.LC2:
	.long	0
	.long	1072693248
	.align 8
.LC12:
	.long	-1
	.long	2146435071
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include "hip/hip_runtime.h"


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <float.h>

__global__  void vector_sub(double *out, const double *a, double c, int m, int n) {
    int tid =threadIdx.x;

    if (tid >= m && tid < n) {
        out[tid] -= a[tid] * c;
    }
}

void printMatrix(double **matrix, const int *SIZE) {
    for (int i = 0; i < *SIZE; ++i) {
        for (int j = 0; j < *SIZE; ++j) {
            printf("%f ", matrix[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}

double diagonalMultiplication(double **matrix, const int *SIZE) {
    double rez = 1;
    for (int i = 0; i < *SIZE; ++i) rez *= matrix[i][i];
    return rez;
}

int zeroesCheck(const double *range, const int *SIZE) {
    int count = 0, flag = 1;
    for (int i = 0; i < *SIZE; ++i)
        if (range[i] == 0 && flag) {
            count++;
        } else flag = 0;
    return count;
}

int power(int a, int b) {
    int rez = 1;
    for (int i = 0; i < b; ++i) rez *= a;
    return rez;
}

int sort(double **matrix, int *SIZE) {
    int i, j, count = 0;
    double *temp;
    for (i = 0; i < *SIZE - 1; i++)
        for (j = 0; j < *SIZE - i - 1; j++) {
            if (zeroesCheck(matrix[j], SIZE) > zeroesCheck(matrix[j + 1], SIZE)) {
                count++;
                temp = matrix[j];
                matrix[j] = matrix[j + 1];
                matrix[j + 1] = temp;
            }
        }
    return power(-1, count);
}


double gaussianDeterminant(double **matrix, int* SIZE) {
    int size = *SIZE;
    double first, factor;
    double *d_a, *d_out;

    hipMalloc((void **) &d_a, sizeof(double) * *SIZE);
    hipMalloc((void **) &d_out, sizeof(double) * *SIZE);

    while (size > 1) {
        if (matrix[*SIZE - size][*SIZE - size] == 0) return 0;
        first = matrix[*SIZE - size][*SIZE - size];
        for (int i = *SIZE - size + 1; i < *SIZE; ++i) {

            factor = matrix[i][*SIZE - size] / first;
            hipMemcpy(d_out, matrix[i], sizeof(double) * *SIZE, hipMemcpyHostToDevice);
            hipMemcpy(d_a, matrix[*SIZE - size], sizeof(double) * *SIZE, hipMemcpyHostToDevice);

            vector_sub <<< 1, *SIZE >>>(d_out, d_a, factor, *SIZE - size, *SIZE);
            hipMemcpy(matrix[i], d_out, sizeof(double) * *SIZE, hipMemcpyDeviceToHost);
            hipDeviceSynchronize();
        }

        size--;
    }
    hipFree(d_a);
    hipFree(d_out);
    return diagonalMultiplication(matrix, SIZE);
}

void init() {
    FILE *fp1, *fp2;
    if ((fp1 = fopen("read.txt", "r")) == nullptr) {
        printf("Can't open file 'read.txt'\n");
        exit(-1);
    }
    if ((fp2 = fopen("write.txt", "w")) == nullptr) {
        printf("Can't open file 'write.txt'\n");
        exit(-1);
    }
    double **matrix;
    double determinant;
    int SIZE, sign;
    clock_t time_start, time_finish;

    while (fscanf(fp1, "%d", &SIZE) == 1) {
        matrix = (double **) malloc(SIZE * sizeof(double *));
        for (int i = 0; i < SIZE; ++i) {
            matrix[i] = (double *) malloc(SIZE * sizeof(double));
            for (int j = 0; j < SIZE; ++j) {
                fscanf(fp1, "%lf", &matrix[i][j]);
            }
        }
        time_start = clock();
        sign = sort(matrix, &SIZE);
        determinant = gaussianDeterminant(matrix, &SIZE) * (double) sign;
        time_finish = clock();
        fprintf(fp2, "%ld %f\n", time_finish - time_start, determinant);
        for (int i = 0; i < SIZE; ++i) free(matrix[i]);
        free(matrix);
        if (determinant > DBL_MAX) exit(-2);
    }
    fclose(fp1);
    fclose(fp2);
}

int main() {
    init();
    return 0;
}





	.text
	.file	"main.hip"
	.globl	_Z25__device_stub__vector_subPdPKddii # -- Begin function _Z25__device_stub__vector_subPdPKddii
	.type	_Z25__device_stub__vector_subPdPKddii,@function
_Z25__device_stub__vector_subPdPKddii:  # @_Z25__device_stub__vector_subPdPKddii
	.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	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movsd	%xmm0, (%rsi)
	leaq	4(%rsp), %r8
	movl	%edx, (%r8)
	movq	%rsp, %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%r8, 24(%rbx)
	movq	%rdx, 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	$_Z10vector_subPdPKddii, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$144, %rsp
	.cfi_adjust_cfa_offset -144
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z25__device_stub__vector_subPdPKddii, .Lfunc_end0-_Z25__device_stub__vector_subPdPKddii
	.cfi_endproc
                                        # -- End function
	.globl	_Z11printMatrixPPdPKi           # -- Begin function _Z11printMatrixPPdPKi
	.type	_Z11printMatrixPPdPKi,@function
_Z11printMatrixPPdPKi:                  # @_Z11printMatrixPPdPKi
	.cfi_startproc
# %bb.0:
	movl	(%rsi), %eax
	testl	%eax, %eax
	jle	.LBB1_7
# %bb.1:                                # %.preheader.preheader
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rsi, %rbx
	movq	%rdi, %r14
	xorl	%r15d, %r15d
.LBB1_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	testl	%eax, %eax
	jle	.LBB1_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB1_2 Depth=1
	xorl	%r12d, %r12d
.LBB1_4:                                #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%r14,%r15,8), %rax
	movsd	(%rax,%r12,8), %xmm0            # xmm0 = mem[0],zero
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r12
	movslq	(%rbx), %rax
	cmpq	%rax, %r12
	jl	.LBB1_4
.LBB1_5:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r15
	movslq	(%rbx), %rax
	cmpq	%rax, %r15
	jl	.LBB1_2
# %bb.6:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r14
	.cfi_restore %r15
.LBB1_7:                                # %._crit_edge12
	movl	$10, %edi
	jmp	putchar@PLT                     # TAILCALL
.Lfunc_end1:
	.size	_Z11printMatrixPPdPKi, .Lfunc_end1-_Z11printMatrixPPdPKi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z22diagonalMultiplicationPPdPKi
.LCPI2_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z22diagonalMultiplicationPPdPKi
	.type	_Z22diagonalMultiplicationPPdPKi,@function
_Z22diagonalMultiplicationPPdPKi:       # @_Z22diagonalMultiplicationPPdPKi
	.cfi_startproc
# %bb.0:
	movl	(%rsi), %eax
	movsd	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero
	testl	%eax, %eax
	jle	.LBB2_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%ecx, %ecx
.LBB2_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rdi,%rcx,8), %rdx
	mulsd	(%rdx,%rcx,8), %xmm0
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	retq
.Lfunc_end2:
	.size	_Z22diagonalMultiplicationPPdPKi, .Lfunc_end2-_Z22diagonalMultiplicationPPdPKi
	.cfi_endproc
                                        # -- End function
	.globl	_Z11zeroesCheckPKdPKi           # -- Begin function _Z11zeroesCheckPKdPKi
	.type	_Z11zeroesCheckPKdPKi,@function
_Z11zeroesCheckPKdPKi:                  # @_Z11zeroesCheckPKdPKi
	.cfi_startproc
# %bb.0:
	movl	(%rsi), %ecx
	testl	%ecx, %ecx
	jle	.LBB3_1
# %bb.3:                                # %.lr.ph.preheader
	xorl	%edx, %edx
	movb	$1, %sil
	xorpd	%xmm0, %xmm0
	xorl	%eax, %eax
.LBB3_4:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	ucomisd	(%rdi,%rdx,8), %xmm0
	setnp	%r8b
	sete	%r9b
	andb	%r8b, %r9b
	andb	%r9b, %sil
	movzbl	%sil, %r8d
	addl	%r8d, %eax
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	.LBB3_4
# %bb.2:                                # %._crit_edge
	retq
.LBB3_1:
	xorl	%eax, %eax
	retq
.Lfunc_end3:
	.size	_Z11zeroesCheckPKdPKi, .Lfunc_end3-_Z11zeroesCheckPKdPKi
	.cfi_endproc
                                        # -- End function
	.globl	_Z5powerii                      # -- Begin function _Z5powerii
	.type	_Z5powerii,@function
_Z5powerii:                             # @_Z5powerii
	.cfi_startproc
# %bb.0:
	movl	$1, %eax
	testl	%esi, %esi
	jle	.LBB4_2
.LBB4_1:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	imull	%edi, %eax
	decl	%esi
	jne	.LBB4_1
.LBB4_2:                                # %._crit_edge
	retq
.Lfunc_end4:
	.size	_Z5powerii, .Lfunc_end4-_Z5powerii
	.cfi_endproc
                                        # -- End function
	.globl	_Z4sortPPdPi                    # -- Begin function _Z4sortPPdPi
	.type	_Z4sortPPdPi,@function
_Z4sortPPdPi:                           # @_Z4sortPPdPi
	.cfi_startproc
# %bb.0:
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	$2, %edx
	jl	.LBB5_15
# %bb.1:                                # %.preheader.lr.ph
	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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	leal	-2(%rdx), %eax
	movl	%eax, -12(%rsp)                 # 4-byte Spill
	xorl	%eax, %eax
	xorpd	%xmm0, %xmm0
	xorl	%ecx, %ecx
.LBB5_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB5_4 Depth 2
                                        #       Child Loop BB5_5 Depth 3
                                        #       Child Loop BB5_7 Depth 3
	movq	%rax, -8(%rsp)                  # 8-byte Spill
	movl	%eax, %r9d
	notl	%r9d
	addl	%edx, %r9d
	jle	.LBB5_11
# %bb.3:                                # %.lr.ph.i.preheader.preheader
                                        #   in Loop: Header=BB5_2 Depth=1
	xorl	%r14d, %r14d
.LBB5_4:                                # %.lr.ph.i.preheader
                                        #   Parent Loop BB5_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB5_5 Depth 3
                                        #       Child Loop BB5_7 Depth 3
	movl	%r14d, %r10d
	movq	(%rdi,%r10,8), %r11
	movb	$1, %bpl
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
.LBB5_5:                                # %.lr.ph.i
                                        #   Parent Loop BB5_2 Depth=1
                                        #     Parent Loop BB5_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	ucomisd	(%r11,%r14,8), %xmm0
	setnp	%sil
	sete	%r15b
	andb	%sil, %r15b
	andb	%r15b, %bpl
	movzbl	%bpl, %esi
	addl	%esi, %ebx
	incq	%r14
	cmpq	%r14, %rdx
	jne	.LBB5_5
# %bb.6:                                # %_Z11zeroesCheckPKdPKi.exit
                                        #   in Loop: Header=BB5_4 Depth=2
	leal	1(%r10), %r14d
	leaq	1(%r10), %r15
	movq	8(%rdi,%r10,8), %r12
	xorl	%r13d, %r13d
	movb	$1, %bpl
	xorl	%esi, %esi
.LBB5_7:                                # %.lr.ph.i28
                                        #   Parent Loop BB5_2 Depth=1
                                        #     Parent Loop BB5_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	ucomisd	(%r12,%r13,8), %xmm0
	setnp	%r8b
	sete	%al
	andb	%r8b, %al
	andb	%al, %bpl
	movzbl	%bpl, %eax
	addl	%eax, %esi
	incq	%r13
	cmpq	%r13, %rdx
	jne	.LBB5_7
# %bb.8:                                # %_Z11zeroesCheckPKdPKi.exit36.loopexit
                                        #   in Loop: Header=BB5_4 Depth=2
	cmpl	%esi, %ebx
	jbe	.LBB5_10
# %bb.9:                                #   in Loop: Header=BB5_4 Depth=2
	incl	%ecx
	movq	%r12, (%rdi,%r10,8)
	movq	%r11, (%rdi,%r15,8)
.LBB5_10:                               #   in Loop: Header=BB5_4 Depth=2
	cmpl	%r9d, %r14d
	jl	.LBB5_4
.LBB5_11:                               # %._crit_edge
                                        #   in Loop: Header=BB5_2 Depth=1
	movq	-8(%rsp), %rsi                  # 8-byte Reload
	leal	1(%rsi), %eax
	cmpl	-12(%rsp), %esi                 # 4-byte Folded Reload
                                        # kill: def $eax killed $eax def $rax
	jne	.LBB5_2
# %bb.12:                               # %._crit_edge47
	testl	%ecx, %ecx
	movl	$1, %eax
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
	.cfi_restore %rbp
	jle	.LBB5_15
# %bb.13:                               # %.lr.ph.i37.preheader
	movl	$1, %edx
	movl	$-1, %esi
.LBB5_14:                               # %.lr.ph.i37
                                        # =>This Inner Loop Header: Depth=1
	movl	%esi, %eax
	movl	%edx, %esi
	movl	%eax, %edx
	decl	%ecx
	jne	.LBB5_14
.LBB5_15:                               # %_Z5powerii.exit
	retq
.Lfunc_end5:
	.size	_Z4sortPPdPi, .Lfunc_end5-_Z4sortPPdPi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z19gaussianDeterminantPPdPi
.LCPI6_0:
	.quad	0x3ff0000000000000              # double 1
	.text
	.globl	_Z19gaussianDeterminantPPdPi
	.type	_Z19gaussianDeterminantPPdPi,@function
_Z19gaussianDeterminantPPdPi:           # @_Z19gaussianDeterminantPPdPi
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.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, %rbx
	movslq	(%rsi), %r12
	leaq	(,%r12,8), %rsi
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movslq	(%r14), %rsi
	shlq	$3, %rsi
	movq	%rsp, %rdi
	callq	hipMalloc
	cmpq	$2, %r12
	jl	.LBB6_9
# %bb.1:                                # %.lr.ph56.preheader
	movabsq	$4294967296, %rcx               # imm = 0x100000000
	movl	$1, %edi
	subl	%r12d, %edi
	movl	(%r14), %eax
	leaq	1(%rcx), %r15
.LBB6_2:                                # %.lr.ph56
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_5 Depth 2
	movl	%eax, %ecx
	subl	%r12d, %ecx
	movslq	%ecx, %rdx
	movq	(%rbx,%rdx,8), %rsi
	movsd	(%rsi,%rdx,8), %xmm1            # xmm1 = mem[0],zero
	xorpd	%xmm0, %xmm0
	movsd	%xmm1, 24(%rsp)                 # 8-byte Spill
	ucomisd	%xmm0, %xmm1
	jne	.LBB6_3
	jnp	.LBB6_12
.LBB6_3:                                # %.preheader
                                        #   in Loop: Header=BB6_2 Depth=1
	incl	%ecx
	cmpl	%eax, %ecx
	movq	%rdi, 16(%rsp)                  # 8-byte Spill
	jge	.LBB6_8
# %bb.4:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB6_2 Depth=1
	leal	(%rax,%rdi), %ecx
	movslq	%ecx, %rbp
	movslq	%r12d, %r13
.LBB6_5:                                # %.lr.ph
                                        #   Parent Loop BB6_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%rbx,%rbp,8), %rsi
	movslq	%eax, %rdx
	subl	%r12d, %eax
	cltq
	movsd	(%rsi,%rax,8), %xmm0            # xmm0 = mem[0],zero
	movsd	%xmm0, 32(%rsp)                 # 8-byte Spill
	movq	(%rsp), %rdi
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movq	8(%rsp), %rdi
	movslq	(%r14), %rdx
	movq	%rdx, %rax
	subq	%r13, %rax
	movq	(%rbx,%rax,8), %rsi
	shlq	$3, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	(%r14), %edx
	movabsq	$4294967296, %rax               # imm = 0x100000000
	orq	%rax, %rdx
	movq	%r15, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB6_7
# %bb.6:                                #   in Loop: Header=BB6_5 Depth=2
	movsd	32(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	divsd	24(%rsp), %xmm0                 # 8-byte Folded Reload
	movq	(%rsp), %rdi
	movq	8(%rsp), %rsi
	movl	(%r14), %ecx
	movl	%ecx, %edx
	subl	%r12d, %edx
	callq	_Z25__device_stub__vector_subPdPKddii
.LBB6_7:                                #   in Loop: Header=BB6_5 Depth=2
	movq	(%rbx,%rbp,8), %rdi
	movq	(%rsp), %rsi
	movslq	(%r14), %rdx
	shlq	$3, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	callq	hipDeviceSynchronize
	incq	%rbp
	movslq	(%r14), %rax
	cmpq	%rax, %rbp
	jl	.LBB6_5
.LBB6_8:                                # %._crit_edge
                                        #   in Loop: Header=BB6_2 Depth=1
	leal	-1(%r12), %ecx
	movq	16(%rsp), %rdi                  # 8-byte Reload
	incl	%edi
	cmpl	$2, %r12d
	movl	%ecx, %r12d
	jg	.LBB6_2
.LBB6_9:                                # %._crit_edge57
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	(%rsp), %rdi
	callq	hipFree
	movl	(%r14), %eax
	movsd	.LCPI6_0(%rip), %xmm0           # xmm0 = mem[0],zero
	testl	%eax, %eax
	jle	.LBB6_12
# %bb.10:                               # %.lr.ph.preheader.i
	xorl	%ecx, %ecx
.LBB6_11:                               # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rbx,%rcx,8), %rdx
	mulsd	(%rdx,%rcx,8), %xmm0
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB6_11
.LBB6_12:                               # %_Z22diagonalMultiplicationPPdPKi.exit
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_Z19gaussianDeterminantPPdPi, .Lfunc_end6-_Z19gaussianDeterminantPPdPi
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0                          # -- Begin function _Z4initv
.LCPI7_0:
	.quad	0x7fefffffffffffff              # double 1.7976931348623157E+308
	.text
	.globl	_Z4initv
	.type	_Z4initv,@function
_Z4initv:                               # @_Z4initv
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	$.L.str.2, %edi
	movl	$.L.str.3, %esi
	callq	fopen
	testq	%rax, %rax
	je	.LBB7_1
# %bb.3:
	movq	%rax, %rbx
	movl	$.L.str.5, %edi
	movl	$.L.str.6, %esi
	callq	fopen
	movq	%rax, 16(%rsp)                  # 8-byte Spill
	testq	%rax, %rax
	je	.LBB7_4
# %bb.5:
	leaq	12(%rsp), %r15
.LBB7_6:                                # =>This Loop Header: Depth=1
                                        #     Child Loop BB7_9 Depth 2
                                        #       Child Loop BB7_11 Depth 3
                                        #     Child Loop BB7_15 Depth 2
	movl	$.L.str.8, %esi
	movq	%rbx, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	cmpl	$1, %eax
	jne	.LBB7_18
# %bb.7:                                #   in Loop: Header=BB7_6 Depth=1
	movslq	12(%rsp), %r14
	leaq	(,%r14,8), %rdi
	callq	malloc
	movq	%rax, %r12
	testq	%r14, %r14
	jle	.LBB7_13
# %bb.8:                                # %.lr.ph34.preheader
                                        #   in Loop: Header=BB7_6 Depth=1
	xorl	%ebp, %ebp
	movq	%r12, 32(%rsp)                  # 8-byte Spill
.LBB7_9:                                # %.lr.ph34
                                        #   Parent Loop BB7_6 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB7_11 Depth 3
	movslq	%r14d, %r15
	leaq	(,%r15,8), %rdi
	callq	malloc
	movq	%rax, (%r12,%rbp,8)
	testl	%r15d, %r15d
	jle	.LBB7_12
# %bb.10:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB7_9 Depth=2
	movq	%rax, %r13
	xorl	%r12d, %r12d
.LBB7_11:                               # %.lr.ph
                                        #   Parent Loop BB7_6 Depth=1
                                        #     Parent Loop BB7_9 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	$.L.str.9, %esi
	movq	%rbx, %rdi
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	__isoc23_fscanf
	incq	%r12
	movl	12(%rsp), %r14d
	movslq	%r14d, %r15
	addq	$8, %r13
	cmpq	%r15, %r12
	jl	.LBB7_11
.LBB7_12:                               # %._crit_edge
                                        #   in Loop: Header=BB7_9 Depth=2
	incq	%rbp
	cmpq	%r15, %rbp
	movq	32(%rsp), %r12                  # 8-byte Reload
	jl	.LBB7_9
.LBB7_13:                               # %._crit_edge35
                                        #   in Loop: Header=BB7_6 Depth=1
	callq	clock
	movq	%rax, %r13
	movq	%r12, %rdi
	leaq	12(%rsp), %r15
	movq	%r15, %rsi
	callq	_Z4sortPPdPi
	movl	%eax, %ebp
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_Z19gaussianDeterminantPPdPi
	xorps	%xmm1, %xmm1
	cvtsi2sd	%ebp, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, 24(%rsp)                 # 8-byte Spill
	callq	clock
	subq	%r13, %rax
	movl	$.L.str.10, %esi
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movq	%rax, %rdx
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	movb	$1, %al
	callq	fprintf
	cmpl	$0, 12(%rsp)
	jle	.LBB7_16
# %bb.14:                               # %.lr.ph38.preheader
                                        #   in Loop: Header=BB7_6 Depth=1
	xorl	%r14d, %r14d
.LBB7_15:                               # %.lr.ph38
                                        #   Parent Loop BB7_6 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	(%r12,%r14,8), %rdi
	callq	free
	incq	%r14
	movslq	12(%rsp), %rax
	cmpq	%rax, %r14
	jl	.LBB7_15
.LBB7_16:                               # %._crit_edge39
                                        #   in Loop: Header=BB7_6 Depth=1
	movq	%r12, %rdi
	callq	free
	movsd	24(%rsp), %xmm0                 # 8-byte Reload
                                        # xmm0 = mem[0],zero
	ucomisd	.LCPI7_0(%rip), %xmm0
	jbe	.LBB7_6
# %bb.17:
	movl	$-2, %edi
	callq	exit
.LBB7_18:
	movq	%rbx, %rdi
	callq	fclose
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	fclose
	addq	$40, %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
.LBB7_1:
	.cfi_def_cfa_offset 96
	movl	$.Lstr.1, %edi
	jmp	.LBB7_2
.LBB7_4:
	movl	$.Lstr, %edi
.LBB7_2:
	callq	puts@PLT
	movl	$-1, %edi
	callq	exit
.Lfunc_end7:
	.size	_Z4initv, .Lfunc_end7-_Z4initv
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	_Z4initv
	xorl	%eax, %eax
	popq	%rcx
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	main, .Lfunc_end8-main
	.cfi_endproc
                                        # -- End function
	.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	$_Z10vector_subPdPKddii, %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	_Z10vector_subPdPKddii,@object  # @_Z10vector_subPdPKddii
	.section	.rodata,"a",@progbits
	.globl	_Z10vector_subPdPKddii
	.p2align	3, 0x0
_Z10vector_subPdPKddii:
	.quad	_Z25__device_stub__vector_subPdPKddii
	.size	_Z10vector_subPdPKddii, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%f "
	.size	.L.str, 4

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"read.txt"
	.size	.L.str.2, 9

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

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"write.txt"
	.size	.L.str.5, 10

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

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

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%lf"
	.size	.L.str.9, 4

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"%ld %f\n"
	.size	.L.str.10, 8

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z10vector_subPdPKddii"
	.size	.L__unnamed_1, 23

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

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

	.type	.Lstr,@object                   # @str
	.section	.rodata.str1.1,"aMS",@progbits,1
.Lstr:
	.asciz	"Can't open file 'write.txt'"
	.size	.Lstr, 28

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Can't open file 'read.txt'"
	.size	.Lstr.1, 27

	.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 _Z25__device_stub__vector_subPdPKddii
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z10vector_subPdPKddii
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z10vector_subPdPKddii  ; -- Begin function _Z10vector_subPdPKddii
	.globl	_Z10vector_subPdPKddii
	.p2align	8
	.type	_Z10vector_subPdPKddii,@function
_Z10vector_subPdPKddii:                 ; @_Z10vector_subPdPKddii
; %bb.0:
	s_load_b64 s[2:3], s[0:1], 0x18
	s_waitcnt lgkmcnt(0)
	v_cmp_le_i32_e32 vcc_lo, s2, v0
	v_cmp_gt_i32_e64 s2, s3, v0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_and_b32 s2, vcc_lo, s2
	s_and_saveexec_b32 s3, s2
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b128 s[4:7], s[0:1], 0x0
	v_lshlrev_b32_e32 v4, 3, v0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_clause 0x1
	global_load_b64 v[0:1], v4, s[6:7]
	global_load_b64 v[2:3], v4, s[4:5]
	s_waitcnt vmcnt(0)
	v_fma_f64 v[0:1], -v[0:1], s[0:1], v[2:3]
	global_store_b64 v4, v[0:1], s[4:5]
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z10vector_subPdPKddii
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 32
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 5
		.amdhsa_next_free_sgpr 8
		.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	_Z10vector_subPdPKddii, .Lfunc_end0-_Z10vector_subPdPKddii
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 116
; NumSgprs: 10
; NumVgprs: 5
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 1
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 10
; NumVGPRsForWavesPerEU: 5
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .offset:         16
        .size:           8
        .value_kind:     by_value
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         28
        .size:           4
        .value_kind:     by_value
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 32
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z10vector_subPdPKddii
    .private_segment_fixed_size: 0
    .sgpr_count:     10
    .sgpr_spill_count: 0
    .symbol:         _Z10vector_subPdPKddii.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     5
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
