#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#include "cuda_runtime_api.h"

#define SIZE_OF_MATRIX 1000
#define SIZE_OF_BLOCK 16 
#define M SIZE_OF_MATRIX
unsigned int m = SIZE_OF_MATRIX;

#define idx(i,j,lda) ((j) + ((i)*(lda)))

__global__ void multiply_matrices(float *d_a, float *d_b, float *d_c, int lda)
{
	unsigned int row = threadIdx.y + blockDim.y * blockIdx.y;
	unsigned int col = threadIdx.x + blockDim.x * blockIdx.x;
	unsigned int id  = idx(row,col,lda);

	float ctemp = 0.0;

	if (row < M && col < M)
	{
		for (unsigned int j=0; j<M; j++)
		{
			ctemp = ctemp + d_a[idx(row,j,lda)] * d_b[idx(j,col,lda)];
		}
		d_c[id] = ctemp;
	}
}

__global__ void multiply_matrices_shared_blocks(float *d_a, float *d_b, float *d_c,
int lda)
{

	int bs = SIZE_OF_BLOCK;
	unsigned int row = threadIdx.y + blockDim.y * blockIdx.y;
	unsigned int col = threadIdx.x + blockDim.x * blockIdx.x;
	unsigned int id  = idx(row,col,lda);
	
	//submatrices
	float *sub_a, *sub_b;

	//shared submatrices	
	__shared__ float a[SIZE_OF_BLOCK][SIZE_OF_BLOCK], b[SIZE_OF_BLOCK][SIZE_OF_BLOCK];
	//temp element of d_c
	float c = 0;
	
	//top-level row,col of block
	int block_row = blockIdx.y * bs;
	int block_col = blockIdx.x * bs;

	//id inside each block
	int sub_row = threadIdx.y;
	int sub_col = threadIdx.x;
	
	//for each block	
	for (int k = 0; k < (M / bs); k++)
	{

	  sub_a = &d_a[idx(block_row, bs*k, lda)];
		sub_b = &d_b[idx(bs*k, block_col, lda)];
		a[sub_row][sub_col] = sub_a[idx(sub_row, sub_col, lda)];
		b[sub_row][sub_col] = sub_b[idx(sub_row, sub_col, lda)];
		
		//wait for all threads to complete copy to shared memory.	
		__syncthreads();

		//multiply each submatrix
		for (int j=0; j < bs; j++)
		{
			c = c + a[sub_row][j] * b[j][sub_col];
		}
	
		// move results to device memory.
		d_c[id] = c;
	
		// wait for multiplication to finish before moving onto the next submatrix.
		__syncthreads();
		
	}
}

void multiply_by_element(dim3 grid, dim3 threads, float *d_a, float *d_b, float *d_c, int m, cudaStream_t cStream)
{

	cudaError err;
	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);
	float* c = (float*)malloc(matsize);
	
	multiply_matrices<<< grid, threads, 0, cStream >>>(d_a, d_b, d_c, m);
	err = cudaGetLastError();
	if (err != cudaSuccess)
	{
		cout << "error in kernel, " << cudaGetErrorString(err) << endl;
	}
	
	cudaStreamSynchronize(cStream);
	err = cudaMemcpyAsync(c, d_c, matsize, cudaMemcpyDeviceToHost, cStream);
	if (err != cudaSuccess)
	{
		cout << "error in memcpy, #=" << cudaGetErrorString(err) << endl;
	}


}

void multiply_by_block(dim3 grid, dim3 threads, float *d_a, float *d_b, float *d_c, int m, cudaStream_t cStream)
{
	cudaError err;
	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);
	float* c = (float*)malloc(matsize);

	multiply_matrices_shared_blocks<<< grid, threads, 0, cStream >>>(d_a, d_b, d_c, m);

	err = cudaGetLastError();
	if (err != cudaSuccess)
	{
		cout << "error in kernel, " << cudaGetErrorString(err) << endl;
	}

	cudaStreamSynchronize(cStream);
	err = cudaMemcpyAsync(c, d_c, matsize, cudaMemcpyDeviceToHost, cStream);
	if (err != cudaSuccess)
	{
		cout << "error in memcpy, #=" << cudaGetErrorString(err) << endl;
	}
}

#define STREAM_INDEX(_d,_i) ((_d*number_of_iterations) + _i)

int main(int argc, char** argv)
{
	
	unsigned int number_of_threads = min(SIZE_OF_MATRIX, SIZE_OF_BLOCK);
	unsigned int number_of_blocks;
	if (SIZE_OF_MATRIX > SIZE_OF_BLOCK)
		number_of_blocks = ceil(SIZE_OF_MATRIX / ((float) SIZE_OF_BLOCK));
	else
		 number_of_blocks = 1;

	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);

	//cout << "blocks: " << number_of_blocks << " threads: " <<
	//number_of_threads << endl;

	//cout.flush();

	float* a = (float*)malloc(matsize);
	float* b = (float*)malloc(matsize);
	float* c = (float*)malloc(matsize);

	//initalize matrices
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			//a[i*m+j] = i;
			//b[i*m+j] = i;
			a[i*m+j] = i-j*2 + i-j+1 + 1;
			b[i*m+j] = i-j*2 + i-j+1 + 1;
			c[i*m+j] = 0;
			//cout << a[i*m+j] << ", ";
		}
		//cout << endl;
	}
	cudaError_t err;

	int count = 0;

	err = cudaGetDeviceCount(&count);

	cout << count << " devices found." << endl;

	string device_list("");
	int number_of_iterations = 1;
	
	int opt = getopt(argc, argv, "d:i:");
	while(opt != -1) {
		stringstream str;
		switch(opt) {
			case 'd':
				device_list = string(optarg);
				break;
			case 'i':
				str << optarg;
				str >> number_of_iterations;
                cout << "Doing " << number_of_iterations << " iterations." << std::endl;
				break;
			case '?':
				if (optopt == 'd')
					cerr << "Error, option -d requires argument: comma delimted list of devices to run on." << endl;
				else if (optopt == 'i')
					cerr << "Error, option -i requires argument: number of iterations to run." << endl;
				else
					cerr << "Error, unknow option. Usage:\nmatmult [-d <device id>,...] [-i <number of iterations]" << endl;
				return 1;
			default:
				break;
		}
	  opt = getopt(argc, argv, "d:i:");
	}
	int devices[count];
	int nDevices = 0;
	//default: use all the devices
	if (device_list.compare("") == 0)
	{
		for (int d=0;d<count;d++)
		{
			devices[d] = d;
		}
		nDevices = count;
	}
	else
	{
		for (int d=0;d<count;d++)
		{
			stringstream str;
			str << d;
			char c = 0;
			if (str >> c) {
				if (device_list.find(c) != string::npos) {
					devices[nDevices++] = d;
				}
			}
		}
	}
	//cout << "finnished mapping devices." << endl;
	float *d_a[nDevices], *d_b[nDevices], *d_c[nDevices];
	cudaStream_t streams[nDevices * number_of_iterations];
	for (int d=0;d<nDevices;d++)
	{
		cudaSetDevice(devices[d]);
		cudaDeviceProp deviceProp;
		cudaGetDeviceProperties(&deviceProp, devices[d]);
		cout << "Using device " << devices[d] << ", name: " << deviceProp.name << endl;

		err = cudaSetDevice(devices[d]);
		if (err != cudaSuccess)
		{
			cout << "error setting device, #=" << cudaGetErrorString(err) << endl;
		}
	    for (int i=0; i<number_of_iterations; i++)
	    {
		    err = cudaStreamCreate(&streams[STREAM_INDEX(d,i)]);
		    if (err != cudaSuccess)
		    {
			    cout << "error in stream creation, #=" << cudaGetErrorString(err) << endl;
		    }
		}

		err = cudaMalloc((void **) &d_a[d], matsize);
		if (err != cudaSuccess)
		{
			cout << "error in malloc, #=" << cudaGetErrorString(err) << endl;
		}
		err = cudaMalloc((void **) &d_b[d], matsize);
		if (err != cudaSuccess)
		{
			cout << "error in malloc, #=" << cudaGetErrorString(err) << endl;
		}
		err = cudaMalloc((void **) &d_c[d], matsize);
		if (err != cudaSuccess)
		{
			cout << "error in malloc, #=" << cudaGetErrorString(err) << endl;
		}
		
	}

    for (int d=0; d<nDevices; d++)
    {
        for (int i=0; i<number_of_iterations; i++)
        {
            cout << "Running on device " << d << ", stream " << i << endl;
            int cDevice = d;
            cudaStream_t cStream = streams[STREAM_INDEX(d,i)];
            cudaSetDevice(devices[cDevice]);
            if (err != cudaSuccess) {
                cout << "error setting device: " << devices[i%nDevices] << " #=" << cudaGetErrorString(err) << endl;
            }

            err = cudaMemcpyAsync(d_a[cDevice], a, matsize, cudaMemcpyHostToDevice, cStream);
            if (err != cudaSuccess) {
                cout << "error in memcpy, #=" << cudaGetErrorString(err) << endl;
            }
            err = cudaMemcpyAsync(d_b[cDevice], b, matsize, cudaMemcpyHostToDevice, cStream);
            if (err != cudaSuccess) {
                cout << "error in memcpy, #=" << cudaGetErrorString(err) << endl;
            }

            //cout << "running on device " << cDevice << endl;

            dim3 grid(number_of_blocks, number_of_blocks);
            dim3 threads(number_of_threads, number_of_threads, 1);

            //multiply each element at a time.
            multiply_by_element(grid, threads, d_a[cDevice], d_b[cDevice], d_c[cDevice], m, cStream);

            //multiply by first load a 16x16 submatrix into shared memory.
            multiply_by_block(grid, threads, d_a[cDevice], d_b[cDevice], d_c[cDevice], m, cStream);
        }
    }

	cout << "Finished " << number_of_iterations << " iterations on " << nDevices << " devices." << endl;

	for (int d=0;d<nDevices;d++) {
		cudaSetDevice(devices[d]);
	    for (int i=0; i<number_of_iterations; i++) {
		    cudaStreamSynchronize(streams[STREAM_INDEX(d,i)]);
        }
	}

	for (int d=0;d<nDevices;d++) {
	    for (int i=0; i<number_of_iterations; i++) {
		    cudaStreamDestroy(streams[STREAM_INDEX(d,i)]);
        }
	}

	//print c	
	/*
	cout << " results: " << endl;
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			cout << c[i*m+j] << ", ";
		}
		cout << endl;
	}
	*/
	
	
	//print c	
	/*
	cout << " results: " << endl;
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			cout << c[i*m+j] << ", ";
		}
		cout << endl;
	}
	*/
	cudaFree(d_a);
	cudaFree(d_b);
	cudaFree(d_c);
}

	.file	"tmpxft_0036bf08_00000000-6_matmult.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3714:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3714:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.align 2
	.type	_ZNSolsEPFRSoS_E.isra.0, @function
_ZNSolsEPFRSoS_E.isra.0:
.LFB4446:
	.cfi_startproc
	jmp	*%rsi
	.cfi_endproc
.LFE4446:
	.size	_ZNSolsEPFRSoS_E.isra.0, .-_ZNSolsEPFRSoS_E.isra.0
	.globl	_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i
	.type	_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i, @function
_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i:
.LFB3736:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L3
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z17multiply_matricesPfS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L3:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3736:
	.size	_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i, .-_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i
	.globl	_Z17multiply_matricesPfS_S_i
	.type	_Z17multiply_matricesPfS_S_i, @function
_Z17multiply_matricesPfS_S_i:
.LFB3737:
	.cfi_startproc
	endbr64
	jmp	_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i
	.cfi_endproc
.LFE3737:
	.size	_Z17multiply_matricesPfS_S_i, .-_Z17multiply_matricesPfS_S_i
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"error in kernel, "
.LC1:
	.string	"error in memcpy, #="
	.text
	.globl	_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st
	.type	_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st, @function
_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st:
.LFB3706:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r9, %r14
	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
	movq	%r8, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rdi, 16(%rsp)
	movq	112(%rsp), %r12
	movl	$4000000, %edi
	movq	96(%rsp), %r13
	movl	104(%rsp), %r15d
	movl	%esi, 24(%rsp)
	movq	%rdx, (%rsp)
	movl	%ecx, 8(%rsp)
	call	malloc@PLT
	movl	8(%rsp), %ecx
	movq	(%rsp), %rdx
	xorl	%r8d, %r8d
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	movq	%r12, %r9
	movq	%rax, %rbp
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L10
	movl	%r15d, %ecx
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_Z42__device_stub__Z17multiply_matricesPfS_S_iPfS_S_i
.L10:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L11
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %r14
	call	cudaGetErrorString@PLT
	movq	%r14, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L11:
	movq	%r12, %rdi
	call	cudaStreamSynchronize@PLT
	movq	%r12, %r8
	movl	$2, %ecx
	movq	%r13, %rsi
	movl	$4000000, %edx
	movq	%rbp, %rdi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L9
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	movq	%rax, %rdi
	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
	jmp	_ZNSolsEPFRSoS_E.isra.0
.L9:
	.cfi_restore_state
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3706:
	.size	_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st, .-_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st
	.globl	_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i
	.type	_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i, @function
_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i:
.LFB3738:
	.cfi_startproc
	endbr64
	subq	$152, %rsp
	.cfi_def_cfa_offset 160
	movq	%rdi, 24(%rsp)
	leaq	56(%rsp), %rdi
	movq	%rsi, 16(%rsp)
	leaq	68(%rsp), %rsi
	movq	%rdx, 8(%rsp)
	leaq	40(%rsp), %rdx
	movl	%ecx, 4(%rsp)
	leaq	48(%rsp), %rcx
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movl	$1, 64(%rsp)
	movq	%rax, 104(%rsp)
	leaq	16(%rsp), %rax
	movq	%rax, 112(%rsp)
	leaq	8(%rsp), %rax
	movq	%rax, 120(%rsp)
	leaq	4(%rsp), %rax
	movq	%rax, 128(%rsp)
	movabsq	$4294967297, %rax
	movq	%rax, 56(%rsp)
	movq	%rax, 68(%rsp)
	movl	$1, 76(%rsp)
	call	__cudaPopCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L17
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z31multiply_matrices_shared_blocksPfS_S_i(%rip), %rdi
	pushq	48(%rsp)
	.cfi_def_cfa_offset 176
	movq	84(%rsp), %rcx
	movl	92(%rsp), %r8d
	movq	72(%rsp), %rsi
	movl	80(%rsp), %edx
	leaq	120(%rsp), %r9
	call	cudaLaunchKernel@PLT
	popq	%rax
	.cfi_def_cfa_offset 168
	popq	%rdx
	.cfi_def_cfa_offset 160
