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 land[50][50]={0};

void dfs(int a, int b, int c, int d){

  int i,j;
  
  land[a][b]=0;

  for(i = -1; i <= 1; i++) for(j = -1; j <= 1; j++) if(a+i >= 0 && b+j >= 0 && a+i < c && b+j < d) if(land[a+i][b+j] == 1) dfs(a+i,b+j,c,d);

}

int main(){

  int w,h,result=0,i,j;

  while(1){
    
    scanf("%d %d",&w,&h);
    
    if(w == 0 && h == 0) return 0;
    
    result=0;
    
    for(i = 0; i < h; i++) for(j = 0; j < w; j++) scanf("%d",&land[j][i]);
    
    for(i = 0; i < h; i++){
      
      for(j = 0; j < w; j++){
	
	if(land[j][i] == 1){
	  
	  result++;
	  
	  dfs(j,i,w,h);
	  
	}
	
      }
      
    }
    
    printf("%d\n",result);
    
  }
  
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	land
	.bss
	.align 32
	.type	land, @object
	.size	land, 10000
land:
	.zero	10000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.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)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%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	land(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$-1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rcx
	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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
.L4:
	addl	$1, -4(%rbp)
.L3:
	cmpl	$1, -4(%rbp)
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	cmpl	$1, -8(%rbp)
	jle	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
.L19:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	jmp	.L21
.L8:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-16(%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	land(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	movl	$0, -16(%rbp)
	jmp	.L14
.L18:
	movl	$0, -12(%rbp)
	jmp	.L15
.L17:
	movl	-16(%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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -20(%rbp)
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L16:
	addl	$1, -12(%rbp)
.L15:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L21:
	call	__stack_chk_fail@PLT
.L20:
	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
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %eax
	movslq	%esi, %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movslq	%eax, %rsi
	movq	%rdi, %r10
	movl	%eax, %r8d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	(%rsi,%rsi,4), %rsi
	leal	-2(%rax), %r9d
	movl	%r10d, %r15d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	(%rsi,%rsi,4), %rsi
	leal	3(%r10), %r11d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leal	-1(%rax), %ebp
	addl	$2, %eax
	leaq	(%rdi,%rsi,2), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	land(%rip), %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movl	$0, (%rdi,%rsi,4)
	movl	%eax, 4(%rsp)
	leal	-2(%r10), %eax
	movl	%r8d, %r10d
	movl	%eax, 16(%rsp)
.L2:
	movslq	%ebp, %rax
	movl	16(%rsp), %r12d
	movl	%r15d, %ebx
	leaq	(%rax,%rax,4), %r14
	leaq	0(,%r14,4), %r8
.L21:
	testl	%ebp, %ebp
	js	.L3
	leal	-1(%rbx), %r13d
	movl	%r13d, %eax
	cmpl	%r13d, %ecx
	notl	%eax
	setg	%sil
	shrl	$31, %eax
	testb	%al, %sil
	je	.L3
	cmpl	%edx, %ebp
	jl	.L59
.L3:
	addl	$1, %ebx
	addl	$1, %r12d
	cmpl	%r11d, %ebx
	jne	.L21
	addl	$1, %ebp
	addl	$1, %r10d
	addl	$1, %r9d
	cmpl	4(%rsp), %ebp
	jne	.L2
	addq	$88, %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
.L59:
	.cfi_restore_state
	movslq	%r13d, %rax
	leaq	(%r14,%r8), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L3
	movl	$0, (%rdi,%rsi,4)
	testl	%r9d, %r9d
	js	.L60
	cmpl	%r9d, %edx
	movl	%r12d, %esi
	notl	%esi
	setg	56(%rsp)
	cmpl	%r12d, %ecx
	movl	%esi, 8(%rsp)
	setg	%dil
	shrl	$31, %esi
	testb	%sil, %dil
	je	.L7
	cmpb	$0, 56(%rsp)
	jne	.L61
.L7:
	cmpl	%r9d, %edx
	jg	.L36
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, 20(%rsp)
	jmp	.L9
.L60:
	movl	%r12d, %edi
	notl	%edi
	movl	%edi, 8(%rsp)
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, 20(%rsp)
.L9:
	movl	8(%rsp), %esi
	shrl	$31, %esi
	cmpl	%r12d, %ecx
	setg	%dil
	andb	%sil, %dil
	movb	%dil, 8(%rsp)
	jne	.L11
.L14:
	leaq	(%r14,%r8), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	je	.L62
.L12:
	movl	20(%rsp), %esi
	testl	%esi, %esi
	jns	.L13
	cmpl	%ebx, %ecx
	jg	.L63
.L13:
	testl	%r10d, %r10d
	js	.L3
	cmpl	%r10d, %edx
	setg	56(%rsp)
	jle	.L3
	cmpb	$0, 8(%rsp)
	jne	.L64
	cmpl	%r10d, %edx
	jle	.L3
	movslq	%r10d, %rdi
	movq	%rdi, 8(%rsp)
.L18:
	movq	8(%rsp), %rdi
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rax
	cmpl	$1, (%rdi,%rax,4)
	je	.L65
.L19:
	movl	20(%rsp), %eax
	shrl	$31, %eax
	cmpl	%ebx, %ecx
	setg	%sil
	testb	%al, %sil
	je	.L3
	cmpb	$0, 56(%rsp)
	je	.L3
	movq	8(%rsp), %rdi
	movslq	%ebx, %rax
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rax
	cmpl	$1, (%rdi,%rax,4)
	jne	.L3
	movl	%r10d, %edi
	movl	%ebx, %esi
	movq	%r8, 40(%rsp)
	movl	%r11d, 32(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%ecx, 56(%rsp)
	movl	%edx, 20(%rsp)
	movl	%r10d, 8(%rsp)
	call	dfs
	movq	40(%rsp), %r8
	movl	32(%rsp), %r11d
	movl	24(%rsp), %r9d
	movl	56(%rsp), %ecx
	movl	20(%rsp), %edx
	movl	8(%rsp), %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L36:
	movslq	%r9d, %rdi
	movq	%rdi, 24(%rsp)
.L10:
	movq	24(%rsp), %rdi
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	je	.L66
.L8:
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, %esi
	movl	%edi, 20(%rsp)
	shrl	$31, %esi
	cmpl	%ebx, %ecx
	setg	%dil
	testb	%sil, %dil
	je	.L9
	cmpb	$0, 56(%rsp)
	je	.L9
	movq	24(%rsp), %rdi
	movslq	%ebx, %rsi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L9
	movl	%r9d, %edi
	movl	%ebx, %esi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r10d, 48(%rsp)
	movq	%rax, 40(%rsp)
	movl	%ecx, 32(%rsp)
	movl	%edx, 24(%rsp)
	movl	%r9d, 56(%rsp)
	call	dfs
	movl	56(%rsp), %r9d
	movl	24(%rsp), %edx
	movl	32(%rsp), %ecx
	movq	40(%rsp), %rax
	movl	48(%rsp), %r10d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L9
.L61:
	movslq	%r9d, %rdi
	movslq	%r12d, %rsi
	movq	%rdi, 24(%rsp)
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L10
	movl	%r9d, %edi
	movl	%r12d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r9d, 20(%rsp)
	call	dfs
	movl	20(%rsp), %r9d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movq	48(%rsp), %rax
	movl	60(%rsp), %r10d
	movl	64(%rsp), %r11d
	movq	72(%rsp), %r8
	jmp	.L10
.L62:
	movl	%r13d, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movq	64(%rsp), %r8
	movl	60(%rsp), %r11d
	movl	48(%rsp), %r9d
	movl	40(%rsp), %r10d
	movq	32(%rsp), %rax
	movl	24(%rsp), %ecx
	movl	56(%rsp), %edx
	jmp	.L12
.L11:
	leaq	(%r14,%r8), %rdi
	movslq	%r12d, %rsi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L14
	movl	%r12d, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movl	56(%rsp), %edx
	movl	24(%rsp), %ecx
	movq	32(%rsp), %rax
	movl	40(%rsp), %r10d
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L14
.L63:
	leaq	(%r14,%r8), %rdi
	movslq	%ebx, %rsi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L13
	movl	%ebx, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movl	56(%rsp), %edx
	movl	24(%rsp), %ecx
	movq	32(%rsp), %rax
	movl	40(%rsp), %r10d
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L13
.L64:
	movslq	%r10d, %rdi
	movslq	%r12d, %rsi
	movq	%rdi, 8(%rsp)
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L18
	movl	%r10d, %edi
	movl	%r12d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r9d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r10d, 24(%rsp)
	call	dfs
	movl	24(%rsp), %r10d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movq	48(%rsp), %rax
	movl	60(%rsp), %r9d
	movl	64(%rsp), %r11d
	movq	72(%rsp), %r8
	jmp	.L18
.L66:
	movl	%r9d, %edi
	movl	%r13d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r9d, 20(%rsp)
	call	dfs
	movq	72(%rsp), %r8
	movl	64(%rsp), %r11d
	movl	60(%rsp), %r10d
	movq	48(%rsp), %rax
	movl	40(%rsp), %ecx
	movl	32(%rsp), %edx
	movl	20(%rsp), %r9d
	jmp	.L8
.L65:
	movl	%r10d, %edi
	movl	%r13d, %esi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r10d, 24(%rsp)
	call	dfs
	movl	24(%rsp), %r10d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L19
	.cfi_endproc
.LFE23:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	leaq	.LC1(%rip), %r15
	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	$296, %rsp
	.cfi_def_cfa_offset 352
	movq	%fs:40, %rax
	movq	%rax, 280(%rsp)
	xorl	%eax, %eax
	leaq	276(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	272(%rsp), %rax
	movq	%rax, 96(%rsp)
.L104:
	movq	104(%rsp), %rdx
	movq	96(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	272(%rsp), %edx
	movl	276(%rsp), %r11d
	movl	%edx, %eax
	orl	%r11d, %eax
	je	.L68
	xorl	%ebx, %ebx
	testl	%r11d, %r11d
	jle	.L70
	testl	%edx, %edx
	jle	.L74
	.p2align 4,,10
	.p2align 3
.L76:
	leaq	land(%rip), %rax
	xorl	%ebp, %ebp
	leaq	(%rax,%rbx,4), %r12
	.p2align 4,,10
	.p2align 3
.L71:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	272(%rsp), %edx
	addq	$200, %r12
	cmpl	%ebp, %edx
	jg	.L71
	movl	276(%rsp), %r11d
	leal	1(%rbx), %eax
	cmpl	%eax, %r11d
	jle	.L171
	addq	$1, %rbx
	testl	%edx, %edx
	jg	.L76
.L74:
	movl	$2, %r10d
	leaq	land(%rip), %r9
	movl	$-1, 24(%rsp)
	movl	%r10d, %r8d
	movl	$0, 40(%rsp)
	movq	%r9, %r10
	testl	%edx, %edx
	jle	.L102
	.p2align 4,,10
	.p2align 3
.L112:
	movq	$-200, %r9
	xorl	%eax, %eax
	movl	%r8d, %r13d
	movq	%r9, %r8
	movl	%r11d, %r9d
	movq	%r10, %r11
	movl	%eax, %r10d
	jmp	.L100
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %r10d
	addq	$50, %r8
	cmpl	%edx, %r10d
	jge	.L172
.L100:
	cmpl	$1, 800(%r11,%r8,4)
	jne	.L78
	leal	2(%r10), %eax
	addl	$1, 40(%rsp)
	leal	-1(%r10), %r12d
	movl	%r9d, %ecx
	movl	%eax, 12(%rsp)
	movl	%r12d, %r9d
	movl	%r13d, %r12d
	movq	%r8, %r13
	movl	%r10d, 28(%rsp)
	movq	%r8, 32(%rsp)
	movl	$0, 800(%r11,%r8,4)
	movq	%r11, 16(%rsp)
	movl	%edx, %r11d
.L79:
	movslq	%r9d, %rax
	movl	24(%rsp), %r14d
	leaq	(%rax,%rax,4), %r10
	leaq	0(,%r10,4), %r8
	movq	%r8, %rax
	movl	%r14d, %r8d
	movq	%r10, %r14
	movl	%r9d, %r10d
	movq	%r13, %r9
	movl	%r12d, %r13d
	movq	%rax, %r12
.L99:
	cmpl	$-1, %r10d
	je	.L80
	movl	%r8d, %eax
	notl	%eax
	shrl	$31, %eax
	cmpl	%ecx, %r8d
	setl	%dl
	testb	%al, %dl
	je	.L80
	cmpl	%r11d, %r10d
	jl	.L173
.L80:
	addl	$1, %r8d
	cmpl	%r13d, %r8d
	jne	.L99
	movl	%r13d, %r12d
	movq	%r9, %r13
	movl	%r10d, %r9d
	addl	$1, %r9d
	addq	$50, %r13
	cmpl	12(%rsp), %r9d
	jne	.L79
	movl	28(%rsp), %r10d
	movq	32(%rsp), %r8
	movl	%r12d, %r13d
	movl	272(%rsp), %edx
	movq	16(%rsp), %r11
	addl	$1, %r10d
	movl	276(%rsp), %r9d
	addq	$50, %r8
	cmpl	%edx, %r10d
	jl	.L100
.L172:
	leal	-1(%r13), %eax
	movq	%r11, %r10
	movl	%r13d, %r8d
	movl	%r9d, %r11d
	cmpl	%eax, %r9d
	jle	.L102
	addl	$1, 24(%rsp)
	addq	$4, %r10
	addl	$1, %r8d
	testl	%edx, %edx
	jg	.L112
.L102:
	movl	40(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L173:
	movslq	%r8d, %rax
	leaq	(%r14,%r12), %rdx
	leaq	land(%rip), %rbx
	leaq	(%rax,%rdx,2), %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L80
	movl	$0, (%rbx,%rax,4)
	leal	2(%r10), %ebx
	leal	-1(%r10), %ebp
	movl	%ebx, 48(%rsp)
	leal	-1(%r8), %ebx
	leal	2(%r8), %eax
	movl	%ebx, 44(%rsp)
	movl	%r13d, 68(%rsp)
	movq	%r14, 72(%rsp)
	movq	%r12, 80(%rsp)
	movl	%r8d, 52(%rsp)
	movq	%r9, %r8
	movl	%r10d, 64(%rsp)
	movl	%r11d, %r10d
	movl	%ebp, %r11d
	movq	%r9, 56(%rsp)
	movl	%eax, %r9d
.L81:
	movslq	%r11d, %rax
	movl	44(%rsp), %r14d
	leaq	(%rax,%rax,4), %r13
	leaq	0(,%r13,4), %r12
	movq	%r13, %rax
	movl	%r10d, %r13d
	movq	%r8, %r10
	movq	%r12, %rbp
	movl	%r9d, %r8d
	movl	%ecx, %r12d
	movq	%rax, %r9
.L98:
	cmpl	$-1, %r11d
	je	.L82
	cmpl	%r12d, %r14d
	setl	%dl
	cmpl	$-1, %r14d
	setne	%al
	testb	%al, %dl
	je	.L82
	cmpl	%r13d, %r11d
	jl	.L174
.L82:
	addl	$1, %r14d
	cmpl	%r8d, %r14d
	jne	.L98
	movl	%r8d, %r9d
	movq	%r10, %r8
	movl	%r12d, %ecx
	movl	%r13d, %r10d
	addl	$1, %r11d
	addq	$50, %r8
	cmpl	48(%rsp), %r11d
	jne	.L81
	movl	%r13d, %r11d
	movl	52(%rsp), %r8d
	movl	64(%rsp), %r10d
	movq	56(%rsp), %r9
	movl	68(%rsp), %r13d
	movq	72(%rsp), %r14
	movq	80(%rsp), %r12
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L174:
	movslq	%r14d, %rax
	leaq	(%r9,%rbp), %rdx
	leaq	land(%rip), %rbx
	leaq	(%rax,%rdx,2), %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L82
	leal	2(%r11), %esi
	movl	%r11d, 144(%rsp)
	movl	%esi, 92(%rsp)
	leal	-1(%r14), %esi
	movl	%esi, 88(%rsp)
	movq	%r10, 136(%rsp)
	movl	%r8d, 148(%rsp)
	movq	%r9, 152(%rsp)
	movl	$0, (%rbx,%rax,4)
	leal	-1(%r11), %eax
	leal	2(%r14), %ebx
	movl	%r14d, 132(%rsp)
	movl	%r12d, %r14d
	movl	%r13d, %r12d
	movl	%eax, %r13d
	movq	%rbp, 160(%rsp)
	movq	%r10, %rbp
.L83:
	movslq	%r13d, %rdx
	movl	88(%rsp), %eax
	movl	%ebx, %r10d
	movl	%r14d, %ebx
	leaq	(%rdx,%rdx,4), %r11
	leaq	0(,%r11,4), %rdi
	movq	%r11, %r9
	movq	%rdi, 112(%rsp)
	movq	%rbp, %rdi
	movl	%r12d, %ebp
	movq	%rdi, %r12
.L97:
	cmpl	$-1, %r13d
	je	.L84
	cmpl	%ebx, %eax
	setl	%sil
	cmpl	$-1, %eax
	setne	%dl
	testb	%dl, %sil
	je	.L84
	cmpl	%ebp, %r13d
	jl	.L175
.L84:
	addl	$1, %eax
	cmpl	%eax, %r10d
	jne	.L97
	movq	%r12, %rax
	movl	%ebp, %r12d
	movl	%ebx, %r14d
	addl	$1, %r13d
	movq	%rax, %rbp
	movl	%r10d, %ebx
	addq	$50, %rbp
	cmpl	92(%rsp), %r13d
	jne	.L83
	movl	%r12d, %r13d
	movl	144(%rsp), %r11d
	movl	%r14d, %r12d
	movq	136(%rsp), %r10
	movl	132(%rsp), %r14d
	movl	148(%rsp), %r8d
	movq	152(%rsp), %r9
	movq	160(%rsp), %rbp
	jmp	.L82
.L175:
	movq	112(%rsp), %rsi
	movslq	%eax, %rdx
	addq	%r9, %rsi
	leaq	(%rdx,%rsi,2), %rdx
	leaq	land(%rip), %rsi
	cmpl	$1, (%rsi,%rdx,4)
	jne	.L84
	leal	2(%r13), %edi
	movl	$0, (%rsi,%rdx,4)
	leal	-1(%rax), %esi
	movl	%edi, 180(%rsp)
	leal	-2(%rax), %edi
	leal	-1(%r13), %r11d
	movq	%r12, 168(%rsp)
	movl	%r11d, %r14d
	movl	%edi, 184(%rsp)
	movq	%r12, 232(%rsp)
	movl	%r13d, 244(%rsp)
	movl	%eax, 128(%rsp)
	movl	%r10d, 256(%rsp)
	movq	%r9, 248(%rsp)
	movl	%esi, 188(%rsp)
	movl	%ebx, %esi
	movl	%ebp, %ebx
	movl	%esi, %ebp
.L85:
	movslq	%r14d, %rax
	movl	188(%rsp), %r12d
	movl	184(%rsp), %r13d
	movq	%rax, 208(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, 216(%rsp)
	salq	$2, %rax
	movq	%rax, 224(%rsp)
	movl	%r12d, %eax
	movl	%r14d, %r12d
	movl	%ebx, %r14d
	movl	%eax, %ebx
	cmpl	$-1, %r12d
	je	.L89
.L86:
	cmpl	$-1, %ebx
	setne	%dil
	cmpl	%ebp, %ebx
	setl	%sil
	testb	%sil, %dil
	je	.L89
	cmpl	%r14d, %r12d
	jl	.L176
.L89:
	addl	$1, %ebx
	leal	1(%r13), %esi
	cmpl	%r13d, 128(%rsp)
	je	.L177
	movl	%esi, %r13d
	cmpl	$-1, %r12d
	jne	.L86
	jmp	.L89
.L177:
	addq	$50, 168(%rsp)
	movl	%r14d, %ebx
	movl	%r12d, %r14d
	addl	$1, %r14d
	cmpl	%r14d, 180(%rsp)
	jne	.L85
	movl	%ebp, %edi
	movl	128(%rsp), %eax
	movl	%ebx, %ebp
	movq	232(%rsp), %r12
	movl	244(%rsp), %r13d
	movl	256(%rsp), %r10d
	movl	%edi, %ebx
	movq	248(%rsp), %r9
	jmp	.L84
.L171:
	testl	%r11d, %r11d
	jg	.L74
.L70:
	movl	$0, 40(%rsp)
	jmp	.L102
.L68:
	movq	280(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L178
	addq	$296, %rsp
	.cfi_remember_state
	.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
.L176:
	.cfi_restore_state
	movq	216(%rsp), %rsi
	movslq	%ebx, %r9
	addq	224(%rsp), %rsi
	leaq	land(%rip), %rax
	leaq	(%r9,%rsi,2), %rsi
	cmpl	$1, (%rax,%rsi,4)
	jne	.L89
	imulq	$50, 208(%rsp), %rsi
	movq	%r9, 264(%rsp)
	leal	-1(%r12), %edi
	movl	%r12d, 260(%rsp)
	addq	%r9, %rsi
	movl	$0, (%rax,%rsi,4)
	movq	168(%rsp), %rsi
	addq	%r9, %rsi
	leaq	(%rax,%rsi,4), %rax
	movq	%rax, 120(%rsp)
	leal	2(%r12), %eax
	movl	%edi, %r12d
	movl	%eax, 240(%rsp)
	leal	2(%r13), %eax
	movl	%eax, 176(%rsp)
	cltq
	subq	%r9, %rax
	movq	%rax, 192(%rsp)
	movslq	%r13d, %rax
	movq	%rax, 200(%rsp)
	movl	%ebx, %eax
	movl	%ebp, %ebx
	movl	%eax, %ebp
.L96:
	cmpl	$-1, %r12d
	je	.L91
	cmpl	%ebx, %r13d
	setl	%sil
	cmpl	$-1, %r13d
	setne	%dl
	testb	%dl, %sil
	je	.L92
	cmpl	%r14d, %r12d
	jl	.L179
.L91:
	addq	$200, 120(%rsp)
	addl	$1, %r12d
	cmpl	%r12d, 240(%rsp)
	jne	.L96
	movl	260(%rsp), %r12d
	xchgl	%ebx, %ebp
	jmp	.L89
.L92:
	cmpl	%r14d, %r12d
	jge	.L91
.L106:
	movq	120(%rsp), %rax
	cmpl	$1, -200(%rax)
	je	.L180
.L94:
	cmpl	176(%rsp), %ebx
	jle	.L91
	movq	120(%rsp), %rax
	movq	192(%rsp), %rdi
	cmpl	$1, -200(%rax,%rdi,4)
	jne	.L91
	movl	176(%rsp), %esi
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%r12d, %edi
	call	dfs
	jmp	.L91
.L179:
	movq	120(%rsp), %rax
	movq	200(%rsp), %rdx
	subq	264(%rsp), %rdx
	cmpl	$1, -200(%rax,%rdx,4)
	jne	.L106
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%r13d, %esi
	movl	%r12d, %edi
	call	dfs
	jmp	.L106
.L178:
	call	__stack_chk_fail@PLT
.L180:
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%ebp, %esi
	movl	%r12d, %edi
	call	dfs
	jmp	.L94
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	land
	.bss
	.align 32
	.type	land, @object
	.size	land, 10000
land:
	.zero	10000
	.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
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %eax
	movslq	%esi, %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movslq	%eax, %rsi
	movq	%rdi, %r10
	movl	%eax, %r8d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	(%rsi,%rsi,4), %rsi
	leal	-2(%rax), %r9d
	movl	%r10d, %r15d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	(%rsi,%rsi,4), %rsi
	leal	3(%r10), %r11d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leal	-1(%rax), %ebp
	addl	$2, %eax
	leaq	(%rdi,%rsi,2), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	land(%rip), %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movl	$0, (%rdi,%rsi,4)
	movl	%eax, 4(%rsp)
	leal	-2(%r10), %eax
	movl	%r8d, %r10d
	movl	%eax, 16(%rsp)
.L2:
	movslq	%ebp, %rax
	movl	16(%rsp), %r12d
	movl	%r15d, %ebx
	leaq	(%rax,%rax,4), %r14
	leaq	0(,%r14,4), %r8
.L21:
	testl	%ebp, %ebp
	js	.L3
	leal	-1(%rbx), %r13d
	movl	%r13d, %eax
	cmpl	%r13d, %ecx
	notl	%eax
	setg	%sil
	shrl	$31, %eax
	testb	%al, %sil
	je	.L3
	cmpl	%edx, %ebp
	jl	.L59
.L3:
	addl	$1, %ebx
	addl	$1, %r12d
	cmpl	%r11d, %ebx
	jne	.L21
	addl	$1, %ebp
	addl	$1, %r10d
	addl	$1, %r9d
	cmpl	4(%rsp), %ebp
	jne	.L2
	addq	$88, %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
.L59:
	.cfi_restore_state
	movslq	%r13d, %rax
	leaq	(%r14,%r8), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L3
	movl	$0, (%rdi,%rsi,4)
	testl	%r9d, %r9d
	js	.L60
	cmpl	%r9d, %edx
	movl	%r12d, %esi
	notl	%esi
	setg	56(%rsp)
	cmpl	%r12d, %ecx
	movl	%esi, 8(%rsp)
	setg	%dil
	shrl	$31, %esi
	testb	%sil, %dil
	je	.L7
	cmpb	$0, 56(%rsp)
	jne	.L61
.L7:
	cmpl	%r9d, %edx
	jg	.L36
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, 20(%rsp)
	jmp	.L9
.L60:
	movl	%r12d, %edi
	notl	%edi
	movl	%edi, 8(%rsp)
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, 20(%rsp)
.L9:
	movl	8(%rsp), %esi
	shrl	$31, %esi
	cmpl	%r12d, %ecx
	setg	%dil
	andb	%sil, %dil
	movb	%dil, 8(%rsp)
	jne	.L11
.L14:
	leaq	(%r14,%r8), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	je	.L62
.L12:
	movl	20(%rsp), %esi
	testl	%esi, %esi
	jns	.L13
	cmpl	%ebx, %ecx
	jg	.L63
.L13:
	testl	%r10d, %r10d
	js	.L3
	cmpl	%r10d, %edx
	setg	56(%rsp)
	jle	.L3
	cmpb	$0, 8(%rsp)
	jne	.L64
	cmpl	%r10d, %edx
	jle	.L3
	movslq	%r10d, %rdi
	movq	%rdi, 8(%rsp)
.L18:
	movq	8(%rsp), %rdi
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rax
	cmpl	$1, (%rdi,%rax,4)
	je	.L65
.L19:
	movl	20(%rsp), %eax
	shrl	$31, %eax
	cmpl	%ebx, %ecx
	setg	%sil
	testb	%al, %sil
	je	.L3
	cmpb	$0, 56(%rsp)
	je	.L3
	movq	8(%rsp), %rdi
	movslq	%ebx, %rax
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rax
	cmpl	$1, (%rdi,%rax,4)
	jne	.L3
	movl	%r10d, %edi
	movl	%ebx, %esi
	movq	%r8, 40(%rsp)
	movl	%r11d, 32(%rsp)
	movl	%r9d, 24(%rsp)
	movl	%ecx, 56(%rsp)
	movl	%edx, 20(%rsp)
	movl	%r10d, 8(%rsp)
	call	dfs
	movq	40(%rsp), %r8
	movl	32(%rsp), %r11d
	movl	24(%rsp), %r9d
	movl	56(%rsp), %ecx
	movl	20(%rsp), %edx
	movl	8(%rsp), %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L36:
	movslq	%r9d, %rdi
	movq	%rdi, 24(%rsp)
.L10:
	movq	24(%rsp), %rdi
	leaq	(%rdi,%rdi,4), %rsi
	leaq	land(%rip), %rdi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,2), %rsi
	cmpl	$1, (%rdi,%rsi,4)
	je	.L66
.L8:
	movl	%ebx, %edi
	notl	%edi
	movl	%edi, %esi
	movl	%edi, 20(%rsp)
	shrl	$31, %esi
	cmpl	%ebx, %ecx
	setg	%dil
	testb	%sil, %dil
	je	.L9
	cmpb	$0, 56(%rsp)
	je	.L9
	movq	24(%rsp), %rdi
	movslq	%ebx, %rsi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L9
	movl	%r9d, %edi
	movl	%ebx, %esi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r10d, 48(%rsp)
	movq	%rax, 40(%rsp)
	movl	%ecx, 32(%rsp)
	movl	%edx, 24(%rsp)
	movl	%r9d, 56(%rsp)
	call	dfs
	movl	56(%rsp), %r9d
	movl	24(%rsp), %edx
	movl	32(%rsp), %ecx
	movq	40(%rsp), %rax
	movl	48(%rsp), %r10d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L9
.L61:
	movslq	%r9d, %rdi
	movslq	%r12d, %rsi
	movq	%rdi, 24(%rsp)
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L10
	movl	%r9d, %edi
	movl	%r12d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r9d, 20(%rsp)
	call	dfs
	movl	20(%rsp), %r9d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movq	48(%rsp), %rax
	movl	60(%rsp), %r10d
	movl	64(%rsp), %r11d
	movq	72(%rsp), %r8
	jmp	.L10
.L62:
	movl	%r13d, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movq	64(%rsp), %r8
	movl	60(%rsp), %r11d
	movl	48(%rsp), %r9d
	movl	40(%rsp), %r10d
	movq	32(%rsp), %rax
	movl	24(%rsp), %ecx
	movl	56(%rsp), %edx
	jmp	.L12
.L11:
	leaq	(%r14,%r8), %rdi
	movslq	%r12d, %rsi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L14
	movl	%r12d, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movl	56(%rsp), %edx
	movl	24(%rsp), %ecx
	movq	32(%rsp), %rax
	movl	40(%rsp), %r10d
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L14
.L63:
	leaq	(%r14,%r8), %rdi
	movslq	%ebx, %rsi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L13
	movl	%ebx, %esi
	movl	%ebp, %edi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%r10d, 40(%rsp)
	movq	%rax, 32(%rsp)
	movl	%ecx, 24(%rsp)
	movl	%edx, 56(%rsp)
	call	dfs
	movl	56(%rsp), %edx
	movl	24(%rsp), %ecx
	movq	32(%rsp), %rax
	movl	40(%rsp), %r10d
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L13
.L64:
	movslq	%r10d, %rdi
	movslq	%r12d, %rsi
	movq	%rdi, 8(%rsp)
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,2), %rsi
	leaq	land(%rip), %rdi
	cmpl	$1, (%rdi,%rsi,4)
	jne	.L18
	movl	%r10d, %edi
	movl	%r12d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r9d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r10d, 24(%rsp)
	call	dfs
	movl	24(%rsp), %r10d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movq	48(%rsp), %rax
	movl	60(%rsp), %r9d
	movl	64(%rsp), %r11d
	movq	72(%rsp), %r8
	jmp	.L18
.L66:
	movl	%r9d, %edi
	movl	%r13d, %esi
	movq	%r8, 72(%rsp)
	movl	%r11d, 64(%rsp)
	movl	%r10d, 60(%rsp)
	movq	%rax, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r9d, 20(%rsp)
	call	dfs
	movq	72(%rsp), %r8
	movl	64(%rsp), %r11d
	movl	60(%rsp), %r10d
	movq	48(%rsp), %rax
	movl	40(%rsp), %ecx
	movl	32(%rsp), %edx
	movl	20(%rsp), %r9d
	jmp	.L8
.L65:
	movl	%r10d, %edi
	movl	%r13d, %esi
	movq	%r8, 64(%rsp)
	movl	%r11d, 60(%rsp)
	movl	%r9d, 48(%rsp)
	movl	%ecx, 40(%rsp)
	movl	%edx, 32(%rsp)
	movl	%r10d, 24(%rsp)
	call	dfs
	movl	24(%rsp), %r10d
	movl	32(%rsp), %edx
	movl	40(%rsp), %ecx
	movl	48(%rsp), %r9d
	movl	60(%rsp), %r11d
	movq	64(%rsp), %r8
	jmp	.L19
	.cfi_endproc
.LFE23:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	leaq	.LC1(%rip), %r15
	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	$296, %rsp
	.cfi_def_cfa_offset 352
	movq	%fs:40, %rax
	movq	%rax, 280(%rsp)
	xorl	%eax, %eax
	leaq	276(%rsp), %rax
	movq	%rax, 104(%rsp)
	leaq	272(%rsp), %rax
	movq	%rax, 96(%rsp)
.L104:
	movq	104(%rsp), %rdx
	movq	96(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	272(%rsp), %edx
	movl	276(%rsp), %r11d
	movl	%edx, %eax
	orl	%r11d, %eax
	je	.L68
	xorl	%ebx, %ebx
	testl	%r11d, %r11d
	jle	.L70
	testl	%edx, %edx
	jle	.L74
	.p2align 4,,10
	.p2align 3
.L76:
	leaq	land(%rip), %rax
	xorl	%ebp, %ebp
	leaq	(%rax,%rbx,4), %r12
	.p2align 4,,10
	.p2align 3
.L71:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	272(%rsp), %edx
	addq	$200, %r12
	cmpl	%ebp, %edx
	jg	.L71
	movl	276(%rsp), %r11d
	leal	1(%rbx), %eax
	cmpl	%eax, %r11d
	jle	.L171
	addq	$1, %rbx
	testl	%edx, %edx
	jg	.L76
.L74:
	movl	$2, %r10d
	leaq	land(%rip), %r9
	movl	$-1, 24(%rsp)
	movl	%r10d, %r8d
	movl	$0, 40(%rsp)
	movq	%r9, %r10
	testl	%edx, %edx
	jle	.L102
	.p2align 4,,10
	.p2align 3
.L112:
	movq	$-200, %r9
	xorl	%eax, %eax
	movl	%r8d, %r13d
	movq	%r9, %r8
	movl	%r11d, %r9d
	movq	%r10, %r11
	movl	%eax, %r10d
	jmp	.L100
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %r10d
	addq	$50, %r8
	cmpl	%edx, %r10d
	jge	.L172
.L100:
	cmpl	$1, 800(%r11,%r8,4)
	jne	.L78
	leal	2(%r10), %eax
	addl	$1, 40(%rsp)
	leal	-1(%r10), %r12d
	movl	%r9d, %ecx
	movl	%eax, 12(%rsp)
	movl	%r12d, %r9d
	movl	%r13d, %r12d
	movq	%r8, %r13
	movl	%r10d, 28(%rsp)
	movq	%r8, 32(%rsp)
	movl	$0, 800(%r11,%r8,4)
	movq	%r11, 16(%rsp)
	movl	%edx, %r11d
.L79:
	movslq	%r9d, %rax
	movl	24(%rsp), %r14d
	leaq	(%rax,%rax,4), %r10
	leaq	0(,%r10,4), %r8
	movq	%r8, %rax
	movl	%r14d, %r8d
	movq	%r10, %r14
	movl	%r9d, %r10d
	movq	%r13, %r9
	movl	%r12d, %r13d
	movq	%rax, %r12
.L99:
	cmpl	$-1, %r10d
	je	.L80
	movl	%r8d, %eax
	notl	%eax
	shrl	$31, %eax
	cmpl	%ecx, %r8d
	setl	%dl
	testb	%al, %dl
	je	.L80
	cmpl	%r11d, %r10d
	jl	.L173
.L80:
	addl	$1, %r8d
	cmpl	%r13d, %r8d
	jne	.L99
	movl	%r13d, %r12d
	movq	%r9, %r13
	movl	%r10d, %r9d
	addl	$1, %r9d
	addq	$50, %r13
	cmpl	12(%rsp), %r9d
	jne	.L79
	movl	28(%rsp), %r10d
	movq	32(%rsp), %r8
	movl	%r12d, %r13d
	movl	272(%rsp), %edx
	movq	16(%rsp), %r11
	addl	$1, %r10d
	movl	276(%rsp), %r9d
	addq	$50, %r8
	cmpl	%edx, %r10d
	jl	.L100
.L172:
	leal	-1(%r13), %eax
	movq	%r11, %r10
	movl	%r13d, %r8d
	movl	%r9d, %r11d
	cmpl	%eax, %r9d
	jle	.L102
	addl	$1, 24(%rsp)
	addq	$4, %r10
	addl	$1, %r8d
	testl	%edx, %edx
	jg	.L112
.L102:
	movl	40(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L173:
	movslq	%r8d, %rax
	leaq	(%r14,%r12), %rdx
	leaq	land(%rip), %rbx
	leaq	(%rax,%rdx,2), %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L80
	movl	$0, (%rbx,%rax,4)
	leal	2(%r10), %ebx
	leal	-1(%r10), %ebp
	movl	%ebx, 48(%rsp)
	leal	-1(%r8), %ebx
	leal	2(%r8), %eax
	movl	%ebx, 44(%rsp)
	movl	%r13d, 68(%rsp)
	movq	%r14, 72(%rsp)
	movq	%r12, 80(%rsp)
	movl	%r8d, 52(%rsp)
	movq	%r9, %r8
	movl	%r10d, 64(%rsp)
	movl	%r11d, %r10d
	movl	%ebp, %r11d
	movq	%r9, 56(%rsp)
	movl	%eax, %r9d
.L81:
	movslq	%r11d, %rax
	movl	44(%rsp), %r14d
	leaq	(%rax,%rax,4), %r13
	leaq	0(,%r13,4), %r12
	movq	%r13, %rax
	movl	%r10d, %r13d
	movq	%r8, %r10
	movq	%r12, %rbp
	movl	%r9d, %r8d
	movl	%ecx, %r12d
	movq	%rax, %r9
.L98:
	cmpl	$-1, %r11d
	je	.L82
	cmpl	%r12d, %r14d
	setl	%dl
	cmpl	$-1, %r14d
	setne	%al
	testb	%al, %dl
	je	.L82
	cmpl	%r13d, %r11d
	jl	.L174
.L82:
	addl	$1, %r14d
	cmpl	%r8d, %r14d
	jne	.L98
	movl	%r8d, %r9d
	movq	%r10, %r8
	movl	%r12d, %ecx
	movl	%r13d, %r10d
	addl	$1, %r11d
	addq	$50, %r8
	cmpl	48(%rsp), %r11d
	jne	.L81
	movl	%r13d, %r11d
	movl	52(%rsp), %r8d
	movl	64(%rsp), %r10d
	movq	56(%rsp), %r9
	movl	68(%rsp), %r13d
	movq	72(%rsp), %r14
	movq	80(%rsp), %r12
	jmp	.L80
	.p2align 4,,10
	.p2align 3
.L174:
	movslq	%r14d, %rax
	leaq	(%r9,%rbp), %rdx
	leaq	land(%rip), %rbx
	leaq	(%rax,%rdx,2), %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L82
	leal	2(%r11), %esi
	movl	%r11d, 144(%rsp)
	movl	%esi, 92(%rsp)
	leal	-1(%r14), %esi
	movl	%esi, 88(%rsp)
	movq	%r10, 136(%rsp)
	movl	%r8d, 148(%rsp)
	movq	%r9, 152(%rsp)
	movl	$0, (%rbx,%rax,4)
	leal	-1(%r11), %eax
	leal	2(%r14), %ebx
	movl	%r14d, 132(%rsp)
	movl	%r12d, %r14d
	movl	%r13d, %r12d
	movl	%eax, %r13d
	movq	%rbp, 160(%rsp)
	movq	%r10, %rbp
.L83:
	movslq	%r13d, %rdx
	movl	88(%rsp), %eax
	movl	%ebx, %r10d
	movl	%r14d, %ebx
	leaq	(%rdx,%rdx,4), %r11
	leaq	0(,%r11,4), %rdi
	movq	%r11, %r9
	movq	%rdi, 112(%rsp)
	movq	%rbp, %rdi
	movl	%r12d, %ebp
	movq	%rdi, %r12
.L97:
	cmpl	$-1, %r13d
	je	.L84
	cmpl	%ebx, %eax
	setl	%sil
	cmpl	$-1, %eax
	setne	%dl
	testb	%dl, %sil
	je	.L84
	cmpl	%ebp, %r13d
	jl	.L175
.L84:
	addl	$1, %eax
	cmpl	%eax, %r10d
	jne	.L97
	movq	%r12, %rax
	movl	%ebp, %r12d
	movl	%ebx, %r14d
	addl	$1, %r13d
	movq	%rax, %rbp
	movl	%r10d, %ebx
	addq	$50, %rbp
	cmpl	92(%rsp), %r13d
	jne	.L83
	movl	%r12d, %r13d
	movl	144(%rsp), %r11d
	movl	%r14d, %r12d
	movq	136(%rsp), %r10
	movl	132(%rsp), %r14d
	movl	148(%rsp), %r8d
	movq	152(%rsp), %r9
	movq	160(%rsp), %rbp
	jmp	.L82
.L175:
	movq	112(%rsp), %rsi
	movslq	%eax, %rdx
	addq	%r9, %rsi
	leaq	(%rdx,%rsi,2), %rdx
	leaq	land(%rip), %rsi
	cmpl	$1, (%rsi,%rdx,4)
	jne	.L84
	leal	2(%r13), %edi
	movl	$0, (%rsi,%rdx,4)
	leal	-1(%rax), %esi
	movl	%edi, 180(%rsp)
	leal	-2(%rax), %edi
	leal	-1(%r13), %r11d
	movq	%r12, 168(%rsp)
	movl	%r11d, %r14d
	movl	%edi, 184(%rsp)
	movq	%r12, 232(%rsp)
	movl	%r13d, 244(%rsp)
	movl	%eax, 128(%rsp)
	movl	%r10d, 256(%rsp)
	movq	%r9, 248(%rsp)
	movl	%esi, 188(%rsp)
	movl	%ebx, %esi
	movl	%ebp, %ebx
	movl	%esi, %ebp
.L85:
	movslq	%r14d, %rax
	movl	188(%rsp), %r12d
	movl	184(%rsp), %r13d
	movq	%rax, 208(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, 216(%rsp)
	salq	$2, %rax
	movq	%rax, 224(%rsp)
	movl	%r12d, %eax
	movl	%r14d, %r12d
	movl	%ebx, %r14d
	movl	%eax, %ebx
	cmpl	$-1, %r12d
	je	.L89
.L86:
	cmpl	$-1, %ebx
	setne	%dil
	cmpl	%ebp, %ebx
	setl	%sil
	testb	%sil, %dil
	je	.L89
	cmpl	%r14d, %r12d
	jl	.L176
.L89:
	addl	$1, %ebx
	leal	1(%r13), %esi
	cmpl	%r13d, 128(%rsp)
	je	.L177
	movl	%esi, %r13d
	cmpl	$-1, %r12d
	jne	.L86
	jmp	.L89
.L177:
	addq	$50, 168(%rsp)
	movl	%r14d, %ebx
	movl	%r12d, %r14d
	addl	$1, %r14d
	cmpl	%r14d, 180(%rsp)
	jne	.L85
	movl	%ebp, %edi
	movl	128(%rsp), %eax
	movl	%ebx, %ebp
	movq	232(%rsp), %r12
	movl	244(%rsp), %r13d
	movl	256(%rsp), %r10d
	movl	%edi, %ebx
	movq	248(%rsp), %r9
	jmp	.L84
.L171:
	testl	%r11d, %r11d
	jg	.L74
.L70:
	movl	$0, 40(%rsp)
	jmp	.L102
.L68:
	movq	280(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L178
	addq	$296, %rsp
	.cfi_remember_state
	.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
.L176:
	.cfi_restore_state
	movq	216(%rsp), %rsi
	movslq	%ebx, %r9
	addq	224(%rsp), %rsi
	leaq	land(%rip), %rax
	leaq	(%r9,%rsi,2), %rsi
	cmpl	$1, (%rax,%rsi,4)
	jne	.L89
	imulq	$50, 208(%rsp), %rsi
	movq	%r9, 264(%rsp)
	leal	-1(%r12), %edi
	movl	%r12d, 260(%rsp)
	addq	%r9, %rsi
	movl	$0, (%rax,%rsi,4)
	movq	168(%rsp), %rsi
	addq	%r9, %rsi
	leaq	(%rax,%rsi,4), %rax
	movq	%rax, 120(%rsp)
	leal	2(%r12), %eax
	movl	%edi, %r12d
	movl	%eax, 240(%rsp)
	leal	2(%r13), %eax
	movl	%eax, 176(%rsp)
	cltq
	subq	%r9, %rax
	movq	%rax, 192(%rsp)
	movslq	%r13d, %rax
	movq	%rax, 200(%rsp)
	movl	%ebx, %eax
	movl	%ebp, %ebx
	movl	%eax, %ebp
.L96:
	cmpl	$-1, %r12d
	je	.L91
	cmpl	%ebx, %r13d
	setl	%sil
	cmpl	$-1, %r13d
	setne	%dl
	testb	%dl, %sil
	je	.L92
	cmpl	%r14d, %r12d
	jl	.L179
.L91:
	addq	$200, 120(%rsp)
	addl	$1, %r12d
	cmpl	%r12d, 240(%rsp)
	jne	.L96
	movl	260(%rsp), %r12d
	xchgl	%ebx, %ebp
	jmp	.L89
.L92:
	cmpl	%r14d, %r12d
	jge	.L91
.L106:
	movq	120(%rsp), %rax
	cmpl	$1, -200(%rax)
	je	.L180
.L94:
	cmpl	176(%rsp), %ebx
	jle	.L91
	movq	120(%rsp), %rax
	movq	192(%rsp), %rdi
	cmpl	$1, -200(%rax,%rdi,4)
	jne	.L91
	movl	176(%rsp), %esi
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%r12d, %edi
	call	dfs
	jmp	.L91
.L179:
	movq	120(%rsp), %rax
	movq	200(%rsp), %rdx
	subq	264(%rsp), %rdx
	cmpl	$1, -200(%rax,%rdx,4)
	jne	.L106
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%r13d, %esi
	movl	%r12d, %edi
	call	dfs
	jmp	.L106
.L178:
	call	__stack_chk_fail@PLT
.L180:
	movl	%ebx, %ecx
	movl	%r14d, %edx
	movl	%ebp, %esi
	movl	%r12d, %edi
	call	dfs
	jmp	.L94
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	land
	.bss
	.align 32
	.type	land, @object
	.size	land, 10000
land:
	.zero	10000
	.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 land[50][50]={0};

void dfs(int a, int b, int c, int d){

  int i,j;
  
  land[a][b]=0;

  for(i = -1; i <= 1; i++) for(j = -1; j <= 1; j++) if(a+i >= 0 && b+j >= 0 && a+i < c && b+j < d) if(land[a+i][b+j] == 1) dfs(a+i,b+j,c,d);

}

int main(){

  int w,h,result=0,i,j;

  while(1){
    
    scanf("%d %d",&w,&h);
    
    if(w == 0 && h == 0) return 0;
    
    result=0;
    
    for(i = 0; i < h; i++) for(j = 0; j < w; j++) scanf("%d",&land[j][i]);
    
    for(i = 0; i < h; i++){
      
      for(j = 0; j < w; j++){
	
	if(land[j][i] == 1){
	  
	  result++;
	  
	  dfs(j,i,w,h);
	  
	}
	
      }
      
    }
    
    printf("%d\n",result);
    
  }
  
}
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
3
1
4
 0
1
0
1
2
1
8
 0
1
0
1
2
1
7
 0
1
1
2
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 land[50][50]={0};

void dfs(int a, int b, int c, int d){

  int i,j;
  
  land[a][b]=0;

  for(i = -1; i <= 1; i++) for(j = -1; j <= 1; j++) if(a+i >= 0 && b+j >= 0 && a+i < c && b+j < d) if(land[a+i][b+j] == 1) dfs(a+i,b+j,c,d);

}

int main(){

  int w,h,result=0,i,j;

  while(1){
    
    scanf("%d %d",&w,&h);
    
    if(w == 0 && h == 0) return 0;
    
    result=0;
    
    for(i = 0; i < h; i++) for(j = 0; j < w; j++) scanf("%d",&land[j][i]);
    
    for(i = 0; i < h; i++){
      
      for(j = 0; j < w; j++){
	
	if(land[j][i] == 1){
	  
	  result++;
	  
	  dfs(j,i,w,h);
	  
	}
	
      }
      
    }
    
    printf("%d\n",result);
    
  }
  
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	land
	.bss
	.align 32
	.type	land, @object
	.size	land, 10000
land:
	.zero	10000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.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)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%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	land(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$-1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rcx
	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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
.L4:
	addl	$1, -4(%rbp)
.L3:
	cmpl	$1, -4(%rbp)
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	cmpl	$1, -8(%rbp)
	jle	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
.L19:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	jmp	.L21
.L8:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-16(%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	land(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	movl	$0, -16(%rbp)
	jmp	.L14
.L18:
	movl	$0, -12(%rbp)
	jmp	.L15
.L17:
	movl	-16(%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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -20(%rbp)
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L16:
	addl	$1, -12(%rbp)
.L15:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L21:
	call	__stack_chk_fail@PLT
.L20:
	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	land
	.bss
	.align 32
	.type	land, @object
	.size	land, 10000
land:
	.zero	10000
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.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)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%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	land(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$-1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$-1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	js	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -32(%rbp)
	jle	.L4
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rcx
	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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L4
	movl	-24(%rbp), %edx
	movl	-4(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	call	dfs
.L4:
	addl	$1, -4(%rbp)
.L3:
	cmpl	$1, -4(%rbp)
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	cmpl	$1, -8(%rbp)
	jle	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
.L19:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	jmp	.L21
.L8:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-16(%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	land(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L11:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	addl	$1, -16(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	movl	$0, -16(%rbp)
	jmp	.L14
.L18:
	movl	$0, -12(%rbp)
	jmp	.L15
.L17:
	movl	-16(%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	land(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -20(%rbp)
	movl	-24(%rbp), %ecx
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	dfs
.L16:
	addl	$1, -12(%rbp)
.L15:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L21:
	call	__stack_chk_fail@PLT
.L20:
	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:
