/*
 ============================================================================
 Name        : CWLab3.cu
 Author      : sm01800
 Version     :
 Copyright   : Your copyright notice
 Description : CUDA compute reciprocals
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <iostream>
#include <fstream>
#define BLOCK_SIZE 16

using namespace std;
// Matrices are stored in row-major order
typedef struct {
	int width;
	int height;
	float* elements;
	int stride;
} Matrix;

//BEGIN HEADER
// Get a matrix element
__device__ float GetElement(const Matrix A, int row, int col) {
	return A.elements[row * A.stride + col];
}
// Set a matrix element
__device__ void SetElement(Matrix A, int row, int col, float value) {
	A.elements[row * A.stride + col] = value;
}
// Get the BLOCK_SIZExBLOCK_SIZE sub-matrix Asub of A that is
// located col sub-matrices to the right and row sub-matrices down
// from the upper-left corner of A
// Note, we are not doing any copying here - just finding the address of the
// start of the sub-matrix we are interested in
__device__ Matrix GetSubMatrix(Matrix A, int row, int col) {
	Matrix Asub;
	Asub.width = BLOCK_SIZE;
	Asub.height = BLOCK_SIZE;
	Asub.stride = A.stride;
	Asub.elements = &A.elements[A.stride * BLOCK_SIZE * row + BLOCK_SIZE * col];
	return Asub;
}

//END HEADER

__global__ void MultKernShared(const Matrix A, const Matrix B, Matrix C);

// Now we have all the device functions we need to define the matrix multiplication
// Kernel. This is going to be called from the host by MatMul()
__global__ void MultSharedKernel(Matrix A, Matrix B, Matrix C) {
	// Identify the Block row and column
	int blockRow = blockIdx.y;
	int blockCol = blockIdx.x;
	// Each thread block computes one sub-matrix Csub of C
	Matrix Csub = GetSubMatrix(C, blockRow, blockCol);
	// Each thread computes one element of Csub
	// by accumulating results into Cvalue
	float Cvalue = 0;
	// Now find the row and column of the element within Csub
	// that this thread is going to calculate
	int row = threadIdx.y;
	int col = threadIdx.x;
	// Loop over all the sub-matrices of A and B that are
	// required to compute Csub
	for (int m = 0; m < (A.width / BLOCK_SIZE); ++m) {
		// Get sub-matrix Asub of A
		Matrix Asub = GetSubMatrix(A, blockRow, m);
		// Get sub-matrix Bsub of B
		Matrix Bsub = GetSubMatrix(B, m, blockCol);
		// Shared memory used to store Asub and Bsub respectively
		__shared__ float As[BLOCK_SIZE][BLOCK_SIZE];
		__shared__ float Bs[BLOCK_SIZE][BLOCK_SIZE];
		// Load Asub and Bsub from global memory into shared memory
		// Each thread loads one element of each sub-matrix
		As[row][col] = GetElement(Asub, row, col);
		Bs[row][col] = GetElement(Bsub, row, col);
		// Synchronise to make sure the sub-matrices are completely loaded
		// before starting the computation for each phase
		__syncthreads();
		// Now multiply Asub and Bsub together to complete phase m of the
		// calculation of this threads element of Csub
		for (int e = 0; e < BLOCK_SIZE; ++e)
			Cvalue += As[row][e] * Bs[e][col];
		// Synchronise again to make sure that the preceding calculation
		// has been completed by all threads in the block before loading two new
		// sub-matrices of A and B in the next iteration
		__syncthreads();
	}
	// Once all the phases are complete we can write Csub to device (global) memory
	// Each thread writes one element
	SetElement(Csub, row, col, Cvalue);
}

// Matrix multiplication - Host code
// Matrix dimensions are assumed to be multiples of BLOCK_SIZE
string MatrixMult(const Matrix h_A, const Matrix h_B, Matrix h_C,
		int arraySize) {
	cudaEvent_t start, stop;
	cudaEventCreate(&start);
	cudaEventCreate(&stop);
	// Load A and B to device memory
	Matrix d_A;
	d_A.width = d_A.stride = h_A.width;
	d_A.height = h_A.height;
	size_t size = h_A.width * h_A.height * sizeof(float);
	cudaError_t err = cudaMalloc(&d_A.elements, size);
	printf("CUDA malloc h_A: %s\n", cudaGetErrorString(err));
	cudaMemcpy(d_A.elements, h_A.elements, size, cudaMemcpyHostToDevice);
	Matrix d_B;
	d_B.width = d_B.stride = h_B.width;
	d_B.height = h_B.height;
	size = h_B.width * h_B.height * sizeof(float);
	err = cudaMalloc(&d_B.elements, size);
	printf("CUDA malloc h_B: %s\n", cudaGetErrorString(err));
	cudaMemcpy(d_B.elements, h_B.elements, size, cudaMemcpyHostToDevice);
	// Allocate C in device memory
	Matrix d_C;
	d_C.width = d_C.stride = h_C.width;
	d_C.height = h_C.height;
	size = h_C.width * h_C.height * sizeof(float);
	err = cudaMalloc(&d_C.elements, size);
	printf("CUDA malloc h_C: %s\n", cudaGetErrorString(err));
	// Invoke kernel
	dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE);
	dim3 dimGrid(h_B.width / dimBlock.x, h_A.height / dimBlock.y);

	cudaEventRecord(start);
	MultSharedKernel<<<dimGrid, dimBlock>>>(d_A, d_B, d_C);
	err = cudaThreadSynchronize();
	cudaEventRecord(stop);
	printf("Run kernel: %s\n", cudaGetErrorString(err));
	// Read C from device memory
	err = cudaMemcpy(h_C.elements, d_C.elements, size, cudaMemcpyDeviceToHost);
	printf("Copy h_C off device: %s\n", cudaGetErrorString(err));

	cudaEventSynchronize(stop);
	float milliseconds = 0;
	cudaEventElapsedTime(&milliseconds, start, stop);
	printf("Elapsed time was: %f\n milliseconds", milliseconds);

	// Free device memory
	cudaFree(d_A.elements);
	cudaFree(d_B.elements);
	cudaFree(d_C.elements);
	string csv = to_string(arraySize) + "," + to_string(milliseconds) + "\n";
	return csv;
}

string arrayGen(int size) {
	printf("Array size: %i\n", size);
	Matrix A, B, C;
	// Read Dimensions of A and B
	A.height = size;
	A.width = size;
	B.height = A.width;
	B.width = size;

	//Allocate memory for arrays
	A.elements = (float*) malloc(A.width * A.height * sizeof(float));
	B.elements = (float*) malloc(B.width * B.height * sizeof(float));
	C.height = A.height;
	C.width = B.width;
	C.elements = (float*) malloc(C.width * C.height * sizeof(float));

	//FILL ARRAYS
	for (int i = 0; i < A.height; i++)
		for (int j = 0; j < A.width; j++)
			A.elements[i * A.width + j] = (float) (rand() % 3);
	for (int i = 0; i < B.height; i++)
		for (int j = 0; j < B.width; j++)
			B.elements[i * B.width + j] = (float) (rand() % 2);

	//CALL FUNCTION
	string csv = MatrixMult(A, B, C, size);
	printf("\n");
	return csv;
}

// Function to check if x is power of 2
bool isPowerOfTwo(int n) {
	return (n != 0 && (n & (n - 1)) == 0);
}

int main(int argc, char* argv[]) {
	//CALL FUNCTION
	std::ofstream myFile;
	myFile.open("times.csv", std::ofstream::trunc);
	myFile << "Array Size,Elapsed Time\n";

	for (int i = 16; i <= 8192; i++) {
		if (isPowerOfTwo(i)) {
			myFile << arrayGen(i);
		}
	}

	myFile.close();

	/*
	 for (int i = 0; i < A.height; i++) {
	 for (int j = 0; j < A.width; j++)
	 printf("%f ", A.elements[i * A.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 for (int i = 0; i < B.height; i++) {
	 for (int j = 0; j < B.width; j++)
	 printf("%f ", B.elements[i * B.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 for (int i = 0; i < C.height; i++) {
	 for (int j = 0; j < C.width; j++)
	 printf("%f ", C.elements[i * C.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 */
	return 0;
}

	.file	"tmpxft_00278c8e_00000000-6_CWLab3.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3775:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3775:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10GetElement6Matrixii
	.type	_Z10GetElement6Matrixii, @function
_Z10GetElement6Matrixii:
.LFB3766:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE3766:
	.size	_Z10GetElement6Matrixii, .-_Z10GetElement6Matrixii
	.globl	_Z10SetElement6Matrixiif
	.type	_Z10SetElement6Matrixiif, @function
_Z10SetElement6Matrixiif:
.LFB3767:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE3767:
	.size	_Z10SetElement6Matrixiif, .-_Z10SetElement6Matrixiif
	.globl	_Z12GetSubMatrix6Matrixii
	.type	_Z12GetSubMatrix6Matrixii, @function
_Z12GetSubMatrix6Matrixii:
.LFB3768:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	popq	%rax
	.cfi_def_cfa_offset 8
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	movl	$1, 12(%rsp)
	movl	12(%rsp), %edi
	call	exit@PLT
	.cfi_endproc
.LFE3768:
	.size	_Z12GetSubMatrix6Matrixii, .-_Z12GetSubMatrix6Matrixii
	.globl	_Z12isPowerOfTwoi
	.type	_Z12isPowerOfTwoi, @function
_Z12isPowerOfTwoi:
.LFB3771:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	testl	%edi, %edi
	je	.L8
	leal	-1(%rdi), %eax
	testl	%edi, %eax
	sete	%al
.L8:
	ret
	.cfi_endproc
.LFE3771:
	.size	_Z12isPowerOfTwoi, .-_Z12isPowerOfTwoi
	.globl	_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_
	.type	_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_, @function
