
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;



void find_alive(){

}


int main(){

	int worldX, worldY;

	printf("Please enter the width of the array : ");
	scanf("%d", &worldX);

	printf("Please enter the height of the array : ");
	scanf("%d", &worldY);

	int population = worldX * worldY;
	int* world = (int*)malloc(sizeof(int*) * population);
	int* count = (int*)malloc(sizeof(int*) * population);
	int* state = (int*)malloc(sizeof(int*) * population);
	int alive = 0;

	// Random initial polulation
	srand(time(NULL));
	for (int row = 0; row < worldY; row++)
		for (int col = 0; col < worldX; col++){
			int rand_val = rand() % 2;
			world[row*worldX + col] = rand_val;
			if (rand_val) alive += 1;
		}
			
	cout << alive;
	memcpy(state, world, sizeof(int*) * population);
	int lowest = INT_MAX;
	while (alive > 0){
		
		// Calculate alive neighbours and print polulation
		for (int row = 0; row < worldY; row++){
			//cout << "| ";
			int tmp = 0;
			for (int col = 0; col < worldX; col++){

				for (int off_row = row - 5; off_row <= row + 5; off_row++){
					for (int off_col = col - 5; off_col <= col + 5; off_col++)
						if (!(off_row < 0 || off_row >= worldY || off_col < 0 || off_col >= worldX || (off_row == row && off_col == col))) //or substract itself
							tmp += world[off_row*worldX + off_col];//tmp = tmp;				
				}

				//cout << world[row * worldX + col] << " | ";
				count[row * worldX + col] = tmp;
				if (tmp >= 34 && tmp <= 58){
					if (tmp <= 45 && state[row * worldX + col] == 0){
						state[row * worldX + col] = 1;
						alive += 1;
					}

				}
				else {
					if (state[row * worldX + col] == 1){
						state[row * worldX + col] = 0;
						alive -= 1;
					}
					
				}
				tmp = 0;
			}

			//cout << "\n";
		}

		//cout << "\n\n\n";

		//for (int row = 0; row < worldY; row++){
		//	cout << "| ";
		//	for (int col = 0; col < worldX; col++){
		//		cout << count[row * worldX + col] << " | ";
		//	}
		//	cout << "\n";
		//}


		//cout << "\n\n\n";

		memcpy(world, state, sizeof(int*) * population);
		//for (int row = 0; row < worldY; row++){
		//	cout << "| ";
		//	for (int col = 0; col < worldX; col++){
		//		cout << world[row * worldX + col] << " | ";

		//	}
		//	cout << "\n";
		//}
		if (alive < lowest){
			cout << '\n' << alive;
			lowest = alive;
		}
	}

	
	
	






	return 0;
}

	.file	"tmpxft_0020c9ed_00000000-6_cpuCode.cudafe1.cpp"
	.text
#APP
	.globl _ZSt21ios_base_library_initv

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB3639:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE3639:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.globl	_Z10find_alivev
	.type	_Z10find_alivev, @function
_Z10find_alivev:
.LFB3635:
	.cfi_startproc
	endbr64
	ret
	.cfi_endproc
.LFE3635:
	.size	_Z10find_alivev, .-_Z10find_alivev
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Please enter the width of the array : "
.LC1:
	.string	"%d"
.LC2:
	.string	"Please enter the height of the array : "
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB3636:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rsi
	movl	$2, %edi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	xorl	%r14d, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	$2, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, %rdi
	leaq	48(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	leaq	.LC2(%rip), %rsi
	movl	$2, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	leaq	52(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc23_scanf@PLT
	movl	48(%rsp), %eax
	imull	52(%rsp), %eax
	xorl	%ebx, %ebx
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	8(%rsp), %rdi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	xorl	%edi, %edi
	movq	%rax, %rbp
	call	time@PLT
	movl	%eax, %edi
	call	srand@PLT
.L4:
	cmpl	%r14d, 52(%rsp)
	jle	.L39
	xorl	%r15d, %r15d
.L7:
	cmpl	%r15d, 48(%rsp)
	jle	.L40
	call	rand@PLT
	movl	48(%rsp), %esi
	cltd
	movl	%eax, %ecx
	idivl	%r13d
	imull	%r14d, %esi
	andl	$1, %ecx
	addl	%r15d, %esi
	cmpl	$1, %ecx
	movslq	%esi, %rsi
	sbbl	$-1, %ebx
	incl	%r15d
	movl	%edx, (%r12,%rsi,4)
	jmp	.L7
.L40:
	incl	%r14d
	jmp	.L4
.L39:
	movl	%ebx, %esi
	leaq	_ZSt4cout(%rip), %rdi
	movl	$2147483647, %r13d
	call	_ZNSolsEi@PLT
	movq	8(%rsp), %rcx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	movq	%rcx, %rdx
	call	__memcpy_chk@PLT
.L8:
	testl	%ebx, %ebx
	jle	.L21
	movl	52(%rsp), %eax
	movl	48(%rsp), %r8d
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	%eax, 20(%rsp)
	imull	$-5, %r8d, %eax
	imull	$-6, %r8d, %r15d
	movl	%eax, 36(%rsp)
.L22:
	cmpl	%ecx, 20(%rsp)
	jle	.L18
	movl	36(%rsp), %edi
	movslq	%edx, %rax
	xorl	%esi, %esi
	salq	$2, %rax
	addl	%edi, %edx
	movl	%edx, 32(%rsp)
	leal	6(%rcx), %edx
	movl	%edx, 44(%rsp)
.L19:
	cmpl	%esi, %r8d
	jle	.L41
	movl	32(%rsp), %r11d
	leal	-5(%rcx), %edi
	xorl	%r9d, %r9d
	leal	6(%rsi), %r14d
.L9:
	movl	44(%rsp), %edx
	cmpl	%edx, %edi
	je	.L42
	leal	-5(%rsi), %edx
.L10:
	cmpl	%r14d, %edx
	je	.L43
	movl	%edi, %r10d
	orl	%edx, %r10d
	notl	%r10d
	shrl	$31, %r10d
	cmpl	%edi, 20(%rsp)
	setg	43(%rsp)
	testb	%r10b, 43(%rsp)
	je	.L11
	cmpl	%edx, %r8d
	jle	.L11
	cmpl	%edi, %ecx
	jne	.L25
	cmpl	%edx, %esi
	je	.L11
.L25:
	leal	(%rdx,%r11), %r10d
	movslq	%r10d, %r10
	addl	(%r12,%r10,4), %r9d
.L11:
	incl	%edx
	jmp	.L10
.L43:
	incl	%edi
	addl	%r8d, %r11d
	jmp	.L9
.L42:
	movq	24(%rsp), %rdx
	movl	%r9d, (%rdx,%rax)
	leal	-34(%r9), %edx
	cmpl	$24, %edx
	ja	.L15
	cmpl	$45, %r9d
	jg	.L16
	cmpl	$0, 0(%rbp,%rax)
	jne	.L16
	movl	$1, 0(%rbp,%rax)
	incl	%ebx
	jmp	.L16
.L15:
	cmpl	$1, 0(%rbp,%rax)
	jne	.L16
	xorl	%edx, %edx
	decl	%ebx
	movl	%edx, 0(%rbp,%rax)
.L16:
	incl	%esi
	addq	$4, %rax
	jmp	.L19
.L41:
	movl	32(%rsp), %edx
	incl	%ecx
	subl	%r15d, %edx
	jmp	.L22
.L18:
	movq	8(%rsp), %rcx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	movq	%rcx, %rdx
	call	__memcpy_chk@PLT
	cmpl	%r13d, %ebx
	jge	.L8
	movl	$10, %esi
	leaq	_ZSt4cout(%rip), %rdi
	movl	%ebx, %r13d
	call	_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
	movl	%ebx, %esi
	movq	%rax, %rdi
	call	_ZNSolsEi@PLT
	jmp	.L8
.L21:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE3636:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB3662:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE3662:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include "hip/hip_runtime.h"


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;



void find_alive(){

}


int main(){

	int worldX, worldY;

	printf("Please enter the width of the array : ");
	scanf("%d", &worldX);

	printf("Please enter the height of the array : ");
	scanf("%d", &worldY);

	int population = worldX * worldY;
	int* world = (int*)malloc(sizeof(int*) * population);
	int* count = (int*)malloc(sizeof(int*) * population);
	int* state = (int*)malloc(sizeof(int*) * population);
	int alive = 0;

	// Random initial polulation
	srand(time(NULL));
	for (int row = 0; row < worldY; row++)
		for (int col = 0; col < worldX; col++){
			int rand_val = rand() % 2;
			world[row*worldX + col] = rand_val;
			if (rand_val) alive += 1;
		}
			
	cout << alive;
	memcpy(state, world, sizeof(int*) * population);
	int lowest = INT_MAX;
	while (alive > 0){
		
		// Calculate alive neighbours and print polulation
		for (int row = 0; row < worldY; row++){
			//cout << "| ";
			int tmp = 0;
			for (int col = 0; col < worldX; col++){

				for (int off_row = row - 5; off_row <= row + 5; off_row++){
					for (int off_col = col - 5; off_col <= col + 5; off_col++)
						if (!(off_row < 0 || off_row >= worldY || off_col < 0 || off_col >= worldX || (off_row == row && off_col == col))) //or substract itself
							tmp += world[off_row*worldX + off_col];//tmp = tmp;				
				}

				//cout << world[row * worldX + col] << " | ";
				count[row * worldX + col] = tmp;
				if (tmp >= 34 && tmp <= 58){
					if (tmp <= 45 && state[row * worldX + col] == 0){
						state[row * worldX + col] = 1;
						alive += 1;
					}

				}
				else {
					if (state[row * worldX + col] == 1){
						state[row * worldX + col] = 0;
						alive -= 1;
					}
					
				}
				tmp = 0;
			}

			//cout << "\n";
		}

		//cout << "\n\n\n";

		//for (int row = 0; row < worldY; row++){
		//	cout << "| ";
		//	for (int col = 0; col < worldX; col++){
		//		cout << count[row * worldX + col] << " | ";
		//	}
		//	cout << "\n";
		//}


		//cout << "\n\n\n";

		memcpy(world, state, sizeof(int*) * population);
		//for (int row = 0; row < worldY; row++){
		//	cout << "| ";
		//	for (int col = 0; col < worldX; col++){
		//		cout << world[row * worldX + col] << " | ";

		//	}
		//	cout << "\n";
		//}
		if (alive < lowest){
			cout << '\n' << alive;
			lowest = alive;
		}
	}

	
	
	






	return 0;
}

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

                                        # End of file scope inline assembly
	.globl	_Z10find_alivev                 # -- Begin function _Z10find_alivev
	.type	_Z10find_alivev,@function
_Z10find_alivev:                        # @_Z10find_alivev
	.cfi_startproc
# %bb.0:
	retq
.Lfunc_end0:
	.size	_Z10find_alivev, .Lfunc_end0-_Z10find_alivev
	.cfi_endproc
                                        # -- End function
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r13
	.cfi_def_cfa_offset 40
	pushq	%r12
	.cfi_def_cfa_offset 48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	xorl	%r15d, %r15d
	movl	$.L.str, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	12(%rsp), %r14
	movl	$.L.str.1, %edi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movl	$.L.str.2, %edi
	xorl	%eax, %eax
	callq	printf
	leaq	28(%rsp), %r13
	movl	$.L.str.1, %edi
	movq	%r13, %rsi
	xorl	%eax, %eax
	callq	__isoc23_scanf
	movslq	(%r14), %rax
	movslq	(%r13), %rbx
	imulq	%rax, %rbx
	shlq	$3, %rbx
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, %r12
	movq	%rbx, 40(%rsp)                  # 8-byte Spill
	movq	%rbx, %rdi
	callq	malloc
	movq	%rax, 32(%rsp)                  # 8-byte Spill
	xorl	%edi, %edi
	callq	time
	movl	%eax, %edi
	callq	srand
	movl	(%r13), %eax
	testl	%eax, %eax
	jle	.LBB1_7
# %bb.1:                                # %.preheader94.preheader
	xorl	%r14d, %r14d
	movl	12(%rsp), %ecx
	xorl	%r15d, %r15d
.LBB1_2:                                # %.preheader94
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_4 Depth 2
	testl	%ecx, %ecx
	jle	.LBB1_6
# %bb.3:                                # %.lr.ph.preheader
                                        #   in Loop: Header=BB1_2 Depth=1
	xorl	%ebx, %ebx
.LBB1_4:                                # %.lr.ph
                                        #   Parent Loop BB1_2 Depth=1
                                        # =>  This Inner Loop Header: Depth=2
	callq	rand
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%eax, %edx
	andl	$-2, %edx
	movl	12(%rsp), %ecx
	movl	%r14d, %esi
	imull	%ecx, %esi
	movslq	%esi, %rsi
	addq	%rbx, %rsi
	xorl	%edi, %edi
	subl	%edx, %eax
	movl	%eax, (%r12,%rsi,4)
	setne	%dil
	addl	%edi, %r15d
	incq	%rbx
	cmpl	%ecx, %ebx
	jl	.LBB1_4
# %bb.5:                                # %._crit_edge.loopexit
                                        #   in Loop: Header=BB1_2 Depth=1
	movl	28(%rsp), %eax
.LBB1_6:                                # %._crit_edge
                                        #   in Loop: Header=BB1_2 Depth=1
	incl	%r14d
	cmpl	%eax, %r14d
	jl	.LBB1_2
.LBB1_7:                                # %._crit_edge99
	movl	$_ZSt4cout, %edi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movq	32(%rsp), %rdi                  # 8-byte Reload
	movq	%r12, %rsi
	movq	40(%rsp), %rdx                  # 8-byte Reload
	callq	memcpy@PLT
	testl	%r15d, %r15d
	jle	.LBB1_37
# %bb.8:                                # %.preheader93.preheader
	movq	%r12, %rax
	addq	$-20, %rax
	movq	%rax, 72(%rsp)                  # 8-byte Spill
	movl	$2147483647, 24(%rsp)           # 4-byte Folded Spill
                                        # imm = 0x7FFFFFFF
	movq	%r12, 80(%rsp)                  # 8-byte Spill
.LBB1_9:                                # %.preheader93
                                        # =>This Loop Header: Depth=1
                                        #     Child Loop BB1_11 Depth 2
                                        #       Child Loop BB1_13 Depth 3
                                        #         Child Loop BB1_14 Depth 4
                                        #           Child Loop BB1_15 Depth 5
	movq	%r15, 16(%rsp)                  # 8-byte Spill
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.LBB1_27
# %bb.10:                               # %.preheader.lr.ph
                                        #   in Loop: Header=BB1_9 Depth=1
	movl	12(%rsp), %ecx
	movslq	%ecx, %rdx
	movq	%rdx, 88(%rsp)                  # 8-byte Spill
	leaq	(,%rdx,4), %rsi
	leaq	(%rsi,%rsi,4), %rdx
	movq	72(%rsp), %r8                   # 8-byte Reload
	subq	%rdx, %r8
	movq	$-5, 56(%rsp)                   # 8-byte Folded Spill
	xorl	%r9d, %r9d
.LBB1_11:                               # %.preheader
                                        #   Parent Loop BB1_9 Depth=1
                                        # =>  This Loop Header: Depth=2
                                        #       Child Loop BB1_13 Depth 3
                                        #         Child Loop BB1_14 Depth 4
                                        #           Child Loop BB1_15 Depth 5
	testl	%ecx, %ecx
	movq	%r8, 96(%rsp)                   # 8-byte Spill
	jle	.LBB1_26
# %bb.12:                               # %.lr.ph107
                                        #   in Loop: Header=BB1_11 Depth=2
	leaq	5(%r9), %r10
	movq	%r9, %rdx
	imulq	88(%rsp), %rdx                  # 8-byte Folded Reload
	movq	32(%rsp), %rdi                  # 8-byte Reload
	leaq	(%rdi,%rdx,4), %rdi
	movq	$-5, %r13
	movq	$-6, %r14
	xorl	%r12d, %r12d
	movq	%rdi, 48(%rsp)                  # 8-byte Spill
.LBB1_13:                               #   Parent Loop BB1_9 Depth=1
                                        #     Parent Loop BB1_11 Depth=2
                                        # =>    This Loop Header: Depth=3
                                        #         Child Loop BB1_14 Depth 4
                                        #           Child Loop BB1_15 Depth 5
	leaq	5(%r12), %rdx
	xorl	%r15d, %r15d
	movq	%r8, 64(%rsp)                   # 8-byte Spill
	movq	%r8, %rdi
	movq	56(%rsp), %r8                   # 8-byte Reload
.LBB1_14:                               #   Parent Loop BB1_9 Depth=1
                                        #     Parent Loop BB1_11 Depth=2
                                        #       Parent Loop BB1_13 Depth=3
                                        # =>      This Loop Header: Depth=4
                                        #           Child Loop BB1_15 Depth 5
	xorl	%ebp, %ebp
.LBB1_15:                               #   Parent Loop BB1_9 Depth=1
                                        #     Parent Loop BB1_11 Depth=2
                                        #       Parent Loop BB1_13 Depth=3
                                        #         Parent Loop BB1_14 Depth=4
                                        # =>        This Inner Loop Header: Depth=5
	testq	%r8, %r8
	js	.LBB1_20
# %bb.16:                               #   in Loop: Header=BB1_15 Depth=5
	movq	%r8, %r11
	xorq	%r9, %r11
	movq	%rbp, %rbx
	xorq	$5, %rbx
	orq	%r11, %rbx
	sete	%r11b
	cmpq	%rax, %r8
	jge	.LBB1_20
# %bb.17:                               #   in Loop: Header=BB1_15 Depth=5
	leal	(%r13,%rbp), %ebx
	cmpl	%ebx, %ecx
	jbe	.LBB1_20
# %bb.18:                               #   in Loop: Header=BB1_15 Depth=5
	testb	%r11b, %r11b
	jne	.LBB1_20
# %bb.19:                               #   in Loop: Header=BB1_15 Depth=5
	addl	(%rdi,%rbp,4), %r15d
.LBB1_20:                               #   in Loop: Header=BB1_15 Depth=5
	leaq	(%r14,%rbp), %r11
	incq	%r11
	incq	%rbp
	cmpq	%rdx, %r11
	jl	.LBB1_15
# %bb.21:                               #   in Loop: Header=BB1_14 Depth=4
	leaq	1(%r8), %r11
	addq	%rsi, %rdi
	cmpq	%r10, %r8
	movq	%r11, %r8
	jl	.LBB1_14
# %bb.22:                               #   in Loop: Header=BB1_13 Depth=3
	leal	-34(%r15), %edx
	cmpl	$25, %edx
	jae	.LBB1_30
# %bb.23:                               #   in Loop: Header=BB1_13 Depth=3
	cmpl	$45, %r15d
	movq	48(%rsp), %rdi                  # 8-byte Reload
	movq	64(%rsp), %r8                   # 8-byte Reload
	ja	.LBB1_33
# %bb.24:                               #   in Loop: Header=BB1_13 Depth=3
	cmpl	$0, (%rdi,%r12,4)
	jne	.LBB1_33
# %bb.25:                               #   in Loop: Header=BB1_13 Depth=3
	movl	$1, (%rdi,%r12,4)
	movq	16(%rsp), %rdx                  # 8-byte Reload
	incl	%edx
	jmp	.LBB1_32
.LBB1_30:                               #   in Loop: Header=BB1_13 Depth=3
	movq	48(%rsp), %rdi                  # 8-byte Reload
	cmpl	$1, (%rdi,%r12,4)
	movq	64(%rsp), %r8                   # 8-byte Reload
	jne	.LBB1_33
# %bb.31:                               #   in Loop: Header=BB1_13 Depth=3
	movl	$0, (%rdi,%r12,4)
	movq	16(%rsp), %rdx                  # 8-byte Reload
	decl	%edx
.LBB1_32:                               #   in Loop: Header=BB1_13 Depth=3
	movq	%rdx, 16(%rsp)                  # 8-byte Spill
.LBB1_33:                               #   in Loop: Header=BB1_13 Depth=3
	incq	%r12
	incq	%r13
	addq	$4, %r8
	incq	%r14
	cmpq	%rcx, %r12
	jne	.LBB1_13
.LBB1_26:                               # %._crit_edge108
                                        #   in Loop: Header=BB1_11 Depth=2
	incq	%r9
	incq	56(%rsp)                        # 8-byte Folded Spill
	movq	96(%rsp), %r8                   # 8-byte Reload
	addq	%rsi, %r8
	cmpq	%rax, %r9
	jne	.LBB1_11
.LBB1_27:                               # %._crit_edge112
                                        #   in Loop: Header=BB1_9 Depth=1
	movq	80(%rsp), %rdi                  # 8-byte Reload
	movq	32(%rsp), %rsi                  # 8-byte Reload
	movq	40(%rsp), %rdx                  # 8-byte Reload
	callq	memcpy@PLT
	movq	16(%rsp), %r15                  # 8-byte Reload
	cmpl	24(%rsp), %r15d                 # 4-byte Folded Reload
	jge	.LBB1_36
# %bb.28:                               #   in Loop: Header=BB1_9 Depth=1
	movb	$10, 11(%rsp)
	movq	_ZSt4cout(%rip), %rax
	movq	-24(%rax), %rax
	cmpq	$0, _ZSt4cout+16(%rax)
	je	.LBB1_34
# %bb.29:                               #   in Loop: Header=BB1_9 Depth=1
	movl	$_ZSt4cout, %edi
	movl	$1, %edx
	leaq	11(%rsp), %rsi
	callq	_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l
	movq	%rax, %rbp
	jmp	.LBB1_35
.LBB1_34:                               #   in Loop: Header=BB1_9 Depth=1
	movl	$_ZSt4cout, %ebp
	movl	$_ZSt4cout, %edi
	movl	$10, %esi
	callq	_ZNSo3putEc
.LBB1_35:                               # %_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c.exit
                                        #   in Loop: Header=BB1_9 Depth=1
	movq	%rbp, %rdi
	movl	%r15d, %esi
	callq	_ZNSolsEi
	movl	%r15d, %eax
	movl	%r15d, 24(%rsp)                 # 4-byte Spill
.LBB1_36:                               #   in Loop: Header=BB1_9 Depth=1
	testl	%r15d, %r15d
	jg	.LBB1_9
.LBB1_37:                               # %._crit_edge116
	xorl	%eax, %eax
	addq	$104, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%r12
	.cfi_def_cfa_offset 40
	popq	%r13
	.cfi_def_cfa_offset 32
	popq	%r14
	.cfi_def_cfa_offset 24
	popq	%r15
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	retq
.Lfunc_end1:
	.size	main, .Lfunc_end1-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"Please enter the width of the array : "
	.size	.L.str, 39

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

	.type	.L.str.2,@object                # @.str.2
.L.str.2:
	.asciz	"Please enter the height of the array : "
	.size	.L.str.2, 40

	.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 _ZSt4cout
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
