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

```c
n,m[256*256],c[4][256*256];
i,j,l,L,p;
main(){
	for(;~scanf("%d\n",&n);){
		int z[]={1,n+2,n+1,n};
		L=0;
		for(p=256,i=(n+1)*n;i--;p++){
			m[p]=getchar();
			for(j=4;j--;){
				l=c[j][p]=m[p]==49?c[j][p-z[j]]+1:0;
				if(l>L)
					L=l;
			}
		}
		n&&printf("%d\n",L);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 262144
m:
	.zero	262144
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 1048576
c:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	l
	.align 4
	.type	l, @object
	.size	l, 4
l:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L11:
	movl	$1, -48(%rbp)
	movl	n(%rip), %eax
	addl	$2, %eax
	movl	%eax, -44(%rbp)
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	n(%rip), %eax
	movl	%eax, -36(%rbp)
	movl	$0, L(%rip)
	movl	$256, p(%rip)
	movl	n(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L3
.L8:
	movl	p(%rip), %ebx
	movl	$0, %eax
	call	getchar@PLT
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$4, j(%rip)
	jmp	.L4
.L7:
	movl	p(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$49, %eax
	jne	.L5
	movl	j(%rip), %edx
	movl	p(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	movl	-48(%rbp,%rax,4), %esi
	movl	%ecx, %eax
	subl	%esi, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$16, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	jmp	.L6
.L5:
	movl	$0, %ecx
.L6:
	movl	j(%rip), %eax
	movl	p(%rip), %edx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	salq	$16, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	c(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movslq	%edx, %rdx
	cltq
	salq	$16, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, l(%rip)
	movl	l(%rip), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	l(%rip), %eax
	movl	%eax, L(%rip)
.L4:
	movl	j(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	jne	.L7
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
.L3:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L2
	movl	L(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L11
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	m(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	c(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	n(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L54
	movl	n(%rip), %eax
	movl	$1, (%rsp)
	movl	$0, L(%rip)
	leal	1(%rax), %esi
	leal	2(%rax), %edx
	movl	%eax, 12(%rsp)
	movl	%esi, 8(%rsp)
	imull	%eax, %esi
	movl	%edx, 4(%rsp)
	movl	$256, p(%rip)
	leal	-1(%rsi), %edx
	movl	%edx, i(%rip)
	testl	%esi, %esi
	je	.L3
	movl	$256, %r13d
.L17:
	xorl	%eax, %eax
	movslq	%r13d, %r13
	call	getchar@PLT
	movslq	p(%rip), %rcx
	movl	L(%rip), %r10d
	xorl	%r9d, %r9d
	movl	%eax, (%r15,%r13,4)
	movl	$4, %eax
	movq	%rcx, %r13
	movl	%r10d, %esi
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	je	.L5
.L56:
	movl	(%r15,%rcx,4), %edi
	xorl	%ebx, %ebx
	movslq	%r8d, %rdx
	cmpl	$49, %edi
	jne	.L6
	movl	%r13d, %ebx
	movq	%rdx, %r11
	subl	(%rsp,%rdx,4), %ebx
	movslq	%ebx, %rbx
	salq	$16, %r11
	addq	%rbx, %r11
	movl	(%r14,%r11,4), %ebx
	addl	$1, %ebx
.L6:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L25
	leal	-2(%rax), %r11d
	testl	%r8d, %r8d
	je	.L8
	xorl	%ebx, %ebx
	movslq	%r11d, %rdx
	cmpl	$49, %edi
	jne	.L9
	movl	%r13d, %ebx
	movq	%rdx, %r8
	subl	(%rsp,%rdx,4), %ebx
	movslq	%ebx, %rbx
	salq	$16, %r8
	addq	%rbx, %r8
	movl	(%r14,%r8,4), %ebx
	addl	$1, %ebx
.L9:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L27
	subl	$3, %eax
	testl	%r11d, %r11d
	je	.L8
	xorl	%ebx, %ebx
	movslq	%eax, %rdx
	cmpl	$49, %edi
	jne	.L10
	movl	%r13d, %r11d
	movq	%rdx, %r8
	subl	(%rsp,%rdx,4), %r11d
	movslq	%r11d, %r11
	salq	$16, %r8
	addq	%r11, %r8
	movl	(%r14,%r8,4), %ebx
	addl	$1, %ebx
.L10:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L7
	testl	%eax, %eax
	je	.L8
	xorl	%ebx, %ebx
	cmpl	$49, %edi
	jne	.L11
	movl	%r13d, %eax
	subl	(%rsp), %eax
	cltq
	movl	(%r14,%rax,4), %ebx
	addl	$1, %ebx
.L11:
	movl	%ebx, (%r14,%rcx,4)
	cmpl	%ebx, %esi
	jl	.L30
.L8:
	movl	$-1, j(%rip)
	testb	%r9b, %r9b
	je	.L55
.L22:
	movl	%esi, L(%rip)
.L20:
	movl	%ebx, l(%rip)
.L51:
	movl	i(%rip), %eax
	addl	$1, %r13d
	movl	%r13d, p(%rip)
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L17
	movl	n(%rip), %eax
.L3:
	testl	%eax, %eax
	je	.L2
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L25:
	movl	%r8d, %eax
.L7:
	movl	%ebx, %esi
	movl	$1, %r9d
.L57:
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	jne	.L56
.L5:
	movl	$-1, j(%rip)
	testb	%r9b, %r9b
	jne	.L22
	movl	%r10d, %esi
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L55:
	movl	%r10d, %esi
	jmp	.L20
.L27:
	movl	%r11d, %eax
	movl	%ebx, %esi
	movl	$1, %r9d
	jmp	.L57
.L30:
	xorl	%eax, %eax
	movl	%ebx, %esi
	movl	$1, %r9d
	jmp	.L57
.L54:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L58
	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
.L58:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	p
	.bss
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	l
	.align 4
	.type	l, @object
	.size	l, 4
l:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 1048576
c:
	.zero	1048576
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 262144
m:
	.zero	262144
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	m(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	c(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	n(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L54
	movl	n(%rip), %eax
	movl	$1, (%rsp)
	movl	$0, L(%rip)
	leal	1(%rax), %esi
	leal	2(%rax), %edx
	movl	%eax, 12(%rsp)
	movl	%esi, 8(%rsp)
	imull	%eax, %esi
	movl	%edx, 4(%rsp)
	movl	$256, p(%rip)
	leal	-1(%rsi), %edx
	movl	%edx, i(%rip)
	testl	%esi, %esi
	je	.L3
	movl	$256, %r13d
.L17:
	xorl	%eax, %eax
	movslq	%r13d, %r13
	call	getchar@PLT
	movslq	p(%rip), %rcx
	movl	L(%rip), %r10d
	xorl	%r9d, %r9d
	movl	%eax, (%r15,%r13,4)
	movl	$4, %eax
	movq	%rcx, %r13
	movl	%r10d, %esi
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	je	.L5
.L56:
	movl	(%r15,%rcx,4), %edi
	xorl	%ebx, %ebx
	movslq	%r8d, %rdx
	cmpl	$49, %edi
	jne	.L6
	movl	%r13d, %ebx
	movq	%rdx, %r11
	subl	(%rsp,%rdx,4), %ebx
	movslq	%ebx, %rbx
	salq	$16, %r11
	addq	%rbx, %r11
	movl	(%r14,%r11,4), %ebx
	addl	$1, %ebx
.L6:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L25
	leal	-2(%rax), %r11d
	testl	%r8d, %r8d
	je	.L8
	xorl	%ebx, %ebx
	movslq	%r11d, %rdx
	cmpl	$49, %edi
	jne	.L9
	movl	%r13d, %ebx
	movq	%rdx, %r8
	subl	(%rsp,%rdx,4), %ebx
	movslq	%ebx, %rbx
	salq	$16, %r8
	addq	%rbx, %r8
	movl	(%r14,%r8,4), %ebx
	addl	$1, %ebx
.L9:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L27
	subl	$3, %eax
	testl	%r11d, %r11d
	je	.L8
	xorl	%ebx, %ebx
	movslq	%eax, %rdx
	cmpl	$49, %edi
	jne	.L10
	movl	%r13d, %r11d
	movq	%rdx, %r8
	subl	(%rsp,%rdx,4), %r11d
	movslq	%r11d, %r11
	salq	$16, %r8
	addq	%r11, %r8
	movl	(%r14,%r8,4), %ebx
	addl	$1, %ebx
.L10:
	salq	$16, %rdx
	addq	%rcx, %rdx
	movl	%ebx, (%r14,%rdx,4)
	cmpl	%ebx, %esi
	jl	.L7
	testl	%eax, %eax
	je	.L8
	xorl	%ebx, %ebx
	cmpl	$49, %edi
	jne	.L11
	movl	%r13d, %eax
	subl	(%rsp), %eax
	cltq
	movl	(%r14,%rax,4), %ebx
	addl	$1, %ebx
.L11:
	movl	%ebx, (%r14,%rcx,4)
	cmpl	%ebx, %esi
	jl	.L30
.L8:
	movl	$-1, j(%rip)
	testb	%r9b, %r9b
	je	.L55
.L22:
	movl	%esi, L(%rip)
.L20:
	movl	%ebx, l(%rip)
.L51:
	movl	i(%rip), %eax
	addl	$1, %r13d
	movl	%r13d, p(%rip)
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L17
	movl	n(%rip), %eax
.L3:
	testl	%eax, %eax
	je	.L2
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L25:
	movl	%r8d, %eax
.L7:
	movl	%ebx, %esi
	movl	$1, %r9d
.L57:
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	jne	.L56
.L5:
	movl	$-1, j(%rip)
	testb	%r9b, %r9b
	jne	.L22
	movl	%r10d, %esi
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L55:
	movl	%r10d, %esi
	jmp	.L20
.L27:
	movl	%r11d, %eax
	movl	%ebx, %esi
	movl	$1, %r9d
	jmp	.L57
.L30:
	xorl	%eax, %eax
	movl	%ebx, %esi
	movl	$1, %r9d
	jmp	.L57
.L54:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L58
	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
.L58:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	p
	.bss
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	l
	.align 4
	.type	l, @object
	.size	l, 4
l:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 1048576
c:
	.zero	1048576
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 262144
m:
	.zero	262144
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:

n,m[256*256],c[4][256*256];
i,j,l,L,p;
main(){
	for(;~scanf("%d\n",&n);){
		int z[]={1,n+2,n+1,n};
		L=0;
		for(p=256,i=(n+1)*n;i--;p++){
			m[p]=getchar();
			for(j=4;j--;){
				l=c[j][p]=m[p]==49?c[j][p-z[j]]+1:0;
				if(l>L)
					L=l;
			}
		}
		n&&printf("%d\n",L);
	}
}
5
00011
00101
01000
10101
00010
8
11000001
10110111
01100111
01111010
11111111
01001010
10100010
10000001
2
01
00
3
000
000
000
0
 5
01011
00101
01000
10101
00010
8
11000001
10110111
01100111
01111010
11111111
01001010
10100000
10000001
0
01
00
3
000
000
000
0
 5
01011
00101
01100
10101
00010
8
11000001
10110111
01100111
10111010
10111111
01001010
10100000
10000000
0
01
00
3
001
100
000
0
 5
01011
00000
01000
10101
01010
8
11010001
10110111
01100011
01111010
11111111
01101000
10100010
10000101
0
0
1
6
000
100
000
0
 5
01011
10000
01000
10001
01010
8
11010001
10110111
01100011
01111010
11111111
01101000
10100010
10000101
0
0
1
6
000
100
000
0
 5
00011
00101
01000
10101
00010
8
11000001
10110111
01100111
01111010
11111111
01001010
10100010
10000001
2
01
00
3
000
010
000
0
 5
01011
00100
01000
10101
01010
8
11010001
10110111
01100111
01111010
11011111
01001010
10100000
10000001
0
0
1
3
000
000
000
0
 5
01011
00101
01000
10101
00010
8
11000001
10110111
01100111
01111010
11111111
01001010
10100010
10000001
2
01
00
3
000
011
000
0
 5
01011
00101
01000
10101
00010
8
11100001
10110111
01100111
01111010
11111111
01000010
10100000
10000001
2
01
00
0
000
000
000
0
 5
01010
00101
01000
10101
00010
8
10000001
10110111
01100011
01111010
11111110
01001010
10110000
10000001
0
0
00
1
000
010
100
0

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

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

```c
n,m[256*256],c[4][256*256];
i,j,l,L,p;
main(){
	for(;~scanf("%d\n",&n);){
		int z[]={1,n+2,n+1,n};
		L=0;
		for(p=256,i=(n+1)*n;i--;p++){
			m[p]=getchar();
			for(j=4;j--;){
				l=c[j][p]=m[p]==49?c[j][p-z[j]]+1:0;
				if(l>L)
					L=l;
			}
		}
		n&&printf("%d\n",L);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 262144
m:
	.zero	262144
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 1048576
c:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	l
	.align 4
	.type	l, @object
	.size	l, 4
l:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L11:
	movl	$1, -48(%rbp)
	movl	n(%rip), %eax
	addl	$2, %eax
	movl	%eax, -44(%rbp)
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	n(%rip), %eax
	movl	%eax, -36(%rbp)
	movl	$0, L(%rip)
	movl	$256, p(%rip)
	movl	n(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L3
.L8:
	movl	p(%rip), %ebx
	movl	$0, %eax
	call	getchar@PLT
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$4, j(%rip)
	jmp	.L4
.L7:
	movl	p(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$49, %eax
	jne	.L5
	movl	j(%rip), %edx
	movl	p(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	movl	-48(%rbp,%rax,4), %esi
	movl	%ecx, %eax
	subl	%esi, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$16, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	jmp	.L6
.L5:
	movl	$0, %ecx
.L6:
	movl	j(%rip), %eax
	movl	p(%rip), %edx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	salq	$16, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	c(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movslq	%edx, %rdx
	cltq
	salq	$16, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, l(%rip)
	movl	l(%rip), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	l(%rip), %eax
	movl	%eax, L(%rip)
.L4:
	movl	j(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	jne	.L7
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
.L3:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L2
	movl	L(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L11
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 262144
m:
	.zero	262144
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 1048576
c:
	.zero	1048576
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	l
	.align 4
	.type	l, @object
	.size	l, 4
l:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L11:
	movl	$1, -48(%rbp)
	movl	n(%rip), %eax
	addl	$2, %eax
	movl	%eax, -44(%rbp)
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, -40(%rbp)
	movl	n(%rip), %eax
	movl	%eax, -36(%rbp)
	movl	$0, L(%rip)
	movl	$256, p(%rip)
	movl	n(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	imull	%edx, %eax
	movl	%eax, i(%rip)
	jmp	.L3
.L8:
	movl	p(%rip), %ebx
	movl	$0, %eax
	call	getchar@PLT
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$4, j(%rip)
	jmp	.L4
.L7:
	movl	p(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$49, %eax
	jne	.L5
	movl	j(%rip), %edx
	movl	p(%rip), %ecx
	movl	j(%rip), %eax
	cltq
	movl	-48(%rbp,%rax,4), %esi
	movl	%ecx, %eax
	subl	%esi, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	salq	$16, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	jmp	.L6
.L5:
	movl	$0, %ecx
.L6:
	movl	j(%rip), %eax
	movl	p(%rip), %edx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	salq	$16, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	c(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movslq	%edx, %rdx
	cltq
	salq	$16, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, l(%rip)
	movl	l(%rip), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	l(%rip), %eax
	movl	%eax, L(%rip)
.L4:
	movl	j(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, j(%rip)
	testl	%eax, %eax
	jne	.L7
	movl	p(%rip), %eax
	addl	$1, %eax
	movl	%eax, p(%rip)
.L3:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L2
	movl	L(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L11
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
