#include <cuda.h>
#include <cstdio>
#define CUDA_CALL(call)														 \
{																			 \
	const cudaError_t error = call;											 \
	if (error != cudaSuccess) {												 \
		printf("Error: %s: %d, ", __FILE__, __LINE__);						 \
		printf("code: %d, reason: %s\n", error, cudaGetErrorString(error));	 \
		std::exit(1);														 \
	}																		 \
}

__global__ void matrix3dAdd(float *A, float *B, float *C, const int limit) {
	int x = blockIdx.x, y = blockIdx.y, z = blockIdx.z * blockDim.z + threadIdx.x;
	if (z < limit) {
		int idx = x * gridDim.y * limit + y * limit + z;
		C[idx] = A[idx] + B[idx];
	}
}

struct Shape {
	int c, h, w;
} shape;

void addOnGPU(float *A, float *B, float *&C, const Shape &shape) {
	CUDA_CALL(cudaMalloc(&C, shape.c * shape.h * shape.w * sizeof(float)));
	dim3 block(128);
	dim3 grid(shape.c, shape.h, (shape.w + block.x - 1) / block.x);
	matrix3dAdd <<<block, grid>>> (A, B, C, shape.w);
}

void read(float *&m, const Shape &shape) {
	float buf[shape.c][shape.h][shape.w];
	for (int i = 0; i < shape.c; i++) 
		for (int j = 0; j < shape.h; j++)
			for (int k = 0; k < shape.w; k++)
				scanf("%f", buf[i][j] + k);
	CUDA_CALL(cudaMalloc(&m, sizeof(buf)));
	CUDA_CALL(cudaMemcpy(m, buf, sizeof(buf), cudaMemcpyHostToDevice));
}

void print(float *m, const Shape &shape) {
	float buf[shape.c][shape.h][shape.w];
	CUDA_CALL(cudaMemcpy(buf, m, sizeof(buf), cudaMemcpyDeviceToHost));
	for (int i = 0; i < shape.c; i++) 
		for (int j = 0; j < shape.h; j++)
			for (int k = 0; k < shape.w; k++)
				printf("%f%c", buf[i][j][k], k == shape.w - 1 ? '\n' : ' ');
}

int main() {
	scanf("%d%d%d", &shape.c, &shape.h, &shape.w);
	float *A, *B, *C;
	read(A, shape);
	read(B, shape);
	addOnGPU(A, B, C, shape);
	print(C, shape);
	return 0;
}

	.file	"tmpxft_00296bc4_00000000-6_add.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2033:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2033:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%f"
.LC1:
	.string	"/home/ubuntu/Datasets/stackv2/train-structured/LucienShui/BN/master/add.cu"
.LC2:
	.string	"Error: %s: %d, "
.LC3:
	.string	"code: %d, reason: %s\n"
	.text
	.globl	_Z4readRPfRK5Shape
	.type	_Z4readRPfRK5Shape, @function
_Z4readRPfRK5Shape:
.LFB2028:
	.cfi_startproc
	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	%rdi, %r12
	pushq	%rbx
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$72, %rsp
	movslq	8(%rsi), %rdx
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movslq	4(%rsi), %rax
	movq	%rsp, %rdi
	leaq	0(,%rdx,4), %rcx
	imulq	%rdx, %rax
	movslq	(%rsi), %rdx
	imulq	%rax, %rdx
	leaq	15(,%rdx,4), %rsi
	movq	%rsi, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rdi
.L3:
	cmpq	%rdi, %rsp
	je	.L4
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L3
.L4:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L5
	orq	$0, -8(%rsp,%rdx)
.L5:
	movq	%rsp, -72(%rbp)
	leaq	0(,%rax,4), %r14
	xorl	%r9d, %r9d
	xorl	%r10d, %r10d
	shrq	$2, %r14
.L6:
	movslq	(%rbx), %rax
	cmpl	%r10d, %eax
	jle	.L9
	movq	-72(%rbp), %rax
	xorl	%r13d, %r13d
	leaq	(%rax,%r9,4), %r15
.L10:
	cmpl	%r13d, 4(%rbx)
	jle	.L21
	movq	%r15, %rsi
	xorl	%r11d, %r11d
.L8:
	cmpl	%r11d, 8(%rbx)
	jle	.L22
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r9, -104(%rbp)
	movl	%r11d, -96(%rbp)
	movl	%r10d, -92(%rbp)
	movq	%rcx, -88(%rbp)
	movq	%rsi, -80(%rbp)
	call	__isoc23_scanf@PLT
	movl	-96(%rbp), %r11d
	movq	-80(%rbp), %rsi
	movq	-88(%rbp), %rcx
	movl	-92(%rbp), %r10d
	movq	-104(%rbp), %r9
	incl	%r11d
	addq	$4, %rsi
	jmp	.L8
