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 max(int a, int b){
	return a>b? a:b;
}

int main(){
	while(1){
		int n, i, j;
		scanf("%d", &n);
		if(n==0) break;

	
		int grid[3*n][3*n];
		for(i=0; i<3*n; i++) for(j=0; j<3*n; j++) grid[i][j]=0;
		for(i=0; i<n; i++){
			char s[300];
			scanf("%s", s);
			for(j=0; j<n; j++){
				grid[n+i][n+j] = s[j]-'0';
			}
		}
		

		int ans = 0;
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[i][j]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[j][i]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		int ltor=0, rtol=0;
		for(i=0; i<n*2; i++){
			for(j=0; j<n*2; j++){
				if(grid[n+j][i+j]==1) ltor++;
				else ltor=0;
				if(grid[n+j][3*n-i-j]==1) rtol++;
				else rtol=0;
				ans = max(ans, max(ltor, rtol));
			}
		}

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

	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$456, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L37:
	movq	%rsp, %rax
	movq	%rax, %rbx
	movq	%rbx, -488(%rbp)
	leaq	-424(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-424(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -392(%rbp)
	movslq	%esi, %rax
	movq	%rax, -480(%rbp)
	movq	$0, -472(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -384(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%r13, %rdx
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r12, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r12, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -464(%rbp)
	movq	$0, -456(%rbp)
	movslq	%edi, %rax
	movq	%rax, -448(%rbp)
	movq	$0, -440(%rbp)
	movq	-464(%rbp), %r9
	movq	-456(%rbp), %r10
	movq	%r10, %rdx
	imulq	-448(%rbp), %rdx
	movq	-440(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-448(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -376(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L9
.L12:
	movl	$0, -416(%rbp)
	jmp	.L10
.L11:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	$0, (%rcx,%rax,4)
	addl	$1, -416(%rbp)
.L10:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L11
	addl	$1, -420(%rbp)
.L9:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L12
	movl	$0, -420(%rbp)
	jmp	.L13
.L16:
	leaq	-368(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -416(%rbp)
	jmp	.L14
.L15:
	movl	-416(%rbp), %eax
	cltq
	movzbl	-368(%rbp,%rax), %eax
	movsbl	%al, %ecx
	movq	%rbx, %r8
	shrq	$2, %r8
	movl	-424(%rbp), %edx
	movl	-420(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	leal	-48(%rcx), %esi
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%edi, %rax
	imulq	%r8, %rax
	addq	%rcx, %rax
	movl	%esi, (%rdx,%rax,4)
	addl	$1, -416(%rbp)
.L14:
	movl	-424(%rbp), %eax
	cmpl	%eax, -416(%rbp)
	jl	.L15
	addl	$1, -420(%rbp)
.L13:
	movl	-424(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L16
	movl	$0, -412(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L17
.L22:
	movl	$0, -408(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L18
.L21:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	addl	$1, -408(%rbp)
	jmp	.L20
.L19:
	movl	$0, -408(%rbp)
.L20:
	movl	-408(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L18:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L21
	addl	$1, -420(%rbp)
.L17:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L22
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L23
.L28:
	movl	$0, -404(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L24
.L27:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-420(%rbp), %eax
	movslq	%eax, %rsi
	movl	-416(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	addl	$1, -404(%rbp)
	jmp	.L26
.L25:
	movl	$0, -404(%rbp)
.L26:
	movl	-404(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L24:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L27
	addl	$1, -420(%rbp)
.L23:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L28
	movl	$0, -400(%rbp)
	movl	$0, -396(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L29
.L36:
	movl	$0, -416(%rbp)
	jmp	.L30
.L35:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-420(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L31
	addl	$1, -400(%rbp)
	jmp	.L32
.L31:
	movl	$0, -400(%rbp)
.L32:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	subl	-420(%rbp), %eax
	subl	-416(%rbp), %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L33
	addl	$1, -396(%rbp)
	jmp	.L34
.L33:
	movl	$0, -396(%rbp)
.L34:
	movl	-396(%rbp), %edx
	movl	-400(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L30:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L35
	addl	$1, -420(%rbp)
.L29:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L36
	movl	-412(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-488(%rbp), %rsp
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$392, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-372(%rbp), %rax
	movq	%rax, -416(%rbp)
	leaq	-368(%rbp), %rax
	movq	%rax, -424(%rbp)
	.p2align 4,,10
	.p2align 3
.L38:
	movq	-416(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, -408(%rbp)
	call	__isoc99_scanf@PLT
	movl	-372(%rbp), %r12d
	testl	%r12d, %r12d
	je	.L4
	leal	(%r12,%r12,2), %eax
	movq	%rsp, %rcx
	movslq	%eax, %r14
	movl	%eax, %esi
	movq	%r14, %rax
	leaq	0(,%r14,4), %r13
	imulq	%r14, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L6
.L58:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L58
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L7
	orq	$0, -8(%rsp,%rdx)
.L7:
	movq	%rsp, %rbx
	testl	%esi, %esi
	jle	.L8
	xorl	%r15d, %r15d
	movq	%rbx, -392(%rbp)
	movq	%rbx, %rdi
	salq	$2, %r14
	movl	%r15d, %ebx
	movl	%esi, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rdx
	xorl	%esi, %esi
	addl	$1, %ebx
	call	memset@PLT
	movq	%rax, %rdi
	addq	%r13, %rdi
	cmpl	%ebx, %r15d
	jne	.L9
	movq	-392(%rbp), %rbx
.L8:
	testl	%r12d, %r12d
	jle	.L10
	movq	%r13, %r14
	movq	%r13, -392(%rbp)
	xorl	%r15d, %r15d
	movq	-424(%rbp), %r13
	shrq	$2, %r14
	.p2align 4,,10
	.p2align 3
.L16:
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	-372(%rbp), %r12d
	movdqa	.LC2(%rip), %xmm4
	testl	%r12d, %r12d
	jle	.L53
	leal	-1(%r12), %eax
	leal	(%r12,%r15), %esi
	cmpl	$14, %eax
	jbe	.L40
	movslq	%esi, %rsi
	movslq	%r12d, %rdi
	pxor	%xmm6, %xmm6
	movq	%r13, %rdx
	movq	%rsi, %rax
	pxor	%xmm3, %xmm3
	imulq	%r14, %rax
	addq	%rdi, %rax
	movl	%r12d, %edi
	shrl	$4, %edi
	leaq	(%rbx,%rax,4), %rax
	subl	$1, %edi
	salq	$4, %rdi
	leaq	-352(%rbp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movdqa	(%rdx), %xmm0
	movdqa	%xmm6, %xmm2
	addq	$16, %rdx
	addq	$64, %rax
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm3, %xmm2
	paddw	%xmm4, %xmm1
	paddw	%xmm4, %xmm0
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm1, %xmm5
	punpckhwd	%xmm2, %xmm1
	punpcklwd	%xmm2, %xmm5
	movdqa	%xmm0, %xmm2
	movups	%xmm1, -48(%rax)
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	movups	%xmm5, -64(%rax)
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movups	%xmm2, -32(%rax)
	movups	%xmm0, -16(%rax)
	cmpq	%rdi, %rdx
	jne	.L14
	movl	%r12d, %eax
	andl	$-16, %eax
	testb	$15, %r12b
	je	.L18
.L13:
	movq	%rsi, %rdx
	movslq	%eax, %r8
	leal	(%r12,%rax), %edi
	movsbl	-368(%rbp,%r8), %r8d
	imulq	%r14, %rdx
	movslq	%edi, %rdi
	subl	$48, %r8d
	addq	%rdx, %rdi
	movl	%r8d, (%rbx,%rdi,4)
	leal	1(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	2(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	3(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	4(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	5(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	6(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	7(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	8(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	9(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%r8, %rdx
	subl	$48, %edi
	movl	%edi, (%rbx,%rdx,4)
	leal	10(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	imulq	%r14, %rsi
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	subl	$48, %edx
	addq	%rsi, %rdi
	movl	%edx, (%rbx,%rdi,4)
	leal	11(%rax), %edx
	cmpl	%r12d, %edx
	jge	.L18
	leal	(%rdx,%r12), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	leal	12(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	leal	13(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	addl	$14, %eax
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	cmpl	%eax, %r12d
	jle	.L18
	leal	(%r12,%rax), %edx
	cltq
	movsbl	-368(%rbp,%rax), %eax
	movslq	%edx, %rdx
	addq	%rsi, %rdx
	subl	$48, %eax
	movl	%eax, (%rbx,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %r15d
	cmpl	%r12d, %r15d
	jl	.L16
	.p2align 4,,10
	.p2align 3
.L53:
	movq	-392(%rbp), %r13
.L10:
	leal	(%r12,%r12), %r11d
	xorl	%r8d, %r8d
	cmpl	%r12d, %r11d
	jle	.L20
	movq	%r13, %rdi
	movl	%r11d, %eax
	movslq	%r12d, %rdx
	movl	%r12d, %esi
	subl	%r12d, %eax
	shrq	$2, %rdi
	xorl	%r8d, %r8d
	leal	-1(%rax), %r9d
	leaq	1(%rdi), %rax
	imulq	%rdx, %rax
	addq	%r9, %rax
	notq	%r9
	leaq	4(%rbx,%rax,4), %rcx
	salq	$2, %r9
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	(%r9,%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%edx, %edx
.L24:
	cmpl	$1, (%rax)
	je	.L59
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L57
	addl	$1, %esi
	addq	%r13, %rcx
	cmpl	%esi, %r11d
	jne	.L25
.L62:
	movl	%r12d, %r9d
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%r12d, %edx
	xorl	%ecx, %ecx
	movslq	%r9d, %rsi
.L30:
	movslq	%edx, %rax
	imulq	%rdi, %rax
	addq	%rsi, %rax
	cmpl	$1, (%rbx,%rax,4)
	je	.L60
.L27:
	addl	$1, %edx
	cmpl	%r11d, %edx
	je	.L29
	movslq	%edx, %rax
	xorl	%ecx, %ecx
	imulq	%rdi, %rax
	addq	%rsi, %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L27
.L60:
	addl	$1, %ecx
	cmpl	%ecx, %r8d
	cmovl	%ecx, %r8d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L30
.L29:
	addl	$1, %r9d
	cmpl	%r9d, %r11d
	jne	.L26
.L20:
	testl	%r11d, %r11d
	jle	.L31
	movl	%r12d, -392(%rbp)
	movq	%r13, %rdi
	leal	(%r12,%r12,2), %r15d
	xorl	%esi, %esi
	movl	%r11d, -396(%rbp)
	movl	%r11d, %r13d
	xorl	%r9d, %r9d
	xorl	%r14d, %r14d
	shrq	$2, %rdi
	.p2align 4,,10
	.p2align 3
.L37:
	movl	-392(%rbp), %r11d
	movl	%r14d, %edx
	leal	(%r15,%r14), %r12d
	subl	%r14d, %r11d
	.p2align 4,,10
	.p2align 3
.L36:
	leal	(%r11,%rdx), %eax
	movslq	%edx, %rcx
	addl	$1, %esi
	cltq
	movq	%rax, %r10
	imulq	%rdi, %r10
	addq	%r10, %rcx
	cmpl	$1, (%rbx,%rcx,4)
	je	.L32
	xorl	%esi, %esi
.L32:
	imulq	%rdi, %rax
	movl	%r12d, %ecx
	subl	%edx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	cmpl	$1, (%rbx,%rax,4)
	je	.L61
	cmpl	%esi, %r8d
	cmovl	%esi, %r8d
	addl	$1, %edx
	xorl	%r9d, %r9d
	cmpl	%edx, %r13d
	jne	.L36
.L35:
	addl	$1, %r14d
	addl	$1, %r13d
	subl	$1, %r15d
	cmpl	-396(%rbp), %r14d
	jne	.L37
.L31:
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-408(%rbp), %rsp
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L61:
	addl	$1, %r9d
	cmpl	%r9d, %esi
	movl	%r9d, %eax
	cmovge	%esi, %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	addl	$1, %edx
	cmpl	%r13d, %edx
	jne	.L36
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L59:
	addl	$1, %edx
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L24
	addl	$1, %esi
	addq	%r13, %rcx
	cmpl	%esi, %r11d
	jne	.L25
	jmp	.L62
.L40:
	xorl	%eax, %eax
	movslq	%esi, %rsi
	jmp	.L13
.L4:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L63
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L63:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$392, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-372(%rbp), %rax
	movq	%rax, -416(%rbp)
	leaq	-368(%rbp), %rax
	movq	%rax, -424(%rbp)
	.p2align 4,,10
	.p2align 3
.L38:
	movq	-416(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, -408(%rbp)
	call	__isoc99_scanf@PLT
	movl	-372(%rbp), %r12d
	testl	%r12d, %r12d
	je	.L4
	leal	(%r12,%r12,2), %eax
	movq	%rsp, %rcx
	movslq	%eax, %r14
	movl	%eax, %esi
	movq	%r14, %rax
	leaq	0(,%r14,4), %r13
	imulq	%r14, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L6
.L58:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L58
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L7
	orq	$0, -8(%rsp,%rdx)
.L7:
	movq	%rsp, %rbx
	testl	%esi, %esi
	jle	.L8
	xorl	%r15d, %r15d
	movq	%rbx, -392(%rbp)
	movq	%rbx, %rdi
	salq	$2, %r14
	movl	%r15d, %ebx
	movl	%esi, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rdx
	xorl	%esi, %esi
	addl	$1, %ebx
	call	memset@PLT
	movq	%rax, %rdi
	addq	%r13, %rdi
	cmpl	%ebx, %r15d
	jne	.L9
	movq	-392(%rbp), %rbx
.L8:
	testl	%r12d, %r12d
	jle	.L10
	movq	%r13, %r14
	movq	%r13, -392(%rbp)
	xorl	%r15d, %r15d
	movq	-424(%rbp), %r13
	shrq	$2, %r14
	.p2align 4,,10
	.p2align 3
.L16:
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	-372(%rbp), %r12d
	movdqa	.LC2(%rip), %xmm4
	testl	%r12d, %r12d
	jle	.L53
	leal	-1(%r12), %eax
	leal	(%r12,%r15), %esi
	cmpl	$14, %eax
	jbe	.L40
	movslq	%esi, %rsi
	movslq	%r12d, %rdi
	pxor	%xmm6, %xmm6
	movq	%r13, %rdx
	movq	%rsi, %rax
	pxor	%xmm3, %xmm3
	imulq	%r14, %rax
	addq	%rdi, %rax
	movl	%r12d, %edi
	shrl	$4, %edi
	leaq	(%rbx,%rax,4), %rax
	subl	$1, %edi
	salq	$4, %rdi
	leaq	-352(%rbp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movdqa	(%rdx), %xmm0
	movdqa	%xmm6, %xmm2
	addq	$16, %rdx
	addq	$64, %rax
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm3, %xmm2
	paddw	%xmm4, %xmm1
	paddw	%xmm4, %xmm0
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm1, %xmm5
	punpckhwd	%xmm2, %xmm1
	punpcklwd	%xmm2, %xmm5
	movdqa	%xmm0, %xmm2
	movups	%xmm1, -48(%rax)
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	movups	%xmm5, -64(%rax)
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movups	%xmm2, -32(%rax)
	movups	%xmm0, -16(%rax)
	cmpq	%rdi, %rdx
	jne	.L14
	movl	%r12d, %eax
	andl	$-16, %eax
	testb	$15, %r12b
	je	.L18
.L13:
	movq	%rsi, %rdx
	movslq	%eax, %r8
	leal	(%r12,%rax), %edi
	movsbl	-368(%rbp,%r8), %r8d
	imulq	%r14, %rdx
	movslq	%edi, %rdi
	subl	$48, %r8d
	addq	%rdx, %rdi
	movl	%r8d, (%rbx,%rdi,4)
	leal	1(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	2(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	3(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	4(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	5(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	6(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	7(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	8(%rax), %edi
	cmpl	%edi, %r12d
	jle	.L18
	leal	(%r12,%rdi), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%rdx, %r8
	subl	$48, %edi
	movl	%edi, (%rbx,%r8,4)
	leal	9(%rax), %edi
	cmpl	%r12d, %edi
	jge	.L18
	leal	(%rdi,%r12), %r8d
	movslq	%edi, %rdi
	movsbl	-368(%rbp,%rdi), %edi
	movslq	%r8d, %r8
	addq	%r8, %rdx
	subl	$48, %edi
	movl	%edi, (%rbx,%rdx,4)
	leal	10(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	imulq	%r14, %rsi
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	subl	$48, %edx
	addq	%rsi, %rdi
	movl	%edx, (%rbx,%rdi,4)
	leal	11(%rax), %edx
	cmpl	%r12d, %edx
	jge	.L18
	leal	(%rdx,%r12), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	leal	12(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	leal	13(%rax), %edx
	cmpl	%edx, %r12d
	jle	.L18
	leal	(%r12,%rdx), %edi
	movslq	%edx, %rdx
	addl	$14, %eax
	movsbl	-368(%rbp,%rdx), %edx
	movslq	%edi, %rdi
	addq	%rsi, %rdi
	subl	$48, %edx
	movl	%edx, (%rbx,%rdi,4)
	cmpl	%eax, %r12d
	jle	.L18
	leal	(%r12,%rax), %edx
	cltq
	movsbl	-368(%rbp,%rax), %eax
	movslq	%edx, %rdx
	addq	%rsi, %rdx
	subl	$48, %eax
	movl	%eax, (%rbx,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %r15d
	cmpl	%r12d, %r15d
	jl	.L16
	.p2align 4,,10
	.p2align 3
.L53:
	movq	-392(%rbp), %r13
.L10:
	leal	(%r12,%r12), %r11d
	xorl	%r8d, %r8d
	cmpl	%r12d, %r11d
	jle	.L20
	movq	%r13, %rdi
	movl	%r11d, %eax
	movslq	%r12d, %rdx
	movl	%r12d, %esi
	subl	%r12d, %eax
	shrq	$2, %rdi
	xorl	%r8d, %r8d
	leal	-1(%rax), %r9d
	leaq	1(%rdi), %rax
	imulq	%rdx, %rax
	addq	%r9, %rax
	notq	%r9
	leaq	4(%rbx,%rax,4), %rcx
	salq	$2, %r9
	.p2align 4,,10
	.p2align 3
.L25:
	leaq	(%r9,%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L57:
	xorl	%edx, %edx
.L24:
	cmpl	$1, (%rax)
	je	.L59
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L57
	addl	$1, %esi
	addq	%r13, %rcx
	cmpl	%esi, %r11d
	jne	.L25
.L62:
	movl	%r12d, %r9d
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%r12d, %edx
	xorl	%ecx, %ecx
	movslq	%r9d, %rsi
.L30:
	movslq	%edx, %rax
	imulq	%rdi, %rax
	addq	%rsi, %rax
	cmpl	$1, (%rbx,%rax,4)
	je	.L60
.L27:
	addl	$1, %edx
	cmpl	%r11d, %edx
	je	.L29
	movslq	%edx, %rax
	xorl	%ecx, %ecx
	imulq	%rdi, %rax
	addq	%rsi, %rax
	cmpl	$1, (%rbx,%rax,4)
	jne	.L27
.L60:
	addl	$1, %ecx
	cmpl	%ecx, %r8d
	cmovl	%ecx, %r8d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L30
.L29:
	addl	$1, %r9d
	cmpl	%r9d, %r11d
	jne	.L26
.L20:
	testl	%r11d, %r11d
	jle	.L31
	movl	%r12d, -392(%rbp)
	movq	%r13, %rdi
	leal	(%r12,%r12,2), %r15d
	xorl	%esi, %esi
	movl	%r11d, -396(%rbp)
	movl	%r11d, %r13d
	xorl	%r9d, %r9d
	xorl	%r14d, %r14d
	shrq	$2, %rdi
	.p2align 4,,10
	.p2align 3
.L37:
	movl	-392(%rbp), %r11d
	movl	%r14d, %edx
	leal	(%r15,%r14), %r12d
	subl	%r14d, %r11d
	.p2align 4,,10
	.p2align 3
.L36:
	leal	(%r11,%rdx), %eax
	movslq	%edx, %rcx
	addl	$1, %esi
	cltq
	movq	%rax, %r10
	imulq	%rdi, %r10
	addq	%r10, %rcx
	cmpl	$1, (%rbx,%rcx,4)
	je	.L32
	xorl	%esi, %esi
.L32:
	imulq	%rdi, %rax
	movl	%r12d, %ecx
	subl	%edx, %ecx
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	cmpl	$1, (%rbx,%rax,4)
	je	.L61
	cmpl	%esi, %r8d
	cmovl	%esi, %r8d
	addl	$1, %edx
	xorl	%r9d, %r9d
	cmpl	%edx, %r13d
	jne	.L36
.L35:
	addl	$1, %r14d
	addl	$1, %r13d
	subl	$1, %r15d
	cmpl	-396(%rbp), %r14d
	jne	.L37
.L31:
	movl	%r8d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-408(%rbp), %rsp
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L61:
	addl	$1, %r9d
	cmpl	%r9d, %esi
	movl	%r9d, %eax
	cmovge	%esi, %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	addl	$1, %edx
	cmpl	%r13d, %edx
	jne	.L36
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L59:
	addl	$1, %edx
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L24
	addl	$1, %esi
	addq	%r13, %rcx
	cmpl	%esi, %r11d
	jne	.L25
	jmp	.L62
.L40:
	xorl	%eax, %eax
	movslq	%esi, %rsi
	jmp	.L13
.L4:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L63
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L63:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.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 max(int a, int b){
	return a>b? a:b;
}

int main(){
	while(1){
		int n, i, j;
		scanf("%d", &n);
		if(n==0) break;

	
		int grid[3*n][3*n];
		for(i=0; i<3*n; i++) for(j=0; j<3*n; j++) grid[i][j]=0;
		for(i=0; i<n; i++){
			char s[300];
			scanf("%s", s);
			for(j=0; j<n; j++){
				grid[n+i][n+j] = s[j]-'0';
			}
		}
		

		int ans = 0;
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[i][j]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[j][i]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		int ltor=0, rtol=0;
		for(i=0; i<n*2; i++){
			for(j=0; j<n*2; j++){
				if(grid[n+j][i+j]==1) ltor++;
				else ltor=0;
				if(grid[n+j][3*n-i-j]==1) rtol++;
				else rtol=0;
				ans = max(ans, max(ltor, rtol));
			}
		}

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

	}
	return 0;
}

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
 4
6
 3
8
 2
8
 4
8
1
1
 4
5
 4
8
1
2
 4
8
1
 4
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 max(int a, int b){
	return a>b? a:b;
}

int main(){
	while(1){
		int n, i, j;
		scanf("%d", &n);
		if(n==0) break;

	
		int grid[3*n][3*n];
		for(i=0; i<3*n; i++) for(j=0; j<3*n; j++) grid[i][j]=0;
		for(i=0; i<n; i++){
			char s[300];
			scanf("%s", s);
			for(j=0; j<n; j++){
				grid[n+i][n+j] = s[j]-'0';
			}
		}
		

		int ans = 0;
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[i][j]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		for(i=n; i<n*2; i++){
			int tmp=0;
			for(j=n; j<n*2; j++){
				if(grid[j][i]==1) tmp++;
				else tmp=0;
				ans = max(ans, tmp);
			}
		}
		int ltor=0, rtol=0;
		for(i=0; i<n*2; i++){
			for(j=0; j<n*2; j++){
				if(grid[n+j][i+j]==1) ltor++;
				else ltor=0;
				if(grid[n+j][3*n-i-j]==1) rtol++;
				else rtol=0;
				ans = max(ans, max(ltor, rtol));
			}
		}

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

	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$456, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L37:
	movq	%rsp, %rax
	movq	%rax, %rbx
	movq	%rbx, -488(%rbp)
	leaq	-424(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-424(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -392(%rbp)
	movslq	%esi, %rax
	movq	%rax, -480(%rbp)
	movq	$0, -472(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -384(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%r13, %rdx
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r12, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r12, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -464(%rbp)
	movq	$0, -456(%rbp)
	movslq	%edi, %rax
	movq	%rax, -448(%rbp)
	movq	$0, -440(%rbp)
	movq	-464(%rbp), %r9
	movq	-456(%rbp), %r10
	movq	%r10, %rdx
	imulq	-448(%rbp), %rdx
	movq	-440(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-448(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -376(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L9
.L12:
	movl	$0, -416(%rbp)
	jmp	.L10
.L11:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	$0, (%rcx,%rax,4)
	addl	$1, -416(%rbp)
.L10:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L11
	addl	$1, -420(%rbp)
.L9:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L12
	movl	$0, -420(%rbp)
	jmp	.L13
.L16:
	leaq	-368(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -416(%rbp)
	jmp	.L14
.L15:
	movl	-416(%rbp), %eax
	cltq
	movzbl	-368(%rbp,%rax), %eax
	movsbl	%al, %ecx
	movq	%rbx, %r8
	shrq	$2, %r8
	movl	-424(%rbp), %edx
	movl	-420(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	leal	-48(%rcx), %esi
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%edi, %rax
	imulq	%r8, %rax
	addq	%rcx, %rax
	movl	%esi, (%rdx,%rax,4)
	addl	$1, -416(%rbp)
.L14:
	movl	-424(%rbp), %eax
	cmpl	%eax, -416(%rbp)
	jl	.L15
	addl	$1, -420(%rbp)
.L13:
	movl	-424(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L16
	movl	$0, -412(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L17
.L22:
	movl	$0, -408(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L18
.L21:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	addl	$1, -408(%rbp)
	jmp	.L20
.L19:
	movl	$0, -408(%rbp)
.L20:
	movl	-408(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L18:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L21
	addl	$1, -420(%rbp)
.L17:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L22
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L23
.L28:
	movl	$0, -404(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L24
.L27:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-420(%rbp), %eax
	movslq	%eax, %rsi
	movl	-416(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	addl	$1, -404(%rbp)
	jmp	.L26
.L25:
	movl	$0, -404(%rbp)
.L26:
	movl	-404(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L24:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L27
	addl	$1, -420(%rbp)
.L23:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L28
	movl	$0, -400(%rbp)
	movl	$0, -396(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L29
.L36:
	movl	$0, -416(%rbp)
	jmp	.L30
.L35:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-420(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L31
	addl	$1, -400(%rbp)
	jmp	.L32
.L31:
	movl	$0, -400(%rbp)
.L32:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	subl	-420(%rbp), %eax
	subl	-416(%rbp), %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L33
	addl	$1, -396(%rbp)
	jmp	.L34
.L33:
	movl	$0, -396(%rbp)
.L34:
	movl	-396(%rbp), %edx
	movl	-400(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L30:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L35
	addl	$1, -420(%rbp)
.L29:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L36
	movl	-412(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-488(%rbp), %rsp
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$456, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L37:
	movq	%rsp, %rax
	movq	%rax, %rbx
	movq	%rbx, -488(%rbp)
	leaq	-424(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-424(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L38
	jmp	.L39
.L4:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	leal	(%rax,%rdx), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -392(%rbp)
	movslq	%esi, %rax
	movq	%rax, -480(%rbp)
	movq	$0, -472(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -384(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movq	%r13, %rdx
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r12, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r12, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -464(%rbp)
	movq	$0, -456(%rbp)
	movslq	%edi, %rax
	movq	%rax, -448(%rbp)
	movq	$0, -440(%rbp)
	movq	-464(%rbp), %r9
	movq	-456(%rbp), %r10
	movq	%r10, %rdx
	imulq	-448(%rbp), %rdx
	movq	-440(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-448(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -376(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L9
.L12:
	movl	$0, -416(%rbp)
	jmp	.L10
.L11:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	$0, (%rcx,%rax,4)
	addl	$1, -416(%rbp)
.L10:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L11
	addl	$1, -420(%rbp)
.L9:
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L12
	movl	$0, -420(%rbp)
	jmp	.L13
.L16:
	leaq	-368(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -416(%rbp)
	jmp	.L14
.L15:
	movl	-416(%rbp), %eax
	cltq
	movzbl	-368(%rbp,%rax), %eax
	movsbl	%al, %ecx
	movq	%rbx, %r8
	shrq	$2, %r8
	movl	-424(%rbp), %edx
	movl	-420(%rbp), %eax
	leal	(%rdx,%rax), %edi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	leal	-48(%rcx), %esi
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%edi, %rax
	imulq	%r8, %rax
	addq	%rcx, %rax
	movl	%esi, (%rdx,%rax,4)
	addl	$1, -416(%rbp)
.L14:
	movl	-424(%rbp), %eax
	cmpl	%eax, -416(%rbp)
	jl	.L15
	addl	$1, -420(%rbp)
.L13:
	movl	-424(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L16
	movl	$0, -412(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L17
.L22:
	movl	$0, -408(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L18
.L21:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-416(%rbp), %eax
	movslq	%eax, %rsi
	movl	-420(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L19
	addl	$1, -408(%rbp)
	jmp	.L20
.L19:
	movl	$0, -408(%rbp)
.L20:
	movl	-408(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L18:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L21
	addl	$1, -420(%rbp)
.L17:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L22
	movl	-424(%rbp), %eax
	movl	%eax, -420(%rbp)
	jmp	.L23
.L28:
	movl	$0, -404(%rbp)
	movl	-424(%rbp), %eax
	movl	%eax, -416(%rbp)
	jmp	.L24
.L27:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movq	-376(%rbp), %rcx
	movl	-420(%rbp), %eax
	movslq	%eax, %rsi
	movl	-416(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movl	(%rcx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L25
	addl	$1, -404(%rbp)
	jmp	.L26
.L25:
	movl	$0, -404(%rbp)
.L26:
	movl	-404(%rbp), %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L24:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L27
	addl	$1, -420(%rbp)
.L23:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L28
	movl	$0, -400(%rbp)
	movl	$0, -396(%rbp)
	movl	$0, -420(%rbp)
	jmp	.L29
.L36:
	movl	$0, -416(%rbp)
	jmp	.L30
.L35:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-420(%rbp), %edx
	movl	-416(%rbp), %eax
	addl	%edx, %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L31
	addl	$1, -400(%rbp)
	jmp	.L32
.L31:
	movl	$0, -400(%rbp)
.L32:
	movq	%rbx, %rdi
	shrq	$2, %rdi
	movl	-424(%rbp), %edx
	movl	-416(%rbp), %eax
	leal	(%rdx,%rax), %esi
	movl	-424(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%edx, %eax
	subl	-420(%rbp), %eax
	subl	-416(%rbp), %eax
	movq	-376(%rbp), %rdx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	%rdi, %rax
	addq	%rcx, %rax
	movl	(%rdx,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L33
	addl	$1, -396(%rbp)
	jmp	.L34
.L33:
	movl	$0, -396(%rbp)
.L34:
	movl	-396(%rbp), %edx
	movl	-400(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, %edx
	movl	-412(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -412(%rbp)
	addl	$1, -416(%rbp)
.L30:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -416(%rbp)
	jl	.L35
	addl	$1, -420(%rbp)
.L29:
	movl	-424(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -420(%rbp)
	jl	.L36
	movl	-412(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-488(%rbp), %rsp
	jmp	.L37
.L39:
	call	__stack_chk_fail@PLT
.L38:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
