Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int w, h;
int map[50][50];

void visit(int x, int y){
	int i, j;
	if (x < 0 || x >= w || y < 0 || y >= h) return;
	if (map[y][x] == 0) return;
	map[y][x] = 0;
	for (i = -1; i <=1; i++){
		for (j = -1; j <=1; j++){
			visit(x + i, y + j);
		}
	}
}

int main(void){
	int i, j;
	int ans;
	while (scanf("%d %d", &w, &h), w != 0 || h != 0){
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &map[i][j]);
			}
		}
		ans = 0;
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				if (map[i][j]){
					ans++;
					visit(j, i);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 10000
map:
	.zero	10000
	.text
	.globl	visit
	.type	visit, @function
visit:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -20(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L10
	cmpl	$0, -24(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L10
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L11
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L6
.L9:
	movl	$-1, -4(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %eax
	addl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
	addl	$1, -4(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jle	.L8
	addl	$1, -8(%rbp)
.L6:
	cmpl	$1, -8(%rbp)
	jle	.L9
	jmp	.L1
.L10:
	nop
	jmp	.L1
.L11:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	visit, .-visit
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	jmp	.L13
.L26:
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	$0, -8(%rbp)
	jmp	.L15
.L16:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L15:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L14:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L22:
	movl	$0, -8(%rbp)
	jmp	.L19
.L21:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
.L20:
	addl	$1, -8(%rbp)
.L19:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L21
	addl	$1, -12(%rbp)
.L18:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L22
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	h(%rip), %eax
	testl	%eax, %eax
	je	.L24
.L23:
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, %eax
.L25:
	testl	%eax, %eax
	jne	.L26
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.type	visit.part.0, @function
visit.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	-1(%rdi), %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movl	%eax, 4(%rsp)
	leal	2(%rdi), %eax
	movl	%eax, 56(%rsp)
	leal	-1(%rsi), %eax
	movl	%eax, 60(%rsp)
	leal	2(%rsi), %eax
	movl	%eax, 32(%rsp)
.L2:
	movl	60(%rsp), %r11d
.L32:
	movl	4(%rsp), %esi
	cmpl	$-1, %esi
	je	.L3
	cmpl	w(%rip), %esi
	jge	.L3
	cmpl	$-1, %r11d
	je	.L3
	cmpl	h(%rip), %r11d
	jge	.L3
	movslq	%r11d, %rdx
	movslq	%esi, %rax
	leaq	map(%rip), %r9
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%r9,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L3
	movl	$0, (%r9,%rax,4)
	leal	2(%r11), %eax
	leal	-1(%rsi), %r10d
	movl	%eax, 12(%rsp)
	leal	2(%rsi), %eax
	movl	%eax, 48(%rsp)
	leal	-1(%r11), %eax
	movl	%eax, 44(%rsp)
	movl	%r11d, 72(%rsp)
	movl	%r10d, %r11d
.L4:
	movl	44(%rsp), %r10d
	movl	%r11d, %eax
	movl	%r10d, %r11d
	movl	%eax, %r10d
.L31:
	cmpl	$-1, %r10d
	je	.L5
	cmpl	w(%rip), %r10d
	jge	.L5
	cmpl	$-1, %r11d
	je	.L5
	cmpl	h(%rip), %r11d
	jge	.L5
	movslq	%r11d, %rdx
	movslq	%r10d, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%r9,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L5
	movl	$0, (%r9,%rax,4)
	leal	2(%r11), %eax
	leal	-1(%r10), %r8d
	movl	%eax, (%rsp)
	leal	2(%r10), %eax
	movl	%eax, 40(%rsp)
	leal	-1(%r11), %eax
	movl	%eax, 36(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 68(%rsp)
.L6:
	movslq	%r8d, %rax
	movl	36(%rsp), %r10d
	movq	%rax, 24(%rsp)
	leal	2(%r8), %eax
	movl	%eax, 8(%rsp)
	movl	%r10d, %r12d
.L30:
	cmpl	$-1, %r8d
	je	.L7
	cmpl	w(%rip), %r8d
	jge	.L7
	cmpl	$-1, %r12d
	je	.L7
	cmpl	h(%rip), %r12d
	jge	.L7
	movslq	%r12d, %rax
	movq	24(%rsp), %rdx
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	(%r9,%rax,4), %r10d
	testl	%r10d, %r10d
	je	.L7
	leal	-1(%r12), %ebx
	leal	-2(%r12), %edi
	movl	%r8d, %r15d
	movl	%r12d, %r10d
	movl	%ebx, 20(%rsp)
	leal	-1(%r8), %r13d
	leal	3(%r12), %r11d
	movl	%edi, 16(%rsp)
	movl	%r8d, 52(%rsp)
	movl	$0, (%r9,%rax,4)
	leal	-2(%r8), %eax
.L8:
	movl	20(%rsp), %ebx
	movl	16(%rsp), %r14d
	movl	%r10d, %ebp
	movslq	%r13d, %rdx
.L29:
	cmpl	$-1, %r13d
	je	.L9
	movl	w(%rip), %esi
	cmpl	%esi, %r13d
	setge	%cl
	cmpl	$-1, %ebx
	sete	%dil
	orb	%dil, %cl
	jne	.L9
	movl	h(%rip), %ecx
	cmpl	%ecx, %ebx
	jge	.L9
	movslq	%ebx, %r12
	leaq	(%r12,%r12,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdx,%rdi,2), %rdi
	movl	(%r9,%rdi,4), %r8d
	testl	%r8d, %r8d
	je	.L9
	movl	$0, (%r9,%rdi,4)
	cmpl	$-1, %eax
	je	.L10
	cmpl	$-1, %r14d
	je	.L11
	cmpl	%eax, %esi
	jle	.L11
	cmpl	%r14d, %ecx
	jle	.L17
	movslq	%r14d, %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L17
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%r14d, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movl	76(%rsp), %eax
	cmpl	%eax, w(%rip)
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	84(%rsp), %r11d
	movq	88(%rsp), %rdx
	jg	.L17
.L14:
	cmpl	$-1, %r14d
	sete	%cl
	cmpl	w(%rip), %r13d
	jge	.L15
	testb	%cl, %cl
	jne	.L15
.L16:
	cmpl	h(%rip), %r14d
	jge	.L37
	movslq	%r14d, %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rdx,%rcx,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L37
	movl	$0, (%r9,%rcx,4)
	movl	%r14d, %esi
	movl	%r13d, %edi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movl	76(%rsp), %eax
	movl	80(%rsp), %r10d
	xorl	%ecx, %ecx
	movl	84(%rsp), %r11d
	movq	88(%rsp), %rdx
	leaq	map(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L15:
	cmpl	$-1, %ebp
	sete	%r8b
	cmpl	w(%rip), %r13d
	jl	.L24
.L21:
	cmpl	$-1, %r15d
	je	.L9
	cmpl	%r15d, w(%rip)
	jle	.L25
	testb	%cl, %cl
	jne	.L25
	cmpl	%r14d, h(%rip)
	jle	.L26
	movslq	%r14d, %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L26
	movl	$0, (%r9,%rcx,4)
	movl	%r14d, %esi
	movl	%r15d, %edi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L25:
	cmpl	%r15d, w(%rip)
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebp
	addl	$1, %ebx
	addl	$1, %r14d
	cmpl	%r11d, %ebp
	jne	.L29
	addl	$1, %r13d
	addl	$1, %r15d
	addl	$1, %eax
	cmpl	8(%rsp), %r13d
	jne	.L8
	movl	52(%rsp), %r8d
	movl	%r10d, %r12d
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r12d
	cmpl	(%rsp), %r12d
	jne	.L30
	addl	$1, %r8d
	cmpl	40(%rsp), %r8d
	jne	.L6
	movl	64(%rsp), %r11d
	movl	68(%rsp), %r10d
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %r11d
	cmpl	12(%rsp), %r11d
	jne	.L31
	movl	%r10d, %r11d
	addl	$1, %r11d
	cmpl	48(%rsp), %r11d
	jne	.L4
	movl	72(%rsp), %r11d
	.p2align 4,,10
	.p2align 3
.L3:
	addl	$1, %r11d
	cmpl	32(%rsp), %r11d
	jne	.L32
	addl	$1, 4(%rsp)
	movl	4(%rsp), %eax
	cmpl	56(%rsp), %eax
	jne	.L2
	addq	$120, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L24:
	cmpl	h(%rip), %ebx
	jge	.L20
	leaq	(%r12,%r12,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,2), %rsi
	movl	(%r9,%rsi,4), %r8d
	testl	%r8d, %r8d
	je	.L20
	movl	$0, (%r9,%rsi,4)
	movl	%r13d, %edi
	movl	%ebx, %esi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%cl, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %ecx
	.p2align 4,,10
	.p2align 3
.L20:
	cmpl	$-1, %ebp
	sete	%sil
	cmpl	w(%rip), %r13d
	setge	%r8b
	orb	%sil, %r8b
	jne	.L35
	cmpl	h(%rip), %ebp
	jge	.L21
	movslq	%ebp, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,2), %rsi
	movl	(%r9,%rsi,4), %edi
	testl	%edi, %edi
	je	.L21
	movl	$0, (%r9,%rsi,4)
	movl	%r13d, %edi
	movl	%ebp, %esi
	movq	%rdx, 104(%rsp)
	movl	%r11d, 96(%rsp)
	movl	%r10d, 88(%rsp)
	movl	%eax, 84(%rsp)
	movb	%cl, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movzbl	76(%rsp), %r8d
	movzbl	80(%rsp), %ecx
	leaq	map(%rip), %r9
	movl	84(%rsp), %eax
	movl	88(%rsp), %r10d
	movl	96(%rsp), %r11d
	movq	104(%rsp), %rdx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	h(%rip), %ebx
	jge	.L28
	leaq	(%r12,%r12,4), %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L28
	movl	$0, (%r9,%rcx,4)
	movl	%ebx, %esi
	movl	%r15d, %edi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	%r15d, w(%rip)
	jle	.L9
	testb	%r8b, %r8b
	jne	.L9
	cmpl	h(%rip), %ebp
	jge	.L9
	movslq	%ebp, %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L9
	movl	$0, (%r9,%rcx,4)
	movl	%ebp, %esi
	movl	%r15d, %edi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%eax, w(%rip)
	jle	.L14
.L34:
	leaq	(%r12,%r12,4), %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %r8d
	testl	%r8d, %r8d
	je	.L13
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%ebx, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	%eax, w(%rip)
	jle	.L14
	cmpl	$-1, %ebp
	je	.L14
	cmpl	h(%rip), %ebp
	jge	.L14
	movslq	%ebp, %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L14
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%ebp, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L10:
	cmpl	$-1, %r14d
	sete	%cl
	cmpl	w(%rip), %r13d
	jge	.L24
	testb	%cl, %cl
	je	.L16
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	h(%rip), %ebx
	jge	.L13
	jmp	.L34
.L35:
	movl	%esi, %r8d
	jmp	.L21
	.cfi_endproc
.LFE25:
	.size	visit.part.0, .-visit.part.0
	.p2align 4
	.globl	visit
	.type	visit, @function
visit:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L64
	cmpl	%edi, w(%rip)
	jg	.L66
.L64:
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	cmpl	%esi, h(%rip)
	jle	.L64
	movslq	%esi, %rdx
	movslq	%edi, %rax
	leaq	map(%rip), %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%rcx,%rax,4), %edx
	testl	%edx, %edx
	je	.L64
	movl	$0, (%rcx,%rax,4)
	jmp	visit.part.0
	.cfi_endproc
.LFE23:
	.size	visit, .-visit
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	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
	leaq	.LC0(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	h(%rip), %rdx
	xorl	%eax, %eax
	leaq	w(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	movl	h(%rip), %ecx
	movl	%eax, %edx
	orl	%ecx, %edx
	je	.L90
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	testl	%ecx, %ecx
	jle	.L76
	testl	%eax, %eax
	jle	.L72
	.p2align 4,,10
	.p2align 3
.L74:
	leaq	map(%rip), %rax
	xorl	%ebp, %ebp
	leaq	(%rax,%r14,4), %r12
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L69
	movl	h(%rip), %ecx
	addl	$1, %r13d
	cmpl	%r13d, %ecx
	jle	.L101
	addq	$50, %r14
	testl	%eax, %eax
	jg	.L74
.L72:
	leaq	map(%rip), %rdx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	movq	%rdx, 8(%rsp)
	testl	%eax, %eax
	jle	.L82
	.p2align 4,,10
	.p2align 3
.L88:
	leal	1(%r14), %edx
	leal	-1(%r14), %r9d
	movq	8(%rsp), %r12
	xorl	%ebp, %ebp
	movl	%edx, 4(%rsp)
	movl	%r14d, %edx
	movl	%r15d, %r14d
	movl	%edx, %r15d
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L77:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%eax, %ebp
	jge	.L102
.L80:
	movl	(%r12), %edx
	testl	%edx, %edx
	je	.L77
	addl	$1, %r14d
	cmpl	%ecx, %r15d
	jge	.L77
	leal	2(%rbp), %eax
	leal	-1(%rbp), %r13d
	movl	%ebp, 20(%rsp)
	movl	%eax, 16(%rsp)
	movl	%r13d, %ebp
	movl	4(%rsp), %r13d
	movl	$0, (%r12)
	movq	%r12, 24(%rsp)
	movl	%r9d, %r12d
.L78:
	movl	%ebp, %edi
	movl	%r12d, %esi
	call	visit
	movl	%ebp, %edi
	movl	%r15d, %esi
	call	visit
	movl	%ebp, %edi
	movl	%r13d, %esi
	addl	$1, %ebp
	call	visit
	cmpl	16(%rsp), %ebp
	jne	.L78
	movl	20(%rsp), %ebp
	movl	%r12d, %r9d
	movl	w(%rip), %eax
	movq	24(%rsp), %r12
	movl	h(%rip), %ecx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%eax, %ebp
	jl	.L80
	.p2align 4,,10
	.p2align 3
.L102:
	movl	%r14d, %r15d
	movl	4(%rsp), %r14d
	cmpl	%ecx, %r14d
	jge	.L82
	addq	$200, 8(%rsp)
	testl	%eax, %eax
	jg	.L88
.L82:
	movl	%r15d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
.L101:
	testl	%ecx, %ecx
	jg	.L72
.L76:
	xorl	%r15d, %r15d
	jmp	.L82
.L90:
	addq	$40, %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
.LFE24:
	.size	main, .-main
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 10000
map:
	.zero	10000
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.type	visit.part.0, @function
visit.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	-1(%rdi), %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movl	%eax, 4(%rsp)
	leal	2(%rdi), %eax
	movl	%eax, 56(%rsp)
	leal	-1(%rsi), %eax
	movl	%eax, 60(%rsp)
	leal	2(%rsi), %eax
	movl	%eax, 32(%rsp)
.L2:
	movl	60(%rsp), %r11d
.L32:
	movl	4(%rsp), %esi
	cmpl	$-1, %esi
	je	.L3
	cmpl	w(%rip), %esi
	jge	.L3
	cmpl	$-1, %r11d
	je	.L3
	cmpl	h(%rip), %r11d
	jge	.L3
	movslq	%r11d, %rdx
	movslq	%esi, %rax
	leaq	map(%rip), %r9
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%r9,%rax,4), %ebp
	testl	%ebp, %ebp
	je	.L3
	movl	$0, (%r9,%rax,4)
	leal	2(%r11), %eax
	leal	-1(%rsi), %r10d
	movl	%eax, 12(%rsp)
	leal	2(%rsi), %eax
	movl	%eax, 48(%rsp)
	leal	-1(%r11), %eax
	movl	%eax, 44(%rsp)
	movl	%r11d, 72(%rsp)
	movl	%r10d, %r11d
.L4:
	movl	44(%rsp), %r10d
	movl	%r11d, %eax
	movl	%r10d, %r11d
	movl	%eax, %r10d
.L31:
	cmpl	$-1, %r10d
	je	.L5
	cmpl	w(%rip), %r10d
	jge	.L5
	cmpl	$-1, %r11d
	je	.L5
	cmpl	h(%rip), %r11d
	jge	.L5
	movslq	%r11d, %rdx
	movslq	%r10d, %rax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%r9,%rax,4), %ebx
	testl	%ebx, %ebx
	je	.L5
	movl	$0, (%r9,%rax,4)
	leal	2(%r11), %eax
	leal	-1(%r10), %r8d
	movl	%eax, (%rsp)
	leal	2(%r10), %eax
	movl	%eax, 40(%rsp)
	leal	-1(%r11), %eax
	movl	%eax, 36(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 68(%rsp)
.L6:
	movslq	%r8d, %rax
	movl	36(%rsp), %r10d
	movq	%rax, 24(%rsp)
	leal	2(%r8), %eax
	movl	%eax, 8(%rsp)
	movl	%r10d, %r12d
.L30:
	cmpl	$-1, %r8d
	je	.L7
	cmpl	w(%rip), %r8d
	jge	.L7
	cmpl	$-1, %r12d
	je	.L7
	cmpl	h(%rip), %r12d
	jge	.L7
	movslq	%r12d, %rax
	movq	24(%rsp), %rdx
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	(%r9,%rax,4), %r10d
	testl	%r10d, %r10d
	je	.L7
	leal	-1(%r12), %ebx
	leal	-2(%r12), %edi
	movl	%r8d, %r15d
	movl	%r12d, %r10d
	movl	%ebx, 20(%rsp)
	leal	-1(%r8), %r13d
	leal	3(%r12), %r11d
	movl	%edi, 16(%rsp)
	movl	%r8d, 52(%rsp)
	movl	$0, (%r9,%rax,4)
	leal	-2(%r8), %eax
.L8:
	movl	20(%rsp), %ebx
	movl	16(%rsp), %r14d
	movl	%r10d, %ebp
	movslq	%r13d, %rdx
.L29:
	cmpl	$-1, %r13d
	je	.L9
	movl	w(%rip), %esi
	cmpl	%esi, %r13d
	setge	%cl
	cmpl	$-1, %ebx
	sete	%dil
	orb	%dil, %cl
	jne	.L9
	movl	h(%rip), %ecx
	cmpl	%ecx, %ebx
	jge	.L9
	movslq	%ebx, %r12
	leaq	(%r12,%r12,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdx,%rdi,2), %rdi
	movl	(%r9,%rdi,4), %r8d
	testl	%r8d, %r8d
	je	.L9
	movl	$0, (%r9,%rdi,4)
	cmpl	$-1, %eax
	je	.L10
	cmpl	$-1, %r14d
	je	.L11
	cmpl	%eax, %esi
	jle	.L11
	cmpl	%r14d, %ecx
	jle	.L17
	movslq	%r14d, %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L17
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%r14d, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movl	76(%rsp), %eax
	cmpl	%eax, w(%rip)
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	84(%rsp), %r11d
	movq	88(%rsp), %rdx
	jg	.L17
.L14:
	cmpl	$-1, %r14d
	sete	%cl
	cmpl	w(%rip), %r13d
	jge	.L15
	testb	%cl, %cl
	jne	.L15
.L16:
	cmpl	h(%rip), %r14d
	jge	.L37
	movslq	%r14d, %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rdx,%rcx,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L37
	movl	$0, (%r9,%rcx,4)
	movl	%r14d, %esi
	movl	%r13d, %edi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movl	76(%rsp), %eax
	movl	80(%rsp), %r10d
	xorl	%ecx, %ecx
	movl	84(%rsp), %r11d
	movq	88(%rsp), %rdx
	leaq	map(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L15:
	cmpl	$-1, %ebp
	sete	%r8b
	cmpl	w(%rip), %r13d
	jl	.L24
.L21:
	cmpl	$-1, %r15d
	je	.L9
	cmpl	%r15d, w(%rip)
	jle	.L25
	testb	%cl, %cl
	jne	.L25
	cmpl	%r14d, h(%rip)
	jle	.L26
	movslq	%r14d, %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L26
	movl	$0, (%r9,%rcx,4)
	movl	%r14d, %esi
	movl	%r15d, %edi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L25:
	cmpl	%r15d, w(%rip)
	jg	.L26
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebp
	addl	$1, %ebx
	addl	$1, %r14d
	cmpl	%r11d, %ebp
	jne	.L29
	addl	$1, %r13d
	addl	$1, %r15d
	addl	$1, %eax
	cmpl	8(%rsp), %r13d
	jne	.L8
	movl	52(%rsp), %r8d
	movl	%r10d, %r12d
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r12d
	cmpl	(%rsp), %r12d
	jne	.L30
	addl	$1, %r8d
	cmpl	40(%rsp), %r8d
	jne	.L6
	movl	64(%rsp), %r11d
	movl	68(%rsp), %r10d
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %r11d
	cmpl	12(%rsp), %r11d
	jne	.L31
	movl	%r10d, %r11d
	addl	$1, %r11d
	cmpl	48(%rsp), %r11d
	jne	.L4
	movl	72(%rsp), %r11d
	.p2align 4,,10
	.p2align 3
.L3:
	addl	$1, %r11d
	cmpl	32(%rsp), %r11d
	jne	.L32
	addl	$1, 4(%rsp)
	movl	4(%rsp), %eax
	cmpl	56(%rsp), %eax
	jne	.L2
	addq	$120, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	xorl	%ecx, %ecx
.L24:
	cmpl	h(%rip), %ebx
	jge	.L20
	leaq	(%r12,%r12,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,2), %rsi
	movl	(%r9,%rsi,4), %r8d
	testl	%r8d, %r8d
	je	.L20
	movl	$0, (%r9,%rsi,4)
	movl	%r13d, %edi
	movl	%ebx, %esi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%cl, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %ecx
	.p2align 4,,10
	.p2align 3
.L20:
	cmpl	$-1, %ebp
	sete	%sil
	cmpl	w(%rip), %r13d
	setge	%r8b
	orb	%sil, %r8b
	jne	.L35
	cmpl	h(%rip), %ebp
	jge	.L21
	movslq	%ebp, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,2), %rsi
	movl	(%r9,%rsi,4), %edi
	testl	%edi, %edi
	je	.L21
	movl	$0, (%r9,%rsi,4)
	movl	%r13d, %edi
	movl	%ebp, %esi
	movq	%rdx, 104(%rsp)
	movl	%r11d, 96(%rsp)
	movl	%r10d, 88(%rsp)
	movl	%eax, 84(%rsp)
	movb	%cl, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movzbl	76(%rsp), %r8d
	movzbl	80(%rsp), %ecx
	leaq	map(%rip), %r9
	movl	84(%rsp), %eax
	movl	88(%rsp), %r10d
	movl	96(%rsp), %r11d
	movq	104(%rsp), %rdx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	h(%rip), %ebx
	jge	.L28
	leaq	(%r12,%r12,4), %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L28
	movl	$0, (%r9,%rcx,4)
	movl	%ebx, %esi
	movl	%r15d, %edi
	movq	%rdx, 96(%rsp)
	movl	%r11d, 88(%rsp)
	movl	%r10d, 84(%rsp)
	movl	%eax, 80(%rsp)
	movb	%r8b, 76(%rsp)
	call	visit.part.0
	movq	96(%rsp), %rdx
	movl	88(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	84(%rsp), %r10d
	movl	80(%rsp), %eax
	movzbl	76(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	%r15d, w(%rip)
	jle	.L9
	testb	%r8b, %r8b
	jne	.L9
	cmpl	h(%rip), %ebp
	jge	.L9
	movslq	%ebp, %rsi
	movslq	%r15d, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %esi
	testl	%esi, %esi
	je	.L9
	movl	$0, (%r9,%rcx,4)
	movl	%ebp, %esi
	movl	%r15d, %edi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%eax, w(%rip)
	jle	.L14
.L34:
	leaq	(%r12,%r12,4), %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %r8d
	testl	%r8d, %r8d
	je	.L13
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%ebx, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	%eax, w(%rip)
	jle	.L14
	cmpl	$-1, %ebp
	je	.L14
	cmpl	h(%rip), %ebp
	jge	.L14
	movslq	%ebp, %rsi
	movslq	%eax, %rcx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rcx,%rsi,2), %rcx
	movl	(%r9,%rcx,4), %edi
	testl	%edi, %edi
	je	.L14
	movl	$0, (%r9,%rcx,4)
	movl	%eax, %edi
	movl	%ebp, %esi
	movq	%rdx, 88(%rsp)
	movl	%r11d, 84(%rsp)
	movl	%r10d, 80(%rsp)
	movl	%eax, 76(%rsp)
	call	visit.part.0
	movq	88(%rsp), %rdx
	movl	84(%rsp), %r11d
	leaq	map(%rip), %r9
	movl	80(%rsp), %r10d
	movl	76(%rsp), %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L10:
	cmpl	$-1, %r14d
	sete	%cl
	cmpl	w(%rip), %r13d
	jge	.L24
	testb	%cl, %cl
	je	.L16
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	h(%rip), %ebx
	jge	.L13
	jmp	.L34
.L35:
	movl	%esi, %r8d
	jmp	.L21
	.cfi_endproc
.LFE25:
	.size	visit.part.0, .-visit.part.0
	.p2align 4
	.globl	visit
	.type	visit, @function
visit:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L64
	cmpl	%edi, w(%rip)
	jg	.L66
.L64:
	ret
	.p2align 4,,10
	.p2align 3
.L66:
	cmpl	%esi, h(%rip)
	jle	.L64
	movslq	%esi, %rdx
	movslq	%edi, %rax
	leaq	map(%rip), %rcx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	movl	(%rcx,%rax,4), %edx
	testl	%edx, %edx
	je	.L64
	movl	$0, (%rcx,%rax,4)
	jmp	visit.part.0
	.cfi_endproc
.LFE23:
	.size	visit, .-visit
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	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
	leaq	.LC0(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	h(%rip), %rdx
	xorl	%eax, %eax
	leaq	w(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	movl	h(%rip), %ecx
	movl	%eax, %edx
	orl	%ecx, %edx
	je	.L90
	xorl	%r14d, %r14d
	xorl	%r13d, %r13d
	testl	%ecx, %ecx
	jle	.L76
	testl	%eax, %eax
	jle	.L72
	.p2align 4,,10
	.p2align 3
.L74:
	leaq	map(%rip), %rax
	xorl	%ebp, %ebp
	leaq	(%rax,%r14,4), %r12
	.p2align 4,,10
	.p2align 3
.L69:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L69
	movl	h(%rip), %ecx
	addl	$1, %r13d
	cmpl	%r13d, %ecx
	jle	.L101
	addq	$50, %r14
	testl	%eax, %eax
	jg	.L74
.L72:
	leaq	map(%rip), %rdx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	movq	%rdx, 8(%rsp)
	testl	%eax, %eax
	jle	.L82
	.p2align 4,,10
	.p2align 3
.L88:
	leal	1(%r14), %edx
	leal	-1(%r14), %r9d
	movq	8(%rsp), %r12
	xorl	%ebp, %ebp
	movl	%edx, 4(%rsp)
	movl	%r14d, %edx
	movl	%r15d, %r14d
	movl	%edx, %r15d
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L77:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%eax, %ebp
	jge	.L102
.L80:
	movl	(%r12), %edx
	testl	%edx, %edx
	je	.L77
	addl	$1, %r14d
	cmpl	%ecx, %r15d
	jge	.L77
	leal	2(%rbp), %eax
	leal	-1(%rbp), %r13d
	movl	%ebp, 20(%rsp)
	movl	%eax, 16(%rsp)
	movl	%r13d, %ebp
	movl	4(%rsp), %r13d
	movl	$0, (%r12)
	movq	%r12, 24(%rsp)
	movl	%r9d, %r12d
.L78:
	movl	%ebp, %edi
	movl	%r12d, %esi
	call	visit
	movl	%ebp, %edi
	movl	%r15d, %esi
	call	visit
	movl	%ebp, %edi
	movl	%r13d, %esi
	addl	$1, %ebp
	call	visit
	cmpl	16(%rsp), %ebp
	jne	.L78
	movl	20(%rsp), %ebp
	movl	%r12d, %r9d
	movl	w(%rip), %eax
	movq	24(%rsp), %r12
	movl	h(%rip), %ecx
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	%eax, %ebp
	jl	.L80
	.p2align 4,,10
	.p2align 3
.L102:
	movl	%r14d, %r15d
	movl	4(%rsp), %r14d
	cmpl	%ecx, %r14d
	jge	.L82
	addq	$200, 8(%rsp)
	testl	%eax, %eax
	jg	.L88
.L82:
	movl	%r15d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
.L101:
	testl	%ecx, %ecx
	jg	.L72
.L76:
	xorl	%r15d, %r15d
	jmp	.L82
.L90:
	addq	$40, %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
.LFE24:
	.size	main, .-main
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 10000
map:
	.zero	10000
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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<stdio.h>

int w, h;
int map[50][50];

void visit(int x, int y){
	int i, j;
	if (x < 0 || x >= w || y < 0 || y >= h) return;
	if (map[y][x] == 0) return;
	map[y][x] = 0;
	for (i = -1; i <=1; i++){
		for (j = -1; j <=1; j++){
			visit(x + i, y + j);
		}
	}
}

int main(void){
	int i, j;
	int ans;
	while (scanf("%d %d", &w, &h), w != 0 || h != 0){
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &map[i][j]);
			}
		}
		ans = 0;
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				if (map[i][j]){
					ans++;
					visit(j, i);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}
1 1
0
2 2
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 0
1 0 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 0 1 0 1
1 0 1 0 1
1 0 1 1 1
5 5
1 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 0 1
0 0
 1 1
0
2 2
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 1
1 0 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 1 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
0 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 0 1
0 0
 1 1
0
2 2
0 1
2 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 2
1 0 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 1 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
0 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 1 0
1 0 1 0 1
0 0
 1 1
0
2 2
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 0
1 1 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 0 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
1 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 0 1
0 0
 1 1
0
2 2
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 1
1 0 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 1 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
0 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 0 0
0 0
 1 1
0
2 2
0 1
2 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 2
1 0 1 0 0
1 0 0 1 0
5 4
1 1 1 0 1
1 1 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
0 0 0 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 1 0
1 0 1 0 1
0 0
 1 1
0
2 1
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 0
1 1 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 0 1 0 1
0 0 1 0 1
2 0 1 1 1
5 5
1 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 0 1
0 0
 1 1
0
2 1
0 1
1 0
3 2
1 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 0
1 1 1 0 1
1 0 0 1 0
5 4
1 1 1 0 1
1 0 1 0 1
0 0 1 0 1
2 0 1 1 1
5 5
1 0 1 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 0 0
1 0 1 1 1
0 0
 1 1
0
2 2
0 1
2 0
3 2
0 1 1
1 1 1
5 4
1 0 1 0 0
1 0 0 0 2
1 1 1 0 0
1 0 0 1 0
5 4
1 1 1 0 1
1 1 1 0 1
1 0 1 0 1
2 0 1 1 1
5 5
0 0 0 0 1
0 0 0 0 0
1 0 1 0 1
0 0 1 1 0
1 0 1 0 1
0 0
 1 1
0
2 2
0 1
1 0
3 2
1 1 1
1 1 1
5 4
2 0 1 0 0
1 0 1 0 0
1 0 1 0 2
1 0 0 1 0
5 4
1 1 1 0 1
1 0 1 0 1
1 0 1 0 1
1 0 1 1 1
5 5
1 0 1 0 1
0 0 0 0 1
1 0 1 0 1
0 0 1 0 0
1 0 1 0 1
0 0

0
1
1
3
1
8
 0
1
1
3
1
7
 0
1
1
3
1
5
 0
1
1
2
1
8
 0
1
1
3
1
6
 0
1
1
4
1
4
 0
1
0
1
2
2
8
 0
1
0
1
2
2
7
 0
1
1
3
1
4
 0
1
1
2
1
7

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int w, h;
int map[50][50];

void visit(int x, int y){
	int i, j;
	if (x < 0 || x >= w || y < 0 || y >= h) return;
	if (map[y][x] == 0) return;
	map[y][x] = 0;
	for (i = -1; i <=1; i++){
		for (j = -1; j <=1; j++){
			visit(x + i, y + j);
		}
	}
}

int main(void){
	int i, j;
	int ans;
	while (scanf("%d %d", &w, &h), w != 0 || h != 0){
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				scanf("%d", &map[i][j]);
			}
		}
		ans = 0;
		for (i = 0; i < h; i++){
			for (j = 0; j < w; j++){
				if (map[i][j]){
					ans++;
					visit(j, i);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 10000
map:
	.zero	10000
	.text
	.globl	visit
	.type	visit, @function
visit:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -20(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L10
	cmpl	$0, -24(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L10
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L11
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L6
.L9:
	movl	$-1, -4(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %eax
	addl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
	addl	$1, -4(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jle	.L8
	addl	$1, -8(%rbp)
.L6:
	cmpl	$1, -8(%rbp)
	jle	.L9
	jmp	.L1
.L10:
	nop
	jmp	.L1
.L11:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	visit, .-visit
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	jmp	.L13
.L26:
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	$0, -8(%rbp)
	jmp	.L15
.L16:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L15:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L14:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L22:
	movl	$0, -8(%rbp)
	jmp	.L19
.L21:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
.L20:
	addl	$1, -8(%rbp)
.L19:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L21
	addl	$1, -12(%rbp)
.L18:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L22
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	h(%rip), %eax
	testl	%eax, %eax
	je	.L24
.L23:
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, %eax
.L25:
	testl	%eax, %eax
	jne	.L26
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	w
	.bss
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 10000
map:
	.zero	10000
	.text
	.globl	visit
	.type	visit, @function
visit:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -20(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L10
	cmpl	$0, -24(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L10
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L11
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L6
.L9:
	movl	$-1, -4(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %eax
	addl	%ecx, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
	addl	$1, -4(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jle	.L8
	addl	$1, -8(%rbp)
.L6:
	cmpl	$1, -8(%rbp)
	jle	.L9
	jmp	.L1
.L10:
	nop
	jmp	.L1
.L11:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	visit, .-visit
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	jmp	.L13
.L26:
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	$0, -8(%rbp)
	jmp	.L15
.L16:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L15:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L14:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L18
.L22:
	movl	$0, -8(%rbp)
	jmp	.L19
.L21:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	visit
.L20:
	addl	$1, -8(%rbp)
.L19:
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L21
	addl	$1, -12(%rbp)
.L18:
	movl	h(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L22
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	h(%rip), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	w(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	h(%rip), %eax
	testl	%eax, %eax
	je	.L24
.L23:
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, %eax
.L25:
	testl	%eax, %eax
	jne	.L26
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.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:
