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 m, n;
int arr[90][90];

int dy[] = {0, 0, -1, 1};
int dx[] = {1, -1, 0, 0};

int dfs(int y, int x) {
  int i;
  if (arr[y][x] == 0) return 0;
  arr[y][x] = 0;

  int ans = 0, a;
  for (i = 0; i < 4; ++i) {
    int py, px;

    py = y + dy[i];
    px = x + dx[i];

    if (py < 0 || px < 0 || py >= m || px >= n) continue;

    a = dfs(py, px);

    if (ans < a) ans = a;
  }
  arr[y][x] = 1;

  return ans + 1;
}

int main(void) {
  while (1) {
    scanf("%d%d", &m, &n);

    if (m * n == 0) return 0;

    int i, j, ans = 0, k;
    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        scanf("%d", &arr[i][j]);
      }
    }

    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        k = dfs(i, j);

        if (k > ans) ans = k;
      }
    }

    printf("%d\n", ans);
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 32400
arr:
	.zero	32400
	.globl	dy
	.data
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	dx
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	-1
	.long	0
	.long	0
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L4
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	cmpl	$0, -8(%rbp)
	js	.L9
	movl	m(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L9
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L9
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L7
	movl	-4(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -20(%rbp)
.L4:
	cmpl	$3, -20(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
.L3:
	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	$16, %rsp
.L22:
	leaq	n(%rip), %rax
	movq	%rax, %rdx
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L11
	movl	$0, %eax
	jmp	.L23
.L11:
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L13
.L16:
	movl	$0, -12(%rbp)
	jmp	.L14
.L15:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%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)
.L14:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L15
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	$0, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L19:
	addl	$1, -12(%rbp)
.L18:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	movl	-8(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L22
.L23:
	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	dfs.part.0, @function
dfs.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%esi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	arr(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	imulq	$90, %r13, %rax
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r15, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r13, %rbx
	addq	%r15, %rax
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	dx(%rip), %esi
	movl	dy(%rip), %edi
	movl	$0, (%r14,%rax,4)
	addl	%r15d, %esi
	addl	%r13d, %edi
	movl	%esi, %eax
	orl	%edi, %eax
	js	.L2
	cmpl	%edi, m(%rip)
	jle	.L2
	cmpl	%esi, n(%rip)
	jle	.L2
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L4
	call	dfs.part.0
.L4:
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movl	%edx, %r12d
.L2:
	movl	4+dy(%rip), %edi
	movl	4+dx(%rip), %esi
	addl	%ebx, %edi
	addl	%ebp, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L5
	cmpl	m(%rip), %edi
	jge	.L5
	cmpl	n(%rip), %esi
	jge	.L5
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L7
	call	dfs.part.0
.L7:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L5:
	movl	8+dy(%rip), %edi
	movl	8+dx(%rip), %esi
	addl	%ebx, %edi
	addl	%ebp, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L8
	cmpl	m(%rip), %edi
	jge	.L8
	cmpl	n(%rip), %esi
	jge	.L8
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	call	dfs.part.0
.L10:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L8:
	addl	12+dy(%rip), %ebx
	addl	12+dx(%rip), %ebp
	movl	%ebx, %eax
	orl	%ebp, %eax
	js	.L11
	cmpl	m(%rip), %ebx
	jge	.L11
	cmpl	n(%rip), %ebp
	jge	.L11
	movslq	%ebx, %rax
	movslq	%ebp, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	%ebp, %esi
	movl	%ebx, %edi
	call	dfs.part.0
.L12:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L11:
	imulq	$90, %r13, %rax
	addq	%r15, %rax
	movl	$1, (%r14,%rax,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	leal	1(%r12), %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
.LFE25:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	arr(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	testl	%eax, %eax
	je	.L21
	jmp	dfs.part.0
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%eax, %eax
	ret
	.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	arr(%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	$40, %rsp
	.cfi_def_cfa_offset 96
.L53:
	leaq	n(%rip), %rdx
	leaq	m(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	movl	n(%rip), %eax
	movl	%edx, %ecx
	imull	%eax, %ecx
	testl	%ecx, %ecx
	je	.L60
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	testl	%edx, %edx
	jle	.L26
	testl	%eax, %eax
	jle	.L30
	.p2align 4,,10
	.p2align 3
.L32:
	leaq	(%r15,%r13,4), %r14
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	addq	$4, %r14
	cmpl	%ebx, %eax
	jg	.L27
	movl	m(%rip), %edx
	addl	$1, %r12d
	cmpl	%r12d, %edx
	jle	.L72
	addq	$90, %r13
	testl	%eax, %eax
	jg	.L32
.L30:
	leaq	arr(%rip), %rbx
	movl	$0, 12(%rsp)
	xorl	%r14d, %r14d
	movq	%rbx, 24(%rsp)
	testl	%eax, %eax
	jle	.L52
	.p2align 4,,10
	.p2align 3
.L57:
	movq	24(%rsp), %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L50:
	movl	(%r12), %edx
	testl	%edx, %edx
	je	.L34
	movq	%r12, 16(%rsp)
	leaq	dy(%rip), %rcx
	xorl	%r13d, %r13d
	leaq	dx(%rip), %r10
	movl	$0, (%r12)
.L49:
	movl	(%rcx), %r8d
	movl	(%r10), %r9d
	addl	%r14d, %r8d
	addl	%ebx, %r9d
	movl	%r8d, %edi
	orl	%r9d, %edi
	js	.L35
	movl	m(%rip), %edx
	cmpl	%edx, %r8d
	jge	.L35
	cmpl	%eax, %r9d
	jge	.L35
	movslq	%r8d, %r12
	movslq	%r9d, %rbp
	imulq	$90, %r12, %rsi
	addq	%rbp, %rsi
	movl	(%r15,%rsi,4), %r11d
	testl	%r11d, %r11d
	je	.L36
	leaq	dx(%rip), %r11
	movl	$0, (%r15,%rsi,4)
	leaq	dy(%rip), %rsi
	movl	(%rsi), %edi
	movl	(%r11), %esi
	addl	%r9d, %esi
	addl	%r8d, %edi
	movl	%esi, %r11d
	orl	%edi, %r11d
	shrl	$31, %r11d
	cmpl	%edi, %edx
	setle	%dl
	orb	%r11b, %dl
	jne	.L56
	cmpl	%esi, %eax
	jg	.L73
.L56:
	xorl	%r11d, %r11d
.L37:
	movl	4+dy(%rip), %edi
	movl	4+dx(%rip), %esi
	addl	%r8d, %edi
	addl	%r9d, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L40
	cmpl	m(%rip), %edi
	jge	.L40
	cmpl	n(%rip), %esi
	jge	.L40
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L42
	call	dfs.part.0
.L42:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L40:
	movl	8+dy(%rip), %edi
	movl	8+dx(%rip), %esi
	addl	%r8d, %edi
	addl	%r9d, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L43
	cmpl	m(%rip), %edi
	jge	.L43
	cmpl	n(%rip), %esi
	jge	.L43
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L45
	call	dfs.part.0
.L45:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L43:
	addl	12+dy(%rip), %r8d
	addl	12+dx(%rip), %r9d
	movl	%r8d, %eax
	orl	%r9d, %eax
	js	.L46
	cmpl	m(%rip), %r8d
	jge	.L46
	cmpl	n(%rip), %r9d
	jge	.L46
	movslq	%r8d, %rax
	movslq	%r9d, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L48
	movl	%r9d, %esi
	movl	%r8d, %edi
	call	dfs.part.0
.L48:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L46:
	imulq	$90, %r12, %rax
	addl	$1, %r11d
	addq	%rbp, %rax
	movl	$1, (%r15,%rax,4)
	movl	n(%rip), %eax
.L36:
	cmpl	%r11d, %r13d
	cmovl	%r11d, %r13d
.L35:
	addq	$4, %rcx
	leaq	16+dy(%rip), %rsi
	addq	$4, %r10
	cmpq	%rsi, %rcx
	jne	.L49
	movq	16(%rsp), %r12
	leal	1(%r13), %edx
	movl	$1, (%r12)
.L34:
	movl	12(%rsp), %ecx
	cmpl	%edx, %ecx
	cmovge	%ecx, %edx
	addl	$1, %ebx
	addq	$4, %r12
	movl	%edx, 12(%rsp)
	cmpl	%eax, %ebx
	jl	.L50
	addl	$1, %r14d
	cmpl	m(%rip), %r14d
	jge	.L52
	addq	$360, 24(%rsp)
	testl	%eax, %eax
	jg	.L57
.L52:
	movl	12(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L73:
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %r11d
	testl	%r11d, %r11d
	je	.L37
	call	dfs.part.0
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movl	%edx, %r11d
	jmp	.L37
.L60:
	addq	$40, %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
.L72:
	.cfi_restore_state
	testl	%edx, %edx
	jg	.L30
.L26:
	movl	$0, 12(%rsp)
	jmp	.L52
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	dx
	.data
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	-1
	.long	0
	.long	0
	.globl	dy
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	arr
	.bss
	.align 32
	.type	arr, @object
	.size	arr, 32400
arr:
	.zero	32400
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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	dfs.part.0, @function
dfs.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%esi, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	arr(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	imulq	$90, %r13, %rax
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r15, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r13, %rbx
	addq	%r15, %rax
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	dx(%rip), %esi
	movl	dy(%rip), %edi
	movl	$0, (%r14,%rax,4)
	addl	%r15d, %esi
	addl	%r13d, %edi
	movl	%esi, %eax
	orl	%edi, %eax
	js	.L2
	cmpl	%edi, m(%rip)
	jle	.L2
	cmpl	%esi, n(%rip)
	jle	.L2
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L4
	call	dfs.part.0
.L4:
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movl	%edx, %r12d
.L2:
	movl	4+dy(%rip), %edi
	movl	4+dx(%rip), %esi
	addl	%ebx, %edi
	addl	%ebp, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L5
	cmpl	m(%rip), %edi
	jge	.L5
	cmpl	n(%rip), %esi
	jge	.L5
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L7
	call	dfs.part.0
.L7:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L5:
	movl	8+dy(%rip), %edi
	movl	8+dx(%rip), %esi
	addl	%ebx, %edi
	addl	%ebp, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L8
	cmpl	m(%rip), %edi
	jge	.L8
	cmpl	n(%rip), %esi
	jge	.L8
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	call	dfs.part.0
.L10:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L8:
	addl	12+dy(%rip), %ebx
	addl	12+dx(%rip), %ebp
	movl	%ebx, %eax
	orl	%ebp, %eax
	js	.L11
	cmpl	m(%rip), %ebx
	jge	.L11
	cmpl	n(%rip), %ebp
	jge	.L11
	movslq	%ebx, %rax
	movslq	%ebp, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	%ebp, %esi
	movl	%ebx, %edi
	call	dfs.part.0
.L12:
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
.L11:
	imulq	$90, %r13, %rax
	addq	%r15, %rax
	movl	$1, (%r14,%rax,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	leal	1(%r12), %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
.LFE25:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	arr(%rip), %rdx
	movl	(%rdx,%rax,4), %eax
	testl	%eax, %eax
	je	.L21
	jmp	dfs.part.0
	.p2align 4,,10
	.p2align 3
.L21:
	xorl	%eax, %eax
	ret
	.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	arr(%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	$40, %rsp
	.cfi_def_cfa_offset 96
.L53:
	leaq	n(%rip), %rdx
	leaq	m(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	movl	n(%rip), %eax
	movl	%edx, %ecx
	imull	%eax, %ecx
	testl	%ecx, %ecx
	je	.L60
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	testl	%edx, %edx
	jle	.L26
	testl	%eax, %eax
	jle	.L30
	.p2align 4,,10
	.p2align 3
.L32:
	leaq	(%r15,%r13,4), %r14
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	addq	$4, %r14
	cmpl	%ebx, %eax
	jg	.L27
	movl	m(%rip), %edx
	addl	$1, %r12d
	cmpl	%r12d, %edx
	jle	.L72
	addq	$90, %r13
	testl	%eax, %eax
	jg	.L32
.L30:
	leaq	arr(%rip), %rbx
	movl	$0, 12(%rsp)
	xorl	%r14d, %r14d
	movq	%rbx, 24(%rsp)
	testl	%eax, %eax
	jle	.L52
	.p2align 4,,10
	.p2align 3
.L57:
	movq	24(%rsp), %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L50:
	movl	(%r12), %edx
	testl	%edx, %edx
	je	.L34
	movq	%r12, 16(%rsp)
	leaq	dy(%rip), %rcx
	xorl	%r13d, %r13d
	leaq	dx(%rip), %r10
	movl	$0, (%r12)
.L49:
	movl	(%rcx), %r8d
	movl	(%r10), %r9d
	addl	%r14d, %r8d
	addl	%ebx, %r9d
	movl	%r8d, %edi
	orl	%r9d, %edi
	js	.L35
	movl	m(%rip), %edx
	cmpl	%edx, %r8d
	jge	.L35
	cmpl	%eax, %r9d
	jge	.L35
	movslq	%r8d, %r12
	movslq	%r9d, %rbp
	imulq	$90, %r12, %rsi
	addq	%rbp, %rsi
	movl	(%r15,%rsi,4), %r11d
	testl	%r11d, %r11d
	je	.L36
	leaq	dx(%rip), %r11
	movl	$0, (%r15,%rsi,4)
	leaq	dy(%rip), %rsi
	movl	(%rsi), %edi
	movl	(%r11), %esi
	addl	%r9d, %esi
	addl	%r8d, %edi
	movl	%esi, %r11d
	orl	%edi, %r11d
	shrl	$31, %r11d
	cmpl	%edi, %edx
	setle	%dl
	orb	%r11b, %dl
	jne	.L56
	cmpl	%esi, %eax
	jg	.L73
.L56:
	xorl	%r11d, %r11d
.L37:
	movl	4+dy(%rip), %edi
	movl	4+dx(%rip), %esi
	addl	%r8d, %edi
	addl	%r9d, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L40
	cmpl	m(%rip), %edi
	jge	.L40
	cmpl	n(%rip), %esi
	jge	.L40
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L42
	call	dfs.part.0
.L42:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L40:
	movl	8+dy(%rip), %edi
	movl	8+dx(%rip), %esi
	addl	%r8d, %edi
	addl	%r9d, %esi
	movl	%edi, %eax
	orl	%esi, %eax
	js	.L43
	cmpl	m(%rip), %edi
	jge	.L43
	cmpl	n(%rip), %esi
	jge	.L43
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L45
	call	dfs.part.0
.L45:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L43:
	addl	12+dy(%rip), %r8d
	addl	12+dx(%rip), %r9d
	movl	%r8d, %eax
	orl	%r9d, %eax
	js	.L46
	cmpl	m(%rip), %r8d
	jge	.L46
	cmpl	n(%rip), %r9d
	jge	.L46
	movslq	%r8d, %rax
	movslq	%r9d, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	je	.L48
	movl	%r9d, %esi
	movl	%r8d, %edi
	call	dfs.part.0
.L48:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
.L46:
	imulq	$90, %r12, %rax
	addl	$1, %r11d
	addq	%rbp, %rax
	movl	$1, (%r15,%rax,4)
	movl	n(%rip), %eax
.L36:
	cmpl	%r11d, %r13d
	cmovl	%r11d, %r13d
.L35:
	addq	$4, %rcx
	leaq	16+dy(%rip), %rsi
	addq	$4, %r10
	cmpq	%rsi, %rcx
	jne	.L49
	movq	16(%rsp), %r12
	leal	1(%r13), %edx
	movl	$1, (%r12)
.L34:
	movl	12(%rsp), %ecx
	cmpl	%edx, %ecx
	cmovge	%ecx, %edx
	addl	$1, %ebx
	addq	$4, %r12
	movl	%edx, 12(%rsp)
	cmpl	%eax, %ebx
	jl	.L50
	addl	$1, %r14d
	cmpl	m(%rip), %r14d
	jge	.L52
	addq	$360, 24(%rsp)
	testl	%eax, %eax
	jg	.L57
.L52:
	movl	12(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L73:
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	movl	(%r15,%rax,4), %r11d
	testl	%r11d, %r11d
	je	.L37
	call	dfs.part.0
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movl	%edx, %r11d
	jmp	.L37
.L60:
	addq	$40, %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
.L72:
	.cfi_restore_state
	testl	%edx, %edx
	jg	.L30
.L26:
	movl	$0, 12(%rsp)
	jmp	.L52
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	dx
	.data
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	-1
	.long	0
	.long	0
	.globl	dy
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	arr
	.bss
	.align 32
	.type	arr, @object
	.size	arr, 32400
arr:
	.zero	32400
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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 m, n;
int arr[90][90];

int dy[] = {0, 0, -1, 1};
int dx[] = {1, -1, 0, 0};

int dfs(int y, int x) {
  int i;
  if (arr[y][x] == 0) return 0;
  arr[y][x] = 0;

  int ans = 0, a;
  for (i = 0; i < 4; ++i) {
    int py, px;

    py = y + dy[i];
    px = x + dx[i];

    if (py < 0 || px < 0 || py >= m || px >= n) continue;

    a = dfs(py, px);

    if (ans < a) ans = a;
  }
  arr[y][x] = 1;

  return ans + 1;
}

int main(void) {
  while (1) {
    scanf("%d%d", &m, &n);

    if (m * n == 0) return 0;

    int i, j, ans = 0, k;
    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        scanf("%d", &arr[i][j]);
      }
    }

    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        k = dfs(i, j);

        if (k > ans) ans = k;
      }
    }

    printf("%d\n", ans);
  }
}

3
3
1 1 0
1 0 1
1 1 0
5
3
1 1 1 0 1
1 1 0 1 0
1 0 0 0 1
0
0
 3
3
1 1 0
1 0 1
0 1 0
5
3
1 1 0 0 1
1 1 0 1 0
1 0 0 0 1
0
0
 3
3
1 1 0
1 0 1
0 1 0
5
3
1 1 0 0 1
1 1 0 1 0
1 1 1 0 1
0
0
 3
3
1 1 0
1 0 1
1 1 0
5
3
1 0 1 0 1
1 1 0 1 0
1 0 0 0 1
0
0
 3
3
1 1 0
0 0 1
0 1 0
5
3
1 1 0 0 1
1 1 0 1 0
1 0 0 0 1
0
0
 3
3
1 0 0
1 0 1
1 1 0
5
3
1 0 1 0 1
1 1 0 1 0
1 0 0 0 1
0
0
 3
3
1 1 0
1 0 1
0 1 0
5
3
0 1 0 0 1
1 1 0 1 0
1 1 1 0 1
0
0
 3
3
1 1 0
1 0 1
0 1 0
5
3
1 1 1 0 1
0 1 0 0 0
1 0 1 0 1
0
0
 3
3
1 1 0
1 0 1
1 0 0
5
3
1 1 1 0 1
1 1 0 0 0
1 0 0 0 1
0
0
 3
3
1 1 0
1 0 1
1 1 1
5
3
1 0 1 0 1
1 0 0 1 0
1 0 0 0 1
0
0

5
5
 3
5
 3
7
 5
3
 2
5
 4
3
 3
6
 3
3
 4
5
 7
3

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 m, n;
int arr[90][90];

int dy[] = {0, 0, -1, 1};
int dx[] = {1, -1, 0, 0};

int dfs(int y, int x) {
  int i;
  if (arr[y][x] == 0) return 0;
  arr[y][x] = 0;

  int ans = 0, a;
  for (i = 0; i < 4; ++i) {
    int py, px;

    py = y + dy[i];
    px = x + dx[i];

    if (py < 0 || px < 0 || py >= m || px >= n) continue;

    a = dfs(py, px);

    if (ans < a) ans = a;
  }
  arr[y][x] = 1;

  return ans + 1;
}

int main(void) {
  while (1) {
    scanf("%d%d", &m, &n);

    if (m * n == 0) return 0;

    int i, j, ans = 0, k;
    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        scanf("%d", &arr[i][j]);
      }
    }

    for (i = 0; i < m; ++i) {
      for (j = 0; j < n; ++j) {
        k = dfs(i, j);

        if (k > ans) ans = k;
      }
    }

    printf("%d\n", ans);
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 32400
arr:
	.zero	32400
	.globl	dy
	.data
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	dx
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	-1
	.long	0
	.long	0
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L4
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	cmpl	$0, -8(%rbp)
	js	.L9
	movl	m(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L9
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L9
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L7
	movl	-4(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -20(%rbp)
.L4:
	cmpl	$3, -20(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
.L3:
	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	$16, %rsp
.L22:
	leaq	n(%rip), %rax
	movq	%rax, %rdx
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L11
	movl	$0, %eax
	jmp	.L23
.L11:
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L13
.L16:
	movl	$0, -12(%rbp)
	jmp	.L14
.L15:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%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)
.L14:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L15
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	$0, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L19:
	addl	$1, -12(%rbp)
.L18:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	movl	-8(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L22
.L23:
	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	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 32400
arr:
	.zero	32400
	.globl	dy
	.data
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	dx
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	-1
	.long	0
	.long	0
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L4
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L9
	cmpl	$0, -8(%rbp)
	js	.L9
	movl	m(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L9
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L9
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L7
	movl	-4(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	nop
.L7:
	addl	$1, -20(%rbp)
.L4:
	cmpl	$3, -20(%rbp)
	jle	.L8
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
.L3:
	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	$16, %rsp
.L22:
	leaq	n(%rip), %rax
	movq	%rax, %rdx
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L11
	movl	$0, %eax
	jmp	.L23
.L11:
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L13
.L16:
	movl	$0, -12(%rbp)
	jmp	.L14
.L15:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$90, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	arr(%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)
.L14:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L15
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	$0, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L19
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L19:
	addl	$1, -12(%rbp)
.L18:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	movl	-8(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L22
.L23:
	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:
