#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <limits.h>

#define TEMP_BOT 0
#define TEMP_LEFT 0
#define TEMP_UP 200
#define TEMP_RIGHT 200
#define TEMP_BEGIN 20

#define ANIMATION_FRAME_DELAY 10
#define TIME 21
#define ALFA1 1
#define ALFA2 1

#define EPS 0.001

float delta;
float eps = INT_MAX;
long long unsigned int x_nodes_num;
long long unsigned int y_nodes_num;
long long unsigned int nodes_num;
FILE *fp;
FILE *gnuPlot;

long long unsigned int N_threads = 512;
long long unsigned int N_blocks;

float get_element(float *x, long long unsigned int  row_size, long long unsigned int  i, long long unsigned int  j)
{
    return x[i * row_size + j];
}

void set_element(float value, float *x, long long unsigned int row_size, long long unsigned int  i, long long unsigned int  j)
{
    x[i * row_size + j] = value;
}

void initAB(float *A, float *B, float *x)
{
    long long unsigned int i = 0, j = 0, offset = 0, step = 0, index = 0;
    // Заполнѝем нижний левый угол плаѝтины
    set_element(1, A, nodes_num, 0, 0);
    set_element(-1, A, nodes_num, 0, 1);
    B[0] = 0;
    // Заполнѝем верхний край плаѝтины
    offset = x_nodes_num * (y_nodes_num - 1);
    for (i = 0; i < x_nodes_num; i++)
    {
        set_element(1, A, nodes_num, i + offset, i + offset);
        B[i + offset] = TEMP_UP;
    }

    // Заполнѝем правый край плаѝтины
    offset = x_nodes_num - 1;
    index = offset;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num; i++)
    {
        set_element(1, A, nodes_num, index, index);
        B[index] = TEMP_RIGHT;
        index += step;
    }

    // Заполнѝем левый край плаѝтины
    offset = x_nodes_num;
    index = offset;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        if (i == 2)
        {
            set_element(1 + delta, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index + 1);
            B[index] = 0;
        }
        else
        {
            set_element(1, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index + 1);
            B[index] = 0;
        }
        index += step;
    }

    // Заполнѝем нижний край плаѝтины
    offset = 1;
    index = offset;
    step = 1;
    for (i = 0; i < x_nodes_num - 2; i++)
    {
        set_element(1, A, nodes_num, index, index);
        set_element(-1, A, nodes_num, index, index + x_nodes_num);
        B[index] = 0;
        index += step;
    }
    // Заполнѝем внутреннюю чаѝть плаѝтины
    offset = x_nodes_num + 1;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        for (j = 0; j < x_nodes_num - 2; j++)
        {
            index = offset + i * x_nodes_num + j;
            set_element(5, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index - 1);
            set_element(-1, A, nodes_num, index, index + 1);
            set_element(-1, A, nodes_num, index, index - x_nodes_num);
            set_element(-1, A, nodes_num, index, index + x_nodes_num);
            B[index] = x[index];
        }
    }
}

void initB(float *B, float *x)
{
    long long unsigned int i = 0, j = 0, offset = 0, index = 0, step = 0;
    // Заполнѝем внутреннюю чаѝть плаѝтины
    offset = x_nodes_num + 1;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        for (j = 0; j < x_nodes_num - 2; j++)
        {
            index = offset + i * x_nodes_num + j;
            B[index] = x[index];
        }
    }
}

void initX(float *x)
{
    for (long long unsigned int  i = 0; i < nodes_num; i++)
    {
        x[i] = (float)TEMP_BEGIN;
    }
}

void initX0(float *A, float *x, float *B)
{
    for (long long unsigned int  i = 0; i < nodes_num; i++)
    {
        float aii = get_element(A, nodes_num, i, i);
        x[i] = B[i] / aii;
    }
}

void printToFile(float *temp)
{
    for (int j = y_nodes_num - 1; j >= 0; j--)
    {
        for (int i = 0; i < x_nodes_num; i++)
        {
            fprintf(fp, "%.1f\t", temp[j * x_nodes_num + i]);
        }
        fprintf(fp, "\n");
    }
    fprintf(fp, "\n");
}

void zeroingA(float *A)
{
    long long unsigned int i = 0, j = 0;
    for (i = 0; i < nodes_num; i++)
    {
        for (j = 0; j < nodes_num; j++)
        {
            set_element(0, A, nodes_num, i, j);
        }
    }
}

void zeroingB(float *vectorB)
{
    long long unsigned int i = 0;
    for (i = 0; i < nodes_num; i++)
    {
        vectorB[i] = 0;
    }
}

__global__ void Solve(float *dA, float *dF, float *dX0, float *dX1, long long unsigned int N)
{
    float aa, sum = 0.;
    long long unsigned int t = blockIdx.x * blockDim.x + threadIdx.x;

    for (long long unsigned int j = 0; j < N; j++)
    {
        sum += dA[j + t * N] * dX0[j];
    }
    aa = dA[t + t * N];
    dX1[t] = dX0[t] + (dF[t] - sum) / aa;
}

__global__ void Eps(float *dX0, float *dX1, float *delta, long long unsigned int N)
{
    long long unsigned int i = blockIdx.x * blockDim.x + threadIdx.x;
    delta[i] = fabs(dX0[i] - dX1[i]);
    dX0[i] = dX1[i];
}

int main(int argc, char **argv)
{
    if (argc != 3) {
        printf("Error data. Please, enter these aruments:\n1st argument - x_nodes;\n2nd argument - y_nodes.\n");
        return 1;
    }

    x_nodes_num = atoi(argv[1]);
    y_nodes_num = atoi(argv[2]);

    if (x_nodes_num == 0 || y_nodes_num == 0) {
        printf("Error data. Please, enter 2 integers.\n");
        return 1;
    }

    nodes_num = x_nodes_num * y_nodes_num;
    delta = 1;
    long long unsigned int  i = 0, j = 0;
    cudaEvent_t GPUstart, GPUstop;
    float GPUtime = 0.0f;

    N_threads = 6;

    if ((nodes_num % N_threads) == 0)
    {
        N_blocks = (nodes_num / N_threads);
    }
    else
    {
        N_blocks = (nodes_num / N_threads) + 1;
    }

    printf("x_nodes_num = %llu\ny_nodes_num=%llu\nN_threads=%llu\nN_blocks=%llu\n", x_nodes_num, y_nodes_num, N_threads, N_blocks);

    dim3 Threads(N_threads);
    dim3 Blocks(N_blocks);

    cudaEventCreate(&GPUstart);
	cudaEventCreate(&GPUstop);

	cudaEventRecord(GPUstart, 0);

    float *hA = (float *)calloc(nodes_num * nodes_num, sizeof(float));
    float *hF = (float *)calloc(nodes_num, sizeof(float));
    float *hX = (float *)calloc(nodes_num, sizeof(float));
    float *hX0 = (float *)calloc(nodes_num, sizeof(float));
    float *hX1 = (float *)calloc(nodes_num, sizeof(float));
    float *hDelta = (float *)calloc(nodes_num, sizeof(float));

    float *dA, *dF, *dX0, *dX1, *dDelta;

    cudaMalloc((void **)&dA, nodes_num * nodes_num * sizeof(float)); // матрица A
    cudaMalloc((void **)&dF, nodes_num * sizeof(float));             // правая часть F
    cudaMalloc((void **)&dX0, nodes_num * sizeof(float));            // решение X(n)
    cudaMalloc((void **)&dX1, nodes_num * sizeof(float));            // решение X(n+1)
    cudaMalloc((void **)&dDelta, nodes_num * sizeof(float));         // разница |X(n+1)- X(n)|

    fp = fopen("result_CUDA.txt", "w");
    if (fp == NULL)
    {
        printf("Open failed\n");
        return -1;
    }

    long long unsigned int  times = (TIME - 1) / delta;
    printf("Times: %llu\n", times);

    initX(hX);
    initAB(hA, hF, hX);
    initX0(hA, hX0, hF);
    cudaMemcpy(dA, hA, nodes_num * nodes_num * sizeof(float), cudaMemcpyHostToDevice);
    cudaMemcpy(dX0, hX0, nodes_num * sizeof(float), cudaMemcpyHostToDevice);
    cudaMemcpy(dF, hF, nodes_num * sizeof(float), cudaMemcpyHostToDevice);

    for (i = 1; i <= times; i++)
    {
        fprintf(fp, "%llu sec\n", i);
        printf("%llu\n", i);
        long long unsigned int k = 0;
        eps = INT_MAX;
        while (eps > EPS)
        {
            k++;
            Solve<<<Blocks, Threads>>>(dA, dF, dX0, dX1, nodes_num);
            Eps<<<Blocks, Threads>>>(dX0, dX1, dDelta, nodes_num);

            cudaMemcpy(hX1, dX1, nodes_num * sizeof(float), cudaMemcpyDeviceToHost);
            cudaMemcpy(hDelta, dDelta, nodes_num * sizeof(float), cudaMemcpyDeviceToHost);
            eps = 0.;
            for (j = 0; j < nodes_num; j++)
            {
                eps += hDelta[j];
            }
            eps = eps / nodes_num;
            // printf("\n Eps[%i]=%e ", k, eps);
            // cudaMemcpy(dX0, dX1, nodes_num * sizeof(float), cudaMemcpyDeviceToDevice);
        }

        printToFile(hX1);
        cudaMemcpy(hX, dX1, nodes_num * sizeof(float), cudaMemcpyDeviceToHost);
        initB(hF, hX);
        cudaMemcpy(dF, hF, nodes_num * sizeof(float), cudaMemcpyHostToDevice);
        initX0(hA, hX0, hF);
        cudaMemcpy(dX0, hX0, nodes_num * sizeof(float), cudaMemcpyHostToDevice);
    }

    cudaEventRecord(GPUstop, 0);
	cudaEventSynchronize(GPUstop);

	cudaEventElapsedTime(&GPUtime, GPUstart, GPUstop);
	printf("GPU time : %.3f ms\n", GPUtime);


    fclose(fp);

    // Оѝвобождение памѝи
    free(hA);
    free(hF);
    free(hX);
    free(hX0);
    free(hX1);
    free(hDelta);

    cudaFree(dA);
    cudaFree(dF);
    cudaFree(dX0);
    cudaFree(dX1);
    cudaFree(dDelta);
}

	.file	"tmpxft_00238d59_00000000-6_fem.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2039:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2039:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z11get_elementPfyyy
	.type	_Z11get_elementPfyyy, @function
_Z11get_elementPfyyy:
.LFB2027:
	.cfi_startproc
	endbr64
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movss	(%rdi,%rdx,4), %xmm0
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z11get_elementPfyyy, .-_Z11get_elementPfyyy
	.globl	_Z11set_elementfPfyyy
	.type	_Z11set_elementfPfyyy, @function
_Z11set_elementfPfyyy:
.LFB2028:
	.cfi_startproc
	endbr64
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movss	%xmm0, (%rdi,%rdx,4)
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z11set_elementfPfyyy, .-_Z11set_elementfPfyyy
	.globl	_Z6initABPfS_S_
	.type	_Z6initABPfS_S_, @function
_Z6initABPfS_S_:
.LFB2029:
	.cfi_startproc
	endbr64
	movq	y_nodes_num(%rip), %r8
	movq	x_nodes_num(%rip), %r10
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	movabsq	$-4647714814380998656, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	nodes_num(%rip), %r11
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movss	.LC0(%rip), %xmm0
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	1(%r11), %r9
	movss	.LC2(%rip), %xmm1
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rax, (%rdi)
	leaq	-1(%r8), %rax
	imulq	%r10, %rax
	movl	$0x00000000, (%rsi)
	leaq	0(,%r9,4), %rsi
	movq	%rdx, -8(%rsp)
	movq	%rax, %rdx
	leaq	(%rcx,%rax,4), %rbx
	xorl	%eax, %eax
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
.L5:
	cmpq	%rax, %r10
	je	.L21
	movss	%xmm0, (%rdx)
	addq	%rsi, %rdx
	movss	%xmm1, (%rbx,%rax,4)
	incq	%rax
	jmp	.L5
.L21:
	leaq	-1(%rax), %r10
	movq	%r9, %rdx
	movq	%r9, %rbx
	movss	.LC0(%rip), %xmm0
	imulq	%r10, %rbx
	movss	.LC2(%rip), %xmm1
	imulq	%rax, %rdx
	leaq	(%rdi,%rbx,4), %rbp
	xorl	%ebx, %ebx
	salq	$2, %rdx
.L7:
	cmpq	%rbx, %r8
	je	.L22
	movss	%xmm0, 0(%rbp)
	incq	%rbx
	addq	%rdx, %rbp
	movss	%xmm1, (%rcx,%r10,4)
	addq	%rax, %r10
	jmp	.L7
.L22:
	leaq	(%rdi,%rdx), %rbx
	movq	%rax, %rbp
	xorl	%r10d, %r10d
	subq	$2, %r8
	movss	.LC0(%rip), %xmm0
	movss	.LC3(%rip), %xmm2
	movq	%rbx, %r12
.L9:
	cmpq	%r8, %r10
	jnb	.L23
	movaps	%xmm0, %xmm1
	cmpq	$2, %r10
	jne	.L10
	addss	delta(%rip), %xmm1
.L10:
	movss	%xmm1, (%rbx)
	incq	%r10
	addq	%rdx, %rbx
	movss	%xmm2, 4(%r12)
	addq	%rdx, %r12
	movl	$0x00000000, (%rcx,%rbp,4)
	addq	%rax, %rbp
	jmp	.L9
.L23:
	leaq	(%r11,%rax), %r10
	movss	.LC0(%rip), %xmm0
	movss	.LC3(%rip), %xmm1
	leaq	(%rdi,%rsi), %rbx
	leaq	(%rdi,%r10,4), %rbp
	leaq	-2(%rax), %r14
	xorl	%r10d, %r10d
.L12:
	cmpq	%r14, %r10
	jnb	.L24
	movss	%xmm0, (%rbx)
	addq	%rsi, %rbx
	movss	%xmm1, 4(%rbp)
	addq	%rsi, %rbp
	movl	$0x00000000, 4(%rcx,%r10,4)
	incq	%r10
	jmp	.L12
.L24:
	leaq	1(%rax), %r10
	movss	.LC4(%rip), %xmm1
	movss	.LC3(%rip), %xmm0
	xorl	%r13d, %r13d
	imulq	%r10, %r9
	imulq	%r10, %r11
	leaq	(%rdi,%r9,4), %rbp
	leaq	4(%rdi,%r11,4), %r12
.L14:
	cmpq	%r8, %r13
	jnb	.L4
	movq	-8(%rsp), %rdi
	leaq	0(,%r10,4), %r11
	movq	%rbp, %rbx
	xorl	%r9d, %r9d
	leaq	(%rdi,%r11), %r15
	addq	%rcx, %r11
	movq	%r12, %rdi
.L17:
	cmpq	%r14, %r9
	jnb	.L25
	movss	%xmm1, (%rbx)
	addq	%rsi, %rbx
	movss	%xmm0, -4(%rdi,%rax,4)
	movss	%xmm0, 4(%rdi,%rax,4)
	movss	%xmm0, (%rdi)
	movss	%xmm0, (%rdi,%rax,8)
	movss	(%r15,%r9,4), %xmm2
	addq	%rsi, %rdi
	movss	%xmm2, (%r11,%r9,4)
	incq	%r9
	jmp	.L17
.L25:
	incq	%r13
	addq	%rdx, %rbp
	addq	%rdx, %r12
	addq	%rax, %r10
	jmp	.L14
.L4:
	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
.LFE2029:
	.size	_Z6initABPfS_S_, .-_Z6initABPfS_S_
	.globl	_Z5initBPfS_
	.type	_Z5initBPfS_, @function
_Z5initBPfS_:
.LFB2030:
	.cfi_startproc
	endbr64
	movq	x_nodes_num(%rip), %r8
	movq	y_nodes_num(%rip), %rax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	xorl	%r10d, %r10d
	leaq	1(%r8), %rcx
	leaq	-2(%rax), %r9
	leaq	-2(%r8), %rbx
.L27:
	cmpq	%r9, %r10
	jnb	.L26
	leaq	0(,%rcx,4), %rax
	leaq	(%rsi,%rax), %r11
	leaq	(%rdi,%rax), %rdx
	xorl	%eax, %eax
.L30:
	cmpq	%rbx, %rax
	jnb	.L32
	movss	(%r11,%rax,4), %xmm0
	movss	%xmm0, (%rdx,%rax,4)
	incq	%rax
	jmp	.L30
.L32:
	incq	%r10
	addq	%r8, %rcx
	jmp	.L27
.L26:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	_Z5initBPfS_, .-_Z5initBPfS_
	.globl	_Z5initXPf
	.type	_Z5initXPf, @function
_Z5initXPf:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	nodes_num(%rip), %rdx
	movss	.LC5(%rip), %xmm0
	xorl	%eax, %eax
.L34:
	cmpq	%rax, %rdx
	je	.L36
	movss	%xmm0, (%rdi,%rax,4)
	incq	%rax
	jmp	.L34
.L36:
	ret
	.cfi_endproc
.LFE2031:
	.size	_Z5initXPf, .-_Z5initXPf
	.globl	_Z6initX0PfS_S_
	.type	_Z6initX0PfS_S_, @function
_Z6initX0PfS_S_:
.LFB2032:
	.cfi_startproc
	endbr64
	movq	nodes_num(%rip), %rcx
	xorl	%eax, %eax
	leaq	4(,%rcx,4), %r8
.L38:
	cmpq	%rax, %rcx
	je	.L40
	movss	(%rdx,%rax,4), %xmm0
	divss	(%rdi), %xmm0
	addq	%r8, %rdi
	movss	%xmm0, (%rsi,%rax,4)
	incq	%rax
	jmp	.L38
.L40:
	ret
	.cfi_endproc
.LFE2032:
	.size	_Z6initX0PfS_S_, .-_Z6initX0PfS_S_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC6:
	.string	"%.1f\t"
.LC7:
	.string	"\n"
	.text
	.globl	_Z11printToFilePf
	.type	_Z11printToFilePf, @function