.L22:
	incl	%r13d
	addq	%rcx, %r15
	jmp	.L10
.L21:
	incl	%r10d
	addq	%r14, %r9
	jmp	.L6
.L9:
	movslq	8(%rbx), %rsi
	movslq	4(%rbx), %rdx
	movq	%r12, %rdi
	imulq	%rdx, %rsi
	imulq	%rax, %rsi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	movl	%eax, %r14d
	testl	%eax, %eax
	je	.L11
	movl	$38, %ecx
	leaq	.LC1(%rip), %rdx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	%r14d, %edi
	call	cudaGetErrorString@PLT
	movl	%r14d, %edx
	movq	%rax, %rcx
	jmp	.L19
.L11:
	movslq	4(%rbx), %rax
	movslq	8(%rbx), %rdx
	movl	$1, %ecx
	movq	-72(%rbp), %rsi
	movq	(%r12), %rdi
	imulq	%rax, %rdx
	movslq	(%rbx), %rax
	imulq	%rax, %rdx
	salq	$2, %rdx
	call	cudaMemcpy@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L2
	movl	$39, %ecx
	leaq	.LC1(%rip), %rdx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	%ebx, %edi
	call	cudaGetErrorString@PLT
	movl	%ebx, %edx
	movq	%rax, %rcx
.L19:
	movl	$2, %edi
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2028:
	.size	_Z4readRPfRK5Shape, .-_Z4readRPfRK5Shape
	.section	.rodata.str1.1
.LC4:
	.string	"%f%c"
	.text
	.globl	_Z5printPfRK5Shape
	.type	_Z5printPfRK5Shape, @function
_Z5printPfRK5Shape:
.LFB2029:
	.cfi_startproc
	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
	pushq	%rbx
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$56, %rsp
	movslq	8(%rsi), %rdx
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movslq	4(%rsi), %rax
	leaq	0(,%rdx,4), %r13
	imulq	%rdx, %rax
	movslq	(%rsi), %rdx
	movq	%rsp, %rsi
	imulq	%rax, %rdx
	leaq	0(,%rax,4), %r12
	salq	$2, %rdx
	leaq	15(%rdx), %rcx
	movq	%rcx, %rax
	andq	$-4096, %rcx
	andq	$-16, %rax
	subq	%rcx, %rsi
.L24:
	cmpq	%rsi, %rsp
	je	.L25
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L24
.L25:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L26
	orq	$0, -8(%rsp,%rax)
.L26:
	movq	%rdi, %rsi
	movl	$2, %ecx
	movq	%rsp, %rdi
	movq	%rsp, -72(%rbp)
	call	cudaMemcpy@PLT
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	.L27
	shrq	$2, %r12
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	jmp	.L28
.L27:
	movl	$44, %ecx
	leaq	.LC1(%rip), %rdx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$2, %edi
	call	__printf_chk@PLT
	movl	%r15d, %edi
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	movl	%r15d, %edx
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L41:
	incl	%r11d
	addq	%r12, %r10
.L28:
	cmpl	%r11d, (%rbx)
	jle	.L23
	movq	-72(%rbp), %rax
	xorl	%r14d, %r14d
	leaq	(%rax,%r10,4), %r15
.L33:
	cmpl	%r14d, 4(%rbx)
	jle	.L41
	xorl	%ecx, %ecx
.L31:
	movl	8(%rbx), %eax
	cmpl	%ecx, %eax
	jle	.L42
	decl	%eax
	movl	$32, %edx
	movl	$2, %edi
	movq	%r10, -96(%rbp)
	cmpl	%ecx, %eax
	movl	$10, %eax
	leaq	.LC4(%rip), %rsi
	movl	%r11d, -84(%rbp)
	cmove	%eax, %edx
	movb	$1, %al
	movq	%rcx, -80(%rbp)
	cvtss2sd	(%r15,%rcx,4), %xmm0
	call	__printf_chk@PLT
	movq	-80(%rbp), %rcx
	movl	-84(%rbp), %r11d
	movq	-96(%rbp), %r10
	incq	%rcx
	jmp	.L31
.L42:
	incl	%r14d
	addq	%r13, %r15
	jmp	.L33
.L23:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2029:
	.size	_Z5printPfRK5Shape, .-_Z5printPfRK5Shape
	.globl	_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i
	.type	_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i, @function
_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i:
.LFB2055:
	.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	.L43
	pushq	48(%rsp)
	.cfi_def_cfa_offset 168
	leaq	_Z11matrix3dAddPfS_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
.L43:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	addq	$152, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2055:
	.size	_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i, .-_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i
	.globl	_Z11matrix3dAddPfS_S_i
	.type	_Z11matrix3dAddPfS_S_i, @function
_Z11matrix3dAddPfS_S_i:
.LFB2056:
	.cfi_startproc
	endbr64
	jmp	_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i
	.cfi_endproc
.LFE2056:
	.size	_Z11matrix3dAddPfS_S_i, .-_Z11matrix3dAddPfS_S_i
	.globl	_Z8addOnGPUPfS_RS_RK5Shape
	.type	_Z8addOnGPUPfS_RS_RK5Shape, @function
_Z8addOnGPUPfS_RS_RK5Shape:
.LFB2027:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rcx, %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%rdi, %rbp
	movq	%rdx, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rdx, %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rcx), %esi
	imull	4(%rcx), %esi
	imull	8(%rcx), %esi
	movslq	%esi, %rsi
	salq	$2, %rsi
	call	cudaMalloc@PLT
	testl	%eax, %eax
	je	.L49
	movl	%eax, %r14d
	movl	$26, %ecx
	xorl	%eax, %eax
	movl	$2, %edi
	leaq	.LC1(%rip), %rdx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movl	%r14d, %edi
	call	cudaGetErrorString@PLT
	movl	$2, %edi
	movl	%r14d, %edx
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rcx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$1, %edi
	call	exit@PLT
.L49:
	movl	8(%r13), %eax
	movl	$33554433, %edi
	movq	0(%r13), %rdx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	salq	$7, %rdi
	movl	$1, %esi
	leal	127(%rax), %ecx
	shrl	$7, %ecx
	call	__cudaPushCallConfiguration@PLT
	testl	%eax, %eax
	jne	.L48
	movl	8(%r13), %ecx
	movq	(%rbx), %rdx
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movq	%r12, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 40
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	jmp	_Z36__device_stub__Z11matrix3dAddPfS_S_iPfS_S_i
.L48:
	.cfi_restore_state
	addq	$32, %rsp
	.cfi_def_cfa_offset 48
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2027:
	.size	_Z8addOnGPUPfS_RS_RK5Shape, .-_Z8addOnGPUPfS_RS_RK5Shape
	.section	.rodata.str1.1
.LC5:
	.string	"%d%d%d"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2030:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	8+shape(%rip), %rcx
	leaq	.LC5(%rip), %rdi
	leaq	-4(%rcx), %rdx
	leaq	-4(%rdx), %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%rbx, %rsi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movq	%rsp, %rdi
	movq	%rbx, %rsi
	call	_Z4readRPfRK5Shape
	leaq	8(%rsp), %rdi
	movq	%rbx, %rsi
	call	_Z4readRPfRK5Shape
	movq	8(%rsp), %rsi
	movq	(%rsp), %rdi
	movq	%rbx, %rcx
	leaq	16(%rsp), %rdx
	call	_Z8addOnGPUPfS_RS_RK5Shape
	movq	16(%rsp), %rdi
	movq	%rbx, %rsi
	call	_Z5printPfRK5Shape
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	je	.L53
	call	__stack_chk_fail@PLT
.L53:
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2030:
	.size	main, .-main
	.section	.rodata.str1.1
.LC6:
	.string	"_Z11matrix3dAddPfS_S_i"
	.section	.text.startup
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2058:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	pushq	$0
	.cfi_def_cfa_offset 24
	xorl	%r9d, %r9d
	orl	$-1, %r8d
	pushq	$0
	.cfi_def_cfa_offset 32
	leaq	.LC6(%rip), %rdx
	movq	%rax, %rdi
	leaq	_Z11matrix3dAddPfS_S_i(%rip), %rsi
	pushq	$0
	.cfi_def_cfa_offset 40
	movq	%rdx, %rcx
	pushq	$0
	.cfi_def_cfa_offset 48
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFunction@PLT
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	addq	$32, %rsp
	.cfi_def_cfa_offset 16
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2058:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.globl	shape
	.bss
	.align 8
	.type	shape, @object
	.size	shape, 12
shape:
	.zero	12
	.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 <cstdio>
