#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/timeb.h>

void Multiplication(float *__restrict__ c, float * a, float * b, int N)
{
#pragma acc parallel loop present(c, a, b)
	for (int n = 0; n < N; n++)
	{
		for (int m = 0; m < N; m++)
		{
			float sum = 0.f;
			for (int k = 0; k < N; k++)
			{
				sum += a[k + n * N] * b[k * N + m ];
			}
			c[m + n * N] = sum;
		}
	}
}
int main()
{
	int i;
	const int N = 4;
	float **Matrix_A = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_A[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float **Matrix_B = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_B[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float **Matrix_C = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_C[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float 
        * a = (float *)malloc(N * N * sizeof(float*)),
		* b = (float *)malloc(N * N * sizeof(float*)),
		* c = (float *)malloc(N * N * sizeof(float*));
        
    srand(time(NULL));
    
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; j++) {
			Matrix_A[i][j] = rand() % 5;
			Matrix_B[i][j] = rand() % 10;
		}
	}
    
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; j++) {
			a[j + i * N] = Matrix_A[i][j];
			b[j + i * N] = Matrix_B[i][j];
		}
	}
	
		
#pragma acc data copyin (a[0:N*N], b[0:N*N]) copyout (c[0:N*N])
	{
		Multiplication(c, a, b, N);
	}

    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			printf("%3.0f  ", Matrix_A[i][j]);
		}
		printf("\n");
	}
    
    printf("\n");
    
    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			printf("%3.0f  ", Matrix_B[i][j]);
		}
		printf("\n");
	}
    
    printf("\n");
    
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			Matrix_C[i][j] = c[j + i * N];
			printf("%3.0f  ", Matrix_C[i][j]);
		}
		printf("\n");
	}
	
	free(a);
	free(b);
	free(c);
	free(Matrix_A);
	free(Matrix_B);
	free(Matrix_C);
}
	.file	"tmpxft_00367157_00000000-6_laba6.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2031:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2031:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z14MultiplicationPfS_S_i
	.type	_Z14MultiplicationPfS_S_i, @function
_Z14MultiplicationPfS_S_i:
.LFB2027:
	.cfi_startproc
	endbr64
	movq	%rdi, %r10
	xorl	%r9d, %r9d
	movslq	%ecx, %rdi
	movq	%rsi, %r11
	salq	$2, %rdi
	xorl	%esi, %esi
	cmpl	%ecx, %r9d
	jl	.L11
	ret
.L11:
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
.L7:
	xorl	%eax, %eax
	leaq	(%r11,%rsi), %rbp
	leaq	(%r10,%rsi), %r12
.L6:
	leaq	(%rdx,%rax,4), %rbx
	xorl	%r8d, %r8d
	xorps	%xmm0, %xmm0
.L4:
	movss	0(%rbp,%r8,4), %xmm1
	mulss	(%rbx), %xmm1
	incq	%r8
	addq	%rdi, %rbx
	addss	%xmm1, %xmm0
	cmpl	%r8d, %ecx
	jg	.L4
	movss	%xmm0, (%r12,%rax,4)
	incq	%rax
	cmpl	%eax, %ecx
	jg	.L6
	incl	%r9d
	addq	%rdi, %rsi
	cmpl	%ecx, %r9d
	jl	.L7
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z14MultiplicationPfS_S_i, .-_Z14MultiplicationPfS_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%3.0f  "
.LC2:
	.string	"\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2028:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$32, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	call	malloc@PLT
	movq	%rax, %rbp
.L14:
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, 0(%rbp,%rbx,8)
	incq	%rbx
	cmpq	$4, %rbx
	jne	.L14
	movl	$32, %edi
	xorl	%r12d, %r12d
	call	malloc@PLT
	movq	%rax, %rbx
.L15:
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, (%rbx,%r12,8)
	incq	%r12
	cmpq	$4, %r12
	jne	.L15
	movl	$32, %edi
	xorl	%r13d, %r13d
	call	malloc@PLT
	movq	%rax, %r12
.L16:
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, (%r12,%r13,8)
	incq	%r13
	cmpq	$4, %r13
	jne	.L16
	movl	$128, %edi
	xorl	%r14d, %r14d
	call	malloc@PLT
	movl	$128, %edi
	movq	%rax, %r15
	call	malloc@PLT
	movl	$128, %edi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	xorl	%edi, %edi
	movq	%rax, 32(%rsp)
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L17:
	xorl	%r13d, %r13d
.L18:
	call	rand@PLT
	movl	$5, %ecx
	movq	0(%rbp,%r14), %rdi
	cltd
	idivl	%ecx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, (%rdi,%r13)
	call	rand@PLT
	movl	$10, %edi
	movq	(%rbx,%r14), %r8
	cltd
	idivl	%edi
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, (%r8,%r13)
	addq	$4, %r13
	cmpq	$16, %r13
	jne	.L18
	addq	$8, %r14
	cmpq	$32, %r14
	jne	.L17
	xorl	%eax, %eax
.L19:
	movq	0(%rbp,%rax), %rcx
	movq	(%rbx,%rax), %rdx
	movups	(%rcx), %xmm1
	movups	(%rdx), %xmm2
	movq	8(%rsp), %rcx
	movups	%xmm1, (%r15,%rax,2)
	movups	%xmm2, (%rcx,%rax,2)
	addq	$8, %rax
	movaps	%xmm2, 16(%rsp)
	cmpq	$32, %rax
	jne	.L19
	movq	8(%rsp), %rdx
	movq	32(%rsp), %rdi
	movq	%r15, %rsi
	xorl	%r14d, %r14d
	movl	$4, %ecx
	call	_Z14MultiplicationPfS_S_i
.L20:
	xorl	%r13d, %r13d
.L21:
	movq	0(%rbp,%r14,8), %rax
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	cvtss2sd	(%rax,%r13), %xmm0
	movb	$1, %al
	addq	$4, %r13
	call	__printf_chk@PLT
	cmpq	$16, %r13
	jne	.L21
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	cmpq	$4, %r14
	jne	.L20
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__printf_chk@PLT
.L23:
	xorl	%r13d, %r13d
.L24:
	movq	(%rbx,%r14,8), %rax
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	cvtss2sd	(%rax,%r13), %xmm0
	movb	$1, %al
	addq	$4, %r13
	call	__printf_chk@PLT
	cmpq	$16, %r13
	jne	.L24
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r14
	call	__printf_chk@PLT
	cmpq	$4, %r14
	jne	.L23
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__printf_chk@PLT
.L26:
	movq	32(%rsp), %rax
	movq	%r13, %r8
	xorl	%edx, %edx
	salq	$4, %r8
	addq	%rax, %r8
.L27:
	movss	(%r8,%rdx), %xmm0
	movq	(%r12,%r13,8), %rax
	movl	$2, %edi
	leaq	.LC1(%rip), %rsi
	movq	%r8, 40(%rsp)
	movss	%xmm0, (%rax,%rdx)
	movb	$1, %al
	cvtss2sd	%xmm0, %xmm0
	movq	%rdx, 16(%rsp)
	call	__printf_chk@PLT
	movq	16(%rsp), %rdx
	movq	40(%rsp), %r8
	addq	$4, %rdx
	cmpq	$16, %rdx
	jne	.L27
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	incq	%r13
	call	__printf_chk@PLT
	cmpq	$4, %r13
	jne	.L26
	movq	%r15, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	32(%rsp), %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	%rbx, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	addq	$56, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2028:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2054:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2054:
	.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
	.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 <time.h>
#include <sys/timeb.h>