_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_:
.LFB3797:
	.cfi_startproc
	endbr64
	subq	$104, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rcx
	movq	%rdi, 64(%rsp)
	movabsq	$4294967297, %rax
	movq	%rsi, 72(%rsp)
	leaq	16(%rsp), %rdi
	leaq	28(%rsp), %rsi
	movq	%rdx, 80(%rsp)
	movq	%rsp, %rdx
	movq	%rax, 16(%rsp)
	movl	$1, 24(%rsp)
	movq	%rax, 28(%rsp)
	movl	$1, 36(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L13
	pushq	8(%rsp)
	.cfi_def_cfa_offset 120
	leaq	_Z16MultSharedKernel6MatrixS_S_(%rip), %rdi
	pushq	8(%rsp)
	.cfi_def_cfa_offset 128
	movq	44(%rsp), %rcx
	movl	52(%rsp), %r8d
	movq	32(%rsp), %rsi
	movl	40(%rsp), %edx
	leaq	80(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 120
	popq	%rdx
	.cfi_def_cfa_offset 112
.L13:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	addq	$104, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3797:
	.size	_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_, .-_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_
	.globl	_Z16MultSharedKernel6MatrixS_S_
	.type	_Z16MultSharedKernel6MatrixS_S_, @function
_Z16MultSharedKernel6MatrixS_S_:
.LFB3798:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	64(%rsp), %rdx
	leaq	40(%rsp), %rsi
	leaq	16(%rsp), %rdi
	call	_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_
	popq	%rdx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3798:
	.size	_Z16MultSharedKernel6MatrixS_S_, .-_Z16MultSharedKernel6MatrixS_S_
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"_Z16MultSharedKernel6MatrixS_S_"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3800:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z16MultSharedKernel6MatrixS_S_(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3800:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.text._ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z,"axG",@progbits,_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z,comdat
	.weak	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
	.type	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z, @function
_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z:
.LFB3972:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsi, %r10
	movq	%rdx, %rsi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%rdi, %rbx
	movq	%rcx, %rdi
	subq	$232, %rsp
	movq	%r8, -176(%rbp)
	movq	%r9, -168(%rbp)
	testb	%al, %al
	je	.L22
	movaps	%xmm0, -160(%rbp)
	movaps	%xmm1, -144(%rbp)
	movaps	%xmm2, -128(%rbp)
	movaps	%xmm3, -112(%rbp)
	movaps	%xmm4, -96(%rbp)
	movaps	%xmm5, -80(%rbp)
	movaps	%xmm6, -64(%rbp)
	movaps	%xmm7, -48(%rbp)
.L22:
	movq	%fs:40, %rax
	movq	%rax, -216(%rbp)
	xorl	%eax, %eax
	leaq	23(%rsi), %rdx
	movq	%rsp, %rcx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L23:
	cmpq	%rcx, %rsp
	je	.L24
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L23
.L24:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L25
	orq	$0, -8(%rsp,%rax)
.L25:
	leaq	16(%rbp), %rax
	leaq	15(%rsp), %r12
	movq	%rdi, %rdx
	movl	$32, -240(%rbp)
	movq	%rax, -232(%rbp)
	andq	$-16, %r12
	leaq	-208(%rbp), %rax
	leaq	-240(%rbp), %rcx
	movl	$48, -236(%rbp)
	movq	%r12, %rdi
	movq	%rax, -224(%rbp)
	call	*%r10
	leaq	16(%rbx), %rdx
	cltq
	movq	%rdx, (%rbx)
	xorl	%edx, %edx
	movq	%rdx, 8(%rbx)
	leaq	(%r12,%rax), %r13
	movq	%rax, -248(%rbp)
	cmpq	$15, %rax
	jbe	.L26
	leaq	-248(%rbp), %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	-248(%rbp), %rax
	movq	%rax, 16(%rbx)
.L26:
	movq	(%rbx), %rdi
	movq	%r13, %rdx
	movq	%r12, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcS5_S5_@PLT
	movq	-248(%rbp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	-216(%rbp), %rax
	subq	%fs:40, %rax
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leaq	-24(%rbp), %rsp
	movq	%rbx, %rax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3972:
	.size	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z, .-_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
	.section	.rodata.str1.1
.LC1:
	.string	"CUDA malloc h_A: %s\n"
.LC2:
	.string	"CUDA malloc h_B: %s\n"
.LC3:
	.string	"CUDA malloc h_C: %s\n"
.LC4:
	.string	"Run kernel: %s\n"
.LC5:
	.string	"Copy h_C off device: %s\n"
.LC7:
	.string	"Elapsed time was: %f\n milliseconds"
.LC8:
	.string	"%f"
.LC10:
	.string	","
.LC11:
	.string	"\n"
.LC9:
	.string	"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"
	.text
	.globl	_Z10MatrixMultB5cxx116MatrixS_S_i
	.type	_Z10MatrixMultB5cxx116MatrixS_S_i, @function
_Z10MatrixMultB5cxx116MatrixS_S_i:
.LFB3769:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3769
	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
	movl	%esi, %r13d
	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	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%rdi, (%rsp)
	movl	656(%rsp), %r9d
	leaq	16(%rsp), %rdi
	movl	608(%rsp), %r15d
	movl	612(%rsp), %r12d
	movl	632(%rsp), %r14d
	movl	636(%rsp), %ebp
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	movl	660(%rsp), %ebx
	movl	%r9d, 12(%rsp)
.LEHB0:
	call	cudaEventCreate@PLT
	leaq	24(%rsp), %rdi
	call	cudaEventCreate@PLT
	movl	%r15d, 72(%rsp)
	leaq	64(%rsp), %rdi
	movl	%r15d, 56(%rsp)
	imull	%r12d, %r15d
	movl	%r12d, 60(%rsp)
	shrl	$4, %r12d
	movslq	%r15d, %r15
	salq	$2, %r15
	movq	%r15, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC1(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	616(%rsp), %rsi
	movq	64(%rsp), %rdi
	movq	%r15, %rdx
	movl	$1, %ecx
	call	cudaMemcpy@PLT
	movl	%ebp, 84(%rsp)
	imull	%r14d, %ebp
	leaq	88(%rsp), %rdi
	movl	%r14d, 96(%rsp)
	movl	%r14d, 80(%rsp)
	shrl	$4, %r14d
	movslq	%ebp, %rbp
	salq	$2, %rbp
	movq	%rbp, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	640(%rsp), %rsi
	movq	88(%rsp), %rdi
	movq	%rbp, %rdx
	movl	$1, %ecx
	leaq	176(%rsp), %rbp
	call	cudaMemcpy@PLT
	movl	12(%rsp), %r9d
	movl	%ebx, 108(%rsp)
	leaq	112(%rsp), %rdi
	imull	%r9d, %ebx
	movl	%r9d, 120(%rsp)
	movl	%r9d, 104(%rsp)
	movslq	%ebx, %rbx
	salq	$2, %rbx
	movq	%rbx, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC3(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rdi
	xorl	%esi, %esi
	movl	%r14d, 44(%rsp)
	movl	%r12d, 48(%rsp)
	movl	$1, 52(%rsp)
	call	cudaEventRecord@PLT
	movq	44(%rsp), %rdi
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	52(%rsp), %esi
	movl	$1, %ecx
	movabsq	$68719476752, %rdx
	movl	$1, 40(%rsp)
	movq	%rdx, 32(%rsp)
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L33
	movq	72(%rsp), %rax
	movups	56(%rsp), %xmm1
	movq	%rbp, %rdx
	leaq	152(%rsp), %rsi
	movups	80(%rsp), %xmm2
	movups	104(%rsp), %xmm3
	leaq	128(%rsp), %rdi
	movq	%rax, 144(%rsp)
	movq	96(%rsp), %rax
	movups	%xmm1, 128(%rsp)
	movq	%rax, 168(%rsp)
	movq	120(%rsp), %rax
	movups	%xmm2, 152(%rsp)
	movq	%rax, 192(%rsp)
	movups	%xmm3, 176(%rsp)
	call	_Z45__device_stub__Z16MultSharedKernel6MatrixS_S_R6MatrixS0_S0_
.L33:
	call	cudaThreadSynchronize@PLT
	movq	24(%rsp), %rdi
	xorl	%esi, %esi
	movl	%r13d, %r15d
	movl	%eax, %r12d
	shrl	$31, %r15d
	call	cudaEventRecord@PLT
	movl	%r12d, %edi
	leaq	264(%rsp), %r12
	call	cudaGetErrorString@PLT
	leaq	.LC4(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	112(%rsp), %rsi
	movl	$2, %ecx
	movq	%rbx, %rdx
	movq	664(%rsp), %rdi
	movl	%r13d, %ebx
	call	cudaMemcpy@PLT
	movl	%eax, %edi
	call	cudaGetErrorString@PLT
	leaq	.LC5(%rip), %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rdi
	call	cudaEventSynchronize@PLT
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	movq	%rbp, %rdi
	movl	$0x00000000, 176(%rsp)
	movl	$1, %ebp
	call	cudaEventElapsedTime@PLT
	leaq	.LC7(%rip), %rsi
	movl	$2, %edi
	movb	$1, %al
	cvtss2sd	176(%rsp), %xmm0
	call	__printf_chk@PLT
	movq	64(%rsp), %rdi
	call	cudaFree@PLT
	movq	88(%rsp), %rdi
	call	cudaFree@PLT
	movq	112(%rsp), %rdi
	call	cudaFree@PLT
	movb	$1, %al
	movl	$58, %edx
	movq	%r12, %rdi
	movq	vsnprintf@GOTPCREL(%rip), %rsi
	leaq	.LC8(%rip), %rcx
	cvtss2sd	176(%rsp), %xmm0
	call	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
.LEHE0:
	negl	%ebx
	movl	$10000, %ecx
	cmovs	%r13d, %ebx
	movl	%ebx, %eax
.L39:
	cmpl	$9, %eax
	jbe	.L35
	cmpl	$99, %eax
	ja	.L36
	incl	%ebp
	jmp	.L35
.L36:
	cmpl	$999, %eax
	ja	.L37
	addl	$2, %ebp
	jmp	.L35
.L37:
	cmpl	$9999, %eax
	ja	.L38
	addl	$3, %ebp
	jmp	.L35
.L38:
	movl	%eax, %eax
	xorl	%edx, %edx
	addl	$4, %ebp
	divq	%rcx
	jmp	.L39
.L35:
	leaq	200(%rsp), %r13
	leal	(%r15,%rbp), %esi
	movl	$45, %edx
	decl	%ebp
	leaq	216(%rsp), %rax
	movq	%r13, %rdi
	movq	%rax, 200(%rsp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructEmc@PLT
	movzbl	%r15b, %r8d
	movl	$201, %ecx
	leaq	335(%rsp), %rdi
	leaq	.LC9(%rip), %rsi
	addq	200(%rsp), %r8
	rep movsb
	movl	$100, %ecx
.L40:
	cmpl	$99, %ebx
	jbe	.L57
	movl	%ebx, %eax
	xorl	%edx, %edx
	movl	%ebp, %esi
	divl	%ecx
	addl	%edx, %edx
	movl	%eax, %ebx
	leal	1(%rdx), %eax
	movb	335(%rsp,%rdx), %dl
	movb	335(%rsp,%rax), %al
	movb	%al, (%r8,%rsi)
	leal	-1(%rbp), %eax
	subl	$2, %ebp
	movb	%dl, (%r8,%rax)
	jmp	.L40
.L57:
	leal	48(%rbx), %eax
	cmpl	$9, %ebx
	jbe	.L43
	addl	%ebx, %ebx
	leal	1(%rbx), %eax
	movb	335(%rsp,%rax), %al
	movb	%al, 1(%r8)
	movb	335(%rsp,%rbx), %al
.L43:
	movb	%al, (%r8)
	leaq	.LC10(%rip), %rsi
	movq	%r13, %rdi
.LEHB1:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc@PLT
.LEHE1:
	leaq	232(%rsp), %rbp
	movq	%rax, %rsi
	leaq	296(%rsp), %r15
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EOS4_@PLT
	movq	%rbp, %rdi
	movq	272(%rsp), %rbx
	addq	240(%rsp), %rbx
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv@PLT
	cmpq	%rbx, %rax
	jnb	.L44
	movq	%r12, %rdi
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv@PLT
	cmpq	%rbx, %rax
	jb	.L44
	movq	%rbp, %rdx
	xorl	%esi, %esi
	movq	%r12, %rdi
.LEHB2:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6insertEmRKS4_@PLT
	jmp	.L56
.L44:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendERKS4_@PLT
.LEHE2:
.L56:
	movq	%rax, %rsi
	movq	%r15, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EOS4_@PLT
	leaq	.LC11(%rip), %rsi
	movq	%r15, %rdi
.LEHB3:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc@PLT
.LEHE3:
	movq	(%rsp), %rdi
	movq	%rax, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EOS4_@PLT
	movq	%r15, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	je	.L50
	jmp	.L54
.L53:
	endbr64
	movq	%rax, %rbx
.L46:
	movq	%r15, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L47
.L52:
	endbr64
	movq	%rax, %rbx
.L47:
	movq	%rbp, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L48
.L51:
	endbr64
	movq	%rax, %rbx
.L48:
	movq	%r13, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L54
	movq	%rbx, %rdi
.LEHB4:
	call	_Unwind_Resume@PLT
.LEHE4:
.L54:
	call	__stack_chk_fail@PLT
.L50:
	movq	(%rsp), %rax
	addq	$552, %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
.LFE3769:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3769:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3769-.LLSDACSB3769
.LLSDACSB3769:
	.uleb128 .LEHB0-.LFB3769
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3769
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L51-.LFB3769
	.uleb128 0
	.uleb128 .LEHB2-.LFB3769
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L52-.LFB3769
	.uleb128 0
	.uleb128 .LEHB3-.LFB3769
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L53-.LFB3769
	.uleb128 0
	.uleb128 .LEHB4-.LFB3769
	.uleb128 .LEHE4-.LEHB4
	.uleb128 0
	.uleb128 0
.LLSDACSE3769:
	.text
	.size	_Z10MatrixMultB5cxx116MatrixS_S_i, .-_Z10MatrixMultB5cxx116MatrixS_S_i
	.section	.rodata.str1.1
.LC13:
	.string	"Array size: %i\n"
	.text
	.globl	_Z8arrayGenB5cxx11i
	.type	_Z8arrayGenB5cxx11i, @function
_Z8arrayGenB5cxx11i:
.LFB3770:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3770
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%esi, %edx
	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
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	.LC13(%rip), %rsi
	movl	%ebx, %ebp
	imull	%ebx, %ebp
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, (%rsp)
	movl	$2, %edi
	movslq	%ebp, %rbp
	salq	$2, %rbp
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
.LEHB5:
	call	__printf_chk@PLT
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rbp, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rbp, %rdi
	movslq	%ebx, %rbp
	movq	%r14, %r15
	movq	%rax, %r13
	salq	$2, %rbp
	call	malloc@PLT
	movq	%rax, 72(%rsp)
.L59:
	cmpl	%ebx, %r12d
	jge	.L74
	leaq	(%r15,%rbp), %rdi
.L60:
	movq	%rdi, 8(%rsp)
	addq	$4, %r15
	call	rand@PLT
	movl	$3, %ecx
	movq	8(%rsp), %rdi
	cltd
	idivl	%ecx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, -4(%r15)
	cmpq	%rdi, %r15
	jne	.L60
	incl	%r12d
	jmp	.L59
.L74:
	movq	%r13, %r15
	xorl	%r12d, %r12d
.L62:
	cmpl	%ebx, %r12d
	jge	.L75
	leaq	(%r15,%rbp), %rdi
.L63:
	movq	%rdi, 8(%rsp)
	addq	$4, %r15
	call	rand@PLT
	movl	$2, %ecx
	movq	8(%rsp), %rdi
	cltd
	idivl	%ecx
	cvtsi2ssl	%edx, %xmm0
	movss	%xmm0, -4(%r15)
	cmpq	%rdi, %r15
	jne	.L63
	incl	%r12d
	jmp	.L62
.L75:
	movl	%ebx, 16(%rsp)
	subq	$80, %rsp
	.cfi_def_cfa_offset 240
	movl	%ebx, %esi
	movl	%ebx, 100(%rsp)
	movq	%r14, 104(%rsp)
	movl	%ebx, 120(%rsp)
	movl	%ebx, 124(%rsp)
	movq	%r13, 128(%rsp)
	movl	%ebx, 144(%rsp)
	movl	%ebx, 148(%rsp)
	movq	160(%rsp), %rax
	movups	144(%rsp), %xmm1
	movups	120(%rsp), %xmm2
	movups	96(%rsp), %xmm3
	movq	80(%rsp), %rdi
	movq	%rax, 64(%rsp)
	movq	136(%rsp), %rax
	movups	%xmm1, 48(%rsp)
	movups	%xmm2, 24(%rsp)
	movq	%rax, 40(%rsp)
	movq	112(%rsp), %rax
	movups	%xmm3, (%rsp)
	movq	%rax, 16(%rsp)
	call	_Z10MatrixMultB5cxx116MatrixS_S_i
.LEHE5:
	addq	$80, %rsp
	.cfi_def_cfa_offset 160
	movl	$2, %edi
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rsi
.LEHB6:
	call	__printf_chk@PLT
.LEHE6:
	jmp	.L76
.L68:
	endbr64
	movq	%rax, %rbx
.L65:
	movq	(%rsp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L73
	movq	%rbx, %rdi
.LEHB7:
	call	_Unwind_Resume@PLT
.LEHE7:
.L76:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	je	.L67
.L73:
	call	__stack_chk_fail@PLT
.L67:
	movq	(%rsp), %rax
	addq	$104, %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
.LFE3770:
	.section	.gcc_except_table
.LLSDA3770:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3770-.LLSDACSB3770
.LLSDACSB3770:
	.uleb128 .LEHB5-.LFB3770
	.uleb128 .LEHE5-.LEHB5
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB6-.LFB3770
	.uleb128 .LEHE6-.LEHB6
	.uleb128 .L68-.LFB3770
	.uleb128 0
	.uleb128 .LEHB7-.LFB3770
	.uleb128 .LEHE7-.LEHB7
	.uleb128 0
	.uleb128 0
.LLSDACSE3770:
	.text
	.size	_Z8arrayGenB5cxx11i, .-_Z8arrayGenB5cxx11i
	.section	.rodata.str1.1
.LC14:
	.string	"times.csv"
.LC15:
	.string	"Array Size,Elapsed Time\n"
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3772:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3772
	endbr64
	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
	subq	$560, %rsp
	.cfi_def_cfa_offset 592
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rbp
	movq	%rbp, %rdi
.LEHB8:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev@PLT
.LEHE8:
	movl	$32, %edx
	leaq	.LC14(%rip), %rsi
	movq	%rbp, %rdi
.LEHB9:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode@PLT
	movl	$24, %edx
	leaq	.LC15(%rip), %rsi
	movq	%rbp, %rdi
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
	movl	$16, %ebx
	leaq	8(%rsp), %r12
.L79:
	movl	%ebx, %edi
	call	_Z12isPowerOfTwoi
	testb	%al, %al
	je	.L78
	movl	%ebx, %esi
	movq	%r12, %rdi
	call	_Z8arrayGenB5cxx11i
.LEHE9:
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
.LEHB10:
	call	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@PLT
.LEHE10:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
.L78:
	incl	%ebx
	cmpl	$8193, %ebx
	jne	.L79
	movq	%rbp, %rdi
.LEHB11:
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv@PLT
.LEHE11:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	je	.L83
	jmp	.L90
.L85:
	endbr64
	movq	%rax, %rbx
.L80:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L81
.L84:
	endbr64
	movq	%rax, %rbx
.L81:
	movq	%rbp, %rdi
	call	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev@PLT
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L90
	movq	%rbx, %rdi
.LEHB12:
	call	_Unwind_Resume@PLT
.LEHE12:
.L90:
	call	__stack_chk_fail@PLT
.L83:
	addq	$560, %rsp
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3772:
	.section	.gcc_except_table
.LLSDA3772:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3772-.LLSDACSB3772
.LLSDACSB3772:
	.uleb128 .LEHB8-.LFB3772
	.uleb128 .LEHE8-.LEHB8
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB9-.LFB3772
	.uleb128 .LEHE9-.LEHB9
	.uleb128 .L84-.LFB3772
	.uleb128 0
	.uleb128 .LEHB10-.LFB3772
	.uleb128 .LEHE10-.LEHB10
	.uleb128 .L85-.LFB3772
	.uleb128 0
	.uleb128 .LEHB11-.LFB3772
	.uleb128 .LEHE11-.LEHB11
	.uleb128 .L84-.LFB3772
	.uleb128 0
	.uleb128 .LEHB12-.LFB3772
	.uleb128 .LEHE12-.LEHB12
	.uleb128 0
	.uleb128 0
.LLSDACSE3772:
	.section	.text.startup
	.size	main, .-main
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

/*
 ============================================================================
 Name        : CWLab3.cu
 Author      : sm01800
 Version     :
 Copyright   : Your copyright notice
 Description : CUDA compute reciprocals
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#include <iostream>
#include <fstream>
#define BLOCK_SIZE 16

using namespace std;
// Matrices are stored in row-major order
typedef struct {
	int width;
	int height;
	float* elements;
	int stride;
} Matrix;

//BEGIN HEADER
// Get a matrix element
__device__ float GetElement(const Matrix A, int row, int col) {
	return A.elements[row * A.stride + col];
}
// Set a matrix element
__device__ void SetElement(Matrix A, int row, int col, float value) {
	A.elements[row * A.stride + col] = value;
}
// Get the BLOCK_SIZExBLOCK_SIZE sub-matrix Asub of A that is
// located col sub-matrices to the right and row sub-matrices down
// from the upper-left corner of A
// Note, we are not doing any copying here - just finding the address of the
// start of the sub-matrix we are interested in
__device__ Matrix GetSubMatrix(Matrix A, int row, int col) {
	Matrix Asub;
	Asub.width = BLOCK_SIZE;
	Asub.height = BLOCK_SIZE;
	Asub.stride = A.stride;
	Asub.elements = &A.elements[A.stride * BLOCK_SIZE * row + BLOCK_SIZE * col];
	return Asub;
}

//END HEADER

__global__ void MultKernShared(const Matrix A, const Matrix B, Matrix C);

// Now we have all the device functions we need to define the matrix multiplication
// Kernel. This is going to be called from the host by MatMul()
__global__ void MultSharedKernel(Matrix A, Matrix B, Matrix C) {
	// Identify the Block row and column
	int blockRow = blockIdx.y;
	int blockCol = blockIdx.x;
	// Each thread block computes one sub-matrix Csub of C
	Matrix Csub = GetSubMatrix(C, blockRow, blockCol);
	// Each thread computes one element of Csub
	// by accumulating results into Cvalue
	float Cvalue = 0;
	// Now find the row and column of the element within Csub
	// that this thread is going to calculate
	int row = threadIdx.y;
	int col = threadIdx.x;
	// Loop over all the sub-matrices of A and B that are
	// required to compute Csub
	for (int m = 0; m < (A.width / BLOCK_SIZE); ++m) {
		// Get sub-matrix Asub of A
		Matrix Asub = GetSubMatrix(A, blockRow, m);
		// Get sub-matrix Bsub of B
		Matrix Bsub = GetSubMatrix(B, m, blockCol);
		// Shared memory used to store Asub and Bsub respectively
		__shared__ float As[BLOCK_SIZE][BLOCK_SIZE];
		__shared__ float Bs[BLOCK_SIZE][BLOCK_SIZE];
		// Load Asub and Bsub from global memory into shared memory
		// Each thread loads one element of each sub-matrix
		As[row][col] = GetElement(Asub, row, col);
		Bs[row][col] = GetElement(Bsub, row, col);
		// Synchronise to make sure the sub-matrices are completely loaded
		// before starting the computation for each phase
		__syncthreads();
		// Now multiply Asub and Bsub together to complete phase m of the
		// calculation of this threads element of Csub
		for (int e = 0; e < BLOCK_SIZE; ++e)
			Cvalue += As[row][e] * Bs[e][col];
		// Synchronise again to make sure that the preceding calculation
		// has been completed by all threads in the block before loading two new
		// sub-matrices of A and B in the next iteration
		__syncthreads();
	}
	// Once all the phases are complete we can write Csub to device (global) memory
	// Each thread writes one element
	SetElement(Csub, row, col, Cvalue);
}

// Matrix multiplication - Host code
// Matrix dimensions are assumed to be multiples of BLOCK_SIZE
string MatrixMult(const Matrix h_A, const Matrix h_B, Matrix h_C,
		int arraySize) {
	hipEvent_t start, stop;
	hipEventCreate(&start);
	hipEventCreate(&stop);
	// Load A and B to device memory
	Matrix d_A;
	d_A.width = d_A.stride = h_A.width;
	d_A.height = h_A.height;
	size_t size = h_A.width * h_A.height * sizeof(float);
	hipError_t err = hipMalloc(&d_A.elements, size);
	printf("CUDA malloc h_A: %s\n", hipGetErrorString(err));
	hipMemcpy(d_A.elements, h_A.elements, size, hipMemcpyHostToDevice);
	Matrix d_B;
	d_B.width = d_B.stride = h_B.width;
	d_B.height = h_B.height;
	size = h_B.width * h_B.height * sizeof(float);
	err = hipMalloc(&d_B.elements, size);
	printf("CUDA malloc h_B: %s\n", hipGetErrorString(err));
	hipMemcpy(d_B.elements, h_B.elements, size, hipMemcpyHostToDevice);
	// Allocate C in device memory
	Matrix d_C;
	d_C.width = d_C.stride = h_C.width;
	d_C.height = h_C.height;
	size = h_C.width * h_C.height * sizeof(float);
	err = hipMalloc(&d_C.elements, size);
	printf("CUDA malloc h_C: %s\n", hipGetErrorString(err));
	// Invoke kernel
	dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE);
	dim3 dimGrid(h_B.width / dimBlock.x, h_A.height / dimBlock.y);

	hipEventRecord(start);
	MultSharedKernel<<<dimGrid, dimBlock>>>(d_A, d_B, d_C);
	err = hipDeviceSynchronize();
	hipEventRecord(stop);
	printf("Run kernel: %s\n", hipGetErrorString(err));
	// Read C from device memory
	err = hipMemcpy(h_C.elements, d_C.elements, size, hipMemcpyDeviceToHost);
	printf("Copy h_C off device: %s\n", hipGetErrorString(err));

	hipEventSynchronize(stop);
	float milliseconds = 0;
	hipEventElapsedTime(&milliseconds, start, stop);
	printf("Elapsed time was: %f\n milliseconds", milliseconds);

	// Free device memory
	hipFree(d_A.elements);
	hipFree(d_B.elements);
	hipFree(d_C.elements);
	string csv = to_string(arraySize) + "," + to_string(milliseconds) + "\n";
	return csv;
}

string arrayGen(int size) {
	printf("Array size: %i\n", size);
	Matrix A, B, C;
	// Read Dimensions of A and B
	A.height = size;
	A.width = size;
	B.height = A.width;
	B.width = size;

	//Allocate memory for arrays
	A.elements = (float*) malloc(A.width * A.height * sizeof(float));
	B.elements = (float*) malloc(B.width * B.height * sizeof(float));
	C.height = A.height;
	C.width = B.width;
	C.elements = (float*) malloc(C.width * C.height * sizeof(float));

	//FILL ARRAYS
	for (int i = 0; i < A.height; i++)
		for (int j = 0; j < A.width; j++)
			A.elements[i * A.width + j] = (float) (rand() % 3);
	for (int i = 0; i < B.height; i++)
		for (int j = 0; j < B.width; j++)
			B.elements[i * B.width + j] = (float) (rand() % 2);

	//CALL FUNCTION
	string csv = MatrixMult(A, B, C, size);
	printf("\n");
	return csv;
}

// Function to check if x is power of 2
bool isPowerOfTwo(int n) {
	return (n != 0 && (n & (n - 1)) == 0);
}

int main(int argc, char* argv[]) {
	//CALL FUNCTION
	std::ofstream myFile;
	myFile.open("times.csv", std::ofstream::trunc);
	myFile << "Array Size,Elapsed Time\n";

	for (int i = 16; i <= 8192; i++) {
		if (isPowerOfTwo(i)) {
			myFile << arrayGen(i);
		}
	}

	myFile.close();

	/*
	 for (int i = 0; i < A.height; i++) {
	 for (int j = 0; j < A.width; j++)
	 printf("%f ", A.elements[i * A.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 for (int i = 0; i < B.height; i++) {
	 for (int j = 0; j < B.width; j++)
	 printf("%f ", B.elements[i * B.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 for (int i = 0; i < C.height; i++) {
	 for (int j = 0; j < C.width; j++)
	 printf("%f ", C.elements[i * C.width + j]);
	 printf("\n");
	 }
	 printf("\n");
	 */
	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z31__device_stub__MultSharedKernel6MatrixS_S_ # -- Begin function _Z31__device_stub__MultSharedKernel6MatrixS_S_
	.type	_Z31__device_stub__MultSharedKernel6MatrixS_S_,@function
_Z31__device_stub__MultSharedKernel6MatrixS_S_: # @_Z31__device_stub__MultSharedKernel6MatrixS_S_
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$80, %rsp
	.cfi_def_cfa_offset 128
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	128(%rsp), %rax
	leaq	48(%rsp), %rbx
	movq	%rax, (%rbx)
	leaq	152(%rsp), %rax
	movq	%rax, 8(%rbx)
	leaq	176(%rsp), %rax
	movq	%rax, 16(%rbx)
	leaq	32(%rsp), %r14
	leaq	16(%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	$_Z16MultSharedKernel6MatrixS_S_, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$96, %rsp
	.cfi_adjust_cfa_offset -96
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z31__device_stub__MultSharedKernel6MatrixS_S_, .Lfunc_end0-_Z31__device_stub__MultSharedKernel6MatrixS_S_
	.cfi_endproc
                                        # -- End function
	.globl	_Z10MatrixMultB5cxx116MatrixS_S_i # -- Begin function _Z10MatrixMultB5cxx116MatrixS_S_i
	.type	_Z10MatrixMultB5cxx116MatrixS_S_i,@function
_Z10MatrixMultB5cxx116MatrixS_S_i:      # @_Z10MatrixMultB5cxx116MatrixS_S_i
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$296, %rsp                      # imm = 0x128
	.cfi_def_cfa_offset 352
	.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	%esi, %r14d
	movq	%rdi, 128(%rsp)                 # 8-byte Spill
	.cfi_escape 0x2e, 0x00
	leaq	56(%rsp), %rdi
	callq	hipEventCreate
	.cfi_escape 0x2e, 0x00
	leaq	8(%rsp), %rdi
	callq	hipEventCreate
	movl	352(%rsp), %eax
	movl	356(%rsp), %ebp
	leaq	264(%rsp), %r15
	movl	%eax, 8(%r15)
	movl	%eax, -8(%r15)
	movl	%ebp, -4(%r15)
	imull	%ebp, %eax
	movslq	%eax, %r12
	shlq	$2, %r12
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	hipMalloc
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
	.cfi_escape 0x2e, 0x00
	movl	$.L.str, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	(%r15), %rdi
	movq	360(%rsp), %rsi
	.cfi_escape 0x2e, 0x00
	movl	$1, %r15d
	movq	%r12, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	movl	376(%rsp), %r13d
	movl	380(%rsp), %eax
	leaq	240(%rsp), %r12
	movl	%r13d, 8(%r12)
	movl	%r13d, -8(%r12)
	movl	%eax, -4(%r12)
	imull	%r13d, %eax
	movslq	%eax, %rbx
	shlq	$2, %rbx
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	hipMalloc
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.1, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	(%r12), %rdi
	movq	384(%rsp), %rsi
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	leaq	400(%rsp), %rcx
	movl	(%rcx), %eax
	movl	4(%rcx), %ecx
	leaq	176(%rsp), %rdi
	movl	%eax, 8(%rdi)
	movl	%eax, -8(%rdi)
	movl	%ecx, -4(%rdi)
	imull	%eax, %ecx
	movslq	%ecx, %r12
	shlq	$2, %r12
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rsi
	callq	hipMalloc
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	shrl	$4, %r13d
	shrl	$4, %ebp
	shlq	$32, %rbp
	orq	%r13, %rbp
	leaq	56(%rsp), %rax
	movq	(%rax), %rdi
	.cfi_escape 0x2e, 0x00
	xorl	%esi, %esi
	callq	hipEventRecord
	.cfi_escape 0x2e, 0x00
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movq	%rbp, %rdi
	movl	$1, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB1_2
# %bb.1:
	movq	272(%rsp), %rax
	leaq	96(%rsp), %rcx
	movq	%rax, 16(%rcx)
	movups	256(%rsp), %xmm0
	movaps	%xmm0, (%rcx)
	movq	248(%rsp), %rax
	leaq	192(%rsp), %rdx
	movq	%rax, 16(%rdx)
	movups	232(%rsp), %xmm0
	movaps	%xmm0, (%rdx)
	movq	184(%rsp), %rax
	leaq	64(%rsp), %rsi
	movq	%rax, 16(%rsi)
	movups	168(%rsp), %xmm0
	movaps	%xmm0, (%rsi)
	leaq	16(%rsp), %rbx
	movq	%rcx, (%rbx)
	movq	%rdx, 8(%rbx)
	movq	%rsi, 16(%rbx)
	.cfi_escape 0x2e, 0x00
	leaq	152(%rsp), %r13
	leaq	280(%rsp), %rbp
	leaq	144(%rsp), %rdx
	leaq	136(%rsp), %rcx
	movq	%r13, %rdi
	movq	%rbp, %rsi
	callq	__hipPopCallConfiguration
	movq	(%r13), %rsi
	movl	8(%r13), %edx
	movq	(%rbp), %rcx
	movl	8(%rbp), %r8d
	.cfi_escape 0x2e, 0x10
	movl	$_Z16MultSharedKernel6MatrixS_S_, %edi
	movq	%rbx, %r9
	leaq	136(%rsp), %rax
	pushq	(%rax)
	.cfi_adjust_cfa_offset 8
	leaq	152(%rsp), %rax
	pushq	(%rax)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
.LBB1_2:
	.cfi_escape 0x2e, 0x00
	callq	hipDeviceSynchronize
	movl	%eax, %ebx
	movq	8(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	xorl	%esi, %esi
	callq	hipEventRecord
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.3, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	leaq	400(%rsp), %rax
	movq	8(%rax), %rdi
	movq	176(%rsp), %rsi
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdx
	movl	$2, %ecx
	callq	hipMemcpy
	.cfi_escape 0x2e, 0x00
	movl	%eax, %edi
	callq	hipGetErrorString
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.4, %edi
	movq	%rax, %rsi
	xorl	%eax, %eax
	callq	printf
	movq	8(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	hipEventSynchronize
	leaq	152(%rsp), %rbx
	movl	$0, (%rbx)
	movq	56(%rsp), %rsi
	movq	8(%rsp), %rdx
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	hipEventElapsedTime
	cvtss2sd	(%rbx), %xmm0
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.5, %edi
	movb	$1, %al
	callq	printf
	movq	264(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	hipFree
	movq	240(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	hipFree
	movq	176(%rsp), %rdi
	.cfi_escape 0x2e, 0x00
	callq	hipFree
	movl	%r14d, %ebp
	negl	%ebp
	cmovsl	%r14d, %ebp
	cmpl	$10, %ebp
	jb	.LBB1_11
# %bb.3:                                # %.lr.ph.i.i.preheader
	movl	$4, %r15d
	movl	$3518437209, %eax               # imm = 0xD1B71759
	movl	%ebp, %ecx
.LBB1_4:                                # %.lr.ph.i.i
                                        # =>This Inner Loop Header: Depth=1
	cmpl	$99, %ecx
	jbe	.LBB1_5
# %bb.6:                                #   in Loop: Header=BB1_4 Depth=1
	cmpl	$999, %ecx                      # imm = 0x3E7
	jbe	.LBB1_7
# %bb.8:                                #   in Loop: Header=BB1_4 Depth=1
	cmpl	$10000, %ecx                    # imm = 0x2710
	jb	.LBB1_11
# %bb.9:                                #   in Loop: Header=BB1_4 Depth=1
	movl	%ecx, %edx
	imulq	%rax, %rdx
	shrq	$45, %rdx
	addl	$4, %r15d
	cmpl	$99999, %ecx                    # imm = 0x1869F
	movl	%edx, %ecx
	ja	.LBB1_4
# %bb.10:                               # %_ZNSt8__detail14__to_chars_lenIjEEjT_i.exit.i.loopexit
	addl	$-3, %r15d
	jmp	.LBB1_11
.LBB1_5:
	addl	$-2, %r15d
	jmp	.LBB1_11
.LBB1_7:
	decl	%r15d
.LBB1_11:                               # %_ZNSt8__detail14__to_chars_lenIjEEjT_i.exit.i
	shrl	$31, %r14d
	leal	(%r15,%r14), %esi
	leaq	208(%rsp), %r12
	movq	%r12, -16(%r12)
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	leaq	192(%rsp), %rdi
	movl	$45, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructEmc
.Ltmp1:
# %bb.12:                               # %_ZNSt7__cxx119to_stringEi.exit
	movl	%r14d, %edi
	leaq	192(%rsp), %rbx
	addq	(%rbx), %rdi
	.cfi_escape 0x2e, 0x00
	movl	%r15d, %esi
	movl	%ebp, %edx
	callq	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
.Ltmp3:
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	movq	%rbx, %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc
.Ltmp4:
# %bb.13:                               # %.noexc
	movq	%rax, %r15
	leaq	80(%rsp), %r14
	movq	%r14, -16(%r14)
	movq	(%rax), %rsi
	movq	%rax, %rbx
	addq	$16, %rbx
	cmpq	%rbx, %rsi
	movq	128(%rsp), %rbp                 # 8-byte Reload
	je	.LBB1_14
# %bb.15:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
	movq	%rsi, 64(%rsp)
	movq	16(%r15), %rax
	movq	%rax, 80(%rsp)
	movq	8(%r15), %r13
	jmp	.LBB1_16
.LBB1_14:
	movq	8(%r15), %r13
	leaq	1(%r13), %rdx
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	memcpy@PLT
.LBB1_16:
	movq	%r13, 72(%rsp)
	movq	%rbx, (%r15)
	movq	$0, 8(%r15)
	movb	$0, 16(%r15)
	xorps	%xmm0, %xmm0
	cvtss2sd	152(%rsp), %xmm0
.Ltmp6:
	.cfi_escape 0x2e, 0x00
	leaq	96(%rsp), %rdi
	movl	$vsnprintf, %esi
	movl	$58, %edx
	movl	$.L.str.11, %ecx
	movb	$1, %al
	callq	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
.Ltmp7:
# %bb.17:                               # %_ZNSt7__cxx119to_stringEf.exit
	movq	64(%rsp), %rcx
	movq	72(%rsp), %r8
	movq	104(%rsp), %rdx
	leaq	(%rdx,%r8), %rax
	movl	$15, %edi
	cmpq	%r14, %rcx
	je	.LBB1_19
# %bb.18:                               # %_ZNSt7__cxx119to_stringEf.exit
	movq	80(%rsp), %rdi
.LBB1_19:                               # %_ZNSt7__cxx119to_stringEf.exit
	movq	96(%rsp), %rsi
	cmpq	%rdi, %rax
	jbe	.LBB1_26
# %bb.20:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv.exit12.i
	leaq	112(%rsp), %r9
	movl	$15, %edi
	cmpq	%r9, %rsi
	je	.LBB1_22
# %bb.21:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv.exit12.i
	movq	112(%rsp), %rdi
.LBB1_22:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv.exit12.i
	cmpq	%rdi, %rax
	jbe	.LBB1_23
.LBB1_26:
.Ltmp11:
	.cfi_escape 0x2e, 0x00
	leaq	64(%rsp), %rdi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm
.Ltmp12:
	jmp	.LBB1_24
.LBB1_23:                               # %.critedge.i
.Ltmp9:
	.cfi_escape 0x2e, 0x00
	leaq	96(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7replaceEmmPKcm
.Ltmp10:
.LBB1_24:                               # %.noexc29
	movq	%rax, %r15
	leaq	32(%rsp), %rdi
	movq	%rdi, -16(%rdi)
	movq	(%rax), %rsi
	leaq	16(%rax), %rbx
	cmpq	%rbx, %rsi
	je	.LBB1_25
# %bb.27:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i13.i
	movq	%rsi, 16(%rsp)
	movq	(%rbx), %rax
	movq	%rax, 32(%rsp)
	jmp	.LBB1_28
.LBB1_25:
	movq	8(%r15), %rdx
	incq	%rdx
	.cfi_escape 0x2e, 0x00
	callq	memcpy@PLT
.LBB1_28:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2EOS4_.exit14.i
	movq	%r15, %rax
	addq	$8, %rax
	movq	8(%r15), %rcx
	movq	%rcx, 24(%rsp)
	movq	%rbx, (%r15)
	movq	$0, (%rax)
	movb	$0, (%rbx)
.Ltmp14:
	.cfi_escape 0x2e, 0x00
	leaq	16(%rsp), %rdi
	movl	$.L.str.7, %esi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKc
.Ltmp15:
# %bb.29:                               # %.noexc35
	movq	%rax, %r15
	leaq	16(%rbp), %rdi
	movq	%rdi, (%rbp)
	movq	(%rax), %rsi
	movq	%rax, %rbx
	addq	$16, %rbx
	cmpq	%rbx, %rsi
	je	.LBB1_30
# %bb.31:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i31
	movq	%rsi, (%rbp)
	movq	16(%r15), %rax
	movq	%rax, 16(%rbp)
	movq	8(%r15), %r13
	jmp	.LBB1_32
.LBB1_30:
	movq	8(%r15), %r13
	leaq	1(%r13), %rdx
	.cfi_escape 0x2e, 0x00
	callq	memcpy@PLT
.LBB1_32:
	movq	%r13, 8(%rbp)
	movq	%rbx, (%r15)
	movq	$0, 8(%r15)
	movb	$0, 16(%r15)
	leaq	32(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_34
# %bb.33:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i37
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_34:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit
	leaq	112(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_36
# %bb.35:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i38
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_36:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit40
	movq	64(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB1_38
# %bb.37:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i41
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_38:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit43
	movq	192(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB1_40
# %bb.39:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i44
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_40:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit46
	movq	%rbp, %rax
	addq	$296, %rsp                      # imm = 0x128
	.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
.LBB1_44:
	.cfi_def_cfa_offset 352
.Ltmp16:
	movq	%rax, %rbx
	leaq	32(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_46
# %bb.45:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i47
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
	jmp	.LBB1_46
.LBB1_43:
.Ltmp13:
	movq	%rax, %rbx
.LBB1_46:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit49
	leaq	112(%rsp), %rax
	movq	-16(%rax), %rdi
	cmpq	%rax, %rdi
	je	.LBB1_48
# %bb.47:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i50
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
	jmp	.LBB1_48
.LBB1_42:
.Ltmp8:
	movq	%rax, %rbx
.LBB1_48:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit52
	movq	64(%rsp), %rdi
	cmpq	%r14, %rdi
	je	.LBB1_50
# %bb.49:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i53
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
	jmp	.LBB1_50
.LBB1_41:
.Ltmp5:
	movq	%rax, %rbx
.LBB1_50:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit55
	movq	192(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB1_52
# %bb.51:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i56
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB1_52:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit58
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.LBB1_53:
.Ltmp2:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	__clang_call_terminate
.Lfunc_end1:
	.size	_Z10MatrixMultB5cxx116MatrixS_S_i, .Lfunc_end1-_Z10MatrixMultB5cxx116MatrixS_S_i
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table1:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	3                               # @TType Encoding = udata4
	.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	1                               #   On action: 1
	.uleb128 .Ltmp3-.Lfunc_begin0           # >> Call Site 3 <<
	.uleb128 .Ltmp4-.Ltmp3                  #   Call between .Ltmp3 and .Ltmp4
	.uleb128 .Ltmp5-.Lfunc_begin0           #     jumps to .Ltmp5
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp4-.Lfunc_begin0           # >> Call Site 4 <<
	.uleb128 .Ltmp6-.Ltmp4                  #   Call between .Ltmp4 and .Ltmp6
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp6-.Lfunc_begin0           # >> Call Site 5 <<
	.uleb128 .Ltmp7-.Ltmp6                  #   Call between .Ltmp6 and .Ltmp7
	.uleb128 .Ltmp8-.Lfunc_begin0           #     jumps to .Ltmp8
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp10-.Ltmp11                #   Call between .Ltmp11 and .Ltmp10
	.uleb128 .Ltmp13-.Lfunc_begin0          #     jumps to .Ltmp13
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp10-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp14-.Ltmp10                #   Call between .Ltmp10 and .Ltmp14
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp14-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp15-.Ltmp14                #   Call between .Ltmp14 and .Ltmp15
	.uleb128 .Ltmp16-.Lfunc_begin0          #     jumps to .Ltmp16
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp15-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Lfunc_end1-.Ltmp15            #   Call between .Ltmp15 and .Lfunc_end1
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.byte	1                               # >> Action Record 1 <<
                                        #   Catch TypeInfo 1
	.byte	0                               #   No further actions
	.p2align	2, 0x0
                                        # >> Catch TypeInfos <<
	.long	0                               # TypeInfo 1
.Lttbase0:
	.p2align	2, 0x0
                                        # -- End function
	.text
	.globl	_Z8arrayGenB5cxx11i             # -- Begin function _Z8arrayGenB5cxx11i
	.type	_Z8arrayGenB5cxx11i,@function
_Z8arrayGenB5cxx11i:                    # @_Z8arrayGenB5cxx11i
	.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	$184, %rsp
	.cfi_def_cfa_offset 240
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movl	%esi, %ebp
	movq	%rdi, 104(%rsp)                 # 8-byte Spill
	xorl	%ebx, %ebx
	movl	$.L.str.8, %edi
	xorl	%eax, %eax
	callq	printf
	movl	%ebp, %r12d
	imull	%r12d, %r12d
	shlq	$2, %r12
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 88(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 80(%rsp)                  # 8-byte Spill
	movq	%r12, %rdi
	callq	malloc
	movq	%rax, 96(%rsp)                  # 8-byte Spill
	testl	%ebp, %ebp
	jle	.LBB2_10
# %bb.1:                                # %.preheader35.lr.ph
	movl	%ebp, %r13d
	xorl	%r12d, %r12d
.LBB2_2:                                # %.lr.ph
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_3 Depth 2
	movl	%ebx, %eax
	movq	88(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r15
	xorl	%r14d, %r14d
.LBB2_3:                                #   Parent Loop BB2_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	cltq
	imulq	$1431655766, %rax, %rcx         # imm = 0x55555556
	movq	%rcx, %rdx
	shrq	$63, %rdx
	shrq	$32, %rcx
	addl	%edx, %ecx
	leal	(%rcx,%rcx,2), %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r15,%r14,4)
	incq	%r14
	cmpq	%r14, %r13
	jne	.LBB2_3
# %bb.4:                                # %._crit_edge
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r12
	addl	%ebp, %ebx
	cmpq	%r13, %r12
	jne	.LBB2_2
# %bb.5:                                # %.preheader34
	testl	%ebp, %ebp
	jle	.LBB2_10
# %bb.6:                                # %.preheader.lr.ph
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
.LBB2_7:                                # %.lr.ph39
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_8 Depth 2
	movl	%ebx, %eax
	movq	80(%rsp), %rcx                  # 8-byte Reload
	leaq	(%rcx,%rax,4), %r14
	xorl	%r15d, %r15d
.LBB2_8:                                #   Parent Loop BB2_7 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	andl	$-2, %ecx
	subl	%ecx, %eax
	xorps	%xmm0, %xmm0
	cvtsi2ss	%eax, %xmm0
	movss	%xmm0, (%r14,%r15,4)
	incq	%r15
	cmpq	%r15, %r13
	jne	.LBB2_8
# %bb.9:                                # %._crit_edge40
                                        #   in Loop: Header=BB2_7 Depth=1
	incq	%r12
	addl	%ebp, %ebx
	cmpq	%r13, %r12
	jne	.LBB2_7
.LBB2_10:                               # %._crit_edge42
	movl	%ebp, 160(%rsp)
	movl	%ebp, 164(%rsp)
	movq	88(%rsp), %rax                  # 8-byte Reload
	movq	%rax, 168(%rsp)
	movl	%ebp, 136(%rsp)
	movl	%ebp, 140(%rsp)
	movq	80(%rsp), %rax                  # 8-byte Reload
	movq	%rax, 144(%rsp)
	movl	%ebp, 112(%rsp)
	movl	%ebp, 116(%rsp)
	movq	96(%rsp), %rax                  # 8-byte Reload
	movq	%rax, 120(%rsp)
	movq	128(%rsp), %rax
	movq	%rax, 64(%rsp)
	movups	112(%rsp), %xmm0
	movups	%xmm0, 48(%rsp)
	movq	152(%rsp), %rax
	movq	%rax, 40(%rsp)
	movups	136(%rsp), %xmm0
	movups	%xmm0, 24(%rsp)
	movq	176(%rsp), %rax
	movq	%rax, 16(%rsp)
	movups	160(%rsp), %xmm0
	movups	%xmm0, (%rsp)
	movq	104(%rsp), %rbx                 # 8-byte Reload
	movq	%rbx, %rdi
	movl	%ebp, %esi
	callq	_Z10MatrixMultB5cxx116MatrixS_S_i
	movl	$10, %edi
	callq	putchar@PLT
	movq	%rbx, %rax
	addq	$184, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end2:
	.size	_Z8arrayGenB5cxx11i, .Lfunc_end2-_Z8arrayGenB5cxx11i
	.cfi_endproc
                                        # -- End function
	.globl	_Z12isPowerOfTwoi               # -- Begin function _Z12isPowerOfTwoi
	.type	_Z12isPowerOfTwoi,@function
_Z12isPowerOfTwoi:                      # @_Z12isPowerOfTwoi
	.cfi_startproc
# %bb.0:
                                        # kill: def $edi killed $edi def $rdi
	testl	%edi, %edi
	je	.LBB3_1
# %bb.2:
	leal	-1(%rdi), %eax
	testl	%eax, %edi
	sete	%al
                                        # kill: def $al killed $al killed $eax
	retq
.LBB3_1:
	xorl	%eax, %eax
                                        # kill: def $al killed $al killed $eax
	retq
.Lfunc_end3:
	.size	_Z12isPowerOfTwoi, .Lfunc_end3-_Z12isPowerOfTwoi
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin1:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception1
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	subq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 592
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rbx
	movq	%rbx, %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1Ev
.Ltmp17:
	movl	$.L.str.9, %esi
	movq	%rbx, %rdi
	movl	$32, %edx
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode
.Ltmp18:
# %bb.1:
.Ltmp19:
	leaq	40(%rsp), %rdi
	movl	$.L.str.10, %esi
	movl	$24, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp20:
# %bb.2:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit.preheader
	movl	$16, %ebx
	leaq	24(%rsp), %r12
	leaq	8(%rsp), %r14
	leaq	40(%rsp), %r15
.LBB4_3:                                # =>This Inner Loop Header: Depth=1
	leal	-1(%rbx), %eax
	testl	%eax, %ebx
	jne	.LBB4_8
# %bb.4:                                #   in Loop: Header=BB4_3 Depth=1
.Ltmp21:
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_Z8arrayGenB5cxx11i
.Ltmp22:
# %bb.5:                                #   in Loop: Header=BB4_3 Depth=1
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdx
.Ltmp24:
	movq	%r15, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp25:
# %bb.6:                                # %_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE.exit
                                        #   in Loop: Header=BB4_3 Depth=1
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB4_8
# %bb.7:                                # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
                                        #   in Loop: Header=BB4_3 Depth=1
	callq	_ZdlPv
.LBB4_8:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB4_3 Depth=1
	incl	%ebx
	cmpl	$8193, %ebx                     # imm = 0x2001
	jne	.LBB4_3
# %bb.9:
.Ltmp27:
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEE5closeEv
.Ltmp28:
# %bb.10:
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE(%rip), %rax
	leaq	48(%rsp), %rdi
	movq	%rax, -8(%rdi)
	movq	_ZTTSt14basic_ofstreamIcSt11char_traitsIcEE+24(%rip), %rcx
	movq	-24(%rax), %rax
	movq	%rcx, 40(%rsp,%rax)
	callq	_ZNSt13basic_filebufIcSt11char_traitsIcEED2Ev
	leaq	288(%rsp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	xorl	%eax, %eax
	addq	$552, %rsp                      # imm = 0x228
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.LBB4_14:
	.cfi_def_cfa_offset 592
.Ltmp29:
	jmp	.LBB4_15
.LBB4_11:
.Ltmp23:
.LBB4_15:
	movq	%rax, %rbx
	jmp	.LBB4_16
.LBB4_12:
.Ltmp26:
	movq	%rax, %rbx
	movq	8(%rsp), %rdi
	cmpq	%r12, %rdi
	je	.LBB4_16
# %bb.13:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i11
	callq	_ZdlPv
.LBB4_16:
	leaq	40(%rsp), %rdi
	callq	_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
	.section	.gcc_except_table,"a",@progbits
	.p2align	2, 0x0
GCC_except_table4:
.Lexception1:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end1-.Lcst_begin1
.Lcst_begin1:
	.uleb128 .Lfunc_begin1-.Lfunc_begin1    # >> Call Site 1 <<
	.uleb128 .Ltmp17-.Lfunc_begin1          #   Call between .Lfunc_begin1 and .Ltmp17
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp17-.Lfunc_begin1          # >> Call Site 2 <<
	.uleb128 .Ltmp20-.Ltmp17                #   Call between .Ltmp17 and .Ltmp20
	.uleb128 .Ltmp29-.Lfunc_begin1          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp21-.Lfunc_begin1          # >> Call Site 3 <<
	.uleb128 .Ltmp22-.Ltmp21                #   Call between .Ltmp21 and .Ltmp22
	.uleb128 .Ltmp23-.Lfunc_begin1          #     jumps to .Ltmp23
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp24-.Lfunc_begin1          # >> Call Site 4 <<
	.uleb128 .Ltmp25-.Ltmp24                #   Call between .Ltmp24 and .Ltmp25
	.uleb128 .Ltmp26-.Lfunc_begin1          #     jumps to .Ltmp26
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp27-.Lfunc_begin1          # >> Call Site 5 <<
	.uleb128 .Ltmp28-.Ltmp27                #   Call between .Ltmp27 and .Ltmp28
	.uleb128 .Ltmp29-.Lfunc_begin1          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp28-.Lfunc_begin1          # >> Call Site 6 <<
	.uleb128 .Lfunc_end4-.Ltmp28            #   Call between .Ltmp28 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end1:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text.__clang_call_terminate,"axG",@progbits,__clang_call_terminate,comdat
	.hidden	__clang_call_terminate          # -- Begin function __clang_call_terminate
	.weak	__clang_call_terminate
	.type	__clang_call_terminate,@function
__clang_call_terminate:                 # @__clang_call_terminate
	.cfi_startproc
# %bb.0:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__cxa_begin_catch
	callq	_ZSt9terminatev
.Lfunc_end5:
	.size	__clang_call_terminate, .Lfunc_end5-__clang_call_terminate
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,"axG",@progbits,_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,comdat
	.weak	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_ # -- Begin function _ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.type	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_,@function
_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_: # @_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.cfi_startproc
# %bb.0:
                                        # kill: def $esi killed $esi def $rsi
	cmpl	$100, %edx
	jb	.LBB6_1
# %bb.2:                                # %.lr.ph.preheader
	decl	%esi
.LBB6_3:                                # %.lr.ph
                                        # =>This Inner Loop Header: Depth=1
	movl	%edx, %eax
	imulq	$1374389535, %rax, %rax         # imm = 0x51EB851F
	shrq	$37, %rax
	imull	$100, %eax, %ecx
	movl	%edx, %r8d
	subl	%ecx, %r8d
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits+1(%r8,%r8), %cl
	movl	%esi, %r9d
	movb	%cl, (%rdi,%r9)
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits(%r8,%r8), %cl
	leal	-1(%rsi), %r8d
	movb	%cl, (%rdi,%r8)
	addl	$-2, %esi
	cmpl	$9999, %edx                     # imm = 0x270F
	movl	%eax, %edx
	ja	.LBB6_3
	jmp	.LBB6_4
.LBB6_1:
	movl	%edx, %eax
.LBB6_4:                                # %._crit_edge
	cmpl	$10, %eax
	jb	.LBB6_6
# %bb.5:
	movl	%eax, %eax
	leaq	(%rax,%rax), %rcx
	movl	%ecx, %ecx
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits+1(%rcx), %cl
	movb	%cl, 1(%rdi)
	movb	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits(%rax,%rax), %al
	jmp	.LBB6_7
.LBB6_6:
	orb	$48, %al
.LBB6_7:
	movb	%al, (%rdi)
	retq
.Lfunc_end6:
	.size	_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_, .Lfunc_end6-_ZNSt8__detail18__to_chars_10_implIjEEvPcjT_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z,"axG",@progbits,_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z,comdat
	.weak	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z # -- Begin function _ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
	.type	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z,@function
_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z: # @_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
	.cfi_startproc
# %bb.0:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IPcvEET_S7_RKS3_.exit
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$208, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %r10
	movq	%rdi, %rbx
	leaq	-224(%rbp), %rsi
	movq	%r8, 32(%rsi)
	movq	%r9, 40(%rsi)
	testb	%al, %al
	je	.LBB7_2
# %bb.1:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IPcvEET_S7_RKS3_.exit
	movaps	%xmm0, -176(%rbp)
	movaps	%xmm1, -160(%rbp)
	movaps	%xmm2, -144(%rbp)
	movaps	%xmm3, -128(%rbp)
	movaps	%xmm4, -112(%rbp)
	movaps	%xmm5, -96(%rbp)
	movaps	%xmm6, -80(%rbp)
	movaps	%xmm7, -64(%rbp)
.LBB7_2:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IPcvEET_S7_RKS3_.exit
	movq	%rsp, %r14
	leaq	15(%rdx), %rax
	andq	$-16, %rax
	subq	%rax, %r14
	movq	%r14, %rsp
	leaq	-48(%rbp), %rax
	movq	%rsi, 16(%rax)
	leaq	16(%rbp), %rsi
	movq	%rsi, 8(%rax)
	movabsq	$206158430240, %rsi             # imm = 0x3000000020
	movq	%rsi, (%rax)
	movq	%r14, %rdi
	movq	%rdx, %rsi
	movq	%rcx, %rdx
	movq	%rax, %rcx
	callq	*%r10
	movslq	%eax, %rdx
	addq	%r14, %rdx
	leaq	16(%rbx), %rax
	movq	%rax, (%rbx)
	movq	$0, 8(%rbx)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	movq	%rbx, %rax
	leaq	-16(%rbp), %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.Lfunc_end7:
	.size	_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z, .Lfunc_end7-_ZN9__gnu_cxx12__to_xstringINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEcEET_PFiPT0_mPKS8_P13__va_list_tagEmSB_z
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB8_1
# %bb.2:
	movq	%rsp, %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm
	movq	%rax, (%rbx)
	movq	(%r12), %rcx
	movq	%rcx, 16(%rbx)
	jmp	.LBB8_3
.LBB8_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB8_3:
	testq	%r14, %r14
	je	.LBB8_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB8_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB8_7
.LBB8_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB8_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end8:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag, .Lfunc_end8-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag
	.cfi_endproc
                                        # -- End function
	.text
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB9_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB9_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z16MultSharedKernel6MatrixS_S_, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end9:
	.size	__hip_module_ctor, .Lfunc_end9-__hip_module_ctor
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_dtor
	.type	__hip_module_dtor,@function
__hip_module_dtor:                      # @__hip_module_dtor
	.cfi_startproc
# %bb.0:
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	je	.LBB10_2
# %bb.1:
	pushq	%rax
	.cfi_def_cfa_offset 16
	callq	__hipUnregisterFatBinary
	movq	$0, __hip_gpubin_handle(%rip)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
.LBB10_2:
	retq
.Lfunc_end10:
	.size	__hip_module_dtor, .Lfunc_end10-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z16MultSharedKernel6MatrixS_S_,@object # @_Z16MultSharedKernel6MatrixS_S_
	.section	.rodata,"a",@progbits
	.globl	_Z16MultSharedKernel6MatrixS_S_
	.p2align	3, 0x0
_Z16MultSharedKernel6MatrixS_S_:
	.quad	_Z31__device_stub__MultSharedKernel6MatrixS_S_
	.size	_Z16MultSharedKernel6MatrixS_S_, 8

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"CUDA malloc h_A: %s\n"
	.size	.L.str, 21

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"CUDA malloc h_B: %s\n"
	.size	.L.str.1, 21

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"CUDA malloc h_C: %s\n"
	.size	.L.str.2, 21

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.asciz	"Run kernel: %s\n"
	.size	.L.str.3, 16

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"Copy h_C off device: %s\n"
	.size	.L.str.4, 25

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Elapsed time was: %f\n milliseconds"
	.size	.L.str.5, 35

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"\n"
	.size	.L.str.7, 2

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Array size: %i\n"
	.size	.L.str.8, 16

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"times.csv"
	.size	.L.str.9, 10

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Array Size,Elapsed Time\n"
	.size	.L.str.10, 25

	.type	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits,@object # @__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits
	.section	.rodata.str1.16,"aMS",@progbits,1
	.p2align	4, 0x0
.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits:
	.asciz	"00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"
	.size	.L__const._ZNSt8__detail18__to_chars_10_implIjEEvPcjT_.__digits, 201

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

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z16MultSharedKernel6MatrixS_S_"
	.size	.L__unnamed_1, 32

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

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

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

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z16MultSharedKernel6MatrixS_S_ ; -- Begin function _Z16MultSharedKernel6MatrixS_S_
	.globl	_Z16MultSharedKernel6MatrixS_S_
	.p2align	8
	.type	_Z16MultSharedKernel6MatrixS_S_,@function
_Z16MultSharedKernel6MatrixS_S_:        ; @_Z16MultSharedKernel6MatrixS_S_
; %bb.0:
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x0
	s_load_b64 s[2:3], s[0:1], 0x38
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	v_mov_b32_e32 v2, 0
	s_waitcnt lgkmcnt(0)
	s_cmp_lt_i32 s5, 16
	s_cbranch_scc1 .LBB0_5
; %bb.1:                                ; %.lr.ph
	s_clause 0x3
	s_load_b32 s10, s[0:1], 0x10
	s_load_b32 s4, s[0:1], 0x28
	s_load_b64 s[6:7], s[0:1], 0x8
	s_load_b64 s[8:9], s[0:1], 0x20
	v_lshlrev_b32_e32 v2, 2, v0
	v_lshlrev_b32_e32 v3, 6, v1
	s_ashr_i32 s11, s5, 31
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	s_lshr_b32 s11, s11, 28
	v_add_nc_u32_e32 v4, 0x400, v2
	s_add_i32 s5, s5, s11
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_3) | instid1(VALU_DEP_2)
	s_ashr_i32 s5, s5, 4
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[5:6], null, s10, v1, v[0:1]
	v_mad_u64_u32 v[7:8], null, s4, v1, v[0:1]
	v_ashrrev_i32_e32 v6, 31, v5
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_ashrrev_i32_e32 v8, 31, v7
	v_lshlrev_b64 v[9:10], 2, v[5:6]
	v_dual_mov_b32 v2, 0 :: v_dual_add_nc_u32 v5, v3, v2
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_1) | instid1(VALU_DEP_4)
	v_lshlrev_b64 v[11:12], 2, v[7:8]
	v_add_nc_u32_e32 v6, v4, v3
	v_add_co_u32 v7, vcc_lo, s6, v9
	v_add_co_ci_u32_e32 v8, vcc_lo, s7, v10, vcc_lo
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_u32 v9, vcc_lo, s8, v11
	v_add_co_ci_u32_e32 v10, vcc_lo, s9, v12, vcc_lo
	s_mul_i32 s6, s10, s15
	s_mov_b32 s7, 0
.LBB0_2:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s8, s7, s4
	s_add_i32 s9, s7, s6
	s_add_i32 s10, s8, s14
	s_lshl_b32 s8, s9, 4
	s_lshl_b32 s10, s10, 4
	s_ashr_i32 s9, s8, 31
	s_ashr_i32 s11, s10, 31
	s_lshl_b64 s[8:9], s[8:9], 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_add_co_u32 v11, vcc_lo, v7, s8
	v_add_co_ci_u32_e32 v12, vcc_lo, s9, v8, vcc_lo
	s_lshl_b64 s[8:9], s[10:11], 2
	v_add_co_u32 v13, vcc_lo, v9, s8
	v_add_co_ci_u32_e32 v14, vcc_lo, s9, v10, vcc_lo
	global_load_b32 v12, v[11:12], off
	global_load_b32 v13, v[13:14], off
	v_mov_b32_e32 v11, v4
	s_mov_b32 s8, 0
	s_waitcnt vmcnt(1)
	ds_store_b32 v5, v12
	s_waitcnt vmcnt(0)
	ds_store_b32 v6, v13
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB0_3:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v12, s8, v3
	s_add_i32 s8, s8, 4
	ds_load_b32 v13, v11
	ds_load_b32 v12, v12
	v_add_nc_u32_e32 v11, 64, v11
	s_cmp_eq_u32 s8, 64
	s_waitcnt lgkmcnt(0)
	v_fmac_f32_e32 v2, v12, v13
	s_cbranch_scc0 .LBB0_3
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	s_add_i32 s7, s7, 1
	s_delay_alu instid0(SALU_CYCLE_1)
	s_cmp_eq_u32 s7, s5
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB0_2
.LBB0_5:                                ; %Flow101
	s_load_b32 s0, s[0:1], 0x40
	s_waitcnt lgkmcnt(0)
	v_mad_u64_u32 v[3:4], null, s0, v1, v[0:1]
	s_mul_i32 s0, s0, s15
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s0, s0, s14
	s_lshl_b32 s0, s0, 4
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_ashr_i32 s1, s0, 31
	v_ashrrev_i32_e32 v4, 31, v3
	s_lshl_b64 s[0:1], s[0:1], 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	s_add_u32 s0, s2, s0
	s_addc_u32 s1, s3, s1
	v_lshlrev_b64 v[0:1], 2, v[3:4]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v0, vcc_lo, s0, v0
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v2, off
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z16MultSharedKernel6MatrixS_S_
		.amdhsa_group_segment_fixed_size 2048
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 72
		.amdhsa_user_sgpr_count 14
		.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 1
		.amdhsa_system_sgpr_workgroup_id_z 0
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 1
		.amdhsa_next_free_vgpr 15
		.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	_Z16MultSharedKernel6MatrixS_S_, .Lfunc_end0-_Z16MultSharedKernel6MatrixS_S_
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 540
; NumSgprs: 18
; NumVgprs: 15
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 2048 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 15
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 14
; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 1
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

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

	.end_amdgpu_metadata