#define CUDA_CALL(call)														 \
{																			 \
	const hipError_t error = call;											 \
	if (error != hipSuccess) {												 \
		printf("Error: %s: %d, ", __FILE__, __LINE__);						 \
		printf("code: %d, reason: %s\n", error, hipGetErrorString(error));	 \
		std::exit(1);														 \
	}																		 \
}

__global__ void matrix3dAdd(float *A, float *B, float *C, const int limit) {
	int x = blockIdx.x, y = blockIdx.y, z = blockIdx.z * blockDim.z + threadIdx.x;
	if (z < limit) {
		int idx = x * gridDim.y * limit + y * limit + z;
		C[idx] = A[idx] + B[idx];
	}
}

struct Shape {
	int c, h, w;
} shape;

void addOnGPU(float *A, float *B, float *&C, const Shape &shape) {
	CUDA_CALL(hipMalloc(&C, shape.c * shape.h * shape.w * sizeof(float)));
	dim3 block(128);
	dim3 grid(shape.c, shape.h, (shape.w + block.x - 1) / block.x);
	matrix3dAdd <<<block, grid>>> (A, B, C, shape.w);
}

void read(float *&m, const Shape &shape) {
	float buf[shape.c][shape.h][shape.w];
	for (int i = 0; i < shape.c; i++) 
		for (int j = 0; j < shape.h; j++)
			for (int k = 0; k < shape.w; k++)
				scanf("%f", buf[i][j] + k);
	CUDA_CALL(hipMalloc(&m, sizeof(buf)));
	CUDA_CALL(hipMemcpy(m, buf, sizeof(buf), hipMemcpyHostToDevice));
}

void print(float *m, const Shape &shape) {
	float buf[shape.c][shape.h][shape.w];
	CUDA_CALL(hipMemcpy(buf, m, sizeof(buf), hipMemcpyDeviceToHost));
	for (int i = 0; i < shape.c; i++) 
		for (int j = 0; j < shape.h; j++)
			for (int k = 0; k < shape.w; k++)
				printf("%f%c", buf[i][j][k], k == shape.w - 1 ? '\n' : ' ');
}

int main() {
	scanf("%d%d%d", &shape.c, &shape.h, &shape.w);
	float *A, *B, *C;
	read(A, shape);
	read(B, shape);
	addOnGPU(A, B, C, shape);
	print(C, shape);
	return 0;
}

	.text
	.file	"add.hip"
	.globl	_Z26__device_stub__matrix3dAddPfS_S_i # -- Begin function _Z26__device_stub__matrix3dAddPfS_S_i
	.type	_Z26__device_stub__matrix3dAddPfS_S_i,@function
_Z26__device_stub__matrix3dAddPfS_S_i:  # @_Z26__device_stub__matrix3dAddPfS_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	$_Z11matrix3dAddPfS_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	_Z26__device_stub__matrix3dAddPfS_S_i, .Lfunc_end0-_Z26__device_stub__matrix3dAddPfS_S_i
	.cfi_endproc
                                        # -- End function
	.globl	_Z8addOnGPUPfS_RS_RK5Shape      # -- Begin function _Z8addOnGPUPfS_RS_RK5Shape
	.type	_Z8addOnGPUPfS_RS_RK5Shape,@function
_Z8addOnGPUPfS_RS_RK5Shape:             # @_Z8addOnGPUPfS_RS_RK5Shape
	.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	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rcx, %r14
	movq	%rdx, %r12
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movslq	(%rcx), %rax
	movslq	4(%rcx), %rcx
	imulq	%rax, %rcx
	movslq	8(%r14), %rsi
	imulq	%rcx, %rsi
	shlq	$2, %rsi
	movq	%rdx, %rdi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB1_3
# %bb.1:
	movq	(%r14), %rdx
	movl	8(%r14), %ecx
	addl	$127, %ecx
	shrl	$7, %ecx
	movabsq	$4294967424, %rdi               # imm = 0x100000080
	movl	$1, %esi
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	__hipPushCallConfiguration
	testl	%eax, %eax
	je	.LBB1_4
# %bb.2:
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.LBB1_4:
	.cfi_def_cfa_offset 48
	movq	(%r12), %rdx
	movl	8(%r14), %ecx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%r12
	.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	_Z26__device_stub__matrix3dAddPfS_S_i # TAILCALL
.LBB1_3:
	.cfi_def_cfa_offset 48
	movl	%eax, %ebp
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	movl	$26, %edx
	xorl	%eax, %eax
	callq	printf
	movl	%ebp, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movl	%ebp, %esi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end1:
	.size	_Z8addOnGPUPfS_RS_RK5Shape, .Lfunc_end1-_Z8addOnGPUPfS_RS_RK5Shape
	.cfi_endproc
                                        # -- End function
	.globl	_Z4readRPfRK5Shape              # -- Begin function _Z4readRPfRK5Shape
	.type	_Z4readRPfRK5Shape,@function
_Z4readRPfRK5Shape:                     # @_Z4readRPfRK5Shape
	.cfi_startproc
# %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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	(%rsi), %edx
	movl	4(%rsi), %ecx
	movl	8(%rsi), %eax
	movq	%rax, %rsi
	imulq	%rcx, %rsi
	movq	%rdx, %r14
	movq	%rsi, -64(%rbp)                 # 8-byte Spill
	imulq	%rsi, %r14
	leaq	15(,%r14,4), %rsi
	andq	$-16, %rsi
	movq	%rsp, %rdi
	subq	%rsi, %rdi
	movq	%rdi, -56(%rbp)                 # 8-byte Spill
	movq	%rdi, %rsp
	testl	%edx, %edx
	jle	.LBB2_11
# %bb.1:                                # %.preheader28.preheader
	shlq	$2, -64(%rbp)                   # 8-byte Folded Spill
	leaq	(,%rax,4), %rsi
	movq	%rsi, -96(%rbp)                 # 8-byte Spill
	movq	-56(%rbp), %rsi                 # 8-byte Reload
	movq	%rsi, -48(%rbp)                 # 8-byte Spill
	xorl	%r8d, %r8d
	movq	%rbx, -80(%rbp)                 # 8-byte Spill
	movq	%r14, -72(%rbp)                 # 8-byte Spill
.LBB2_2:                                # %.preheader28
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB2_4 Depth 2
                                        #       Child Loop BB2_6 Depth 3
	testl	%ecx, %ecx
	jle	.LBB2_10
# %bb.3:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB2_2 Depth=1
	movq	-48(%rbp), %r14                 # 8-byte Reload
	xorl	%ebx, %ebx
	movq	%r8, -88(%rbp)                  # 8-byte Spill
.LBB2_4:                                # %.preheader
                                        #   Parent Loop BB2_2 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB2_6 Depth 3
	testl	%eax, %eax
	jle	.LBB2_8
# %bb.5:                                # %.lr.ph
                                        #   in Loop: Header=BB2_4 Depth=2
	movq	%r14, %r13
	xorl	%r12d, %r12d
.LBB2_6:                                #   Parent Loop BB2_2 Depth=1
                                        #     Parent Loop BB2_4 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	movl	$.L.str.3, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	incq	%r12
	movslq	8(%r15), %rax
	addq	$4, %r13
	cmpq	%rax, %r12
	jl	.LBB2_6
# %bb.7:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB2_4 Depth=2
	movl	4(%r15), %ecx
	movq	-88(%rbp), %r8                  # 8-byte Reload
.LBB2_8:                                # %._crit_edge
                                        #   in Loop: Header=BB2_4 Depth=2
	incq	%rbx
	movslq	%ecx, %rdx
	addq	-96(%rbp), %r14                 # 8-byte Folded Reload
	cmpq	%rdx, %rbx
	jl	.LBB2_4
# %bb.9:                                # %._crit_edge31.loopexit
                                        #   in Loop: Header=BB2_2 Depth=1
	movl	(%r15), %edx
	movq	-80(%rbp), %rbx                 # 8-byte Reload
	movq	-72(%rbp), %r14                 # 8-byte Reload
.LBB2_10:                               # %._crit_edge31
                                        #   in Loop: Header=BB2_2 Depth=1
	incq	%r8
	movslq	%edx, %rsi
	movq	-48(%rbp), %rdi                 # 8-byte Reload
	addq	-64(%rbp), %rdi                 # 8-byte Folded Reload
	movq	%rdi, -48(%rbp)                 # 8-byte Spill
	cmpq	%rsi, %r8
	jl	.LBB2_2
.LBB2_11:                               # %._crit_edge33
	shlq	$2, %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	hipMalloc
	testl	%eax, %eax
	jne	.LBB2_12
# %bb.14:
	movq	(%rbx), %rdi
	movq	-56(%rbp), %rsi                 # 8-byte Reload
	movq	%r14, %rdx
	movl	$1, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB2_15
# %bb.16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB2_12:
	.cfi_def_cfa %rbp, 16
	movl	%eax, %r15d
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	movl	$38, %edx
	xorl	%eax, %eax
	callq	printf
	movl	%r15d, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movl	%r15d, %esi
	jmp	.LBB2_13