void Multiplication(float *__restrict__ c, float * a, float * b, int N)
{
#pragma acc parallel loop present(c, a, b)
	for (int n = 0; n < N; n++)
	{
		for (int m = 0; m < N; m++)
		{
			float sum = 0.f;
			for (int k = 0; k < N; k++)
			{
				sum += a[k + n * N] * b[k * N + m ];
			}
			c[m + n * N] = sum;
		}
	}
}
int main()
{
	int i;
	const int N = 4;
	float **Matrix_A = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_A[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float **Matrix_B = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_B[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float **Matrix_C = (float**)malloc(N * sizeof(float*));
	for (i = 0; i < N; i++) {
		Matrix_C[i] = (float*)malloc(N * sizeof(float*));
	}
    
	float 
        * a = (float *)malloc(N * N * sizeof(float*)),
		* b = (float *)malloc(N * N * sizeof(float*)),
		* c = (float *)malloc(N * N * sizeof(float*));
        
    srand(time(NULL));
    
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; j++) {
			Matrix_A[i][j] = rand() % 5;
			Matrix_B[i][j] = rand() % 10;
		}
	}
    
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; j++) {
			a[j + i * N] = Matrix_A[i][j];
			b[j + i * N] = Matrix_B[i][j];
		}
	}
	
		
#pragma acc data copyin (a[0:N*N], b[0:N*N]) copyout (c[0:N*N])
	{
		Multiplication(c, a, b, N);
	}

    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			printf("%3.0f  ", Matrix_A[i][j]);
		}
		printf("\n");
	}
    
    printf("\n");
    
    for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			printf("%3.0f  ", Matrix_B[i][j]);
		}
		printf("\n");
	}
    
    printf("\n");
    
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			Matrix_C[i][j] = c[j + i * N];
			printf("%3.0f  ", Matrix_C[i][j]);
		}
		printf("\n");
	}
	
	free(a);
	free(b);
	free(c);
	free(Matrix_A);
	free(Matrix_B);
	free(Matrix_C);
}
	.text
	.file	"laba6.hip"
	.globl	_Z14MultiplicationPfS_S_i       # -- Begin function _Z14MultiplicationPfS_S_i
	.type	_Z14MultiplicationPfS_S_i,@function
_Z14MultiplicationPfS_S_i:              # @_Z14MultiplicationPfS_S_i
	.cfi_startproc
# %bb.0:
	testl	%ecx, %ecx
	jle	.LBB0_8
# %bb.1:                                # %.preheader26.lr.ph
	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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movl	%ecx, %eax
	leaq	(,%rax,4), %r8
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
.LBB0_2:                                # %.preheader.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB0_3 Depth 2
                                        #       Child Loop BB0_4 Depth 3
	movl	%r9d, %r11d
	leaq	(%rsi,%r11,4), %r11
	movq	%r10, %rbx
	imulq	%rax, %rbx
	leaq	(%rdi,%rbx,4), %rbx
	movq	%rdx, %r14
	xorl	%r15d, %r15d
.LBB0_3:                                # %.preheader
                                        #   Parent Loop BB0_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB0_4 Depth 3
	xorps	%xmm0, %xmm0
	movq	%r14, %r12
	xorl	%r13d, %r13d
.LBB0_4:                                #   Parent Loop BB0_2 Depth=1
                                        #     Parent Loop BB0_3 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%r11,%r13,4), %xmm1            # xmm1 = mem[0],zero,zero,zero
	mulss	(%r12), %xmm1
	addss	%xmm1, %xmm0
	incq	%r13
	addq	%r8, %r12
	cmpq	%r13, %rax
	jne	.LBB0_4
# %bb.5:                                # %._crit_edge
                                        #   in Loop: Header=BB0_3 Depth=2
	movss	%xmm0, (%rbx,%r15,4)
	incq	%r15
	addq	$4, %r14
	cmpq	%rax, %r15
	jne	.LBB0_3