.L17:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3738:
	.size	_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i, .-_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i
	.globl	_Z31multiply_matrices_shared_blocksPfS_S_i
	.type	_Z31multiply_matrices_shared_blocksPfS_S_i, @function
_Z31multiply_matrices_shared_blocksPfS_S_i:
.LFB3739:
	.cfi_startproc
	endbr64
	jmp	_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i
	.cfi_endproc
.LFE3739:
	.size	_Z31multiply_matrices_shared_blocksPfS_S_i, .-_Z31multiply_matrices_shared_blocksPfS_S_i
	.globl	_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st
	.type	_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st, @function
_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st:
.LFB3707:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r9, %r14
	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
	movq	%r8, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%rdi, 16(%rsp)
	movq	112(%rsp), %r12
	movl	$4000000, %edi
	movq	96(%rsp), %r13
	movl	104(%rsp), %r15d
	movl	%esi, 24(%rsp)
	movq	%rdx, (%rsp)
	movl	%ecx, 8(%rsp)
	call	malloc@PLT
	movl	8(%rsp), %ecx
	movq	(%rsp), %rdx
	xorl	%r8d, %r8d
	movq	16(%rsp), %rdi
	movl	24(%rsp), %esi
	movq	%r12, %r9
	movq	%rax, %rbp
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L23
	movl	%r15d, %ecx
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	call	_Z56__device_stub__Z31multiply_matrices_shared_blocksPfS_S_iPfS_S_i
.L23:
	call	cudaGetLastError@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L24
	leaq	.LC0(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %r14
	call	cudaGetErrorString@PLT
	movq	%r14, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L24:
	movq	%r12, %rdi
	call	cudaStreamSynchronize@PLT
	movq	%r12, %r8
	movl	$2, %ecx
	movq	%r13, %rsi
	movl	$4000000, %edx
	movq	%rbp, %rdi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L22
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%ebx, %edi
	movq	%rax, %rbp
	call	cudaGetErrorString@PLT
	movq	%rbp, %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	movq	%rax, %rdi
	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
	jmp	_ZNSolsEPFRSoS_E.isra.0
.L22:
	.cfi_restore_state
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3707:
	.size	_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st, .-_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st
	.section	.rodata.str1.1
.LC2:
	.string	"_Z31multiply_matrices_shared_blocksPfS_S_i"
.LC3:
	.string	"_Z17multiply_matricesPfS_S_i"
	.section	.text.startup,"ax",@progbits
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3741:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC2(%rip), %rdx
	movq	%rax, %rdi
	movq	%rax, %rbx
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	leaq	_Z31multiply_matrices_shared_blocksPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	movq	%rbx, %rdi
	xorl	%r9d, %r9d
	pushq	$0
	.cfi_def_cfa_offset 24
	leaq	.LC3(%rip), %rdx
	orl	$-1, %r8d
	leaq	_Z17multiply_matricesPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 32
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 40
	pushq	$0
	.cfi_def_cfa_offset 48
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3741:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.rodata._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.str1.1,"aMS",@progbits,1
.LC4:
	.string	"basic_string: construction from null is not valid"
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC5IS3_EEPKcRKS3_,comdat
	.align 2
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, @function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_:
.LFB4045:
	.cfi_startproc
	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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	jne	.L33
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	leaq	.LC4(%rip), %rdi
	call	_ZSt19__throw_logic_errorPKc@PLT
.L33:
	movq	%rdi, %rbx
	movq	%rsi, %rdi
	movq	%rsi, %rbp
	call	strlen@PLT
	movq	%rax, (%rsp)
	leaq	0(%rbp,%rax), %r12
	cmpq	$15, %rax
	jbe	.L35
	movq	%rsp, %rsi
	xorl	%edx, %edx
	movq	%rbx, %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm@PLT
	movq	%rax, (%rbx)
	movq	(%rsp), %rax
	movq	%rax, 16(%rbx)
.L35:
	movq	(%rbx), %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE13_S_copy_charsEPcPKcS7_@PLT
	movq	(%rsp), %rax
	movq	(%rbx), %rdx
	movq	%rax, 8(%rbx)
	movb	$0, (%rdx,%rax)
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	je	.L36
.L38:
	call	__stack_chk_fail@PLT
.L36:
	addq	$16, %rsp
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE4045:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	.set	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.section	.rodata.str1.1
.LC6:
	.string	" devices found."
.LC7:
	.string	""
.LC8:
	.string	"d:i:"
.LC9:
	.string	"Doing "
.LC10:
	.string	" iterations."
.LC11:
	.string	"Error, option -d requires argument: comma delimted list of devices to run on."
.LC12:
	.string	"Error, option -i requires argument: number of iterations to run."
.LC13:
	.string	"Error, unknow option. Usage:\nmatmult [-d <device id>,...] [-i <number of iterations]"
.LC14:
	.string	"Using device "
.LC15:
	.string	", name: "
.LC16:
	.string	"error setting device, #="
.LC17:
	.string	"error in stream creation, #="
.LC18:
	.string	"error in malloc, #="
.LC19:
	.string	"Running on device "
.LC20:
	.string	", stream "
.LC21:
	.string	"error setting device: "
.LC22:
	.string	" #="
.LC23:
	.string	"Finished "
.LC24:
	.string	" iterations on "
.LC25:
	.string	" devices."
	.section	.text.startup
	.globl	main
	.type	main, @function
main:
.LFB3708:
	.cfi_startproc
	.cfi_personality 0x9b,DW.ref.__gxx_personality_v0
	.cfi_lsda 0x1b,.LLSDA3708
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	movq	%rsi, %r12
	pushq	%rbx
	subq	$1224, %rsp
	.cfi_offset 3, -56
	movl	%edi, -1216(%rbp)
	movl	$4000000, %edi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, -1248(%rbp)
	call	malloc@PLT
	movl	$4000000, %edi
	movq	%rax, -1256(%rbp)
	call	malloc@PLT
	movl	m(%rip), %esi
	xorl	%edi, %edi
	xorl	%edx, %edx
.L40:
	cmpl	%esi, %edx
	je	.L172
	incl	%edx
	xorl	%ecx, %ecx
	leal	(%rdx,%rdx), %r8d
.L41:
	cvtsi2ssl	%r8d, %xmm0
	movq	-1248(%rbp), %rbx
	leal	(%rcx,%rdi), %r9d
	incl	%ecx
	movl	$0x00000000, (%rax,%r9,4)
	subl	$3, %r8d
	movss	%xmm0, (%rbx,%r9,4)
	movq	-1256(%rbp), %rbx
	movss	%xmm0, (%rbx,%r9,4)
	cmpl	%esi, %ecx
	jne	.L41
	addl	%esi, %edi
	jmp	.L40
.L172:
	xorl	%edi, %edi
	leaq	_ZSt4cout(%rip), %r13
	movl	%edi, -1184(%rbp)
	leaq	-1184(%rbp), %rdi
.LEHB0:
	call	cudaGetDeviceCount@PLT
	movl	-1184(%rbp), %esi
	movq	%r13, %rdi
	movl	%eax, %r14d
	call	_ZNSolsEi@PLT
	leaq	.LC6(%rip), %rsi
	movq	%rax, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	leaq	-1164(%rbp), %rax
	leaq	.LC7(%rip), %rsi
	movq	%rax, -1208(%rbp)
	leaq	-1152(%rbp), %rax
	movq	-1208(%rbp), %rdx
	movq	%rax, %rdi
	movq	%rax, -1200(%rbp)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
.LEHE0:
	movl	-1216(%rbp), %edi
	leaq	.LC8(%rip), %rdx
	movq	%r12, %rsi
	movl	$1, -1180(%rbp)
	call	getopt@PLT
	movl	%eax, %ebx
	leaq	-1088(%rbp), %rax
	movq	%rax, -1192(%rbp)
.L43:
	cmpl	$-1, %ebx
	je	.L173
	movq	-1192(%rbp), %rdi
.LEHB1:
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev@PLT
.LEHE1:
	cmpl	$100, %ebx
	je	.L44
	cmpl	$105, %ebx
	je	.L45
	cmpl	$63, %ebx
	je	.L46
	jmp	.L47
.L44:
	leaq	-1120(%rbp), %rbx
	movq	-1208(%rbp), %rdx
	movq	optarg(%rip), %rsi
	movq	%rbx, %rdi
.LEHB2:
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1IS3_EEPKcRKS3_
	movq	%rbx, %rdi
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv@PLT
	movq	-1112(%rbp), %rbx
	testb	%al, %al
	je	.L48
	testq	%rbx, %rbx
	je	.L49
	movq	-1120(%rbp), %rsi
	movq	-1152(%rbp), %rdi
	movq	%rbx, %rdx
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7_S_copyEPcPKcm@PLT
.L49:
	movq	-1112(%rbp), %rax
	movq	-1152(%rbp), %rdx
	movq	%rax, -1144(%rbp)
	movb	$0, (%rdx,%rax)
	jmp	.L50
.L48:
	movq	-1200(%rbp), %rdi
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv@PLT
	movl	%eax, %edx
	xorl	%eax, %eax
	testb	%dl, %dl
	jne	.L51
	movq	-1152(%rbp), %rax
	movq	-1136(%rbp), %r15
.L51:
	movq	-1120(%rbp), %rdx
	movq	%rbx, -1144(%rbp)
	movq	%rdx, -1152(%rbp)
	movq	-1104(%rbp), %rdx
	movq	%rdx, -1136(%rbp)
	testq	%rax, %rax
	je	.L52
	movq	%rax, -1120(%rbp)
	movq	%r15, -1104(%rbp)
	jmp	.L50
.L52:
	leaq	-1104(%rbp), %rax
	movq	%rax, -1120(%rbp)
.L50:
	movq	-1120(%rbp), %rax
	xorl	%esi, %esi
	leaq	-1120(%rbp), %rdi
	movq	%rsi, -1112(%rbp)
	movb	$0, (%rax)
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	jmp	.L47
.L45:
	movq	optarg(%rip), %rsi
	leaq	-1072(%rbp), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	-1192(%rbp), %rdi
	leaq	-1180(%rbp), %rsi
	call	_ZNSirsERi@PLT
	leaq	.LC9(%rip), %rsi
	movq	%r13, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	-1180(%rbp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC10(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	jmp	.L47
.L46:
	movl	optopt(%rip), %eax
	leaq	.LC11(%rip), %rsi
	leaq	_ZSt4cerr(%rip), %rdi
	cmpl	$100, %eax
	je	.L170
	leaq	.LC12(%rip), %rsi
	cmpl	$105, %eax
	je	.L170
	leaq	.LC13(%rip), %rsi
.L170:
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.LEHE2:
	movq	-1192(%rbp), %rdi
	movl	$1, %ebx
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L56
.L47:
	movl	-1216(%rbp), %edi
	leaq	.LC8(%rip), %rdx
	movq	%r12, %rsi
	call	getopt@PLT
	movq	-1192(%rbp), %rdi
	movl	%eax, %ebx
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L43
.L173:
	movslq	-1184(%rbp), %rax
	movq	%rsp, -1264(%rbp)
	movq	%rsp, %rcx
	leaq	15(,%rax,4), %rdx
	movq	%rax, %r13
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L58:
	cmpq	%rcx, %rsp
	je	.L59
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L58
.L59:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L60
	orq	$0, -8(%rsp,%rax)
.L60:
	movq	-1200(%rbp), %rdi
	leaq	.LC7(%rip), %rsi
	movq	%rsp, %r15
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc@PLT
	testl	%eax, %eax
	je	.L110
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	leaq	-1088(%rbp), %r12
	jmp	.L62
.L110:
	xorl	%eax, %eax
.L61:
	cmpl	%eax, %r13d
	jle	.L64
	movl	%eax, (%r15,%rax,4)
	incq	%rax
	jmp	.L61
.L68:
	movq	%r12, %rdi
.LEHB3:
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev@PLT
.LEHE3:
	leaq	-1072(%rbp), %rdi
	movl	%ebx, %esi
.LEHB4:
	call	_ZNSolsEi@PLT
	movq	-1208(%rbp), %rsi
	movq	%r12, %rdi
	movb	$0, -1164(%rbp)
	call	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
.LEHE4:
	movq	(%rax), %rdx
	movq	-24(%rdx), %rdx
	testb	$5, 32(%rax,%rdx)
	je	.L174
.L67:
	movq	%r12, %rdi
	incl	%ebx
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
.L62:
	cmpl	%ebx, -1184(%rbp)
	jg	.L68
	jmp	.L64
.L174:
	movsbl	-1164(%rbp), %esi
	movq	-1200(%rbp), %rdi
	xorl	%edx, %edx
	call	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcm@PLT
	incq	%rax
	je	.L67
	movslq	%r13d, %rax
	incl	%r13d
	movl	%ebx, (%r15,%rax,4)
	jmp	.L67
.L64:
	movslq	%r13d, %rax
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L69:
	cmpq	%rcx, %rsp
	je	.L70
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L69
.L70:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L71
	orq	$0, -8(%rsp,%rdx)
.L71:
	movq	%rax, %rsi
	movq	%rsp, -1200(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L72:
	cmpq	%rcx, %rsp
	je	.L73
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L72
.L73:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L74
	orq	$0, -8(%rsp,%rdx)
.L74:
	movq	%rsp, -1208(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L75:
	cmpq	%rcx, %rsp
	je	.L76
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L75
.L76:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L77
	orq	$0, -8(%rsp,%rax)
.L77:
	movl	-1180(%rbp), %eax
	movq	%rsp, -1224(%rbp)
	movq	%rsp, %rcx
	imull	%r13d, %eax
	cltq
	leaq	15(,%rax,8), %rdx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	andq	$-16, %rax
	subq	%rdx, %rcx
.L78:
	cmpq	%rcx, %rsp
	je	.L79
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L78
.L79:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L80
	orq	$0, -8(%rsp,%rax)
.L80:
	movq	%rsp, -1232(%rbp)
	xorl	%ebx, %ebx
.L81:
	movl	%ebx, -1192(%rbp)
	cmpl	%ebx, %r13d
	jle	.L175
	movl	(%r15,%rbx,4), %r12d
	movl	%r12d, %edi
.LEHB5:
	call	cudaSetDevice@PLT
	leaq	-1088(%rbp), %rdi
	movl	%r12d, %esi
	call	cudaGetDeviceProperties_v2@PLT
	leaq	.LC14(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r12d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC15(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	leaq	-1088(%rbp), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	%r12d, %edi
	call	cudaSetDevice@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L82
	leaq	.LC16(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %edi
	movq	%rax, %r14
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L82:
	xorl	%r12d, %r12d
.L83:
	movl	-1180(%rbp), %eax
	cmpl	%r12d, %eax
	jle	.L176
	movl	-1192(%rbp), %ecx
	imull	%ecx, %eax
	movq	-1232(%rbp), %rcx
	addl	%r12d, %eax
	cltq
	leaq	(%rcx,%rax,8), %rdi
	call	cudaStreamCreate@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L84
	leaq	.LC17(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, -1216(%rbp)
	call	cudaGetErrorString@PLT
	movq	-1216(%rbp), %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L84:
	incl	%r12d
	jmp	.L83
.L176:
	movq	-1200(%rbp), %rax
	leaq	0(,%rbx,8), %r12
	movl	$4000000, %esi
	leaq	(%rax,%r12), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L86
	leaq	.LC18(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, -1192(%rbp)
	call	cudaGetErrorString@PLT
	movq	-1192(%rbp), %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L86:
	movq	-1208(%rbp), %rax
	movl	$4000000, %esi
	leaq	(%rax,%r12), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L87
	leaq	.LC18(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, -1192(%rbp)
	call	cudaGetErrorString@PLT
	movq	-1192(%rbp), %rdi
	movq	%rax, %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L87:
	movq	-1224(%rbp), %rax
	movl	$4000000, %esi
	leaq	(%rax,%r12), %rdi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L88
	leaq	.LC18(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, %r12
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L88:
	incq	%rbx
	jmp	.L81
.L175:
	xorl	%ebx, %ebx
.L90:
	movl	%ebx, -1236(%rbp)
	cmpl	%ebx, %r13d
	jle	.L177
	xorl	%eax, %eax
	movl	%eax, -1192(%rbp)
.L95:
	movl	-1192(%rbp), %eax
	cmpl	%eax, -1180(%rbp)
	jle	.L178
	leaq	.LC19(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	-1236(%rbp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC20(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	-1192(%rbp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	movl	-1236(%rbp), %eax
	imull	-1180(%rbp), %eax
	movl	-1192(%rbp), %ecx
	movl	(%r15,%rbx,4), %edi
	addl	%ecx, %eax
	movq	-1232(%rbp), %rcx
	cltq
	movq	(%rcx,%rax,8), %rax
	movq	%rax, -1216(%rbp)
	call	cudaSetDevice@PLT
	testl	%r14d, %r14d
	je	.L91
	leaq	.LC21(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	-1192(%rbp), %eax
	cltd
	idivl	%r13d
	movslq	%edx, %rdx
	movl	(%r15,%rdx,4), %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC22(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, %r12
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L91:
	movq	-1200(%rbp), %rax
	movl	$1, %ecx
	movl	$4000000, %edx
	movq	-1216(%rbp), %r8
	movq	-1248(%rbp), %rsi
	movq	(%rax,%rbx,8), %rdi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %r12d
	testl	%eax, %eax
	je	.L92
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r12d, %edi
	movq	%rax, %r14
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r14, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L92:
	movq	-1208(%rbp), %rax
	movl	$1, %ecx
	movl	$4000000, %edx
	movq	-1216(%rbp), %r8
	movq	-1256(%rbp), %rsi
	movq	(%rax,%rbx,8), %rdi
	call	cudaMemcpyAsync@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L93
	leaq	.LC1(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	%r14d, %edi
	movq	%rax, %r12
	call	cudaGetErrorString@PLT
	movq	%rax, %rsi
	movq	%r12, %rdi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
.L93:
	movq	-1208(%rbp), %rax
	movl	$1, %esi
	movabsq	$270582939711, %rdi
	movabsq	$68719476752, %rdx
	movq	%rdi, -1176(%rbp)
	movq	(%rax,%rbx,8), %r9
	movq	-1200(%rbp), %rax
	movl	$1, -1168(%rbp)
	movq	%rdx, -1164(%rbp)
	movl	$1, -1156(%rbp)
	movq	(%rax,%rbx,8), %r8
	pushq	%rcx
	movl	m(%rip), %eax
	movl	$1, %ecx
	pushq	-1216(%rbp)
	pushq	%rax
	movq	-1224(%rbp), %rax
	pushq	(%rax,%rbx,8)
	.cfi_escape 0x2e,0x20
	call	_Z19multiply_by_element4dim3S_PfS0_S0_iP11CUstream_st
	addq	$24, %rsp
	movq	-1208(%rbp), %rax
	movq	-1164(%rbp), %rdx
	movl	-1156(%rbp), %ecx
	movq	-1176(%rbp), %rdi
	movq	(%rax,%rbx,8), %r9
	movq	-1200(%rbp), %rax
	movl	-1168(%rbp), %esi
	movq	(%rax,%rbx,8), %r8
	movl	m(%rip), %eax
	pushq	-1216(%rbp)
	pushq	%rax
	movq	-1224(%rbp), %rax
	pushq	(%rax,%rbx,8)
	call	_Z17multiply_by_block4dim3S_PfS0_S0_iP11CUstream_st
	addq	$32, %rsp
	incl	-1192(%rbp)
	jmp	.L95
.L178:
	incq	%rbx
	jmp	.L90
.L177:
	leaq	.LC23(%rip), %rsi
	leaq	_ZSt4cout(%rip), %rdi
	.cfi_escape 0x2e,0
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movl	-1180(%rbp), %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC24(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	%rax, %rdi
	movl	%r13d, %esi
	call	_ZNSolsEi@PLT
	movq	%rax, %rdi
	leaq	.LC25(%rip), %rsi
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
	movq	_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	call	_ZNSolsEPFRSoS_E.isra.0
	xorl	%ebx, %ebx
.L96:
	movl	%ebx, %r14d
	cmpl	%ebx, %r13d
	jle	.L179
	movl	(%r15,%rbx,4), %edi
	call	cudaSetDevice@PLT
	xorl	%r12d, %r12d
.L97:
	movl	-1180(%rbp), %eax
	cmpl	%r12d, %eax
	jle	.L180
	imull	%r14d, %eax
	movq	-1232(%rbp), %rcx
	addl	%r12d, %eax
	cltq
	movq	(%rcx,%rax,8), %rdi
	call	cudaStreamSynchronize@PLT
	incl	%r12d
	jmp	.L97
.L180:
	incq	%rbx
	jmp	.L96
.L179:
	xorl	%ebx, %ebx
.L100:
	cmpl	%ebx, %r13d
	jle	.L181
	xorl	%r12d, %r12d
.L102:
	movl	-1180(%rbp), %eax
	cmpl	%r12d, %eax
	jle	.L182
	imull	%ebx, %eax
	movq	-1232(%rbp), %rcx
	addl	%r12d, %eax
	cltq
	movq	(%rcx,%rax,8), %rdi
	call	cudaStreamDestroy@PLT
	incl	%r12d
	jmp	.L102
.L182:
	incl	%ebx
	jmp	.L100
.L181:
	movq	-1200(%rbp), %rdi
	call	cudaFree@PLT
	movq	-1208(%rbp), %rdi
	call	cudaFree@PLT
	movq	-1224(%rbp), %rdi
	call	cudaFree@PLT
.LEHE5:
	movq	-1264(%rbp), %rsp
	xorl	%ebx, %ebx
.L56:
	leaq	-1152(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L108
	jmp	.L164
.L115:
	endbr64
	movq	%rax, %rbx
.L103:
	movq	-1192(%rbp), %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L104
.L117:
	endbr64
	movq	%rax, %rbx
.L105:
	movq	%r12, %rdi
	call	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev@PLT
	jmp	.L106
.L118:
	endbr64
	movq	%rax, %rbx
.L106:
	movq	-1264(%rbp), %rsp
	jmp	.L104
.L116:
	endbr64
	movq	%rax, %rbx
.L104:
	leaq	-1152(%rbp), %rdi
	call	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE10_M_disposeEv@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L164
	movq	%rbx, %rdi
.LEHB6:
	call	_Unwind_Resume@PLT
.LEHE6:
.L164:
	call	__stack_chk_fail@PLT
.L108:
	leaq	-40(%rbp), %rsp
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3708:
	.globl	__gxx_personality_v0
	.section	.gcc_except_table,"a",@progbits
.LLSDA3708:
	.byte	0xff
	.byte	0xff
	.byte	0x1
	.uleb128 .LLSDACSE3708-.LLSDACSB3708
.LLSDACSB3708:
	.uleb128 .LEHB0-.LFB3708
	.uleb128 .LEHE0-.LEHB0
	.uleb128 0
	.uleb128 0
	.uleb128 .LEHB1-.LFB3708
	.uleb128 .LEHE1-.LEHB1
	.uleb128 .L116-.LFB3708
	.uleb128 0
	.uleb128 .LEHB2-.LFB3708
	.uleb128 .LEHE2-.LEHB2
	.uleb128 .L115-.LFB3708
	.uleb128 0
	.uleb128 .LEHB3-.LFB3708
	.uleb128 .LEHE3-.LEHB3
	.uleb128 .L118-.LFB3708
	.uleb128 0
	.uleb128 .LEHB4-.LFB3708
	.uleb128 .LEHE4-.LEHB4
	.uleb128 .L117-.LFB3708
	.uleb128 0
	.uleb128 .LEHB5-.LFB3708
	.uleb128 .LEHE5-.LEHB5
	.uleb128 .L118-.LFB3708
	.uleb128 0
	.uleb128 .LEHB6-.LFB3708
	.uleb128 .LEHE6-.LEHB6
	.uleb128 0
	.uleb128 0
.LLSDACSE3708:
	.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
	.globl	m
	.data
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.long	1000
	.hidden	DW.ref.__gxx_personality_v0
	.weak	DW.ref.__gxx_personality_v0
	.section	.data.rel.local.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
	.align 8
	.type	DW.ref.__gxx_personality_v0, @object
	.size	DW.ref.__gxx_personality_v0, 8
DW.ref.__gxx_personality_v0:
	.quad	__gxx_personality_v0
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#include "hip/hip_runtime_api.h"

#define SIZE_OF_MATRIX 1000
#define SIZE_OF_BLOCK 16 
#define M SIZE_OF_MATRIX
unsigned int m = SIZE_OF_MATRIX;

#define idx(i,j,lda) ((j) + ((i)*(lda)))

__global__ void multiply_matrices(float *d_a, float *d_b, float *d_c, int lda)
{
	unsigned int row = threadIdx.y + blockDim.y * blockIdx.y;
	unsigned int col = threadIdx.x + blockDim.x * blockIdx.x;
	unsigned int id  = idx(row,col,lda);

	float ctemp = 0.0;

	if (row < M && col < M)
	{
		for (unsigned int j=0; j<M; j++)
		{
			ctemp = ctemp + d_a[idx(row,j,lda)] * d_b[idx(j,col,lda)];
		}
		d_c[id] = ctemp;
	}
}

__global__ void multiply_matrices_shared_blocks(float *d_a, float *d_b, float *d_c,
int lda)
{

	int bs = SIZE_OF_BLOCK;
	unsigned int row = threadIdx.y + blockDim.y * blockIdx.y;
	unsigned int col = threadIdx.x + blockDim.x * blockIdx.x;
	unsigned int id  = idx(row,col,lda);
	
	//submatrices
	float *sub_a, *sub_b;

	//shared submatrices	
	__shared__ float a[SIZE_OF_BLOCK][SIZE_OF_BLOCK], b[SIZE_OF_BLOCK][SIZE_OF_BLOCK];
	//temp element of d_c
	float c = 0;
	
	//top-level row,col of block
	int block_row = blockIdx.y * bs;
	int block_col = blockIdx.x * bs;

	//id inside each block
	int sub_row = threadIdx.y;
	int sub_col = threadIdx.x;
	
	//for each block	
	for (int k = 0; k < (M / bs); k++)
	{

	  sub_a = &d_a[idx(block_row, bs*k, lda)];
		sub_b = &d_b[idx(bs*k, block_col, lda)];
		a[sub_row][sub_col] = sub_a[idx(sub_row, sub_col, lda)];
		b[sub_row][sub_col] = sub_b[idx(sub_row, sub_col, lda)];
		
		//wait for all threads to complete copy to shared memory.	
		__syncthreads();

		//multiply each submatrix
		for (int j=0; j < bs; j++)
		{
			c = c + a[sub_row][j] * b[j][sub_col];
		}
	
		// move results to device memory.
		d_c[id] = c;
	
		// wait for multiplication to finish before moving onto the next submatrix.
		__syncthreads();
		
	}
}

void multiply_by_element(dim3 grid, dim3 threads, float *d_a, float *d_b, float *d_c, int m, hipStream_t cStream)
{

	hipError_t err;
	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);
	float* c = (float*)malloc(matsize);
	
	multiply_matrices<<< grid, threads, 0, cStream >>>(d_a, d_b, d_c, m);
	err = hipGetLastError();
	if (err != hipSuccess)
	{
		cout << "error in kernel, " << hipGetErrorString(err) << endl;
	}
	
	hipStreamSynchronize(cStream);
	err = hipMemcpyAsync(c, d_c, matsize, hipMemcpyDeviceToHost, cStream);
	if (err != hipSuccess)
	{
		cout << "error in memcpy, #=" << hipGetErrorString(err) << endl;
	}


}

void multiply_by_block(dim3 grid, dim3 threads, float *d_a, float *d_b, float *d_c, int m, hipStream_t cStream)
{
	hipError_t err;
	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);
	float* c = (float*)malloc(matsize);

	multiply_matrices_shared_blocks<<< grid, threads, 0, cStream >>>(d_a, d_b, d_c, m);

	err = hipGetLastError();
	if (err != hipSuccess)
	{
		cout << "error in kernel, " << hipGetErrorString(err) << endl;
	}

	hipStreamSynchronize(cStream);
	err = hipMemcpyAsync(c, d_c, matsize, hipMemcpyDeviceToHost, cStream);
	if (err != hipSuccess)
	{
		cout << "error in memcpy, #=" << hipGetErrorString(err) << endl;
	}
}

#define STREAM_INDEX(_d,_i) ((_d*number_of_iterations) + _i)

int main(int argc, char** argv)
{
	
	unsigned int number_of_threads = min(SIZE_OF_MATRIX, SIZE_OF_BLOCK);
	unsigned int number_of_blocks;
	if (SIZE_OF_MATRIX > SIZE_OF_BLOCK)
		number_of_blocks = ceil(SIZE_OF_MATRIX / ((float) SIZE_OF_BLOCK));
	else
		 number_of_blocks = 1;

	unsigned int matsize = SIZE_OF_MATRIX*SIZE_OF_MATRIX*sizeof(float);

	//cout << "blocks: " << number_of_blocks << " threads: " <<
	//number_of_threads << endl;

	//cout.flush();

	float* a = (float*)malloc(matsize);
	float* b = (float*)malloc(matsize);
	float* c = (float*)malloc(matsize);

	//initalize matrices
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			//a[i*m+j] = i;
			//b[i*m+j] = i;
			a[i*m+j] = i-j*2 + i-j+1 + 1;
			b[i*m+j] = i-j*2 + i-j+1 + 1;
			c[i*m+j] = 0;
			//cout << a[i*m+j] << ", ";
		}
		//cout << endl;
	}
	hipError_t err;

	int count = 0;

	err = hipGetDeviceCount(&count);

	cout << count << " devices found." << endl;

	string device_list("");
	int number_of_iterations = 1;
	
	int opt = getopt(argc, argv, "d:i:");
	while(opt != -1) {
		stringstream str;
		switch(opt) {
			case 'd':
				device_list = string(optarg);
				break;
			case 'i':
				str << optarg;
				str >> number_of_iterations;
                cout << "Doing " << number_of_iterations << " iterations." << std::endl;
				break;
			case '?':
				if (optopt == 'd')
					cerr << "Error, option -d requires argument: comma delimted list of devices to run on." << endl;
				else if (optopt == 'i')
					cerr << "Error, option -i requires argument: number of iterations to run." << endl;
				else
					cerr << "Error, unknow option. Usage:\nmatmult [-d <device id>,...] [-i <number of iterations]" << endl;
				return 1;
			default:
				break;
		}
	  opt = getopt(argc, argv, "d:i:");
	}
	int devices[count];
	int nDevices = 0;
	//default: use all the devices
	if (device_list.compare("") == 0)
	{
		for (int d=0;d<count;d++)
		{
			devices[d] = d;
		}
		nDevices = count;
	}
	else
	{
		for (int d=0;d<count;d++)
		{
			stringstream str;
			str << d;
			char c = 0;
			if (str >> c) {
				if (device_list.find(c) != string::npos) {
					devices[nDevices++] = d;
				}
			}
		}
	}
	//cout << "finnished mapping devices." << endl;
	float *d_a[nDevices], *d_b[nDevices], *d_c[nDevices];
	hipStream_t streams[nDevices * number_of_iterations];
	for (int d=0;d<nDevices;d++)
	{
		hipSetDevice(devices[d]);
		hipDeviceProp_t deviceProp;
		hipGetDeviceProperties(&deviceProp, devices[d]);
		cout << "Using device " << devices[d] << ", name: " << deviceProp.name << endl;

		err = hipSetDevice(devices[d]);
		if (err != hipSuccess)
		{
			cout << "error setting device, #=" << hipGetErrorString(err) << endl;
		}
	    for (int i=0; i<number_of_iterations; i++)
	    {
		    err = hipStreamCreate(&streams[STREAM_INDEX(d,i)]);
		    if (err != hipSuccess)
		    {
			    cout << "error in stream creation, #=" << hipGetErrorString(err) << endl;
		    }
		}

		err = hipMalloc((void **) &d_a[d], matsize);
		if (err != hipSuccess)
		{
			cout << "error in malloc, #=" << hipGetErrorString(err) << endl;
		}
		err = hipMalloc((void **) &d_b[d], matsize);
		if (err != hipSuccess)
		{
			cout << "error in malloc, #=" << hipGetErrorString(err) << endl;
		}
		err = hipMalloc((void **) &d_c[d], matsize);
		if (err != hipSuccess)
		{
			cout << "error in malloc, #=" << hipGetErrorString(err) << endl;
		}
		
	}

    for (int d=0; d<nDevices; d++)
    {
        for (int i=0; i<number_of_iterations; i++)
        {
            cout << "Running on device " << d << ", stream " << i << endl;
            int cDevice = d;
            hipStream_t cStream = streams[STREAM_INDEX(d,i)];
            hipSetDevice(devices[cDevice]);
            if (err != hipSuccess) {
                cout << "error setting device: " << devices[i%nDevices] << " #=" << hipGetErrorString(err) << endl;
            }

            err = hipMemcpyAsync(d_a[cDevice], a, matsize, hipMemcpyHostToDevice, cStream);
            if (err != hipSuccess) {
                cout << "error in memcpy, #=" << hipGetErrorString(err) << endl;
            }
            err = hipMemcpyAsync(d_b[cDevice], b, matsize, hipMemcpyHostToDevice, cStream);
            if (err != hipSuccess) {
                cout << "error in memcpy, #=" << hipGetErrorString(err) << endl;
            }

            //cout << "running on device " << cDevice << endl;

            dim3 grid(number_of_blocks, number_of_blocks);
            dim3 threads(number_of_threads, number_of_threads, 1);

            //multiply each element at a time.
            multiply_by_element(grid, threads, d_a[cDevice], d_b[cDevice], d_c[cDevice], m, cStream);

            //multiply by first load a 16x16 submatrix into shared memory.
            multiply_by_block(grid, threads, d_a[cDevice], d_b[cDevice], d_c[cDevice], m, cStream);
        }
    }

	cout << "Finished " << number_of_iterations << " iterations on " << nDevices << " devices." << endl;

	for (int d=0;d<nDevices;d++) {
		hipSetDevice(devices[d]);
	    for (int i=0; i<number_of_iterations; i++) {
		    hipStreamSynchronize(streams[STREAM_INDEX(d,i)]);
        }
	}

	for (int d=0;d<nDevices;d++) {
	    for (int i=0; i<number_of_iterations; i++) {
		    hipStreamDestroy(streams[STREAM_INDEX(d,i)]);
        }
	}

	//print c	
	/*
	cout << " results: " << endl;
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			cout << c[i*m+j] << ", ";
		}
		cout << endl;
	}
	*/
	
	
	//print c	
	/*
	cout << " results: " << endl;
	for (int i=0; i<m; i++) {
		for (int j=0; j<m; j++) {
			cout << c[i*m+j] << ", ";
		}
		cout << endl;
	}
	*/
	hipFree(d_a);
	hipFree(d_b);
	hipFree(d_c);
}

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

                                        # End of file scope inline assembly
	.globl	_Z32__device_stub__multiply_matricesPfS_S_i # -- Begin function _Z32__device_stub__multiply_matricesPfS_S_i
	.type	_Z32__device_stub__multiply_matricesPfS_S_i,@function
_Z32__device_stub__multiply_matricesPfS_S_i: # @_Z32__device_stub__multiply_matricesPfS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z17multiply_matricesPfS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end0:
	.size	_Z32__device_stub__multiply_matricesPfS_S_i, .Lfunc_end0-_Z32__device_stub__multiply_matricesPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i # -- Begin function _Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i
	.type	_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i,@function
_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i: # @_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r13
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	subq	$112, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r13, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	leaq	40(%rsp), %rax
	movq	%rdi, (%rax)
	leaq	32(%rsp), %rdi
	movq	%rsi, (%rdi)
	leaq	24(%rsp), %rsi
	movq	%rdx, (%rsi)
	leaq	4(%rsp), %rdx
	movl	%ecx, (%rdx)
	leaq	80(%rsp), %rbx
	movq	%rax, (%rbx)
	movq	%rdi, 8(%rbx)
	movq	%rsi, 16(%rbx)
	movq	%rdx, 24(%rbx)
	leaq	64(%rsp), %r14
	leaq	48(%rsp), %r15
	leaq	16(%rsp), %r12
	leaq	8(%rsp), %r13
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movq	%r13, %rcx
	callq	__hipPopCallConfiguration
	movq	(%r14), %rsi
	movl	8(%r14), %edx
	movq	(%r15), %rcx
	movl	8(%r15), %r8d
	movl	$_Z31multiply_matrices_shared_blocksPfS_S_i, %edi
	movq	%rbx, %r9
	pushq	(%r13)
	.cfi_adjust_cfa_offset 8
	pushq	(%r12)
	.cfi_adjust_cfa_offset 8
	callq	hipLaunchKernel
	addq	$128, %rsp
	.cfi_adjust_cfa_offset -128
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i, .Lfunc_end1-_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t # -- Begin function _Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t
	.type	_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t,@function
_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t: # @_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 24(%rsp)                   # 8-byte Spill
	movq	%r8, 16(%rsp)                   # 8-byte Spill
	movl	%ecx, %r15d
	movq	%rdx, %rbp
	movl	%esi, %r12d
	movq	%rdi, %r13
	movq	112(%rsp), %rbx
	movl	104(%rsp), %eax
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movq	96(%rsp), %r14
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movq	%r13, %rdi
	movl	%r12d, %esi
	movq	%rbp, %rdx
	movl	%r15d, %ecx
	xorl	%r8d, %r8d
	movq	%rbx, %r9
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB2_2
# %bb.1:
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	12(%rsp), %ecx                  # 4-byte Reload
	callq	_Z32__device_stub__multiply_matricesPfS_S_i
.LBB2_2:
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB2_7
# %bb.3:
	movl	%eax, %ebp
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_4
# %bb.5:
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_6
.LBB2_4:
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB2_7:
	movq	%rbx, %rdi
	callq	hipStreamSynchronize
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rsi
	movl	$2, %ecx
	movq	%rbx, %r8
	callq	hipMemcpyAsync
	testl	%eax, %eax
	je	.LBB2_12
# %bb.8:
	movl	%eax, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB2_9
# %bb.10:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB2_11
.LBB2_12:
	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
.LBB2_9:
	.cfi_def_cfa_offset 96
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB2_11:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit32
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	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
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end2:
	.size	_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t, .Lfunc_end2-_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t
	.cfi_endproc
                                        # -- End function
	.globl	_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t # -- Begin function _Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t
	.type	_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t,@function
_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t: # @_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%r9, 24(%rsp)                   # 8-byte Spill
	movq	%r8, 16(%rsp)                   # 8-byte Spill
	movl	%ecx, %r15d
	movq	%rdx, %rbp
	movl	%esi, %r12d
	movq	%rdi, %r13
	movq	112(%rsp), %rbx
	movl	104(%rsp), %eax
	movl	%eax, 12(%rsp)                  # 4-byte Spill
	movq	96(%rsp), %r14
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	movq	%r13, %rdi
	movl	%r12d, %esi
	movq	%rbp, %rdx
	movl	%r15d, %ecx
	xorl	%r8d, %r8d
	movq	%rbx, %r9
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	jne	.LBB3_2
# %bb.1:
	movq	16(%rsp), %rdi                  # 8-byte Reload
	movq	24(%rsp), %rsi                  # 8-byte Reload
	movq	%r14, %rdx
	movl	12(%rsp), %ecx                  # 4-byte Reload
	callq	_Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i
.LBB3_2:
	callq	hipGetLastError
	testl	%eax, %eax
	je	.LBB3_7
# %bb.3:
	movl	%eax, %ebp
	movl	$_ZSt4cout, %edi
	movl	$.L.str, %esi
	movl	$17, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebp, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB3_4
# %bb.5:
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%r12, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB3_6
.LBB3_4:
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB3_6:                                # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.LBB3_7:
	movq	%rbx, %rdi
	callq	hipStreamSynchronize
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r14, %rsi
	movl	$2, %ecx
	movq	%rbx, %r8
	callq	hipMemcpyAsync
	testl	%eax, %eax
	je	.LBB3_12
# %bb.8:
	movl	%eax, %ebx
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movl	%ebx, %edi
	callq	hipGetErrorString
	testq	%rax, %rax
	je	.LBB3_9
# %bb.10:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	strlen
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	jmp	.LBB3_11
.LBB3_12:
	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
.LBB3_9:
	.cfi_def_cfa_offset 96
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.LBB3_11:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit32
	movq	_ZSt4cout(%rip), %rax
	movl	$_ZSt4cout, %ecx
	movq	-24(%rax), %rdi
	addq	%rcx, %rdi
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
	movq	%rax, %rdi
	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
	jmp	_ZNSo5flushEv                   # TAILCALL
.Lfunc_end3:
	.size	_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t, .Lfunc_end3-_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
.Lfunc_begin0:
	.cfi_startproc
	.cfi_personality 3, __gxx_personality_v0
	.cfi_lsda 3, .Lexception0
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$1656, %rsp                     # imm = 0x678
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movl	%edi, %r12d
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %edi                  # imm = 0x3D0900
	callq	malloc
	movl	m(%rip), %r10d
	testq	%r10, %r10
	je	.LBB4_5
# %bb.1:                                # %.preheader405.preheader
	xorl	%ecx, %ecx
	movl	$2, %edx
	xorl	%esi, %esi
.LBB4_2:                                # %.preheader405
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_3 Depth 2
	movl	%edx, %edi
	xorl	%r8d, %r8d
.LBB4_3:                                #   Parent Loop BB4_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	xorps	%xmm0, %xmm0
	cvtsi2ss	%edi, %xmm0
	leal	(%rcx,%r8), %r9d
	movss	%xmm0, (%r14,%r9,4)
	movss	%xmm0, (%rax,%r9,4)
	incq	%r8
	addl	$-3, %edi
	cmpq	%r8, %r10
	jne	.LBB4_3
# %bb.4:                                #   in Loop: Header=BB4_2 Depth=1
	incl	%esi
	addq	%r10, %rcx
	addl	$2, %edx
	cmpl	%r10d, %esi
	jne	.LBB4_2
.LBB4_5:                                # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_.exit
	movq	%rax, -176(%rbp)                # 8-byte Spill
	movq	%r14, -184(%rbp)                # 8-byte Spill
	leaq	-68(%rbp), %r14
	movl	$0, (%r14)
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	hipGetDeviceCount
	movl	(%r14), %esi
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.2, %esi
	movl	$15, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
	movsbl	%al, %esi
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	_ZNSo3putEc
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
	leaq	-144(%rbp), %rax
	movq	%rax, -16(%rax)
	.cfi_escape 0x2e, 0x00
	leaq	-160(%rbp), %rdi
	movl	$.L.str.3, %esi
	movl	$.L.str.3, %edx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	leaq	-44(%rbp), %rax
	movl	$1, (%rax)
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.4, %edx
	movl	%r12d, %edi
	movq	%rbx, %rsi
	callq	getopt
	movl	%eax, %r15d
	movl	$0, -84(%rbp)                   # 4-byte Folded Spill
	leaq	-1696(%rbp), %r13
.LBB4_6:                                # =>This Inner Loop Header: Depth=1
	cmpl	$-1, %r15d
	je	.LBB4_42
# %bb.7:                                #   in Loop: Header=BB4_6 Depth=1
.Ltmp0:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev
.Ltmp1:
# %bb.8:                                #   in Loop: Header=BB4_6 Depth=1
	cmpl	$63, %r15d
	je	.LBB4_26
# %bb.9:                                #   in Loop: Header=BB4_6 Depth=1
	cmpl	$100, %r15d
	je	.LBB4_13
# %bb.10:                               #   in Loop: Header=BB4_6 Depth=1
	cmpl	$105, %r15d
	jne	.LBB4_24
# %bb.11:                               #   in Loop: Header=BB4_6 Depth=1
	movq	optarg(%rip), %r15
	testq	%r15, %r15
	je	.LBB4_12
# %bb.16:                               #   in Loop: Header=BB4_6 Depth=1
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	strlen
.Ltmp11:
	.cfi_escape 0x2e, 0x00
	leaq	-1680(%rbp), %rdi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp12:
	jmp	.LBB4_17
.LBB4_13:                               #   in Loop: Header=BB4_6 Depth=1
	movq	optarg(%rip), %rsi
.Ltmp30:
	.cfi_escape 0x2e, 0x00
	leaq	-224(%rbp), %r14
	movq	%r14, %rdi
	leaq	-69(%rbp), %rdx
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
.Ltmp31:
# %bb.14:                               #   in Loop: Header=BB4_6 Depth=1
	.cfi_escape 0x2e, 0x00
	leaq	-160(%rbp), %rdi
	movq	%r14, %rsi
	callq	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEOS4_
	movq	-224(%rbp), %rdi
	leaq	-208(%rbp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_24
# %bb.15:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i
                                        #   in Loop: Header=BB4_6 Depth=1
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
	jmp	.LBB4_24
.LBB4_26:                               #   in Loop: Header=BB4_6 Depth=1
	movl	optopt(%rip), %eax
	cmpl	$100, %eax
	je	.LBB4_27
# %bb.28:                               #   in Loop: Header=BB4_6 Depth=1
	cmpl	$105, %eax
	jne	.LBB4_30
# %bb.29:                               #   in Loop: Header=BB4_6 Depth=1
	movl	$64, %edx
	movl	$.L.str.8, %esi
	jmp	.LBB4_31
.LBB4_12:                               #   in Loop: Header=BB4_6 Depth=1
	movq	-1680(%rbp), %rax
	movq	-24(%rax), %rax
	leaq	-1680(%rbp), %rcx
	leaq	(%rcx,%rax), %rdi
	movl	-1648(%rbp,%rax), %esi
	orl	$1, %esi
.Ltmp13:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp14:
.LBB4_17:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp15:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	leaq	-44(%rbp), %rsi
	callq	_ZNSirsERi
.Ltmp16:
# %bb.18:                               #   in Loop: Header=BB4_6 Depth=1
.Ltmp17:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.5, %esi
	movl	$6, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp18:
# %bb.19:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit219
                                        #   in Loop: Header=BB4_6 Depth=1
	movl	-44(%rbp), %esi
.Ltmp19:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
.Ltmp20:
# %bb.20:                               #   in Loop: Header=BB4_6 Depth=1
.Ltmp21:
	movq	%rax, %r15
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.6, %esi
	movl	$12, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp22:
# %bb.21:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit221
                                        #   in Loop: Header=BB4_6 Depth=1
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp23:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp24:
# %bb.22:                               # %.noexc331
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp25:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp26:
# %bb.23:                               # %.noexc332
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp27:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp28:
.LBB4_24:                               # %_ZNSolsEPFRSoS_E.exit
                                        #   in Loop: Header=BB4_6 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.4, %edx
	movl	%r12d, %edi
	movq	%rbx, %rsi
	callq	getopt
	movl	%eax, %r15d
	movb	$1, %r14b
	jmp	.LBB4_36
.LBB4_27:                               #   in Loop: Header=BB4_6 Depth=1
	movl	$77, %edx
	movl	$.L.str.7, %esi
	jmp	.LBB4_31
.LBB4_30:                               #   in Loop: Header=BB4_6 Depth=1
	movl	$84, %edx
	movl	$.L.str.9, %esi
.LBB4_31:                               # %.invoke
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp3:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cerr, %edi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp4:
# %bb.32:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit232.invoke
                                        #   in Loop: Header=BB4_6 Depth=1
	movq	_ZSt4cerr(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cerr, %eax
	addq	%rax, %rdi
.Ltmp5:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp6:
# %bb.33:                               # %.noexc342.invoke
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp7:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cerr, %edi
	callq	_ZNSo3putEc
.Ltmp8:
# %bb.34:                               # %.noexc343.invoke
                                        #   in Loop: Header=BB4_6 Depth=1
.Ltmp9:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp10:
# %bb.35:                               #   in Loop: Header=BB4_6 Depth=1
	movl	$1, -84(%rbp)                   # 4-byte Folded Spill
	movl	$63, %r15d
	xorl	%r14d, %r14d
.LBB4_36:                               # %_ZNSolsEPFRSoS_E.exit226
                                        #   in Loop: Header=BB4_6 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	movq	%r13, %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	-1568(%rbp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	testb	%r14b, %r14b
	jne	.LBB4_6
	jmp	.LBB4_37
.LBB4_42:
	movq	%rsp, -168(%rbp)                # 8-byte Spill
	movl	-68(%rbp), %eax
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %rcx
	leaq	15(,%rax,4), %rax
	andq	$-16, %rax
	subq	%rax, %rcx
	movq	%rcx, -64(%rbp)                 # 8-byte Spill
	movq	%rcx, %rsp
	.cfi_escape 0x2e, 0x00
	leaq	-160(%rbp), %rdi
	movl	$.L.str.3, %esi
	callq	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEPKc
	movl	-68(%rbp), %r15d
	testl	%eax, %eax
	je	.LBB4_45
# %bb.43:                               # %.preheader402
	testl	%r15d, %r15d
	jle	.LBB4_44
# %bb.48:                               # %.lr.ph
	leaq	-1680(%rbp), %r14
	xorl	%r15d, %r15d
	leaq	-1696(%rbp), %r12
	leaq	-224(%rbp), %r13
	xorl	%ebx, %ebx
.LBB4_49:                               # =>This Inner Loop Header: Depth=1
.Ltmp33:
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEC1Ev
.Ltmp34:
# %bb.50:                               #   in Loop: Header=BB4_49 Depth=1
.Ltmp36:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_ZNSolsEi
.Ltmp37:
# %bb.51:                               #   in Loop: Header=BB4_49 Depth=1
	movb	$0, -224(%rbp)
.Ltmp39:
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_
.Ltmp40:
# %bb.52:                               #   in Loop: Header=BB4_49 Depth=1
	movq	(%rax), %rcx
	movq	-24(%rcx), %rcx
	testb	$5, 32(%rax,%rcx)
	jne	.LBB4_55
# %bb.53:                               #   in Loop: Header=BB4_49 Depth=1
	movsbl	-224(%rbp), %esi
	.cfi_escape 0x2e, 0x00
	leaq	-160(%rbp), %rdi
	xorl	%edx, %edx
	callq	_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4findEcm
	cmpq	$-1, %rax
	je	.LBB4_55
# %bb.54:                               #   in Loop: Header=BB4_49 Depth=1
	movslq	%r15d, %rax
	incl	%r15d
	movq	-64(%rbp), %rcx                 # 8-byte Reload
	movl	%ebx, (%rcx,%rax,4)
.LBB4_55:                               #   in Loop: Header=BB4_49 Depth=1
	.cfi_escape 0x2e, 0x00
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	movq	%r12, %rdi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	-1568(%rbp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	incl	%ebx
	cmpl	-68(%rbp), %ebx
	jl	.LBB4_49
	jmp	.LBB4_56
.LBB4_45:                               # %.preheader401
	testl	%r15d, %r15d
	jle	.LBB4_56
# %bb.46:                               # %.lr.ph424.preheader
	xorl	%eax, %eax
	movq	-64(%rbp), %rcx                 # 8-byte Reload
.LBB4_47:                               # %.lr.ph424
                                        # =>This Inner Loop Header: Depth=1
	movl	%eax, (%rcx,%rax,4)
	incq	%rax
	cmpq	%rax, %r15
	jne	.LBB4_47
	jmp	.LBB4_56
.LBB4_44:
	xorl	%r15d, %r15d
.LBB4_56:                               # %.loopexit
	movl	%r15d, %eax
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %rcx
	movq	%rax, -56(%rbp)                 # 8-byte Spill
	leaq	15(,%rax,8), %rax
	andq	$-16, %rax
	subq	%rax, %rcx
	movq	%rcx, -104(%rbp)                # 8-byte Spill
	movq	%rcx, %rsp
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %rcx
	subq	%rax, %rcx
	movq	%rcx, -96(%rbp)                 # 8-byte Spill
	movq	%rcx, %rsp
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %rcx
	subq	%rax, %rcx
	movq	%rcx, -120(%rbp)                # 8-byte Spill
	movq	%rcx, %rsp
	movl	-44(%rbp), %eax
	imull	%r15d, %eax
	.cfi_escape 0x2e, 0x00
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	andq	$-16, %rax
	subq	%rax, %rcx
	movq	%rcx, -112(%rbp)                # 8-byte Spill
	movq	%rcx, %rsp
	testl	%r15d, %r15d
	movq	-64(%rbp), %r15                 # 8-byte Reload
	jle	.LBB4_146
# %bb.57:                               # %.lr.ph430.preheader
	xorl	%r15d, %r15d
	movl	$_ZSt4cout, %r12d
.LBB4_58:                               # %.lr.ph430
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_101 Depth 2
	movq	-64(%rbp), %rax                 # 8-byte Reload
	movl	(%rax,%r15,4), %ebx
.Ltmp42:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipSetDevice
.Ltmp43:
# %bb.59:                               #   in Loop: Header=BB4_58 Depth=1
.Ltmp45:
	.cfi_escape 0x2e, 0x00
	leaq	-1696(%rbp), %rdi
	movl	%ebx, %esi
	callq	hipGetDevicePropertiesR0600
.Ltmp46:
# %bb.60:                               #   in Loop: Header=BB4_58 Depth=1
.Ltmp47:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.10, %esi
	movl	$13, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp48:
# %bb.61:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit237
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp49:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	%ebx, %esi
	callq	_ZNSolsEi
.Ltmp50:
# %bb.62:                               #   in Loop: Header=BB4_58 Depth=1
.Ltmp51:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.11, %esi
	movl	$8, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp52:
# %bb.63:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit239
                                        #   in Loop: Header=BB4_58 Depth=1
	.cfi_escape 0x2e, 0x00
	leaq	-1696(%rbp), %r13
	movq	%r13, %rdi
	callq	strlen
.Ltmp53:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp54:
# %bb.64:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit242
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	(%r14), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp55:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp56:
# %bb.65:                               # %.noexc346
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp57:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp58:
# %bb.66:                               # %.noexc347
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp59:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp60:
# %bb.67:                               # %_ZNSolsEPFRSoS_E.exit244
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp61:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipSetDevice
.Ltmp62:
# %bb.68:                               #   in Loop: Header=BB4_58 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_99
# %bb.69:                               #   in Loop: Header=BB4_58 Depth=1
.Ltmp63:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.12, %esi
	movl	$24, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp64:
# %bb.70:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit246
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp65:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp66:
# %bb.71:                               #   in Loop: Header=BB4_58 Depth=1
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_72
# %bb.95:                               #   in Loop: Header=BB4_58 Depth=1
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp67:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp68:
	jmp	.LBB4_96
.LBB4_72:                               #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp69:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp70:
.LBB4_96:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit250
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp71:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp72:
# %bb.97:                               # %.noexc350
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp73:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp74:
# %bb.98:                               # %.noexc351
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp75:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp76:
.LBB4_99:                               # %_ZNSolsEPFRSoS_E.exit252
                                        #   in Loop: Header=BB4_58 Depth=1
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB4_114
# %bb.100:                              # %.lr.ph427.preheader
                                        #   in Loop: Header=BB4_58 Depth=1
	xorl	%r14d, %r14d
.LBB4_101:                              # %.lr.ph427
                                        #   Parent Loop BB4_58 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	imull	%r15d, %eax
	cltq
	addq	%r14, %rax
	movq	-112(%rbp), %rcx                # 8-byte Reload
	leaq	(%rcx,%rax,8), %rdi
.Ltmp77:
	.cfi_escape 0x2e, 0x00
	callq	hipStreamCreate
.Ltmp78:
# %bb.102:                              #   in Loop: Header=BB4_101 Depth=2
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_113
# %bb.103:                              #   in Loop: Header=BB4_101 Depth=2
.Ltmp79:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.13, %esi
	movl	$28, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp80:
# %bb.104:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit254
                                        #   in Loop: Header=BB4_101 Depth=2
.Ltmp81:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp82:
# %bb.105:                              #   in Loop: Header=BB4_101 Depth=2
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_106
# %bb.109:                              #   in Loop: Header=BB4_101 Depth=2
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp83:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp84:
	jmp	.LBB4_110
.LBB4_106:                              #   in Loop: Header=BB4_101 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp85:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp86:
.LBB4_110:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit258
                                        #   in Loop: Header=BB4_101 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp87:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp88:
# %bb.111:                              # %.noexc354
                                        #   in Loop: Header=BB4_101 Depth=2
.Ltmp89:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp90:
# %bb.112:                              # %.noexc355
                                        #   in Loop: Header=BB4_101 Depth=2
.Ltmp91:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp92:
.LBB4_113:                              # %_ZNSolsEPFRSoS_E.exit260
                                        #   in Loop: Header=BB4_101 Depth=2
	movl	-44(%rbp), %eax
	incq	%r14
	cmpl	%eax, %r14d
	jl	.LBB4_101
.LBB4_114:                              # %._crit_edge
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	-104(%rbp), %rax                # 8-byte Reload
	leaq	(%rax,%r15,8), %rdi
.Ltmp94:
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
.Ltmp95:
# %bb.115:                              #   in Loop: Header=BB4_58 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_124
# %bb.116:                              #   in Loop: Header=BB4_58 Depth=1
.Ltmp96:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp97:
# %bb.117:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit262
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp98:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp99:
# %bb.118:                              #   in Loop: Header=BB4_58 Depth=1
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_119
# %bb.120:                              #   in Loop: Header=BB4_58 Depth=1
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp100:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp101:
	jmp	.LBB4_121
.LBB4_119:                              #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp102:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp103:
.LBB4_121:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit266
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp104:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp105:
# %bb.122:                              # %.noexc358
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp106:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp107:
# %bb.123:                              # %.noexc359
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp108:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp109:
.LBB4_124:                              # %_ZNSolsEPFRSoS_E.exit268
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	-96(%rbp), %rax                 # 8-byte Reload
	leaq	(%rax,%r15,8), %rdi
.Ltmp110:
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
.Ltmp111:
# %bb.125:                              #   in Loop: Header=BB4_58 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_134
# %bb.126:                              #   in Loop: Header=BB4_58 Depth=1
.Ltmp112:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp113:
# %bb.127:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit270
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp114:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp115:
# %bb.128:                              #   in Loop: Header=BB4_58 Depth=1
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_129
# %bb.130:                              #   in Loop: Header=BB4_58 Depth=1
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp116:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp117:
	jmp	.LBB4_131
.LBB4_129:                              #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp118:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp119:
.LBB4_131:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit274
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp120:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp121:
# %bb.132:                              # %.noexc362
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp122:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp123:
# %bb.133:                              # %.noexc363
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp124:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp125:
.LBB4_134:                              # %_ZNSolsEPFRSoS_E.exit276
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	-120(%rbp), %rax                # 8-byte Reload
	leaq	(%rax,%r15,8), %rdi
.Ltmp126:
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %esi                  # imm = 0x3D0900
	callq	hipMalloc
.Ltmp127:
# %bb.135:                              #   in Loop: Header=BB4_58 Depth=1
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_144
# %bb.136:                              #   in Loop: Header=BB4_58 Depth=1
.Ltmp128:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.14, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp129:
# %bb.137:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit278
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp130:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp131:
# %bb.138:                              #   in Loop: Header=BB4_58 Depth=1
	movq	%rax, %r14
	testq	%rax, %rax
	je	.LBB4_139
# %bb.140:                              #   in Loop: Header=BB4_58 Depth=1
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	callq	strlen
.Ltmp132:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%r14, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp133:
	jmp	.LBB4_141
.LBB4_139:                              #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp134:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp135:
.LBB4_141:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit282
                                        #   in Loop: Header=BB4_58 Depth=1
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	addq	%r12, %rdi
.Ltmp136:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp137:
# %bb.142:                              # %.noexc366
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp138:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp139:
# %bb.143:                              # %.noexc367
                                        #   in Loop: Header=BB4_58 Depth=1
.Ltmp140:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp141:
.LBB4_144:                              # %_ZNSolsEPFRSoS_E.exit284
                                        #   in Loop: Header=BB4_58 Depth=1
	incq	%r15
	cmpq	-56(%rbp), %r15                 # 8-byte Folded Reload
	jne	.LBB4_58
# %bb.76:                               # %.preheader400
	cmpl	$0, -56(%rbp)                   # 4-byte Folded Reload
	movq	-64(%rbp), %r15                 # 8-byte Reload
	jle	.LBB4_146
# %bb.77:                               # %.preheader399.preheader
	movl	-44(%rbp), %eax
	xorl	%r12d, %r12d
	movabsq	$68719476752, %r13              # imm = 0x1000000010
.LBB4_78:                               # %.preheader399
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_80 Depth 2
	testl	%eax, %eax
	jle	.LBB4_145
# %bb.79:                               # %.lr.ph434
                                        #   in Loop: Header=BB4_78 Depth=1
	movslq	%r12d, %rax
	movq	%rax, -192(%rbp)                # 8-byte Spill
	xorl	%eax, %eax
	movq	%rax, -80(%rbp)                 # 8-byte Spill
.LBB4_80:                               #   Parent Loop BB4_78 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
.Ltmp143:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.15, %esi
	movl	$18, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp144:
# %bb.81:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit288
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp145:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	%r12d, %esi
	callq	_ZNSolsEi
.Ltmp146:
# %bb.82:                               #   in Loop: Header=BB4_80 Depth=2
.Ltmp147:
	movq	%rax, %r14
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.16, %esi
	movl	$9, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp148:
# %bb.83:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit290
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp149:
	.cfi_escape 0x2e, 0x00
	movq	%r14, %rdi
	movq	-80(%rbp), %rsi                 # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_ZNSolsEi
.Ltmp150:
# %bb.84:                               #   in Loop: Header=BB4_80 Depth=2
	movq	%rax, %r14
	movq	(%rax), %rax
	movq	-24(%rax), %rdi
	addq	%r14, %rdi
.Ltmp151:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp152:
# %bb.85:                               # %.noexc370
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp153:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r14, %rdi
	callq	_ZNSo3putEc
.Ltmp154:
# %bb.86:                               # %.noexc371
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp155:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp156:
# %bb.87:                               # %_ZNSolsEPFRSoS_E.exit292
                                        #   in Loop: Header=BB4_80 Depth=2
	movslq	-44(%rbp), %rax
	imulq	-192(%rbp), %rax                # 8-byte Folded Reload
	addq	-80(%rbp), %rax                 # 8-byte Folded Reload
	movq	-112(%rbp), %rcx                # 8-byte Reload
	movq	(%rcx,%rax,8), %r14
	movl	(%r15,%r12,4), %edi
.Ltmp158:
	.cfi_escape 0x2e, 0x00
	callq	hipSetDevice
.Ltmp159:
# %bb.88:                               #   in Loop: Header=BB4_80 Depth=2
	testl	%ebx, %ebx
	je	.LBB4_177
# %bb.89:                               #   in Loop: Header=BB4_80 Depth=2
.Ltmp160:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.17, %esi
	movl	$22, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp161:
# %bb.90:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit294
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	-80(%rbp), %rax                 # 8-byte Reload
                                        # kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	-56(%rbp)                       # 4-byte Folded Reload
                                        # kill: def $edx killed $edx def $rdx
	movq	-64(%rbp), %rax                 # 8-byte Reload
	movl	(%rax,%rdx,4), %esi
.Ltmp162:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
.Ltmp163:
# %bb.91:                               #   in Loop: Header=BB4_80 Depth=2
.Ltmp164:
	movq	%rax, %r15
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.18, %esi
	movl	$3, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp165:
# %bb.92:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit296
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp166:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp167:
# %bb.93:                               #   in Loop: Header=BB4_80 Depth=2
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_94
# %bb.173:                              #   in Loop: Header=BB4_80 Depth=2
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp168:
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp169:
	jmp	.LBB4_174
.LBB4_94:                               #   in Loop: Header=BB4_80 Depth=2
	movq	(%r15), %rax
	movq	-24(%rax), %rax
	movq	%r15, %rdi
	addq	%rax, %rdi
	movl	32(%r15,%rax), %esi
	orl	$1, %esi
.Ltmp170:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp171:
.LBB4_174:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit300
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	(%r15), %rax
	movq	-24(%rax), %rdi
	addq	%r15, %rdi
.Ltmp172:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp173:
# %bb.175:                              # %.noexc374
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp174:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%r15, %rdi
	callq	_ZNSo3putEc
.Ltmp175:
# %bb.176:                              # %.noexc375
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp176:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp177:
.LBB4_177:                              # %_ZNSolsEPFRSoS_E.exit302
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	-104(%rbp), %rax                # 8-byte Reload
	movq	(%rax,%r12,8), %rdi
.Ltmp178:
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	-184(%rbp), %rsi                # 8-byte Reload
	movl	$1, %ecx
	movq	%r14, %r8
	callq	hipMemcpyAsync
.Ltmp179:
# %bb.178:                              #   in Loop: Header=BB4_80 Depth=2
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_189
# %bb.179:                              #   in Loop: Header=BB4_80 Depth=2
.Ltmp180:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp181:
# %bb.180:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit304
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp182:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp183:
# %bb.181:                              #   in Loop: Header=BB4_80 Depth=2
	movq	%rax, %rbx
	testq	%rax, %rax
	je	.LBB4_182
# %bb.185:                              #   in Loop: Header=BB4_80 Depth=2
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	callq	strlen
.Ltmp184:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%rbx, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp185:
	jmp	.LBB4_186
.LBB4_182:                              #   in Loop: Header=BB4_80 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp186:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp187:
.LBB4_186:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit308
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp188:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp189:
# %bb.187:                              # %.noexc378
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp190:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp191:
# %bb.188:                              # %.noexc379
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp192:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp193:
.LBB4_189:                              # %_ZNSolsEPFRSoS_E.exit310
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	-96(%rbp), %rax                 # 8-byte Reload
	movq	(%rax,%r12,8), %rdi
.Ltmp194:
	.cfi_escape 0x2e, 0x00
	movl	$4000000, %edx                  # imm = 0x3D0900
	movq	-176(%rbp), %rsi                # 8-byte Reload
	movl	$1, %ecx
	movq	%r14, %r8
	callq	hipMemcpyAsync
.Ltmp195:
# %bb.190:                              #   in Loop: Header=BB4_80 Depth=2
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.LBB4_199
# %bb.191:                              #   in Loop: Header=BB4_80 Depth=2
.Ltmp196:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.1, %esi
	movl	$19, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp197:
# %bb.192:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit312
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp198:
	.cfi_escape 0x2e, 0x00
	movl	%ebx, %edi
	callq	hipGetErrorString
.Ltmp199:
# %bb.193:                              #   in Loop: Header=BB4_80 Depth=2
	movq	%rax, %r15
	testq	%rax, %rax
	je	.LBB4_194
# %bb.195:                              #   in Loop: Header=BB4_80 Depth=2
	.cfi_escape 0x2e, 0x00
	movq	%r15, %rdi
	callq	strlen
.Ltmp200:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movq	%r15, %rsi
	movq	%rax, %rdx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp201:
	jmp	.LBB4_196
.LBB4_194:                              #   in Loop: Header=BB4_80 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	leaq	_ZSt4cout(%rax), %rdi
	movl	32(%rdi), %esi
	orl	$1, %esi
.Ltmp202:
	.cfi_escape 0x2e, 0x00
	callq	_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate
.Ltmp203:
.LBB4_196:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit316
                                        #   in Loop: Header=BB4_80 Depth=2
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rdi
	movl	$_ZSt4cout, %eax
	addq	%rax, %rdi
.Ltmp204:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp205:
# %bb.197:                              # %.noexc382
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp206:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movl	$_ZSt4cout, %edi
	callq	_ZNSo3putEc
.Ltmp207:
# %bb.198:                              # %.noexc383
                                        #   in Loop: Header=BB4_80 Depth=2
.Ltmp208:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp209:
.LBB4_199:                              # %_ZNSolsEPFRSoS_E.exit318
                                        #   in Loop: Header=BB4_80 Depth=2
	movl	%ebx, -124(%rbp)                # 4-byte Spill
	movq	-104(%rbp), %rbx                # 8-byte Reload
	movq	(%rbx,%r12,8), %r8
	movq	%r14, %r10
	movq	-96(%rbp), %r14                 # 8-byte Reload
	movq	(%r14,%r12,8), %r9
	movl	m(%rip), %eax
.Ltmp211:
	.cfi_escape 0x2e, 0x20
	subq	$8, %rsp
	movq	%r13, %rdx
	movabsq	$270582939711, %rdi             # imm = 0x3F0000003F
	movl	$1, %esi
	movl	$1, %ecx
	movq	%r10, %r13
	pushq	%r10
	pushq	%rax
	movq	-120(%rbp), %r15                # 8-byte Reload
	pushq	(%r15,%r12,8)
	callq	_Z19multiply_by_element4dim3S_PfS0_S0_iP12ihipStream_t
	addq	$32, %rsp
.Ltmp212:
# %bb.200:                              #   in Loop: Header=BB4_80 Depth=2
	movq	(%rbx,%r12,8), %r8
	movq	(%r14,%r12,8), %r9
	movl	m(%rip), %eax
.Ltmp213:
	.cfi_escape 0x2e, 0x20
	subq	$8, %rsp
	movabsq	$270582939711, %rdi             # imm = 0x3F0000003F
	movl	$1, %esi
	movabsq	$68719476752, %rdx              # imm = 0x1000000010
	movl	$1, %ecx
	pushq	%r13
	pushq	%rax
	pushq	(%r15,%r12,8)
	callq	_Z17multiply_by_block4dim3S_PfS0_S0_iP12ihipStream_t
	addq	$32, %rsp
.Ltmp214:
# %bb.201:                              #   in Loop: Header=BB4_80 Depth=2
	movl	-44(%rbp), %eax
	movq	-80(%rbp), %rcx                 # 8-byte Reload
	incq	%rcx
	movq	%rcx, -80(%rbp)                 # 8-byte Spill
	cmpl	%eax, %ecx
	movq	-64(%rbp), %r15                 # 8-byte Reload
	movabsq	$68719476752, %r13              # imm = 0x1000000010
	movl	-124(%rbp), %ebx                # 4-byte Reload
	jl	.LBB4_80
.LBB4_145:                              # %._crit_edge435
                                        #   in Loop: Header=BB4_78 Depth=1
	incq	%r12
	cmpq	-56(%rbp), %r12                 # 8-byte Folded Reload
	jne	.LBB4_78
.LBB4_146:                              # %._crit_edge439
.Ltmp216:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	movl	$.L.str.19, %esi
	movl	$9, %edx
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp217:
	movq	-120(%rbp), %r12                # 8-byte Reload
# %bb.147:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit286
	movl	-44(%rbp), %esi
.Ltmp218:
	.cfi_escape 0x2e, 0x00
	movl	$_ZSt4cout, %edi
	callq	_ZNSolsEi
.Ltmp219:
# %bb.148:
.Ltmp220:
	movq	%rax, %rbx
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.20, %esi
	movl	$15, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp221:
# %bb.149:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit320
.Ltmp222:
	.cfi_escape 0x2e, 0x00
	movq	%rbx, %rdi
	movq	-56(%rbp), %rsi                 # 8-byte Reload
                                        # kill: def $esi killed $esi killed $rsi
	callq	_ZNSolsEi
.Ltmp223:
# %bb.150:
.Ltmp224:
	movq	%rax, %rbx
	.cfi_escape 0x2e, 0x00
	movl	$.L.str.21, %esi
	movl	$9, %edx
	movq	%rax, %rdi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
.Ltmp225:
# %bb.151:                              # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc.exit322
	movq	(%rbx), %rax
	movq	-24(%rax), %rdi
	addq	%rbx, %rdi
.Ltmp226:
	.cfi_escape 0x2e, 0x00
	movl	$10, %esi
	callq	_ZNKSt9basic_iosIcSt11char_traitsIcEE5widenEc
.Ltmp227:
# %bb.152:                              # %.noexc386
.Ltmp228:
	.cfi_escape 0x2e, 0x00
	movsbl	%al, %esi
	movq	%rbx, %rdi
	callq	_ZNSo3putEc
.Ltmp229:
# %bb.153:                              # %.noexc387
.Ltmp230:
	.cfi_escape 0x2e, 0x00
	movq	%rax, %rdi
	callq	_ZNSo5flushEv
.Ltmp231:
# %bb.154:                              # %_ZNSolsEPFRSoS_E.exit324.preheader
	cmpl	$0, -56(%rbp)                   # 4-byte Folded Reload
	movq	-104(%rbp), %r13                # 8-byte Reload
	jle	.LBB4_169
# %bb.155:                              # %.lr.ph444.preheader
	xorl	%ebx, %ebx
.LBB4_156:                              # %.lr.ph444
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_159 Depth 2
	movl	(%r15,%rbx,4), %edi
.Ltmp232:
	.cfi_escape 0x2e, 0x00
	callq	hipSetDevice
.Ltmp233:
# %bb.157:                              # %.preheader398
                                        #   in Loop: Header=BB4_156 Depth=1
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jle	.LBB4_161
# %bb.158:                              # %.lr.ph441.preheader
                                        #   in Loop: Header=BB4_156 Depth=1
	xorl	%r14d, %r14d
.LBB4_159:                              # %.lr.ph441
                                        #   Parent Loop BB4_156 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	imull	%ebx, %eax
	cltq
	addq	%r14, %rax
	movq	-112(%rbp), %rcx                # 8-byte Reload
	movq	(%rcx,%rax,8), %rdi
.Ltmp235:
	.cfi_escape 0x2e, 0x00
	callq	hipStreamSynchronize
.Ltmp236:
# %bb.160:                              #   in Loop: Header=BB4_159 Depth=2
	movl	-44(%rbp), %eax
	incq	%r14
	cmpl	%eax, %r14d
	jl	.LBB4_159
.LBB4_161:                              # %_ZNSolsEPFRSoS_E.exit324
                                        #   in Loop: Header=BB4_156 Depth=1
	incq	%rbx
	cmpq	-56(%rbp), %rbx                 # 8-byte Folded Reload
	jne	.LBB4_156
# %bb.162:                              # %.preheader397
	cmpl	$0, -56(%rbp)                   # 4-byte Folded Reload
	jle	.LBB4_169
# %bb.163:                              # %.preheader.preheader
	xorl	%ebx, %ebx
	movl	-44(%rbp), %eax
.LBB4_164:                              # %.preheader
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB4_166 Depth 2
	testl	%eax, %eax
	jle	.LBB4_168
# %bb.165:                              # %.lr.ph446.preheader
                                        #   in Loop: Header=BB4_164 Depth=1
	xorl	%r14d, %r14d
.LBB4_166:                              # %.lr.ph446
                                        #   Parent Loop BB4_164 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	imull	%ebx, %eax
	cltq
	addq	%r14, %rax
	movq	-112(%rbp), %rcx                # 8-byte Reload
	movq	(%rcx,%rax,8), %rdi
.Ltmp238:
	.cfi_escape 0x2e, 0x00
	callq	hipStreamDestroy
.Ltmp239:
# %bb.167:                              #   in Loop: Header=BB4_166 Depth=2
	movl	-44(%rbp), %eax
	incq	%r14
	cmpl	%eax, %r14d
	jl	.LBB4_166
.LBB4_168:                              # %._crit_edge447
                                        #   in Loop: Header=BB4_164 Depth=1
	incl	%ebx
	cmpl	-56(%rbp), %ebx                 # 4-byte Folded Reload
	jne	.LBB4_164
.LBB4_169:                              # %._crit_edge449
.Ltmp241:
	.cfi_escape 0x2e, 0x00
	movq	%r13, %rdi
	callq	hipFree
.Ltmp242:
# %bb.170:
.Ltmp243:
	.cfi_escape 0x2e, 0x00
	movq	-96(%rbp), %rdi                 # 8-byte Reload
	callq	hipFree
.Ltmp244:
# %bb.171:
.Ltmp245:
	.cfi_escape 0x2e, 0x00
	movq	%r12, %rdi
	callq	hipFree
.Ltmp246:
# %bb.172:
	movq	-168(%rbp), %rsp                # 8-byte Reload
.LBB4_37:                               # %.loopexit404
	movq	-160(%rbp), %rdi
	leaq	-144(%rbp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_39
# %bb.38:                               # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i325
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB4_39:                               # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit327
	movl	-84(%rbp), %eax                 # 4-byte Reload
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB4_40:
	.cfi_def_cfa %rbp, 16
.Ltmp32:
	jmp	.LBB4_41
.LBB4_203:
.Ltmp247:
	jmp	.LBB4_207
.LBB4_73:
.Ltmp35:
	jmp	.LBB4_207
.LBB4_74:
.Ltmp41:
	jmp	.LBB4_41
.LBB4_75:
.Ltmp38:
	jmp	.LBB4_41
.LBB4_204:
.Ltmp234:
	jmp	.LBB4_207
.LBB4_107:
.Ltmp44:
	jmp	.LBB4_207
.LBB4_206:
.Ltmp2:
	jmp	.LBB4_207
.LBB4_25:
.Ltmp29:
.LBB4_41:
	movq	%rax, %r15
	.cfi_escape 0x2e, 0x00
	leaq	-1696(%rbp), %rdi
	movl	$_ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE, %esi
	callq	_ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED2Ev
	.cfi_escape 0x2e, 0x00
	leaq	-1568(%rbp), %rdi
	callq	_ZNSt8ios_baseD2Ev
	jmp	.LBB4_208
.LBB4_212:
.Ltmp240:
	jmp	.LBB4_207
.LBB4_205:
.Ltmp237:
	jmp	.LBB4_207
.LBB4_202:
.Ltmp215:
	jmp	.LBB4_207
.LBB4_108:
.Ltmp142:
	jmp	.LBB4_207
.LBB4_183:
.Ltmp157:
	jmp	.LBB4_207
.LBB4_211:
.Ltmp93:
	jmp	.LBB4_207
.LBB4_184:
.Ltmp210:
.LBB4_207:
	movq	%rax, %r15
.LBB4_208:
	movq	-160(%rbp), %rdi
	leaq	-144(%rbp), %rax
	cmpq	%rax, %rdi
	je	.LBB4_210
# %bb.209:                              # %_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE11_M_is_localEv.exit.i.i328
	.cfi_escape 0x2e, 0x00
	callq	_ZdlPv
.LBB4_210:                              # %_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev.exit330
	.cfi_escape 0x2e, 0x00
	movq	%r15, %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:
.Lexception0:
	.byte	255                             # @LPStart Encoding = omit
	.byte	255                             # @TType Encoding = omit
	.byte	1                               # Call site Encoding = uleb128
	.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
	.uleb128 .Lfunc_begin0-.Lfunc_begin0    # >> Call Site 1 <<
	.uleb128 .Ltmp0-.Lfunc_begin0           #   Call between .Lfunc_begin0 and .Ltmp0
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp0-.Lfunc_begin0           # >> Call Site 2 <<
	.uleb128 .Ltmp1-.Ltmp0                  #   Call between .Ltmp0 and .Ltmp1
	.uleb128 .Ltmp2-.Lfunc_begin0           #     jumps to .Ltmp2
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp11-.Lfunc_begin0          # >> Call Site 3 <<
	.uleb128 .Ltmp12-.Ltmp11                #   Call between .Ltmp11 and .Ltmp12
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp30-.Lfunc_begin0          # >> Call Site 4 <<
	.uleb128 .Ltmp31-.Ltmp30                #   Call between .Ltmp30 and .Ltmp31
	.uleb128 .Ltmp32-.Lfunc_begin0          #     jumps to .Ltmp32
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp13-.Lfunc_begin0          # >> Call Site 5 <<
	.uleb128 .Ltmp10-.Ltmp13                #   Call between .Ltmp13 and .Ltmp10
	.uleb128 .Ltmp29-.Lfunc_begin0          #     jumps to .Ltmp29
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp33-.Lfunc_begin0          # >> Call Site 6 <<
	.uleb128 .Ltmp34-.Ltmp33                #   Call between .Ltmp33 and .Ltmp34
	.uleb128 .Ltmp35-.Lfunc_begin0          #     jumps to .Ltmp35
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp36-.Lfunc_begin0          # >> Call Site 7 <<
	.uleb128 .Ltmp37-.Ltmp36                #   Call between .Ltmp36 and .Ltmp37
	.uleb128 .Ltmp38-.Lfunc_begin0          #     jumps to .Ltmp38
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp39-.Lfunc_begin0          # >> Call Site 8 <<
	.uleb128 .Ltmp40-.Ltmp39                #   Call between .Ltmp39 and .Ltmp40
	.uleb128 .Ltmp41-.Lfunc_begin0          #     jumps to .Ltmp41
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp42-.Lfunc_begin0          # >> Call Site 9 <<
	.uleb128 .Ltmp43-.Ltmp42                #   Call between .Ltmp42 and .Ltmp43
	.uleb128 .Ltmp44-.Lfunc_begin0          #     jumps to .Ltmp44
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp45-.Lfunc_begin0          # >> Call Site 10 <<
	.uleb128 .Ltmp76-.Ltmp45                #   Call between .Ltmp45 and .Ltmp76
	.uleb128 .Ltmp142-.Lfunc_begin0         #     jumps to .Ltmp142
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp77-.Lfunc_begin0          # >> Call Site 11 <<
	.uleb128 .Ltmp92-.Ltmp77                #   Call between .Ltmp77 and .Ltmp92
	.uleb128 .Ltmp93-.Lfunc_begin0          #     jumps to .Ltmp93
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp94-.Lfunc_begin0          # >> Call Site 12 <<
	.uleb128 .Ltmp141-.Ltmp94               #   Call between .Ltmp94 and .Ltmp141
	.uleb128 .Ltmp142-.Lfunc_begin0         #     jumps to .Ltmp142
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp143-.Lfunc_begin0         # >> Call Site 13 <<
	.uleb128 .Ltmp156-.Ltmp143              #   Call between .Ltmp143 and .Ltmp156
	.uleb128 .Ltmp157-.Lfunc_begin0         #     jumps to .Ltmp157
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp158-.Lfunc_begin0         # >> Call Site 14 <<
	.uleb128 .Ltmp209-.Ltmp158              #   Call between .Ltmp158 and .Ltmp209
	.uleb128 .Ltmp210-.Lfunc_begin0         #     jumps to .Ltmp210
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp211-.Lfunc_begin0         # >> Call Site 15 <<
	.uleb128 .Ltmp214-.Ltmp211              #   Call between .Ltmp211 and .Ltmp214
	.uleb128 .Ltmp215-.Lfunc_begin0         #     jumps to .Ltmp215
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp216-.Lfunc_begin0         # >> Call Site 16 <<
	.uleb128 .Ltmp231-.Ltmp216              #   Call between .Ltmp216 and .Ltmp231
	.uleb128 .Ltmp247-.Lfunc_begin0         #     jumps to .Ltmp247
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp232-.Lfunc_begin0         # >> Call Site 17 <<
	.uleb128 .Ltmp233-.Ltmp232              #   Call between .Ltmp232 and .Ltmp233
	.uleb128 .Ltmp234-.Lfunc_begin0         #     jumps to .Ltmp234
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp235-.Lfunc_begin0         # >> Call Site 18 <<
	.uleb128 .Ltmp236-.Ltmp235              #   Call between .Ltmp235 and .Ltmp236
	.uleb128 .Ltmp237-.Lfunc_begin0         #     jumps to .Ltmp237
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp238-.Lfunc_begin0         # >> Call Site 19 <<
	.uleb128 .Ltmp239-.Ltmp238              #   Call between .Ltmp238 and .Ltmp239
	.uleb128 .Ltmp240-.Lfunc_begin0         #     jumps to .Ltmp240
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp241-.Lfunc_begin0         # >> Call Site 20 <<
	.uleb128 .Ltmp246-.Ltmp241              #   Call between .Ltmp241 and .Ltmp246
	.uleb128 .Ltmp247-.Lfunc_begin0         #     jumps to .Ltmp247
	.byte	0                               #   On action: cleanup
	.uleb128 .Ltmp246-.Lfunc_begin0         # >> Call Site 21 <<
	.uleb128 .Lfunc_end4-.Ltmp246           #   Call between .Ltmp246 and .Lfunc_end4
	.byte	0                               #     has no landing pad
	.byte	0                               #   On action: cleanup
.Lcst_end0:
	.p2align	2, 0x0
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_ # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	pushq	%rax
	.cfi_def_cfa_offset 32
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	leaq	16(%rdi), %rax
	movq	%rax, (%rdi)
	testq	%rsi, %rsi
	je	.LBB5_1
# %bb.2:
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	strlen
	leaq	(%rax,%rbx), %rdx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # TAILCALL
.LBB5_1:
	.cfi_def_cfa_offset 32
	movl	$.L.str.22, %edi
	callq	_ZSt19__throw_logic_errorPKc
.Lfunc_end5:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_, .Lfunc_end5-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_
	.cfi_endproc
                                        # -- End function
	.section	.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,"axG",@progbits,_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,comdat
	.weak	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag # -- Begin function _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.p2align	1, 0x90
	.type	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag,@function
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag: # @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag
	.cfi_startproc
# %bb.0:
	pushq	%r15
	.cfi_def_cfa_offset 16
	pushq	%r14
	.cfi_def_cfa_offset 24
	pushq	%r12
	.cfi_def_cfa_offset 32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	pushq	%rax
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -40
	.cfi_offset %r12, -32
	.cfi_offset %r14, -24
	.cfi_offset %r15, -16
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	subq	%rsi, %r14
	movq	%r14, (%rsp)
	cmpq	$15, %r14
	jbe	.LBB6_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	.LBB6_3
.LBB6_1:                                # %._crit_edge
	movq	(%rbx), %rax
.LBB6_3:
	testq	%r14, %r14
	je	.LBB6_7
# %bb.4:
	cmpq	$1, %r14
	jne	.LBB6_6
# %bb.5:
	movb	(%r15), %cl
	movb	%cl, (%rax)
	jmp	.LBB6_7
.LBB6_6:
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	memcpy@PLT
.LBB6_7:                                # %_ZZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tagEN6_GuardD2Ev.exit
	movq	(%rsp), %rax
	movq	%rax, 8(%rbx)
	movq	(%rbx), %rcx
	movb	$0, (%rcx,%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end6:
	.size	_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_St20forward_iterator_tag, .Lfunc_end6-_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPKcEEvT_S8_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:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -16
	movq	__hip_gpubin_handle(%rip), %rbx
	testq	%rbx, %rbx
	jne	.LBB7_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rbx
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB7_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z17multiply_matricesPfS_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z31multiply_matrices_shared_blocksPfS_S_i, %esi
	movl	$.L__unnamed_2, %edx
	movl	$.L__unnamed_2, %ecx
	movq	%rbx, %rdi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end7:
	.size	__hip_module_ctor, .Lfunc_end7-__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	.LBB8_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
.LBB8_2:
	retq
.Lfunc_end8:
	.size	__hip_module_dtor, .Lfunc_end8-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	m,@object                       # @m
	.data
	.globl	m
	.p2align	2, 0x0
m:
	.long	1000                            # 0x3e8
	.size	m, 4

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

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

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"error in kernel, "
	.size	.L.str, 18

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"error in memcpy, #="
	.size	.L.str.1, 20

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	" devices found."
	.size	.L.str.2, 16

	.type	.L.str.3,@object                # @.str.3
.L.str.3:
	.zero	1
	.size	.L.str.3, 1

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"d:i:"
	.size	.L.str.4, 5

	.type	.L.str.5,@object                # @.str.5
.L.str.5:
	.asciz	"Doing "
	.size	.L.str.5, 7

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

	.type	.L.str.7,@object                # @.str.7
.L.str.7:
	.asciz	"Error, option -d requires argument: comma delimted list of devices to run on."
	.size	.L.str.7, 78

	.type	.L.str.8,@object                # @.str.8
.L.str.8:
	.asciz	"Error, option -i requires argument: number of iterations to run."
	.size	.L.str.8, 65

	.type	.L.str.9,@object                # @.str.9
.L.str.9:
	.asciz	"Error, unknow option. Usage:\nmatmult [-d <device id>,...] [-i <number of iterations]"
	.size	.L.str.9, 85

	.type	.L.str.10,@object               # @.str.10
.L.str.10:
	.asciz	"Using device "
	.size	.L.str.10, 14

	.type	.L.str.11,@object               # @.str.11
.L.str.11:
	.asciz	", name: "
	.size	.L.str.11, 9

	.type	.L.str.12,@object               # @.str.12
.L.str.12:
	.asciz	"error setting device, #="
	.size	.L.str.12, 25

	.type	.L.str.13,@object               # @.str.13
.L.str.13:
	.asciz	"error in stream creation, #="
	.size	.L.str.13, 29

	.type	.L.str.14,@object               # @.str.14
.L.str.14:
	.asciz	"error in malloc, #="
	.size	.L.str.14, 20

	.type	.L.str.15,@object               # @.str.15
.L.str.15:
	.asciz	"Running on device "
	.size	.L.str.15, 19

	.type	.L.str.16,@object               # @.str.16
.L.str.16:
	.asciz	", stream "
	.size	.L.str.16, 10

	.type	.L.str.17,@object               # @.str.17
.L.str.17:
	.asciz	"error setting device: "
	.size	.L.str.17, 23

	.type	.L.str.18,@object               # @.str.18
.L.str.18:
	.asciz	" #="
	.size	.L.str.18, 4

	.type	.L.str.19,@object               # @.str.19
.L.str.19:
	.asciz	"Finished "
	.size	.L.str.19, 10

	.type	.L.str.20,@object               # @.str.20
.L.str.20:
	.asciz	" iterations on "
	.size	.L.str.20, 16

	.type	.L.str.21,@object               # @.str.21
.L.str.21:
	.asciz	" devices."
	.size	.L.str.21, 10

	.type	.L.str.22,@object               # @.str.22
.L.str.22:
	.asciz	"basic_string: construction from null is not valid"
	.size	.L.str.22, 50

	.type	.L__unnamed_1,@object           # @0
.L__unnamed_1:
	.asciz	"_Z17multiply_matricesPfS_S_i"
	.size	.L__unnamed_1, 29

	.type	.L__unnamed_2,@object           # @1
.L__unnamed_2:
	.asciz	"_Z31multiply_matrices_shared_blocksPfS_S_i"
	.size	.L__unnamed_2, 43

	.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 _Z32__device_stub__multiply_matricesPfS_S_i
	.addrsig_sym _Z46__device_stub__multiply_matrices_shared_blocksPfS_S_i
	.addrsig_sym __gxx_personality_v0
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Unwind_Resume
	.addrsig_sym _Z17multiply_matricesPfS_S_i
	.addrsig_sym _Z31multiply_matrices_shared_blocksPfS_S_i
	.addrsig_sym _ZSt4cout
	.addrsig_sym _ZSt4cerr
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z17multiply_matricesPfS_S_i ; -- Begin function _Z17multiply_matricesPfS_S_i
	.globl	_Z17multiply_matricesPfS_S_i
	.p2align	8
	.type	_Z17multiply_matricesPfS_S_i,@function
_Z17multiply_matricesPfS_S_i:           ; @_Z17multiply_matricesPfS_S_i
; %bb.0:
	s_load_b32 s2, s[0:1], 0x2c
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v4, 0x3ff, v0
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s3, s2, 16
	s_and_b32 s2, s2, 0xffff
	v_mad_u64_u32 v[2:3], null, s15, s3, v[1:2]
	v_mad_u64_u32 v[0:1], null, s14, s2, v[4:5]
	s_mov_b32 s2, exec_lo
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_max_u32_e32 v1, v2, v0
	v_cmpx_gt_u32_e32 0x3e8, v1
	s_cbranch_execz .LBB0_4
; %bb.1:                                ; %.preheader.preheader
	s_clause 0x2
	s_load_b32 s2, s[0:1], 0x18
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_mov_b32_e32 v5, 0
	s_mov_b32 s3, 0
	v_mov_b32_e32 v3, v0
	s_waitcnt lgkmcnt(0)
	v_mul_lo_u32 v6, v2, s2
	v_mov_b32_e32 v2, 0
.LBB0_2:                                ; %.preheader
                                        ; =>This Inner Loop Header: Depth=1
	s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(SALU_CYCLE_1)
	v_dual_mov_b32 v4, v2 :: v_dual_add_nc_u32 v1, s3, v6
	s_add_i32 s3, s3, 1
	s_cmpk_eq_i32 s3, 0x3e8
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_lshlrev_b64 v[7:8], 2, v[1:2]
	v_lshlrev_b64 v[9:10], 2, v[3:4]
	v_add_nc_u32_e32 v3, s2, v3
	s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_co_u32 v7, vcc_lo, s4, v7
	v_add_co_ci_u32_e32 v8, vcc_lo, s5, v8, vcc_lo
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_u32 v9, vcc_lo, s6, v9
	v_add_co_ci_u32_e32 v10, vcc_lo, s7, v10, vcc_lo
	global_load_b32 v1, v[7:8], off
	global_load_b32 v4, v[9:10], off
	s_waitcnt vmcnt(0)
	v_fmac_f32_e32 v5, v1, v4
	s_cbranch_scc0 .LBB0_2
; %bb.3:
	v_dual_mov_b32 v1, 0 :: v_dual_add_nc_u32 v0, v0, v6
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_lshlrev_b64 v[0:1], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s0, v0
	s_delay_alu instid0(VALU_DEP_2)
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	global_store_b32 v[0:1], v5, off
.LBB0_4:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z17multiply_matricesPfS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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 11
		.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	_Z17multiply_matricesPfS_S_i, .Lfunc_end0-_Z17multiply_matricesPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 296
; NumSgprs: 18
; NumVgprs: 11
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 1
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 11
; 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
	.protected	_Z31multiply_matrices_shared_blocksPfS_S_i ; -- Begin function _Z31multiply_matrices_shared_blocksPfS_S_i
	.globl	_Z31multiply_matrices_shared_blocksPfS_S_i
	.p2align	8
	.type	_Z31multiply_matrices_shared_blocksPfS_S_i,@function
_Z31multiply_matrices_shared_blocksPfS_S_i: ; @_Z31multiply_matrices_shared_blocksPfS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s3, s[0:1], 0x2c
	s_load_b32 s2, s[0:1], 0x18
	v_bfe_u32 v1, v0, 10, 10
	v_and_b32_e32 v0, 0x3ff, v0
	s_clause 0x1
	s_load_b128 s[4:7], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	v_lshlrev_b32_e32 v4, 6, v1
	s_waitcnt lgkmcnt(0)
	s_lshr_b32 s8, s3, 16
	v_mad_u64_u32 v[2:3], null, v1, s2, v[0:1]
	s_and_b32 s3, s3, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	s_mul_i32 s3, s14, s3
	v_mad_u64_u32 v[6:7], null, s15, s8, v[1:2]
	v_mov_b32_e32 v1, 0
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b32_e32 v7, 2, v0
	s_mul_i32 s15, s15, s2
	s_delay_alu instid0(VALU_DEP_2) | instskip(SKIP_1) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[2:3], 2, v[2:3]
	v_mul_lo_u32 v8, v6, s2
	v_add_nc_u32_e32 v5, 0x400, v7
	v_add_nc_u32_e32 v6, v4, v7
	s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_4)
	v_add_nc_u32_e32 v7, v5, v4
	v_add3_u32 v0, s3, v0, v8
	v_add_co_u32 v8, vcc_lo, s4, v2
	v_add_co_ci_u32_e32 v9, vcc_lo, s5, v3, vcc_lo
	s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_3) | instid1(VALU_DEP_3)
	v_lshlrev_b64 v[11:12], 2, v[0:1]
	v_add_co_u32 v0, vcc_lo, s6, v2
	v_add_co_ci_u32_e32 v10, vcc_lo, s7, v3, vcc_lo
	s_mov_b32 s3, 0
	v_add_co_u32 v2, vcc_lo, s0, v11
	s_delay_alu instid0(VALU_DEP_4)
	v_add_co_ci_u32_e32 v3, vcc_lo, s1, v12, vcc_lo
	s_lshl_b32 s0, s14, 4
	s_lshl_b32 s1, s15, 4
.LBB1_1:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_2 Depth 2
	s_lshl_b32 s4, s3, 4
	s_delay_alu instid0(SALU_CYCLE_1)
	s_mul_i32 s5, s4, s2
	s_add_i32 s4, s4, s1
	s_add_i32 s6, s5, s0
	s_ashr_i32 s5, s4, 31
	s_ashr_i32 s7, s6, 31
	s_lshl_b64 s[4:5], s[4:5], 2
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(SALU_CYCLE_1)
	v_add_co_u32 v11, vcc_lo, v8, s4
	v_add_co_ci_u32_e32 v12, vcc_lo, s5, v9, vcc_lo
	s_lshl_b64 s[4:5], s[6:7], 2
	v_add_co_u32 v13, vcc_lo, v0, s4
	v_add_co_ci_u32_e32 v14, vcc_lo, s5, v10, vcc_lo
	global_load_b32 v12, v[11:12], off
	global_load_b32 v13, v[13:14], off
	v_mov_b32_e32 v11, v5
	s_mov_b32 s4, 0
	s_waitcnt vmcnt(1)
	ds_store_b32 v6, v12
	s_waitcnt vmcnt(0)
	ds_store_b32 v7, v13
	s_waitcnt lgkmcnt(0)
	s_barrier
	buffer_gl0_inv
.LBB1_2:                                ;   Parent Loop BB1_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	v_add_nc_u32_e32 v12, s4, v4
	s_add_i32 s4, s4, 4
	ds_load_b32 v13, v11
	ds_load_b32 v12, v12
	v_add_nc_u32_e32 v11, 64, v11
	s_cmp_eq_u32 s4, 64
	s_waitcnt lgkmcnt(0)
	v_fmac_f32_e32 v1, v12, v13
	s_cbranch_scc0 .LBB1_2
; %bb.3:                                ;   in Loop: Header=BB1_1 Depth=1
	s_add_i32 s3, s3, 1
	global_store_b32 v[2:3], v1, off
	s_cmp_eq_u32 s3, 62
	s_waitcnt_vscnt null, 0x0
	s_barrier
	buffer_gl0_inv
	s_cbranch_scc0 .LBB1_1
; %bb.4:
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z31multiply_matrices_shared_blocksPfS_S_i
		.amdhsa_group_segment_fixed_size 2048
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.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_end1:
	.size	_Z31multiply_matrices_shared_blocksPfS_S_i, .Lfunc_end1-_Z31multiply_matrices_shared_blocksPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 440
; 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:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 0
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z17multiply_matricesPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z17multiply_matricesPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     11
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .offset:         24
        .size:           4
        .value_kind:     by_value
      - .offset:         32
        .size:           4
        .value_kind:     hidden_block_count_x
      - .offset:         36
        .size:           4
        .value_kind:     hidden_block_count_y
      - .offset:         40
        .size:           4
        .value_kind:     hidden_block_count_z
      - .offset:         44
        .size:           2
        .value_kind:     hidden_group_size_x
      - .offset:         46
        .size:           2
        .value_kind:     hidden_group_size_y
      - .offset:         48
        .size:           2
        .value_kind:     hidden_group_size_z
      - .offset:         50
        .size:           2
        .value_kind:     hidden_remainder_x
      - .offset:         52
        .size:           2
        .value_kind:     hidden_remainder_y
      - .offset:         54
        .size:           2
        .value_kind:     hidden_remainder_z
      - .offset:         72
        .size:           8
        .value_kind:     hidden_global_offset_x
      - .offset:         80
        .size:           8
        .value_kind:     hidden_global_offset_y
      - .offset:         88
        .size:           8
        .value_kind:     hidden_global_offset_z
      - .offset:         96
        .size:           2
        .value_kind:     hidden_grid_dims
    .group_segment_fixed_size: 2048
    .kernarg_segment_align: 8
    .kernarg_segment_size: 288
    .language:       OpenCL C
    .language_version:
      - 2
      - 0
    .max_flat_workgroup_size: 1024
    .name:           _Z31multiply_matrices_shared_blocksPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z31multiply_matrices_shared_blocksPfS_S_i.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