.LBB2_15:
	movl	%eax, %ebx
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	movl	$39, %edx
	xorl	%eax, %eax
	callq	printf
	movl	%ebx, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movl	%ebx, %esi
.LBB2_13:
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end2:
	.size	_Z4readRPfRK5Shape, .Lfunc_end2-_Z4readRPfRK5Shape
	.cfi_endproc
                                        # -- End function
	.globl	_Z5printPfRK5Shape              # -- Begin function _Z5printPfRK5Shape
	.type	_Z5printPfRK5Shape,@function
_Z5printPfRK5Shape:                     # @_Z5printPfRK5Shape
	.cfi_startproc
# %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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %rsi
	movl	(%rbx), %edx
	movl	4(%rbx), %eax
	movl	8(%rbx), %ecx
	movq	%rcx, -56(%rbp)                 # 8-byte Spill
	imulq	%rcx, %rax
	movq	%rax, -48(%rbp)                 # 8-byte Spill
	imulq	%rax, %rdx
	leaq	15(,%rdx,4), %rax
	andq	$-16, %rax
	movq	%rsp, %r14
	subq	%rax, %r14
	movq	%r14, %rsp
	shlq	$2, %rdx
	movq	%r14, %rdi
	movl	$2, %ecx
	callq	hipMemcpy
	testl	%eax, %eax
	jne	.LBB3_13
# %bb.1:                                # %.preheader26
	movl	(%rbx), %ecx
	testl	%ecx, %ecx
	jle	.LBB3_12
# %bb.2:                                # %.preheader25.lr.ph
	movl	4(%rbx), %eax
	shlq	$2, -48(%rbp)                   # 8-byte Folded Spill
	shlq	$2, -56(%rbp)                   # 8-byte Folded Spill
	xorl	%esi, %esi
	movl	$10, %r12d
.LBB3_3:                                # %.preheader25
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB3_5 Depth 2
                                        #       Child Loop BB3_7 Depth 3
	testl	%eax, %eax
	jle	.LBB3_11
# %bb.4:                                # %.preheader.lr.ph
                                        #   in Loop: Header=BB3_3 Depth=1
	movq	%rsi, -64(%rbp)                 # 8-byte Spill
	movl	8(%rbx), %ecx
	movq	%r14, -72(%rbp)                 # 8-byte Spill
	xorl	%r15d, %r15d
.LBB3_5:                                # %.preheader
                                        #   Parent Loop BB3_3 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB3_7 Depth 3
	testl	%ecx, %ecx
	jle	.LBB3_9
# %bb.6:                                # %.lr.ph
                                        #   in Loop: Header=BB3_5 Depth=2
	xorl	%r13d, %r13d
.LBB3_7:                                #   Parent Loop BB3_3 Depth=1
                                        #     Parent Loop BB3_5 Depth=2
                                        # =>    This Inner Loop Header: Depth=3
	xorps	%xmm0, %xmm0
	cvtss2sd	(%r14,%r13,4), %xmm0
	decl	%ecx
	cmpq	%rcx, %r13
	movl	$32, %esi
	cmovel	%r12d, %esi
	movl	$.L.str.4, %edi
	movb	$1, %al
	callq	printf
	incq	%r13
	movslq	8(%rbx), %rcx
	cmpq	%rcx, %r13
	jl	.LBB3_7
# %bb.8:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB3_5 Depth=2
	movl	4(%rbx), %eax
.LBB3_9:                                # %._crit_edge
                                        #   in Loop: Header=BB3_5 Depth=2
	incq	%r15
	movslq	%eax, %rdx
	addq	-56(%rbp), %r14                 # 8-byte Folded Reload
	cmpq	%rdx, %r15
	jl	.LBB3_5
# %bb.10:                               # %._crit_edge29.loopexit
                                        #   in Loop: Header=BB3_3 Depth=1
	movl	(%rbx), %ecx
	movq	-72(%rbp), %r14                 # 8-byte Reload
	movq	-64(%rbp), %rsi                 # 8-byte Reload
.LBB3_11:                               # %._crit_edge29
                                        #   in Loop: Header=BB3_3 Depth=1
	incq	%rsi
	movslq	%ecx, %rdx
	addq	-48(%rbp), %r14                 # 8-byte Folded Reload
	cmpq	%rdx, %rsi
	jl	.LBB3_3
.LBB3_12:                               # %._crit_edge31
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa %rsp, 8
	retq
.LBB3_13:
	.cfi_def_cfa %rbp, 16
	movl	%eax, %r15d
	movl	$.L.str, %edi
	movl	$.L.str.1, %esi
	movl	$44, %edx
	xorl	%eax, %eax
	callq	printf
	movl	%r15d, %edi
	callq	hipGetErrorString
	movl	$.L.str.2, %edi
	movl	%r15d, %esi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	printf
	movl	$1, %edi
	callq	exit
.Lfunc_end3:
	.size	_Z5printPfRK5Shape, .Lfunc_end3-_Z5printPfRK5Shape
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%r14
	.cfi_def_cfa_offset 16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -24
	.cfi_offset %r14, -16
	movl	$.L.str.5, %edi
	movl	$shape, %esi
	movl	$shape+4, %edx
	movl	$shape+8, %ecx
	xorl	%eax, %eax
	callq	__isoc23_scanf
	leaq	16(%rsp), %rbx
	movl	$shape, %esi
	movq	%rbx, %rdi
	callq	_Z4readRPfRK5Shape
	leaq	8(%rsp), %r14
	movl	$shape, %esi
	movq	%r14, %rdi
	callq	_Z4readRPfRK5Shape
	movq	(%rbx), %rdi
	movq	(%r14), %rsi
	movq	%rsp, %rbx
	movl	$shape, %ecx
	movq	%rbx, %rdx
	callq	_Z8addOnGPUPfS_RS_RK5Shape
	movq	(%rbx), %rdi
	movl	$shape, %esi
	callq	_Z5printPfRK5Shape
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end4:
	.size	main, .Lfunc_end4-main
	.cfi_endproc
                                        # -- End function
	.p2align	4, 0x90                         # -- Begin function __hip_module_ctor
	.type	__hip_module_ctor,@function
__hip_module_ctor:                      # @__hip_module_ctor
	.cfi_startproc
# %bb.0:
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	movq	__hip_gpubin_handle(%rip), %rdi
	testq	%rdi, %rdi
	jne	.LBB5_2
# %bb.1:
	movl	$__hip_fatbin_wrapper, %edi
	callq	__hipRegisterFatBinary
	movq	%rax, %rdi
	movq	%rax, __hip_gpubin_handle(%rip)
.LBB5_2:
	xorps	%xmm0, %xmm0
	movups	%xmm0, 16(%rsp)
	movups	%xmm0, (%rsp)
	movl	$_Z11matrix3dAddPfS_S_i, %esi
	movl	$.L__unnamed_1, %edx
	movl	$.L__unnamed_1, %ecx
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	__hipRegisterFunction
	movl	$__hip_module_dtor, %edi
	addq	$40, %rsp
	.cfi_def_cfa_offset 8
	jmp	atexit                          # TAILCALL
.Lfunc_end5:
	.size	__hip_module_ctor, .Lfunc_end5-__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	.LBB6_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
.LBB6_2:
	retq
.Lfunc_end6:
	.size	__hip_module_dtor, .Lfunc_end6-__hip_module_dtor
	.cfi_endproc
                                        # -- End function
	.type	_Z11matrix3dAddPfS_S_i,@object  # @_Z11matrix3dAddPfS_S_i
	.section	.rodata,"a",@progbits
	.globl	_Z11matrix3dAddPfS_S_i
	.p2align	3, 0x0
_Z11matrix3dAddPfS_S_i:
	.quad	_Z26__device_stub__matrix3dAddPfS_S_i
	.size	_Z11matrix3dAddPfS_S_i, 8

	.type	shape,@object                   # @shape
	.bss
	.globl	shape
	.p2align	2, 0x0
shape:
	.zero	12
	.size	shape, 12

	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Error: %s: %d, "
	.size	.L.str, 16

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"/home/ubuntu/Datasets/stackv2/train-structured-repos-hip-sm89/LucienShui/BN/master/add.hip"
	.size	.L.str.1, 91

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"code: %d, reason: %s\n"
	.size	.L.str.2, 22

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

	.type	.L.str.4,@object                # @.str.4
.L.str.4:
	.asciz	"%f%c"
	.size	.L.str.4, 5

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

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

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

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

	.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 _Z26__device_stub__matrix3dAddPfS_S_i
	.addrsig_sym __hip_module_ctor
	.addrsig_sym __hip_module_dtor
	.addrsig_sym _Z11matrix3dAddPfS_S_i
	.addrsig_sym shape
	.addrsig_sym __hip_fatbin
	.addrsig_sym __hip_fatbin_wrapper
	.addrsig_sym __hip_cuid_

	.text
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.protected	_Z11matrix3dAddPfS_S_i  ; -- Begin function _Z11matrix3dAddPfS_S_i
	.globl	_Z11matrix3dAddPfS_S_i
	.p2align	8
	.type	_Z11matrix3dAddPfS_S_i,@function