# %bb.6:                                # %._crit_edge30
                                        #   in Loop: Header=BB0_2 Depth=1
	incq	%r10
	addl	%ecx, %r9d
	cmpq	%rax, %r10
	jne	.LBB0_2
# %bb.7:
	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
	.cfi_restore %rbx
	.cfi_restore %r12
	.cfi_restore %r13
	.cfi_restore %r14
	.cfi_restore %r15
.LBB0_8:                                # %._crit_edge32
	retq
.Lfunc_end0:
	.size	_Z14MultiplicationPfS_S_i, .Lfunc_end0-_Z14MultiplicationPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function 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	$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	$32, %edi
	callq	malloc
	movq	%rax, %rbx
	xorl	%r14d, %r14d
.LBB1_1:                                # =>This Inner Loop Header: Depth=1
	movl	$32, %edi
	callq	malloc
	movq	%rax, (%rbx,%r14,8)
	incq	%r14
	cmpq	$4, %r14
	jne	.LBB1_1
# %bb.2:
	movl	$32, %edi
	callq	malloc
	movq	%rax, %r14
	xorl	%r15d, %r15d
.LBB1_3:                                # =>This Inner Loop Header: Depth=1
	movl	$32, %edi
	callq	malloc
	movq	%rax, (%r14,%r15,8)
	incq	%r15
	cmpq	$4, %r15
	jne	.LBB1_3
# %bb.4:
	movl	$32, %edi
	callq	malloc
	movq	%rax, %r12
	xorl	%r15d, %r15d
.LBB1_5:                                # =>This Inner Loop Header: Depth=1
	movl	$32, %edi
	callq	malloc
	movq	%rax, (%r12,%r15,8)
	incq	%r15
	cmpq	$4, %r15
	jne	.LBB1_5
# %bb.6:
	movq	%r12, 16(%rsp)                  # 8-byte Spill
	movl	$128, %edi
	callq	malloc
	movq	%rax, %r15
	movl	$128, %edi
	callq	malloc
	movq	%rax, %r13
	movl	$128, %edi
	callq	malloc
	movq	%rax, 8(%rsp)                   # 8-byte Spill
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
.LBB1_7:                                # %.preheader92
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_8 Depth 2
	xorl	%ebp, %ebp
.LBB1_8:                                #   Parent Loop BB1_7 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$33, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movq	(%rbx,%r12,8), %rax
	movss	%xmm0, (%rax,%rbp,4)
	callq	rand
	cltq
	imulq	$1717986919, %rax, %rcx         # imm = 0x66666667
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$34, %rcx
	addl	%edx, %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movq	(%r14,%r12,8), %rax
	movss	%xmm0, (%rax,%rbp,4)
	incq	%rbp
	cmpq	$4, %rbp
	jne	.LBB1_8
# %bb.9:                                #   in Loop: Header=BB1_7 Depth=1
	incq	%r12
	cmpq	$4, %r12
	jne	.LBB1_7
# %bb.10:                               # %.preheader90.preheader
	xorl	%eax, %eax
.LBB1_11:                               # %.preheader90
                                        # =>This Inner Loop Header: Depth=1
	movq	(%rbx,%rax), %rcx
	movq	(%r14,%rax), %rdx
	movups	(%rcx), %xmm0
	movups	%xmm0, (%r15,%rax,2)
	movups	(%rdx), %xmm0
	movups	%xmm0, (%r13,%rax,2)
	addq	$8, %rax
	cmpq	$32, %rax
	jne	.LBB1_11
# %bb.12:
	xorl	%eax, %eax
	movq	%r15, %rcx
	movq	8(%rsp), %rbp                   # 8-byte Reload
.LBB1_13:                               # %.preheader.lr.ph.i
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_14 Depth 2
                                        #       Child Loop BB1_15 Depth 3
	movq	%rax, %rdx
	shlq	$4, %rdx
	addq	%rbp, %rdx
	movq	%r13, %rsi
	xorl	%edi, %edi
.LBB1_14:                               # %.preheader.i
                                        #   Parent Loop BB1_13 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_15 Depth 3
	xorps	%xmm0, %xmm0
	xorl	%r8d, %r8d
.LBB1_15:                               #   Parent Loop BB1_13 Depth=1
                                        #     Parent Loop BB1_14 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movss	(%rcx,%r8), %xmm1               # xmm1 = mem[0],zero,zero,zero
	mulss	(%rsi,%r8,4), %xmm1
	addss	%xmm1, %xmm0
	addq	$4, %r8
	cmpq	$16, %r8
	jne	.LBB1_15
# %bb.16:                               # %._crit_edge.i
                                        #   in Loop: Header=BB1_14 Depth=2
	movss	%xmm0, (%rdx,%rdi,4)
	incq	%rdi
	addq	$4, %rsi
	cmpq	$4, %rdi
	jne	.LBB1_14
# %bb.17:                               # %._crit_edge30.i
                                        #   in Loop: Header=BB1_13 Depth=1
	incq	%rax
	addq	$16, %rcx
	cmpq	$4, %rax
	jne	.LBB1_13
# %bb.18:                               # %.preheader89.preheader
	movq	%r13, 24(%rsp)                  # 8-byte Spill
	movq	%r15, 32(%rsp)                  # 8-byte Spill
	xorl	%r12d, %r12d
.LBB1_19:                               # %.preheader89
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_20 Depth 2
	movq	(%rbx,%r12,8), %r15
	xorl	%r13d, %r13d
.LBB1_20:                               #   Parent Loop BB1_19 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%r13,4), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$4, %r13
	jne	.LBB1_20
# %bb.21:                               # %_Z14MultiplicationPfS_S_i.exit
                                        #   in Loop: Header=BB1_19 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r12
	cmpq	$4, %r12
	jne	.LBB1_19
# %bb.22:
	movl	$10, %edi
	callq	putchar@PLT
	xorl	%r12d, %r12d
.LBB1_23:                               # %.preheader88
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_24 Depth 2
	movq	(%r14,%r12,8), %r15
	xorl	%r13d, %r13d
.LBB1_24:                               #   Parent Loop BB1_23 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r15,%r13,4), %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$4, %r13
	jne	.LBB1_24
# %bb.25:                               #   in Loop: Header=BB1_23 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r12
	cmpq	$4, %r12
	jne	.LBB1_23
# %bb.26:
	movl	$10, %edi
	callq	putchar@PLT
	xorl	%r12d, %r12d
.LBB1_27:                               # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_28 Depth 2
	movq	16(%rsp), %rax                  # 8-byte Reload
	movq	(%rax,%r12,8), %r15
	xorl	%r13d, %r13d
.LBB1_28:                               #   Parent Loop BB1_27 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	movss	(%rbp,%r13,4), %xmm0            # xmm0 = mem[0],zero,zero,zero
	movss	%xmm0, (%r15,%r13,4)
	cvtss2sd	%xmm0, %xmm0
	movl	$.L.str, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	cmpq	$4, %r13
	jne	.LBB1_28
# %bb.29:                               #   in Loop: Header=BB1_27 Depth=1
	movl	$10, %edi
	callq	putchar@PLT
	incq	%r12
	addq	$16, %rbp
	cmpq	$4, %r12
	jne	.LBB1_27
# %bb.30:
	movq	32(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	24(%rsp), %rdi                  # 8-byte Reload
	callq	free
	movq	8(%rsp), %rdi                   # 8-byte Reload
	callq	free
	movq	%rbx, %rdi
	callq	free
	movq	%r14, %rdi
	callq	free
	movq	16(%rsp), %rdi                  # 8-byte Reload
	callq	free
	xorl	%eax, %eax
	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_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"%3.0f  "
	.size	.L.str, 8

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

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

	.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_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