_Z11printToFilePf:
.LFB2033:
	.cfi_startproc
	endbr64
	movl	y_nodes_num(%rip), %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC6(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leal	-1(%rax), %ebx
	movslq	%ebx, %rbp
.L42:
	testl	%ebx, %ebx
	js	.L47
	xorl	%r14d, %r14d
.L44:
	movq	x_nodes_num(%rip), %rax
	movq	fp(%rip), %rdi
	cmpq	%rax, %r14
	jnb	.L48
	imulq	%rbp, %rax
	movq	%r13, %rdx
	movl	$2, %esi
	addq	%r14, %rax
	incq	%r14
	cvtss2sd	(%r12,%rax,4), %xmm0
	movb	$1, %al
	call	__fprintf_chk@PLT
	jmp	.L44
.L48:
	leaq	.LC7(%rip), %rdx
	movl	$2, %esi
	xorl	%eax, %eax
	decl	%ebx
	call	__fprintf_chk@PLT
	decq	%rbp
	jmp	.L42
.L47:
	movq	fp(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 40
	movl	$2, %esi
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	leaq	.LC7(%rip), %rdx
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	__fprintf_chk@PLT
	.cfi_endproc
.LFE2033:
	.size	_Z11printToFilePf, .-_Z11printToFilePf
	.globl	_Z8zeroingAPf
	.type	_Z8zeroingAPf, @function
_Z8zeroingAPf:
.LFB2034:
	.cfi_startproc
	endbr64
	movq	nodes_num(%rip), %r8
	movq	%rdi, %rdx
	xorl	%esi, %esi
	xorl	%eax, %eax
	leaq	0(,%r8,4), %r9
.L50:
	cmpq	%rsi, %r8
	je	.L52
	movq	%rdx, %rdi
	movq	%r9, %rcx
	incq	%rsi
	rep stosb
	movq	%rdi, %rdx
	jmp	.L50
.L52:
	ret
	.cfi_endproc
.LFE2034:
	.size	_Z8zeroingAPf, .-_Z8zeroingAPf
	.globl	_Z8zeroingBPf
	.type	_Z8zeroingBPf, @function
_Z8zeroingBPf:
.LFB2035:
	.cfi_startproc
	endbr64
	movq	nodes_num(%rip), %rdx
	xorl	%eax, %eax
.L54:
	cmpq	%rax, %rdx
	je	.L56
	movl	$0x00000000, (%rdi,%rax,4)
	incq	%rax
	jmp	.L54
.L56:
	ret
	.cfi_endproc
.LFE2035:
	.size	_Z8zeroingBPf, .-_Z8zeroingBPf
	.globl	_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y
	.type	_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y, @function
_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y:
.LFB2061:
	.cfi_startproc
	endbr64
	subq	$168, %rsp
	.cfi_def_cfa_offset 176
	movq	%rdi, 40(%rsp)
	leaq	64(%rsp), %rdi
	movq	%rsi, 32(%rsp)
	leaq	76(%rsp), %rsi
	movq	%rdx, 24(%rsp)
	leaq	48(%rsp), %rdx
	movq	%rcx, 16(%rsp)
	leaq	56(%rsp), %rcx
	movq	%r8, 8(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movl	$1, 72(%rsp)
	movq	%rax, 112(%rsp)
	leaq	32(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, 128(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 136(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 144(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 64(%rsp)
	movq	%rax, 76(%rsp)
	movl	$1, 84(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L57
	pushq	56(%rsp)
	.cfi_def_cfa_offset 184
	leaq	_Z5SolvePfS_S_S_y(%rip), %rdi
	pushq	56(%rsp)
	.cfi_def_cfa_offset 192
	movq	92(%rsp), %rcx
	movl	100(%rsp), %r8d
	movq	80(%rsp), %rsi
	movl	88(%rsp), %edx
	leaq	128(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 184
	popq	%rdx
	.cfi_def_cfa_offset 176
.L57:
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	je	.L59
	call	__stack_chk_fail@PLT
.L59:
	addq	$168, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2061:
	.size	_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y, .-_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y
	.globl	_Z5SolvePfS_S_S_y
	.type	_Z5SolvePfS_S_S_y, @function
_Z5SolvePfS_S_S_y:
.LFB2062:
	.cfi_startproc
	endbr64
	jmp	_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y
	.cfi_endproc
.LFE2062:
	.size	_Z5SolvePfS_S_S_y, .-_Z5SolvePfS_S_S_y
	.globl	_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y
	.type	_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y, @function
_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y:
.LFB2063:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movq	%rcx, (%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	movq	%rsp, %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L62
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z3EpsPfS_S_y(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L62:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L64
	call	__stack_chk_fail@PLT
.L64:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2063:
	.size	_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y, .-_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y
	.globl	_Z3EpsPfS_S_y
	.type	_Z3EpsPfS_S_y, @function
_Z3EpsPfS_S_y:
.LFB2064:
	.cfi_startproc
	endbr64
	jmp	_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y
	.cfi_endproc
.LFE2064:
	.size	_Z3EpsPfS_S_y, .-_Z3EpsPfS_S_y
	.section	.rodata.str1.1
.LC9:
	.string	"Error data. Please, enter these aruments:\n1st argument - x_nodes;\n2nd argument - y_nodes.\n"
.LC10:
	.string	"Error data. Please, enter 2 integers.\n"
.LC11:
	.string	"x_nodes_num = %llu\ny_nodes_num=%llu\nN_threads=%llu\nN_blocks=%llu\n"
.LC12:
	.string	"w"
.LC13:
	.string	"result_CUDA.txt"
.LC14:
	.string	"Open failed\n"
.LC16:
	.string	"Times: %llu\n"
.LC17:
	.string	"%llu sec\n"
.LC18:
	.string	"%llu\n"
.LC20:
	.string	"GPU time : %.3f ms\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2036:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	cmpl	$3, %edi
	je	.L68
	leaq	.LC9(%rip), %rsi
	movl	$2, %edi
	jmp	.L92
.L68:
	movq	8(%rsi), %rdi
	movq	%rsi, %rbp
	call	atoi@PLT
	movq	16(%rbp), %rdi
	movslq	%eax, %rbx
	movq	%rbx, x_nodes_num(%rip)
	call	atoi@PLT
	testq	%rbx, %rbx
	movslq	%eax, %rcx
	sete	%al
	testq	%rcx, %rcx
	movq	%rcx, y_nodes_num(%rip)
	sete	%dl
	orb	%dl, %al
	je	.L70
	leaq	.LC10(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
.L92:
	call	__printf_chk@PLT
	movl	$1, %eax
	jmp	.L67
.L70:
	movq	%rbx, %rax
	movl	$6, %esi
	xorl	%edx, %edx
	movl	$6, %r8d
	imulq	%rcx, %rax
	movl	$2, %edi
	movl	$0x3f800000, delta(%rip)
	movl	$0x00000000, 36(%rsp)
	movq	$6, N_threads(%rip)
	movq	%rax, nodes_num(%rip)
	divq	%rsi
	leaq	.LC11(%rip), %rsi
	cmpq	$1, %rdx
	movq	%rbx, %rdx
	sbbq	$-1, %rax
	movq	%rax, %r9
	movq	%rax, N_blocks(%rip)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	N_threads(%rip), %rax
	leaq	40(%rsp), %rdi
	movq	N_blocks(%rip), %rdx
	movl	%eax, 96(%rsp)
	movabsq	$4294967297, %rax
	movl	%edx, 108(%rsp)
	movq	%rax, 100(%rsp)
	movq	%rax, 112(%rsp)
	call	cudaEventCreate@PLT
	leaq	48(%rsp), %rdi
	call	cudaEventCreate@PLT
	movq	40(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	nodes_num(%rip), %r12
	movl	$4, %esi
	movq	%r12, %r13
	imulq	%r12, %r13
	movq	%r13, %rdi
	call	calloc@PLT
	movq	%r12, %rdi
	movl	$4, %esi
	movq	%rax, %rbp
	call	calloc@PLT
	movq	%r12, %rdi
	movl	$4, %esi
	movq	%rax, %rbx
	call	calloc@PLT
	movq	%r12, %rdi
	movl	$4, %esi
	movq	%rax, 8(%rsp)
	call	calloc@PLT
	movq	%r12, %rdi
	movl	$4, %esi
	movq	%rax, 16(%rsp)
	call	calloc@PLT
	movq	%r12, %rdi
	movl	$4, %esi
	movq	%rax, 24(%rsp)
	call	calloc@PLT
	leaq	0(,%r13,4), %rsi
	leaq	56(%rsp), %rdi
	movq	%rax, %r12
	call	cudaMalloc@PLT
	movq	nodes_num(%rip), %rax
	leaq	64(%rsp), %rdi
	leaq	0(,%rax,4), %rsi
	call	cudaMalloc@PLT
	movq	nodes_num(%rip), %rax
	leaq	72(%rsp), %rdi
	leaq	0(,%rax,4), %rsi
	call	cudaMalloc@PLT
	movq	nodes_num(%rip), %rax
	leaq	80(%rsp), %rdi
	leaq	0(,%rax,4), %rsi
	call	cudaMalloc@PLT
	movq	nodes_num(%rip), %rax
	leaq	88(%rsp), %rdi
	leaq	0(,%rax,4), %rsi
	call	cudaMalloc@PLT
	leaq	.LC12(%rip), %rsi
	leaq	.LC13(%rip), %rdi
	call	fopen@PLT
	movq	%rax, fp(%rip)
	testq	%rax, %rax
	jne	.L73
	leaq	.LC14(%rip), %rsi
	movl	$2, %edi
	call	__printf_chk@PLT
	orl	$-1, %eax
	jmp	.L67
.L73:
	movss	.LC5(%rip), %xmm0
	divss	delta(%rip), %xmm0
	comiss	.LC15(%rip), %xmm0
	jnb	.L74
	cvttss2siq	%xmm0, %r14
	jmp	.L75
.L74:
	subss	.LC15(%rip), %xmm0
	cvttss2siq	%xmm0, %r14
	btcq	$63, %r14
.L75:
	movq	%r14, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	movl	$1, %r13d
	leaq	.LC16(%rip), %rsi
	leaq	.LC17(%rip), %r15
	call	__printf_chk@PLT
	movq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	_Z5initXPf
	movq	8(%rsp), %rdx
	movq	%rbp, %rdi
	call	_Z6initABPfS_S_
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	call	_Z6initX0PfS_S_
	movq	nodes_num(%rip), %rdx
	movq	56(%rsp), %rdi
	movq	%rbp, %rsi
	movl	$1, %ecx
	imulq	%rdx, %rdx
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rsi
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	movq	nodes_num(%rip), %rax
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	movq	nodes_num(%rip), %rax
	movq	64(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
.L76:
	cmpq	%r13, %r14
	jb	.L93
	movq	fp(%rip), %rdi
	movq	%r13, %rcx
	movq	%r15, %rdx
	xorl	%eax, %eax
	movl	$2, %esi
	call	__fprintf_chk@PLT
	movq	%r13, %rdx
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC18(%rip), %rsi
	call	__printf_chk@PLT
	movss	.LC8(%rip), %xmm0
.L77:
	movss	%xmm0, eps(%rip)
	cvtss2sd	%xmm0, %xmm0
	comisd	.LC19(%rip), %xmm0
	jbe	.L94
	movl	104(%rsp), %ecx
	movq	96(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	108(%rsp), %rdi
	movl	116(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L78
	movq	nodes_num(%rip), %r8
	movq	80(%rsp), %rcx
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	movq	56(%rsp), %rdi
	call	_Z31__device_stub__Z5SolvePfS_S_S_yPfS_S_S_y
.L78:
	movl	104(%rsp), %ecx
	movq	96(%rsp), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movq	108(%rsp), %rdi
	movl	116(%rsp), %esi
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L79
	movq	nodes_num(%rip), %rcx
	movq	88(%rsp), %rdx
	movq	80(%rsp), %rsi
	movq	72(%rsp), %rdi
	call	_Z27__device_stub__Z3EpsPfS_S_yPfS_S_y
.L79:
	movq	80(%rsp), %rsi
	movq	24(%rsp), %rdi
	movl	$2, %ecx
	movq	nodes_num(%rip), %rax
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	movq	nodes_num(%rip), %rax
	movq	88(%rsp), %rsi
	movq	%r12, %rdi
	movl	$2, %ecx
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	movq	nodes_num(%rip), %rcx
	xorl	%edx, %edx
	xorl	%eax, %eax
	movl	$0x00000000, eps(%rip)
	xorps	%xmm0, %xmm0
.L80:
	cmpq	%rax, %rcx
	je	.L95
	addss	(%r12,%rax,4), %xmm0
	movb	$1, %dl
	incq	%rax
	jmp	.L80
.L95:
	testb	%dl, %dl
	je	.L82
	movss	%xmm0, eps(%rip)
.L82:
	cvtsi2ssq	%rax, %xmm1
	movss	eps(%rip), %xmm0
	divss	%xmm1, %xmm0
	jmp	.L77
.L94:
	movq	24(%rsp), %rdi
	incq	%r13
	call	_Z11printToFilePf
	movq	80(%rsp), %rsi
	movq	8(%rsp), %rdi
	movl	$2, %ecx
	movq	nodes_num(%rip), %rax
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	movq	8(%rsp), %rsi
	movq	%rbx, %rdi
	call	_Z5initBPfS_
	movq	nodes_num(%rip), %rax
	movq	64(%rsp), %rdi
	movq	%rbx, %rsi
	movl	$1, %ecx
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	movq	16(%rsp), %rsi
	movq	%rbx, %rdx
	movq	%rbp, %rdi
	call	_Z6initX0PfS_S_
	movq	16(%rsp), %rsi
	movq	72(%rsp), %rdi
	movl	$1, %ecx
	movq	nodes_num(%rip), %rax
	leaq	0(,%rax,4), %rdx
	call	cudaMemcpy@PLT
	jmp	.L76
.L93:
	movq	48(%rsp), %rdi
	xorl	%esi, %esi
	call	cudaEventRecord@PLT
	movq	48(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	48(%rsp), %rdx
	movq	40(%rsp), %rsi
	leaq	36(%rsp), %rdi
	call	cudaEventElapsedTime@PLT
	leaq	.LC20(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	36(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	fp(%rip), %rdi
	call	fclose@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	16(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	56(%rsp), %rdi
	call	cudaFree@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	72(%rsp), %rdi
	call	cudaFree@PLT
	movq	80(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	xorl	%eax, %eax
.L67:
	movq	120(%rsp), %rdx
	subq	%fs:40, %rdx
	je	.L85
	call	__stack_chk_fail@PLT
.L85:
	addq	$136, %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
.LFE2036:
	.size	main, .-main
	.section	.rodata.str1.1
.LC21:
	.string	"_Z3EpsPfS_S_y"
.LC22:
	.string	"_Z5SolvePfS_S_S_y"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2066:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC21(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z3EpsPfS_S_y(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC22(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z5SolvePfS_S_S_y(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2066:
	.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
	.globl	N_blocks
	.bss
	.align 8
	.type	N_blocks, @object
	.size	N_blocks, 8
N_blocks:
	.zero	8
	.globl	N_threads
	.data
	.align 8
	.type	N_threads, @object
	.size	N_threads, 8
N_threads:
	.quad	512
	.globl	gnuPlot
	.bss
	.align 8
	.type	gnuPlot, @object
	.size	gnuPlot, 8
gnuPlot:
	.zero	8
	.globl	fp
	.align 8
	.type	fp, @object
	.size	fp, 8
fp:
	.zero	8
	.globl	nodes_num
	.align 8
	.type	nodes_num, @object
	.size	nodes_num, 8
nodes_num:
	.zero	8
	.globl	y_nodes_num
	.align 8
	.type	y_nodes_num, @object
	.size	y_nodes_num, 8
y_nodes_num:
	.zero	8
	.globl	x_nodes_num
	.align 8
	.type	x_nodes_num, @object
	.size	x_nodes_num, 8
x_nodes_num:
	.zero	8
	.globl	eps
	.data
	.align 4
	.type	eps, @object
	.size	eps, 4
eps:
	.long	1325400064
	.globl	delta
	.bss
	.align 4
	.type	delta, @object
	.size	delta, 4
delta:
	.zero	4
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1065353216
	.align 4
.LC2:
	.long	1128792064
	.align 4
.LC3:
	.long	-1082130432
	.align 4
.LC4:
	.long	1084227584
	.align 4
.LC5:
	.long	1101004800
	.align 4
.LC8:
	.long	1325400064
	.align 4
.LC15:
	.long	1593835520
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC19:
	.long	-755914244
	.long	1062232653
	.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 <math.h>
#include <float.h>
#include <limits.h>

#define TEMP_BOT 0
#define TEMP_LEFT 0
#define TEMP_UP 200
#define TEMP_RIGHT 200
#define TEMP_BEGIN 20

#define ANIMATION_FRAME_DELAY 10
#define TIME 21
#define ALFA1 1
#define ALFA2 1

#define EPS 0.001

float delta;
float eps = INT_MAX;
long long unsigned int x_nodes_num;
long long unsigned int y_nodes_num;
long long unsigned int nodes_num;
FILE *fp;
FILE *gnuPlot;

long long unsigned int N_threads = 512;
long long unsigned int N_blocks;

float get_element(float *x, long long unsigned int  row_size, long long unsigned int  i, long long unsigned int  j)
{
    return x[i * row_size + j];
}

void set_element(float value, float *x, long long unsigned int row_size, long long unsigned int  i, long long unsigned int  j)
{
    x[i * row_size + j] = value;
}

void initAB(float *A, float *B, float *x)
{
    long long unsigned int i = 0, j = 0, offset = 0, step = 0, index = 0;
    // Заполнѝем нижний левый угол плаѝтины
    set_element(1, A, nodes_num, 0, 0);
    set_element(-1, A, nodes_num, 0, 1);
    B[0] = 0;
    // Заполнѝем верхний край плаѝтины
    offset = x_nodes_num * (y_nodes_num - 1);
    for (i = 0; i < x_nodes_num; i++)
    {
        set_element(1, A, nodes_num, i + offset, i + offset);
        B[i + offset] = TEMP_UP;
    }

    // Заполнѝем правый край плаѝтины
    offset = x_nodes_num - 1;
    index = offset;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num; i++)
    {
        set_element(1, A, nodes_num, index, index);
        B[index] = TEMP_RIGHT;
        index += step;
    }

    // Заполнѝем левый край плаѝтины
    offset = x_nodes_num;
    index = offset;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        if (i == 2)
        {
            set_element(1 + delta, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index + 1);
            B[index] = 0;
        }
        else
        {
            set_element(1, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index + 1);
            B[index] = 0;
        }
        index += step;
    }

    // Заполнѝем нижний край плаѝтины
    offset = 1;
    index = offset;
    step = 1;
    for (i = 0; i < x_nodes_num - 2; i++)
    {
        set_element(1, A, nodes_num, index, index);
        set_element(-1, A, nodes_num, index, index + x_nodes_num);
        B[index] = 0;
        index += step;
    }
    // Заполнѝем внутреннюю чаѝть плаѝтины
    offset = x_nodes_num + 1;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        for (j = 0; j < x_nodes_num - 2; j++)
        {
            index = offset + i * x_nodes_num + j;
            set_element(5, A, nodes_num, index, index);
            set_element(-1, A, nodes_num, index, index - 1);
            set_element(-1, A, nodes_num, index, index + 1);
            set_element(-1, A, nodes_num, index, index - x_nodes_num);
            set_element(-1, A, nodes_num, index, index + x_nodes_num);
            B[index] = x[index];
        }
    }
}

void initB(float *B, float *x)
{
    long long unsigned int i = 0, j = 0, offset = 0, index = 0, step = 0;
    // Заполнѝем внутреннюю чаѝть плаѝтины
    offset = x_nodes_num + 1;
    step = x_nodes_num;
    for (i = 0; i < y_nodes_num - 2; i++)
    {
        for (j = 0; j < x_nodes_num - 2; j++)
        {
            index = offset + i * x_nodes_num + j;
            B[index] = x[index];
        }
    }
}

void initX(float *x)
{
    for (long long unsigned int  i = 0; i < nodes_num; i++)
    {
        x[i] = (float)TEMP_BEGIN;
    }
}

void initX0(float *A, float *x, float *B)
{
    for (long long unsigned int  i = 0; i < nodes_num; i++)
    {
        float aii = get_element(A, nodes_num, i, i);
        x[i] = B[i] / aii;
    }
}

void printToFile(float *temp)
{
    for (int j = y_nodes_num - 1; j >= 0; j--)
    {
        for (int i = 0; i < x_nodes_num; i++)
        {
            fprintf(fp, "%.1f\t", temp[j * x_nodes_num + i]);
        }
        fprintf(fp, "\n");
    }
    fprintf(fp, "\n");
}

void zeroingA(float *A)
{
    long long unsigned int i = 0, j = 0;
    for (i = 0; i < nodes_num; i++)
    {
        for (j = 0; j < nodes_num; j++)
        {
            set_element(0, A, nodes_num, i, j);
        }
    }
}

void zeroingB(float *vectorB)
{
    long long unsigned int i = 0;
    for (i = 0; i < nodes_num; i++)
    {
        vectorB[i] = 0;
    }
}

__global__ void Solve(float *dA, float *dF, float *dX0, float *dX1, long long unsigned int N)
{
    float aa, sum = 0.;
    long long unsigned int t = blockIdx.x * blockDim.x + threadIdx.x;

    for (long long unsigned int j = 0; j < N; j++)
    {
        sum += dA[j + t * N] * dX0[j];
    }
    aa = dA[t + t * N];
    dX1[t] = dX0[t] + (dF[t] - sum) / aa;
}

__global__ void Eps(float *dX0, float *dX1, float *delta, long long unsigned int N)
{
    long long unsigned int i = blockIdx.x * blockDim.x + threadIdx.x;
    delta[i] = fabs(dX0[i] - dX1[i]);
    dX0[i] = dX1[i];
}

int main(int argc, char **argv)
{
    if (argc != 3) {
        printf("Error data. Please, enter these aruments:\n1st argument - x_nodes;\n2nd argument - y_nodes.\n");
        return 1;
    }

    x_nodes_num = atoi(argv[1]);
    y_nodes_num = atoi(argv[2]);

    if (x_nodes_num == 0 || y_nodes_num == 0) {
        printf("Error data. Please, enter 2 integers.\n");
        return 1;
    }

    nodes_num = x_nodes_num * y_nodes_num;
    delta = 1;
    long long unsigned int  i = 0, j = 0;
    hipEvent_t GPUstart, GPUstop;
    float GPUtime = 0.0f;

    N_threads = 6;

    if ((nodes_num % N_threads) == 0)
    {
        N_blocks = (nodes_num / N_threads);
    }
    else
    {
        N_blocks = (nodes_num / N_threads) + 1;
    }

    printf("x_nodes_num = %llu\ny_nodes_num=%llu\nN_threads=%llu\nN_blocks=%llu\n", x_nodes_num, y_nodes_num, N_threads, N_blocks);

    dim3 Threads(N_threads);
    dim3 Blocks(N_blocks);

    hipEventCreate(&GPUstart);
	hipEventCreate(&GPUstop);

	hipEventRecord(GPUstart, 0);

    float *hA = (float *)calloc(nodes_num * nodes_num, sizeof(float));
    float *hF = (float *)calloc(nodes_num, sizeof(float));
    float *hX = (float *)calloc(nodes_num, sizeof(float));
    float *hX0 = (float *)calloc(nodes_num, sizeof(float));
    float *hX1 = (float *)calloc(nodes_num, sizeof(float));
    float *hDelta = (float *)calloc(nodes_num, sizeof(float));

    float *dA, *dF, *dX0, *dX1, *dDelta;

    hipMalloc((void **)&dA, nodes_num * nodes_num * sizeof(float)); // матрица A
    hipMalloc((void **)&dF, nodes_num * sizeof(float));             // правая часть F
    hipMalloc((void **)&dX0, nodes_num * sizeof(float));            // решение X(n)
    hipMalloc((void **)&dX1, nodes_num * sizeof(float));            // решение X(n+1)
    hipMalloc((void **)&dDelta, nodes_num * sizeof(float));         // разница |X(n+1)- X(n)|

    fp = fopen("result_CUDA.txt", "w");
    if (fp == NULL)
    {
        printf("Open failed\n");
        return -1;
    }

    long long unsigned int  times = (TIME - 1) / delta;
    printf("Times: %llu\n", times);

    initX(hX);
    initAB(hA, hF, hX);
    initX0(hA, hX0, hF);
    hipMemcpy(dA, hA, nodes_num * nodes_num * sizeof(float), hipMemcpyHostToDevice);
    hipMemcpy(dX0, hX0, nodes_num * sizeof(float), hipMemcpyHostToDevice);
    hipMemcpy(dF, hF, nodes_num * sizeof(float), hipMemcpyHostToDevice);

    for (i = 1; i <= times; i++)
    {
        fprintf(fp, "%llu sec\n", i);
        printf("%llu\n", i);
        long long unsigned int k = 0;
        eps = INT_MAX;
        while (eps > EPS)
        {
            k++;
            Solve<<<Blocks, Threads>>>(dA, dF, dX0, dX1, nodes_num);
            Eps<<<Blocks, Threads>>>(dX0, dX1, dDelta, nodes_num);

            hipMemcpy(hX1, dX1, nodes_num * sizeof(float), hipMemcpyDeviceToHost);
            hipMemcpy(hDelta, dDelta, nodes_num * sizeof(float), hipMemcpyDeviceToHost);
            eps = 0.;
            for (j = 0; j < nodes_num; j++)
            {
                eps += hDelta[j];
            }
            eps = eps / nodes_num;
            // printf("\n Eps[%i]=%e ", k, eps);
            // cudaMemcpy(dX0, dX1, nodes_num * sizeof(float), cudaMemcpyDeviceToDevice);
        }

        printToFile(hX1);
        hipMemcpy(hX, dX1, nodes_num * sizeof(float), hipMemcpyDeviceToHost);
        initB(hF, hX);
        hipMemcpy(dF, hF, nodes_num * sizeof(float), hipMemcpyHostToDevice);
        initX0(hA, hX0, hF);
        hipMemcpy(dX0, hX0, nodes_num * sizeof(float), hipMemcpyHostToDevice);
    }

    hipEventRecord(GPUstop, 0);
	hipEventSynchronize(GPUstop);

	hipEventElapsedTime(&GPUtime, GPUstart, GPUstop);
	printf("GPU time : %.3f ms\n", GPUtime);


    fclose(fp);

    // Оѝвобождение памѝи
    free(hA);
    free(hF);
    free(hX);
    free(hX0);
    free(hX1);
    free(hDelta);

    hipFree(dA);
    hipFree(dF);
    hipFree(dX0);
    hipFree(dX1);
    hipFree(dDelta);
}

	.text
	.file	"fem.hip"
	.globl	_Z11get_elementPfyyy            # -- Begin function _Z11get_elementPfyyy
	.type	_Z11get_elementPfyyy,@function
_Z11get_elementPfyyy:                   # @_Z11get_elementPfyyy
	.cfi_startproc
# %bb.0:
	imulq	%rdx, %rsi
	leaq	(%rdi,%rsi,4), %rax
	movss	(%rax,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	retq
.Lfunc_end0:
	.size	_Z11get_elementPfyyy, .Lfunc_end0-_Z11get_elementPfyyy
	.cfi_endproc
                                        # -- End function
	.globl	_Z11set_elementfPfyyy           # -- Begin function _Z11set_elementfPfyyy
	.type	_Z11set_elementfPfyyy,@function
_Z11set_elementfPfyyy:                  # @_Z11set_elementfPfyyy
	.cfi_startproc
# %bb.0:
	imulq	%rdx, %rsi
	leaq	(%rdi,%rsi,4), %rax
	movss	%xmm0, (%rax,%rcx,4)
	retq
.Lfunc_end1:
	.size	_Z11set_elementfPfyyy, .Lfunc_end1-_Z11set_elementfPfyyy
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function _Z6initABPfS_S_
.LCPI2_0:
	.long	0x3f800000                      # float 1
	.text
	.globl	_Z6initABPfS_S_
	.type	_Z6initABPfS_S_,@function
_Z6initABPfS_S_:                        # @_Z6initABPfS_S_
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movabsq	$-4647714814380998656, %rax     # imm = 0xBF8000003F800000
	movq	%rdi, %r14
	movq	%rax, (%rdi)
	movl	$0, (%rsi)
	movq	x_nodes_num(%rip), %rcx
	movq	y_nodes_num(%rip), %r15
	testq	%rcx, %rcx
	je	.LBB2_3
# %bb.1:                                # %.lr.ph
	leaq	-1(%r15), %rax
	movq	nodes_num(%rip), %rdi
	imulq	%rcx, %rax
	leaq	4(,%rdi,4), %rdi
	leaq	(%rsi,%rax,4), %r8
	imulq	%rdi, %rax
	addq	%r14, %rax
	xorl	%r9d, %r9d
.LBB2_2:                                # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%rax)             # imm = 0x3F800000
	movl	$1128792064, (%r8,%r9,4)        # imm = 0x43480000
	incq	%r9
	addq	%rdi, %rax
	cmpq	%r9, %rcx
	jne	.LBB2_2
.LBB2_3:                                # %._crit_edge
	testq	%r15, %r15
	je	.LBB2_4
# %bb.20:                               # %.lr.ph95
	leaq	-1(%rcx), %r8
	movq	nodes_num(%rip), %rax
	leaq	4(,%rax,4), %r9
	imulq	%r8, %rax
	leaq	(,%rcx,4), %rdi
	leaq	(%rdi,%rax,4), %rax
	addq	%r14, %rax
	addq	$-4, %rax
	imulq	%rcx, %r9
	movq	%r15, %rdi
.LBB2_21:                               # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%rax)             # imm = 0x3F800000
	movl	$1128792064, (%rsi,%r8,4)       # imm = 0x43480000
	addq	%rcx, %r8
	addq	%r9, %rax
	decq	%rdi
	jne	.LBB2_21
# %bb.8:                                # %.preheader89
	addq	$-2, %r15
	jne	.LBB2_5
# %bb.9:
	xorl	%r15d, %r15d
	movb	$1, %r9b
	jmp	.LBB2_10
.LBB2_4:
	movq	$-2, %r15
.LBB2_5:                                # %.lr.ph98
	movq	nodes_num(%rip), %rax
	leaq	4(,%rax,4), %r8
	imulq	%rcx, %r8
	leaq	(%r8,%r14), %r9
	addq	$4, %r9
	xorl	%r10d, %r10d
	movss	.LCPI2_0(%rip), %xmm0           # xmm0 = mem[0],zero,zero,zero
	movq	%rcx, %r11
.LBB2_6:                                # =>This Inner Loop Header: Depth=1
	cmpq	$2, %r10
	je	.LBB2_7
# %bb.22:                               #   in Loop: Header=BB2_6 Depth=1
	movaps	%xmm0, %xmm1
	jmp	.LBB2_23
.LBB2_7:                                #   in Loop: Header=BB2_6 Depth=1
	movss	delta(%rip), %xmm1              # xmm1 = mem[0],zero,zero,zero
	addss	%xmm0, %xmm1
.LBB2_23:                               #   in Loop: Header=BB2_6 Depth=1
	movss	%xmm1, -4(%r9)
	movl	$-1082130432, (%r9)             # imm = 0xBF800000
	movl	$0, (%rsi,%r11,4)
	addq	%rcx, %r11
	incq	%r10
	addq	%r8, %r9
	cmpq	%r10, %r15
	jne	.LBB2_6
# %bb.24:
	xorl	%r9d, %r9d
.LBB2_10:                               # %.preheader88
	movq	%rcx, %r8
	addq	$-2, %r8
	je	.LBB2_13
# %bb.11:                               # %.lr.ph101
	movq	nodes_num(%rip), %r10
	movl	$2, %eax
	subq	%rcx, %rax
	leaq	4(,%r10,4), %rdi
	leaq	(%r14,%r10,4), %r10
	addq	$4, %r10
	movl	$1, %r11d
.LBB2_12:                               # =>This Inner Loop Header: Depth=1
	movl	$1065353216, (%r10)             # imm = 0x3F800000
	movl	$-1082130432, (%r10,%rcx,4)     # imm = 0xBF800000
	movl	$0, (%rsi,%r11,4)
	leaq	(%rax,%r11), %rbx
	incq	%rbx
	incq	%r11
	addq	%rdi, %r10
	cmpq	$1, %rbx
	jne	.LBB2_12
.LBB2_13:                               # %._crit_edge102
	testb	%r9b, %r9b
	jne	.LBB2_19
# %bb.14:                               # %.preheader.lr.ph
	movq	nodes_num(%rip), %rax
	leaq	1(%rcx), %r9
	imulq	%rax, %r9
	movq	%r14, %rdi
	leaq	(%r14,%rcx,8), %r14
	addq	$4, %r14
	leaq	4(,%rax,4), %r11
	movq	%rcx, %rax
	imulq	%r11, %rax
	movq	%rax, -16(%rsp)                 # 8-byte Spill
	leaq	(,%rcx,4), %rax
	movq	%rax, -24(%rsp)                 # 8-byte Spill
	leaq	(%rdi,%rcx,4), %rax
	addq	$8, %rax
	addq	$4, %rdi
	leaq	(%rsi,%rcx,4), %rsi
	addq	$4, %rsi
	leaq	(%rdx,%rcx,4), %rcx
	addq	$4, %rcx
	xorl	%edx, %edx
	movabsq	$4656722017913929728, %r12      # imm = 0x40A00000BF800000
	movl	$-1082130432, %ebp              # imm = 0xBF800000
	movq	%r15, -8(%rsp)                  # 8-byte Spill
.LBB2_15:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_17 Depth 2
	testq	%r8, %r8
	je	.LBB2_18
# %bb.16:                               # %.lr.ph105
                                        #   in Loop: Header=BB2_15 Depth=1
	movq	%rdi, %r13
	movq	%rax, %r15
	movq	%r14, %r10
	xorl	%ebx, %ebx
.LBB2_17:                               #   Parent Loop BB2_15 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	%r12, -8(%r15,%r9,4)
	movl	%ebp, (%r15,%r9,4)
	movl	%ebp, (%r13,%r9,4)
	movl	%ebp, (%r10,%r9,4)
	movss	(%rcx,%rbx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rsi,%rbx,4)
	incq	%rbx
	addq	%r11, %r10
	addq	%r11, %r15
	addq	%r11, %r13
	cmpq	%rbx, %r8
	jne	.LBB2_17
.LBB2_18:                               # %._crit_edge106
                                        #   in Loop: Header=BB2_15 Depth=1
	incq	%rdx
	movq	-16(%rsp), %r10                 # 8-byte Reload
	addq	%r10, %r14
	addq	%r10, %rax
	addq	%r10, %rdi
	movq	-24(%rsp), %r10                 # 8-byte Reload
	addq	%r10, %rsi
	addq	%r10, %rcx
	movq	-8(%rsp), %r15                  # 8-byte Reload
	cmpq	%r15, %rdx
	jne	.LBB2_15
.LBB2_19:                               # %._crit_edge108
	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_end2:
	.size	_Z6initABPfS_S_, .Lfunc_end2-_Z6initABPfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z5initBPfS_                    # -- Begin function _Z5initBPfS_
	.type	_Z5initBPfS_,@function
_Z5initBPfS_:                           # @_Z5initBPfS_
	.cfi_startproc
# %bb.0:
	movq	y_nodes_num(%rip), %rax
	addq	$-2, %rax
	je	.LBB3_6
# %bb.1:                                # %.preheader.lr.ph
	movq	x_nodes_num(%rip), %r8
	leaq	-2(%r8), %rcx
	leaq	(,%r8,4), %rdx
	leaq	(%rdi,%r8,4), %rdi
	addq	$4, %rdi
	leaq	(%rsi,%r8,4), %rsi
	addq	$4, %rsi
	xorl	%r8d, %r8d
.LBB3_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_4 Depth 2
	testq	%rcx, %rcx
	je	.LBB3_5
# %bb.3:                                # %.lr.ph
                                        #   in Loop: Header=BB3_2 Depth=1
	xorl	%r9d, %r9d
.LBB3_4:                                #   Parent Loop BB3_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rsi,%r9,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%rdi,%r9,4)
	incq	%r9
	cmpq	%r9, %rcx
	jne	.LBB3_4
.LBB3_5:                                # %._crit_edge
                                        #   in Loop: Header=BB3_2 Depth=1
	incq	%r8
	addq	%rdx, %rdi
	addq	%rdx, %rsi
	cmpq	%rax, %r8
	jne	.LBB3_2
.LBB3_6:                                # %._crit_edge13
	retq
.Lfunc_end3:
	.size	_Z5initBPfS_, .Lfunc_end3-_Z5initBPfS_
	.cfi_endproc
                                        # -- End function
	.globl	_Z5initXPf                      # -- Begin function _Z5initXPf
	.type	_Z5initXPf,@function
_Z5initXPf:                             # @_Z5initXPf
	.cfi_startproc
# %bb.0:
	movq	nodes_num(%rip), %rax
	testq	%rax, %rax
	je	.LBB4_3
# %bb.1:                                # %.lr.ph.preheader
	xorl	%ecx, %ecx
.LBB4_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	$1101004800, (%rdi,%rcx,4)      # imm = 0x41A00000
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB4_2
.LBB4_3:                                # %._crit_edge
	retq
.Lfunc_end4:
	.size	_Z5initXPf, .Lfunc_end4-_Z5initXPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z6initX0PfS_S_                 # -- Begin function _Z6initX0PfS_S_
	.type	_Z6initX0PfS_S_,@function
_Z6initX0PfS_S_:                        # @_Z6initX0PfS_S_
	.cfi_startproc
# %bb.0:
	movq	nodes_num(%rip), %rax
	testq	%rax, %rax
	je	.LBB5_3
# %bb.1:                                # %.lr.ph.preheader
	leaq	4(,%rax,4), %rcx
	xorl	%r8d, %r8d
.LBB5_2:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movss	(%rdx,%r8,4), %xmm0             # xmm0 = mem[0],zero,zero,zero
	divss	(%rdi), %xmm0
	movss	%xmm0, (%rsi,%r8,4)
	incq	%r8
	addq	%rcx, %rdi
	cmpq	%r8, %rax
	jne	.LBB5_2
.LBB5_3:                                # %._crit_edge
	retq
.Lfunc_end5:
	.size	_Z6initX0PfS_S_, .Lfunc_end5-_Z6initX0PfS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z11printToFilePf               # -- Begin function _Z11printToFilePf
	.type	_Z11printToFilePf,@function
_Z11printToFilePf:                      # @_Z11printToFilePf
	.cfi_startproc
# %bb.0:
	movl	y_nodes_num(%rip), %eax
	decl	%eax
	js	.LBB6_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	%rdi, %rbx
	movl	%eax, %r15d
	leaq	(,%r15,4), %r14
.LBB6_2:                                # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB6_4 Depth 2
	movq	x_nodes_num(%rip), %rax
	testq	%rax, %rax
	je	.LBB6_5
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB6_2 Depth=1
	xorl	%r12d, %r12d
.LBB6_4:                                # %.lr.ph
                                        #   Parent Loop BB6_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movq	fp(%rip), %rdi
	imulq	%r14, %rax
	addq	%rbx, %rax
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rax,%r12,4), %xmm0
	movl	$.L.str, %esi
	movb	$1, %al
	callq	fprintf
	incq	%r12
	movq	x_nodes_num(%rip), %rax
	cmpq	%r12, %rax
	ja	.LBB6_4
.LBB6_5:                                # %._crit_edge
                                        #   in Loop: Header=BB6_2 Depth=1
	movq	fp(%rip), %rsi
	movl	$10, %edi
	callq	fputc@PLT
	leaq	-1(%r15), %rax
	addq	$-4, %r14
	testq	%r15, %r15
	movq	%rax, %r15
	jg	.LBB6_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
.LBB6_7:                                # %._crit_edge13
	movq	fp(%rip), %rsi
	movl	$10, %edi
	jmp	fputc@PLT                       # TAILCALL
.Lfunc_end6:
	.size	_Z11printToFilePf, .Lfunc_end6-_Z11printToFilePf
	.cfi_endproc
                                        # -- End function
	.globl	_Z8zeroingAPf                   # -- Begin function _Z8zeroingAPf
	.type	_Z8zeroingAPf,@function
_Z8zeroingAPf:                          # @_Z8zeroingAPf
	.cfi_startproc
# %bb.0:
	movq	nodes_num(%rip), %rdx
	testq	%rdx, %rdx
	je	.LBB7_1
# %bb.2:                                # %.preheader.preheader
	imulq	%rdx, %rdx
	shlq	$2, %rdx
	xorl	%esi, %esi
	jmp	memset@PLT                      # TAILCALL
.LBB7_1:                                # %._crit_edge
	retq
.Lfunc_end7:
	.size	_Z8zeroingAPf, .Lfunc_end7-_Z8zeroingAPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z8zeroingBPf                   # -- Begin function _Z8zeroingBPf
	.type	_Z8zeroingBPf,@function
_Z8zeroingBPf:                          # @_Z8zeroingBPf
	.cfi_startproc
# %bb.0:
	movq	nodes_num(%rip), %rdx
	testq	%rdx, %rdx
	je	.LBB8_1
# %bb.2:                                # %.lr.ph.preheader
	shlq	$2, %rdx
	xorl	%esi, %esi
	jmp	memset@PLT                      # TAILCALL
.LBB8_1:                                # %._crit_edge
	retq
.Lfunc_end8:
	.size	_Z8zeroingBPf, .Lfunc_end8-_Z8zeroingBPf
	.cfi_endproc
                                        # -- End function
	.globl	_Z20__device_stub__SolvePfS_S_S_y # -- Begin function _Z20__device_stub__SolvePfS_S_S_y
	.type	_Z20__device_stub__SolvePfS_S_S_y,@function
_Z20__device_stub__SolvePfS_S_S_y:      # @_Z20__device_stub__SolvePfS_S_S_y
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$144, %rsp
	.cfi_def_cfa_offset 192
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	56(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	48(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	40(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	32(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	24(%rsp), %rcx
	movq	%r8, (%rcx)
	leaq	96(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	movq	%rcx, 32(%rbx)
	leaq	80(%rsp), %r14
	leaq	64(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z5SolvePfS_S_S_y, %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_end9:
	.size	_Z20__device_stub__SolvePfS_S_S_y, .Lfunc_end9-_Z20__device_stub__SolvePfS_S_S_y
	.cfi_endproc
                                        # -- End function
	.globl	_Z18__device_stub__EpsPfS_S_y   # -- Begin function _Z18__device_stub__EpsPfS_S_y
	.type	_Z18__device_stub__EpsPfS_S_y,@function
_Z18__device_stub__EpsPfS_S_y:          # @_Z18__device_stub__EpsPfS_S_y
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	16(%rsp), %rdx
	movq	%rcx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	8(%rsp), %r12
	movq	%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	$_Z3EpsPfS_S_y, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end10:
	.size	_Z18__device_stub__EpsPfS_S_y, .Lfunc_end10-_Z18__device_stub__EpsPfS_S_y
	.cfi_endproc
                                        # -- End function
	.section	.rodata.cst4,"aM",@progbits,4
	.p2align	2, 0x0                          # -- Begin function main
.LCPI11_0:
	.long	0x41a00000                      # float 20
.LCPI11_1:
	.long	0x5f000000                      # float 9.22337203E+18
	.section	.rodata.cst8,"aM",@progbits,8
	.p2align	3, 0x0
.LCPI11_2:
	.quad	0x3f50624dd2f1a9fc              # double 0.001
	.text
	.globl	main
	.type	main,@function
main:                                   # @main
	.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	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	cmpl	$3, %edi
	jne	.LBB11_1
# %bb.3:
	movq	%rsi, %r14
	movq	8(%rsi), %rdi
	callq	atoi
	movslq	%eax, %rbx
	movq	%rbx, x_nodes_num(%rip)
	movq	16(%r14), %rdi
	callq	atoi
	movslq	%eax, %r9
	movq	%r9, y_nodes_num(%rip)
	testl	%ebx, %ebx
	je	.LBB11_5
# %bb.4:
	testl	%eax, %eax
	je	.LBB11_5
# %bb.6:
	movq	%r9, %rcx
	imulq	%rbx, %rcx
	movq	%rcx, nodes_num(%rip)
	movl	$1065353216, delta(%rip)        # imm = 0x3F800000
	movl	$0, 76(%rsp)
	movq	$6, N_threads(%rip)
	movabsq	$-6148914691236517205, %rdx     # imm = 0xAAAAAAAAAAAAAAAB
	movq	%rcx, %rax
	mulq	%rdx
	shrq	$2, %rdx
	leaq	(%rdx,%rdx), %rax
	leaq	(%rax,%rax,2), %rax
	xorl	%r8d, %r8d
	cmpq	%rax, %rcx
	setne	%r8b
	addq	%rdx, %r8
	movq	%r8, N_blocks(%rip)
	movl	$.L.str.4, %edi
	movl	$6, %ecx
	movq	%rbx, %rsi
	movq	%r9, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	N_threads(%rip), %r12d
	movl	N_blocks(%rip), %ebp
	leaq	96(%rsp), %rbx
	movq	%rbx, %rdi
	callq	hipEventCreate
	leaq	64(%rsp), %rdi
	callq	hipEventCreate
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	nodes_num(%rip), %r15
	movq	%r15, %rdi
	imulq	%r15, %rdi
	movq	%rdi, 40(%rsp)                  # 8-byte Spill
	movl	$4, %esi
	callq	calloc
	movq	%rax, (%rsp)                    # 8-byte Spill
	movl	$4, %esi
	movq	%r15, %rdi
	callq	calloc
	movq	%rax, %r14
	movl	$4, %esi
	movq	%r15, %rdi
	callq	calloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movl	$4, %esi
	movq	%r15, %rdi
	callq	calloc
	movq	%rax, %r13
	movl	$4, %esi
	movq	%r15, %rdi
	callq	calloc
	movq	%rax, %rbx
	movl	$4, %esi
	movq	%r15, %rdi
	callq	calloc
	movq	%rax, %r15
	movq	40(%rsp), %rsi                  # 8-byte Reload
	shlq	$2, %rsi
	leaq	56(%rsp), %rdi
	callq	hipMalloc
	movq	nodes_num(%rip), %rsi
	shlq	$2, %rsi
	leaq	24(%rsp), %rdi
	callq	hipMalloc
	movq	nodes_num(%rip), %rsi
	shlq	$2, %rsi
	leaq	16(%rsp), %rdi
	callq	hipMalloc
	movq	nodes_num(%rip), %rsi
	shlq	$2, %rsi
	leaq	8(%rsp), %rdi
	callq	hipMalloc
	movq	nodes_num(%rip), %rsi
	shlq	$2, %rsi
	leaq	48(%rsp), %rdi
	callq	hipMalloc
	movl	$.L.str.5, %edi
	movl	$.L.str.6, %esi
	callq	fopen
	movq	%rax, fp(%rip)
	testq	%rax, %rax
	je	.LBB11_7
# %bb.8:
	movss	.LCPI11_0(%rip), %xmm0          # xmm0 = mem[0],zero,zero,zero
	divss	delta(%rip), %xmm0
	cvttss2si	%xmm0, %rax
	movq	%rax, %rcx
	sarq	$63, %rcx
	subss	.LCPI11_1(%rip), %xmm0
	cvttss2si	%xmm0, %rsi
	andq	%rcx, %rsi
	orq	%rax, %rsi
	movl	$.L.str.8, %edi
	movq	%rsi, 80(%rsp)                  # 8-byte Spill
	xorl	%eax, %eax
	callq	printf
	movq	nodes_num(%rip), %rax
	testq	%rax, %rax
	movq	32(%rsp), %rdx                  # 8-byte Reload
	je	.LBB11_11
# %bb.9:                                # %.lr.ph.i.preheader
	xorl	%ecx, %ecx
.LBB11_10:                              # %.lr.ph.i
                                        # =>This Inner Loop Header: Depth=1
	movl	$1101004800, (%rdx,%rcx,4)      # imm = 0x41A00000
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB11_10
.LBB11_11:                              # %_Z5initXPf.exit
	movq	(%rsp), %rdi                    # 8-byte Reload
	movq	%r14, %rsi
	callq	_Z6initABPfS_S_
	movq	nodes_num(%rip), %rdx
	testq	%rdx, %rdx
	je	.LBB11_14
# %bb.12:                               # %.lr.ph.i69.preheader
	leaq	4(,%rdx,4), %rax
	xorl	%ecx, %ecx
	movq	(%rsp), %rsi                    # 8-byte Reload
.LBB11_13:                              # %.lr.ph.i69
                                        # =>This Inner Loop Header: Depth=1
	movss	(%r14,%rcx,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	divss	(%rsi), %xmm0
	movss	%xmm0, (%r13,%rcx,4)
	incq	%rcx
	addq	%rax, %rsi
	cmpq	%rcx, %rdx
	jne	.LBB11_13
.LBB11_14:                              # %_Z6initX0PfS_S_.exit
	movq	56(%rsp), %rdi
	imulq	%rdx, %rdx
	shlq	$2, %rdx
	movq	(%rsp), %rsi                    # 8-byte Reload
	movl	$1, %ecx
	callq	hipMemcpy
	movq	16(%rsp), %rdi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	24(%rsp), %rdi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	cmpq	$0, 80(%rsp)                    # 8-byte Folded Reload
	je	.LBB11_32
# %bb.15:                               # %.lr.ph86.preheader
	btsq	$32, %r12
	btsq	$32, %rbp
	movl	$1, %eax
	movq	%r13, 88(%rsp)                  # 8-byte Spill
.LBB11_16:                              # %.lr.ph86
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB11_17 Depth 2
                                        #       Child Loop BB11_23 Depth 3
                                        #     Child Loop BB11_30 Depth 2
	movq	fp(%rip), %rdi
	movl	$.L.str.9, %esi
	movq	%rax, %r13
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	fprintf
	movl	$.L.str.10, %edi
	movq	%r13, 40(%rsp)                  # 8-byte Spill
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	printf
	movl	$1325400064, eps(%rip)          # imm = 0x4F000000
.LBB11_17:                              #   Parent Loop BB11_16 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB11_23 Depth 3
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_19
# %bb.18:                               #   in Loop: Header=BB11_17 Depth=2
	movq	56(%rsp), %rdi
	movq	24(%rsp), %rsi
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rcx
	movq	nodes_num(%rip), %r8
	callq	_Z20__device_stub__SolvePfS_S_S_y
.LBB11_19:                              #   in Loop: Header=BB11_17 Depth=2
	movq	%rbp, %rdi
	movl	$1, %esi
	movq	%r12, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB11_21
# %bb.20:                               #   in Loop: Header=BB11_17 Depth=2
	movq	16(%rsp), %rdi
	movq	8(%rsp), %rsi
	movq	48(%rsp), %rdx
	movq	nodes_num(%rip), %rcx
	callq	_Z18__device_stub__EpsPfS_S_y
.LBB11_21:                              #   in Loop: Header=BB11_17 Depth=2
	movq	8(%rsp), %rsi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	48(%rsp), %rsi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	%r15, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	nodes_num(%rip), %rax
	xorps	%xmm0, %xmm0
	testq	%rax, %rax
	je	.LBB11_24
# %bb.22:                               # %.lr.ph.preheader
                                        #   in Loop: Header=BB11_17 Depth=2
	xorl	%ecx, %ecx
.LBB11_23:                              # %.lr.ph
                                        #   Parent Loop BB11_16 Depth=1
                                        #     Parent Loop BB11_17 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	addss	(%r15,%rcx,4), %xmm0
	incq	%rcx
	cmpq	%rcx, %rax
	jne	.LBB11_23
.LBB11_24:                              # %._crit_edge
                                        #   in Loop: Header=BB11_17 Depth=2
	testq	%rax, %rax
	js	.LBB11_25
# %bb.26:                               # %._crit_edge
                                        #   in Loop: Header=BB11_17 Depth=2
	xorps	%xmm1, %xmm1
	cvtsi2ss	%rax, %xmm1
	jmp	.LBB11_27
.LBB11_25:                              #   in Loop: Header=BB11_17 Depth=2
	movq	%rax, %rcx
	shrq	%rcx
	andl	$1, %eax
	orq	%rcx, %rax
	xorps	%xmm1, %xmm1
	cvtsi2ss	%rax, %xmm1
	addss	%xmm1, %xmm1
.LBB11_27:                              # %._crit_edge
                                        #   in Loop: Header=BB11_17 Depth=2
	divss	%xmm1, %xmm0
	movss	%xmm0, eps(%rip)
	cvtss2sd	%xmm0, %xmm0
	ucomisd	.LCPI11_2(%rip), %xmm0
	ja	.LBB11_17
# %bb.28:                               #   in Loop: Header=BB11_16 Depth=1
	movq	%rbx, %rdi
	callq	_Z11printToFilePf
	movq	8(%rsp), %rsi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	32(%rsp), %r13                  # 8-byte Reload
	movq	%r13, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_Z5initBPfS_
	movq	24(%rsp), %rdi
	movq	nodes_num(%rip), %rdx
	shlq	$2, %rdx
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	nodes_num(%rip), %rdx
	testq	%rdx, %rdx
	movq	88(%rsp), %r13                  # 8-byte Reload
	je	.LBB11_31
# %bb.29:                               # %.lr.ph.i72.preheader
                                        #   in Loop: Header=BB11_16 Depth=1
	leaq	4(,%rdx,4), %rax
	movq	(%rsp), %rcx                    # 8-byte Reload
	xorl	%esi, %esi
.LBB11_30:                              # %.lr.ph.i72
                                        #   Parent Loop BB11_16 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%r14,%rsi,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	divss	(%rcx), %xmm0
	movss	%xmm0, (%r13,%rsi,4)
	incq	%rsi
	addq	%rax, %rcx
	cmpq	%rsi, %rdx
	jne	.LBB11_30
.LBB11_31:                              # %_Z6initX0PfS_S_.exit75
                                        #   in Loop: Header=BB11_16 Depth=1
	movq	16(%rsp), %rdi
	shlq	$2, %rdx
	movq	%r13, %rsi
	movl	$1, %ecx
	callq	hipMemcpy
	movq	40(%rsp), %rax                  # 8-byte Reload
	incq	%rax
	cmpq	80(%rsp), %rax                  # 8-byte Folded Reload
	jbe	.LBB11_16
.LBB11_32:                              # %._crit_edge87
	movq	64(%rsp), %rdi
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	callq	hipEventRecord
	movq	64(%rsp), %rdi
	callq	hipEventSynchronize
	movq	96(%rsp), %rsi
	movq	64(%rsp), %rdx
	leaq	76(%rsp), %rbp
	movq	%rbp, %rdi
	callq	hipEventElapsedTime
	xorps	%xmm0, %xmm0
	cvtss2sd	(%rbp), %xmm0
	movl	$.L.str.11, %edi
	movb	$1, %al
	callq	printf
	movq	fp(%rip), %rdi
	callq	fclose
	movq	(%rsp), %rdi                    # 8-byte Reload
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	%r13, %rdi
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	%r15, %rdi
	callq	free
	movq	56(%rsp), %rdi
	callq	hipFree
	movq	24(%rsp), %rdi
	callq	hipFree
	movq	16(%rsp), %rdi
	callq	hipFree
	movq	8(%rsp), %rdi
	callq	hipFree
	movq	48(%rsp), %rdi
	callq	hipFree
	jmp	.LBB11_33
.LBB11_1:
	movl	$.Lstr.2, %edi
	jmp	.LBB11_2
.LBB11_5:
	movl	$.Lstr.1, %edi
.LBB11_2:
	callq	puts@PLT
	movl	$1, %r12d
.LBB11_33:
	movl	%r12d, %eax
	addq	$104, %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
.LBB11_7:
	.cfi_def_cfa_offset 160
	movl	$.Lstr, %edi
	callq	puts@PLT
	movl	$-1, %r12d
	jmp	.LBB11_33
.Lfunc_end11:
	.size	main, .Lfunc_end11-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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB12_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB12_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z5SolvePfS_S_S_y, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z3EpsPfS_S_y, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end12:
	.size	__hip_module_ctor, .Lfunc_end12-__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	.LBB13_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
.LBB13_2:
	retq
.Lfunc_end13:
	.size	__hip_module_dtor, .Lfunc_end13-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	delta,@object                   # @delta
	.bss
	.globl	delta
	.p2align	2, 0x0
delta:
	.long	0x00000000                      # float 0
	.size	delta, 4

	.type	eps,@object                     # @eps
	.data
	.globl	eps
	.p2align	2, 0x0
eps:
	.long	0x4f000000                      # float 2.14748365E+9
	.size	eps, 4

	.type	x_nodes_num,@object             # @x_nodes_num
	.bss
	.globl	x_nodes_num
	.p2align	3, 0x0
x_nodes_num:
	.quad	0                               # 0x0
	.size	x_nodes_num, 8

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

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

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

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

	.type	N_threads,@object               # @N_threads
	.data
	.globl	N_threads
	.p2align	3, 0x0
N_threads:
	.quad	512                             # 0x200
	.size	N_threads, 8

	.type	N_blocks,@object                # @N_blocks
	.bss
	.globl	N_blocks
	.p2align	3, 0x0
N_blocks:
	.quad	0                               # 0x0
	.size	N_blocks, 8

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

	.type	_Z5SolvePfS_S_S_y,@object       # @_Z5SolvePfS_S_S_y
	.section	.rodata,"a",@progbits
	.globl	_Z5SolvePfS_S_S_y
	.p2align	3, 0x0
_Z5SolvePfS_S_S_y:
	.quad	_Z20__device_stub__SolvePfS_S_S_y
	.size	_Z5SolvePfS_S_S_y, 8

	.type	_Z3EpsPfS_S_y,@object           # @_Z3EpsPfS_S_y
	.globl	_Z3EpsPfS_S_y
	.p2align	3, 0x0
_Z3EpsPfS_S_y:
	.quad	_Z18__device_stub__EpsPfS_S_y
	.size	_Z3EpsPfS_S_y, 8

	.type	.L.str.4,@object                # @.str.4
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str.4:
	.asciz	"x_nodes_num = %llu\ny_nodes_num=%llu\nN_threads=%llu\nN_blocks=%llu\n"
	.size	.L.str.4, 66

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"result_CUDA.txt"
	.size	.L.str.5, 16

	.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	"Times: %llu\n"
	.size	.L.str.8, 13

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"%llu sec\n"
	.size	.L.str.9, 10

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"%llu\n"
	.size	.L.str.10, 6

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	"GPU time : %.3f ms\n"
	.size	.L.str.11, 20

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

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z3EpsPfS_S_y"
	.size	.L__unnamed_2, 14

	.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	"Open failed"
	.size	.Lstr, 12

	.type	.Lstr.1,@object                 # @str.1
.Lstr.1:
	.asciz	"Error data. Please, enter 2 integers."
	.size	.Lstr.1, 38

	.type	.Lstr.2,@object                 # @str.2
.Lstr.2:
	.asciz	"Error data. Please, enter these aruments:\n1st argument - x_nodes;\n2nd argument - y_nodes."
	.size	.Lstr.2, 90

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym _Z20__device_stub__SolvePfS_S_S_y
	.addrsig_sym _Z18__device_stub__EpsPfS_S_y
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z5SolvePfS_S_S_y
	.addrsig_sym _Z3EpsPfS_S_y
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z5SolvePfS_S_S_y       ; -- Begin function _Z5SolvePfS_S_S_y
	.globl	_Z5SolvePfS_S_S_y
	.p2align	8
	.type	_Z5SolvePfS_S_S_y,@function
_Z5SolvePfS_S_S_y:                      ; @_Z5SolvePfS_S_S_y
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x34
	s_load_b256 s[4:11], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x20
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_mov_b32_e32 v2, 0
	s_cmp_eq_u64 s[0:1], 0
	v_mov_b32_e32 v0, v2
	s_cbranch_scc1 .LBB0_3
; %bb.1:                                ; %.lr.ph
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v1, s0, 0
	s_mov_b32 s2, s8
	s_mov_b32 s3, s9
	s_mov_b64 s[12:13], s[0:1]
	v_mov_b32_e32 v0, v4
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_mad_u64_u32 v[4:5], null, v1, s1, v[0:1]
	v_mov_b32_e32 v0, 0
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v3, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
.LBB0_2:                                ; =>This Inner Loop Header: Depth=1
	global_load_b32 v5, v[3:4], off
	s_load_b32 s14, s[2:3], 0x0
	v_add_co_u32 v3, vcc_lo, v3, 4
	s_add_u32 s12, s12, -1
	v_add_co_ci_u32_e32 v4, vcc_lo, 0, v4, vcc_lo
	s_addc_u32 s13, s13, -1
	s_add_u32 s2, s2, 4
	s_addc_u32 s3, s3, 0
	s_cmp_eq_u64 s[12:13], 0
	s_waitcnt vmcnt(0) lgkmcnt(0)
	v_fmac_f32_e32 v0, s14, v5
	s_cbranch_scc0 .LBB0_2
.LBB0_3:                                ; %Flow46
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[3:4], null, v1, s0, v[1:2]
	v_mad_u64_u32 v[5:6], null, v1, s1, v[4:5]
	v_lshlrev_b64 v[1:2], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_mov_b32_e32 v4, v5
	v_add_co_u32 v5, vcc_lo, s6, v1
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_3)
	v_add_co_ci_u32_e32 v6, vcc_lo, s7, v2, vcc_lo
	v_lshlrev_b64 v[3:4], 2, v[3:4]
	global_load_b32 v5, v[5:6], off
	v_add_co_u32 v3, vcc_lo, s4, v3
	v_add_co_ci_u32_e32 v4, vcc_lo, s5, v4, vcc_lo
	global_load_b32 v6, v[3:4], off
	v_add_co_u32 v3, vcc_lo, s8, v1
	v_add_co_ci_u32_e32 v4, vcc_lo, s9, v2, vcc_lo
	global_load_b32 v3, v[3:4], off
	s_waitcnt vmcnt(2)
	v_sub_f32_e32 v0, v5, v0
	s_waitcnt vmcnt(1)
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
	v_div_scale_f32 v4, null, v6, v6, v0
	v_div_scale_f32 v8, vcc_lo, v0, v6, v0
	v_rcp_f32_e32 v5, v4
	s_waitcnt_depctr 0xfff
	v_fma_f32 v7, -v4, v5, 1.0
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fmac_f32_e32 v5, v7, v5
	v_mul_f32_e32 v7, v8, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v9, -v4, v7, v8
	v_fmac_f32_e32 v7, v9, v5
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_fma_f32 v4, -v4, v7, v8
	v_div_fmas_f32 v4, v4, v5, v7
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_div_fixup_f32 v0, v4, v6, v0
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v3, v3, v0
	v_add_co_u32 v0, vcc_lo, s10, v1
	v_add_co_ci_u32_e32 v1, vcc_lo, s11, v2, vcc_lo
	global_store_b32 v[0:1], v3, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z5SolvePfS_S_S_y
		.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 10
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end0:
	.size	_Z5SolvePfS_S_S_y, .Lfunc_end0-_Z5SolvePfS_S_S_y
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 452
; NumSgprs: 18
; NumVgprs: 10
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 10
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 15
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.protected	_Z3EpsPfS_S_y           ; -- Begin function _Z3EpsPfS_S_y
	.globl	_Z3EpsPfS_S_y
	.p2align	8
	.type	_Z3EpsPfS_S_y,@function
_Z3EpsPfS_S_y:                          ; @_Z3EpsPfS_S_y
; %bb.0:
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x2c
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_and_b32 s2, s2, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s2, v[0:1]
	v_mov_b32_e32 v2, 0
	v_lshlrev_b64 v[0:1], 2, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s4, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s5, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s6, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s7, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v6, v[2:3], off
	global_load_b32 v7, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_sub_f32_e32 v6, v6, v7
	s_delay_alu instid0(VALU_DEP_1)
	v_and_b32_e32 v6, 0x7fffffff, v6
	global_store_b32 v[0:1], v6, off
	global_load_b32 v0, v[4:5], off
	s_waitcnt vmcnt(0)
	global_store_b32 v[2:3], v0, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z3EpsPfS_S_y
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 15
		.amdhsa_user_sgpr_dispatch_ptr 0
		.amdhsa_user_sgpr_queue_ptr 0
		.amdhsa_user_sgpr_kernarg_segment_ptr 1
		.amdhsa_user_sgpr_dispatch_id 0
		.amdhsa_user_sgpr_private_segment_size 0
		.amdhsa_wavefront_size32 1
		.amdhsa_uses_dynamic_stack 0
		.amdhsa_enable_private_segment 0
		.amdhsa_system_sgpr_workgroup_id_x 1
		.amdhsa_system_sgpr_workgroup_id_y 0
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 8
		.amdhsa_next_free_sgpr 16
		.amdhsa_float_round_mode_32 0
		.amdhsa_float_round_mode_16_64 0
		.amdhsa_float_denorm_mode_32 3
		.amdhsa_float_denorm_mode_16_64 3
		.amdhsa_dx10_clamp 1
		.amdhsa_ieee_mode 1
		.amdhsa_fp16_overflow 0
		.amdhsa_workgroup_processor_mode 1
		.amdhsa_memory_ordered 1
		.amdhsa_forward_progress 0
		.amdhsa_shared_vgpr_count 0
		.amdhsa_exception_fp_ieee_invalid_op 0
		.amdhsa_exception_fp_denorm_src 0
		.amdhsa_exception_fp_ieee_div_zero 0
		.amdhsa_exception_fp_ieee_overflow 0
		.amdhsa_exception_fp_ieee_underflow 0
		.amdhsa_exception_fp_ieee_inexact 0
		.amdhsa_exception_int_div_zero 0
	.end_amdhsa_kernel
	.text
.Lfunc_end1:
	.size	_Z3EpsPfS_S_y, .Lfunc_end1-_Z3EpsPfS_S_y
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 180
; NumSgprs: 18
; NumVgprs: 8
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 8
; 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
      - .address_space:  global
        .offset:         24
        .size:           8
        .value_kind:     global_buffer
      - .offset:         32
        .size:           8
        .value_kind:     by_value
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         44
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         48
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         52
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         54
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         56
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         58
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         60
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         62
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         96
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         104
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 296
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z5SolvePfS_S_S_y
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z5SolvePfS_S_S_y.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     10
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           8
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z3EpsPfS_S_y
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z3EpsPfS_S_y.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     8
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