_Z11matrix3dAddPfS_S_i:                 ; @_Z11matrix3dAddPfS_S_i
; %bb.0:
	s_clause 0x1
	s_load_b32 s5, s[0:1], 0x30
	s_load_b32 s4, s[0:1], 0x18
	s_add_u32 s2, s0, 32
	s_addc_u32 s3, s1, 0
	s_waitcnt lgkmcnt(0)
	s_and_b32 s5, s5, 0xffff
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
	v_mad_u64_u32 v[1:2], null, s15, s5, v[0:1]
	s_mov_b32 s5, exec_lo
	v_cmpx_gt_i32_e64 s4, v1
	s_cbranch_execz .LBB0_2
; %bb.1:
	s_load_b32 s2, s[2:3], 0x4
	s_clause 0x1
	s_load_b128 s[8:11], s[0:1], 0x0
	s_load_b64 s[0:1], s[0:1], 0x10
	s_waitcnt lgkmcnt(0)
	s_mul_i32 s2, s2, s13
	s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
	s_add_i32 s2, s2, s14
	v_mad_u64_u32 v[2:3], null, s2, s4, v[1:2]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
	v_ashrrev_i32_e32 v3, 31, v2
	v_lshlrev_b64 v[0:1], 2, v[2:3]
	s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
	v_add_co_u32 v2, vcc_lo, s8, v0
	v_add_co_ci_u32_e32 v3, vcc_lo, s9, v1, vcc_lo
	v_add_co_u32 v4, vcc_lo, s10, v0
	v_add_co_ci_u32_e32 v5, vcc_lo, s11, v1, vcc_lo
	v_add_co_u32 v0, vcc_lo, s0, v0
	global_load_b32 v2, v[2:3], off
	global_load_b32 v3, v[4:5], off
	v_add_co_ci_u32_e32 v1, vcc_lo, s1, v1, vcc_lo
	s_waitcnt vmcnt(0)
	v_add_f32_e32 v2, v2, v3
	global_store_b32 v[0:1], v2, off
.LBB0_2:
	s_nop 0
	s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
	s_endpgm
	.section	.rodata,"a",@progbits
	.p2align	6, 0x0
	.amdhsa_kernel _Z11matrix3dAddPfS_S_i
		.amdhsa_group_segment_fixed_size 0
		.amdhsa_private_segment_fixed_size 0
		.amdhsa_kernarg_size 288
		.amdhsa_user_sgpr_count 13
		.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 1
		.amdhsa_system_sgpr_workgroup_info 0
		.amdhsa_system_vgpr_workitem_id 0
		.amdhsa_next_free_vgpr 6
		.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	_Z11matrix3dAddPfS_S_i, .Lfunc_end0-_Z11matrix3dAddPfS_S_i
                                        ; -- End function
	.section	.AMDGPU.csdata,"",@progbits
; Kernel info:
; codeLenInByte = 220
; NumSgprs: 18
; NumVgprs: 6
; ScratchSize: 0
; MemoryBound: 0
; FloatMode: 240
; IeeeMode: 1
; LDSByteSize: 0 bytes/workgroup (compile time only)
; SGPRBlocks: 2
; VGPRBlocks: 0
; NumSGPRsForWavesPerEU: 18
; NumVGPRsForWavesPerEU: 6
; Occupancy: 16
; WaveLimiterHint : 0
; COMPUTE_PGM_RSRC2:SCRATCH_EN: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 13
; 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: 1
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgpu_metadata
---
amdhsa.kernels:
  - .args:
      - .address_space:  global
        .offset:         0
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         8
        .size:           8
        .value_kind:     global_buffer
      - .address_space:  global
        .offset:         16
        .size:           8
        .value_kind:     global_buffer
      - .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:           _Z11matrix3dAddPfS_S_i
    .private_segment_fixed_size: 0
    .sgpr_count:     18
    .sgpr_spill_count: 0
    .symbol:         _Z11matrix3dAddPfS_S_i.kd
    .uniform_work_group_size: 1
    .uses_dynamic_stack: false
    .vgpr_count:     6
    .vgpr_spill_count: 0
    .wavefront_size: 32
    .workgroup_processor_mode: 1
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
