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

```c
// Aizu Vol-1 0151: Grid
// 2017.8.17 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
char *gets();

#define MAX 256
char a[MAX+5][MAX+5];
int n, max;

void maxOnes(int r0, int c0, int w, int dir)
{
	int r, c, k, f;
	if (w < max) return;
	if (dir == 0) {
		for (f = 0, c = 0; c < n; c++) {
			if (a[r0][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 1) {
		for (f = 0, r = 0; r < n; r++) {
			if (a[r][c0] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 2) {
		for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r--, c++) {
			if (a[r][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r++, c++) {
		if (a[r][c] & 1) f++;
		else { if (f > max) max = f; f = 0; }
	}
	if (f > max) max = f;
	return;
}

int main()
{
	int r, c, k;
	char buf[10];

	while (1) {
		gets(buf); if (!(n = atoi(buf))) break;
		for (r = 0; r < n; r++) gets(a[r]);
		max = 0;
		for (k = 1; k <= n; k++)   maxOnes(k - 1, 0, k, 2);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - 1, n - k, k, 2);
		for (k = 1; k <= n; k++)   maxOnes(0, n - k, k, 3);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - k, 0, k, 3);
		for (r = 0; r < n; r++) {
			maxOnes(r, 0, n, 0);
			if (max == n) goto Done;
		}
		for (c = 0; c < n; c++) {
			maxOnes(0, c, n, 1);
			if (max == n) goto Done;
		}
	Done: printf("%d\n", max);
	}
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 68121
a:
	.zero	68121
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	maxOnes
	.type	maxOnes, @function
maxOnes:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	max(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L31
	cmpl	$0, -32(%rbp)
	jne	.L4
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -4(%rbp)
	jmp	.L7
.L6:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L8
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L8:
	movl	$0, -4(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L5:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L32
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L32
.L4:
	cmpl	$1, -32(%rbp)
	jne	.L11
	movl	$0, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L12
.L16:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -4(%rbp)
	jmp	.L14
.L13:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L15
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L15:
	movl	$0, -4(%rbp)
.L14:
	addl	$1, -16(%rbp)
.L12:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L33
.L11:
	cmpl	$2, -32(%rbp)
	jne	.L18
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L19
.L23:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	jmp	.L21
.L20:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L22
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L22:
	movl	$0, -4(%rbp)
.L21:
	addl	$1, -8(%rbp)
	subl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L19:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L34
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L34
.L18:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L25
.L29:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L26
	addl	$1, -4(%rbp)
	jmp	.L27
.L26:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L28
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L28:
	movl	$0, -4(%rbp)
.L27:
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L29
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L35
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L35
.L31:
	nop
	jmp	.L1
.L32:
	nop
	jmp	.L1
.L33:
	nop
	jmp	.L1
.L34:
	nop
	jmp	.L1
.L35:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	maxOnes, .-maxOnes
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L58:
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, n(%rip)
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L62
	movl	$0, -32(%rbp)
	jmp	.L39
.L40:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	addl	$1, -32(%rbp)
.L39:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	$0, max(%rip)
	movl	$1, -24(%rbp)
	jmp	.L41
.L42:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edi
	movl	-24(%rbp), %eax
	movl	$2, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	call	maxOnes
	addl	$1, -24(%rbp)
.L41:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L42
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L63
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L45
.L46:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	n(%rip), %edx
	leal	-1(%rdx), %edi
	movl	-24(%rbp), %edx
	movl	$2, %ecx
	movl	%eax, %esi
	call	maxOnes
	subl	$1, -24(%rbp)
.L45:
	cmpl	$0, -24(%rbp)
	jg	.L46
	movl	$1, -24(%rbp)
	jmp	.L47
.L48:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	addl	$1, -24(%rbp)
.L47:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L48
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L64
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L50
.L51:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	subl	$1, -24(%rbp)
.L50:
	cmpl	$0, -24(%rbp)
	jg	.L51
	movl	$0, -32(%rbp)
	jmp	.L52
.L54:
	movl	n(%rip), %edx
	movl	-32(%rbp), %eax
	movl	$0, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L65
	addl	$1, -32(%rbp)
.L52:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L54
	movl	$0, -28(%rbp)
	jmp	.L55
.L57:
	movl	n(%rip), %edx
	movl	-28(%rbp), %eax
	movl	$1, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L66
	addl	$1, -28(%rbp)
.L55:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L57
	jmp	.L44
.L63:
	nop
	jmp	.L44
.L64:
	nop
	jmp	.L44
.L65:
	nop
	jmp	.L44
.L66:
	nop
.L44:
	movl	max(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L58
.L62:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	maxOnes
	.type	maxOnes, @function
maxOnes:
.LFB39:
	.cfi_startproc
	endbr64
	movl	max(%rip), %r8d
	cmpl	%edx, %r8d
	jg	.L1
	testl	%ecx, %ecx
	je	.L58
	cmpl	$1, %ecx
	je	.L59
	cmpl	$2, %ecx
	je	.L17
	testl	%edx, %edx
	jle	.L60
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	a(%rip), %rcx
	subl	$1, %edx
	movq	%rdi, %rax
	imulq	$262, %rdx, %rdx
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rdi
	leaq	(%rsi,%rdi), %rax
	addq	%rcx, %rax
	addq	$262, %rcx
	addq	%rsi, %rcx
	movl	%r8d, %esi
	addq	%rdi, %rcx
	xorl	%edi, %edi
	addq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L62:
	addq	$262, %rax
	addl	$1, %edx
	cmpq	%rcx, %rax
	je	.L61
.L27:
	testb	$1, (%rax)
	jne	.L62
	cmpl	%esi, %edx
	jle	.L50
	movl	%edx, %esi
	movl	$1, %edi
.L50:
	addq	$262, %rax
	xorl	%edx, %edx
	cmpq	%rcx, %rax
	jne	.L27
.L61:
	testb	%dil, %dil
	je	.L37
	movl	%esi, max(%rip)
.L19:
	cmpl	%esi, %edx
	jle	.L1
.L51:
	movl	%edx, max(%rip)
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L58:
	movslq	n(%rip), %rcx
	testl	%ecx, %ecx
	jle	.L29
	movslq	%edi, %rdi
	xorl	%edx, %edx
	xorl	%r9d, %r9d
	movq	%rdi, %rax
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rsi
	leaq	a(%rip), %rax
	movl	%r8d, %edi
	addq	%rax, %rsi
	xorl	%eax, %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L64:
	addl	$1, %edx
.L7:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L63
.L8:
	testb	$1, (%rsi,%rax)
	jne	.L64
	cmpl	%edi, %edx
	jg	.L30
	addq	$1, %rax
	xorl	%edx, %edx
	cmpq	%rax, %rcx
	jne	.L8
.L63:
	testb	%r9b, %r9b
	je	.L31
	movl	%edi, max(%rip)
.L5:
	cmpl	%edi, %edx
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	movl	%r8d, %esi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%edx, %edi
	movl	$1, %r9d
	xorl	%edx, %edx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L59:
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L34
	movslq	%esi, %rsi
	subl	$1, %edx
	leaq	a(%rip), %rax
	xorl	%edi, %edi
	leaq	261+a(%rip), %rcx
	addq	%rsi, %rax
	addq	%rsi, %rcx
	movq	%rdx, %rsi
	salq	$6, %rsi
	addq	%rdx, %rsi
	leaq	(%rdx,%rsi,4), %rdx
	movl	%r8d, %esi
	addq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L65:
	addl	$1, %edx
.L14:
	addq	$261, %rax
	cmpq	%rax, %rcx
	je	.L54
.L15:
	testb	$1, (%rax)
	jne	.L65
	cmpl	%esi, %edx
	jle	.L48
	movl	%edx, %esi
	movl	$1, %edi
.L48:
	xorl	%edx, %edx
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L54:
	testb	%dil, %dil
	je	.L20
	movl	%esi, max(%rip)
	movl	%esi, %r8d
.L20:
	cmpl	%r8d, %edx
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	testl	%edx, %edx
	jle	.L34
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	a(%rip), %rcx
	movq	%rdi, %rax
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rdi
	leaq	(%rdi,%rsi), %rax
	addq	%rcx, %rax
	subq	$260, %rcx
	addq	%rsi, %rcx
	leal	-1(%rdx), %esi
	movq	%rsi, %rdx
	addq	%rdi, %rcx
	xorl	%edi, %edi
	salq	$6, %rdx
	addq	%rsi, %rdx
	movl	%r8d, %esi
	salq	$2, %rdx
	subq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L66:
	addl	$1, %edx
.L22:
	subq	$260, %rax
	cmpq	%rax, %rcx
	je	.L54
.L23:
	testb	$1, (%rax)
	jne	.L66
	cmpl	%esi, %edx
	jle	.L49
	movl	%edx, %esi
	movl	$1, %edi
.L49:
	xorl	%edx, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L31:
	movl	%r8d, %edi
	jmp	.L5
.L29:
	movl	%r8d, %edi
	xorl	%edx, %edx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L60:
	movl	%r8d, %esi
	xorl	%edx, %edx
	jmp	.L19
.L34:
	xorl	%edx, %edx
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	maxOnes, .-maxOnes
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	261+a(%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
	leaq	14(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L117:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movq	%rbx, %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	movl	%eax, n(%rip)
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L68
	jle	.L69
	leaq	a(%rip), %r14
	xorl	%r12d, %r12d
	movq	%r14, %r13
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	addq	$261, %r13
	call	gets@PLT
	movl	n(%rip), %edi
	cmpl	%r12d, %edi
	jg	.L70
	movl	$0, max(%rip)
	testl	%edi, %edi
	jle	.L127
	leaq	-260+a(%rip), %rsi
	leal	1(%rdi), %r10d
	xorl	%r9d, %r9d
	xorl	%edx, %edx
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L76:
	cmpl	%edx, %r8d
	jl	.L72
	movq	%r14, %rax
	xorl	%ecx, %ecx
	jmp	.L75
	.p2align 4,,10
	.p2align 3
.L178:
	subq	$260, %rax
	addl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L177
.L75:
	testb	$1, (%rax)
	jne	.L178
	cmpl	%edx, %ecx
	jle	.L170
	movl	%ecx, %edx
	movl	$1, %r9d
.L170:
	subq	$260, %rax
	xorl	%ecx, %ecx
	cmpq	%rsi, %rax
	jne	.L75
.L177:
	cmpl	%edx, %ecx
	jle	.L72
	movl	%ecx, %edx
	movl	$1, %r9d
.L72:
	addl	$1, %r8d
	addq	$1, %rsi
	addq	$261, %r14
	cmpl	%r10d, %r8d
	jne	.L76
	testb	%r9b, %r9b
	je	.L77
	movl	%edx, max(%rip)
.L71:
	cmpl	%edx, %edi
	jne	.L119
.L78:
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L117
.L77:
	leal	-1(%rdi), %r11d
	xorl	%edx, %edx
	movl	%r11d, %r8d
	testl	%r11d, %r11d
	jle	.L118
.L125:
	movslq	%edi, %rax
	movl	%edx, %ecx
	movl	%r11d, %esi
	xorl	%r9d, %r9d
	movq	%rax, %r10
	salq	$6, %r10
	addq	%rax, %r10
	leaq	-261(%rax,%r10,4), %r12
	leaq	a(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L84:
	cmpl	%ecx, %esi
	jl	.L80
	movl	%edi, %eax
	movl	%ecx, %r14d
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	subl	%esi, %eax
	cltq
	addq	%r12, %rax
	addq	%r10, %rax
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L180:
	addl	$1, %r13d
	addl	$1, %ecx
	subq	$260, %rax
	cmpl	%r13d, %esi
	jle	.L179
.L83:
	testb	$1, (%rax)
	jne	.L180
	cmpl	%r14d, %ecx
	jle	.L171
	movl	%ecx, %r14d
	movl	$1, %r9d
.L171:
	addl	$1, %r13d
	xorl	%ecx, %ecx
	subq	$260, %rax
	cmpl	%r13d, %esi
	jg	.L83
.L179:
	cmpl	%r14d, %ecx
	jg	.L131
	movl	%r14d, %ecx
.L80:
	subl	$1, %esi
	jne	.L84
.L196:
	testb	%r9b, %r9b
	je	.L85
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
.L85:
	testl	%edi, %edi
	jle	.L86
.L118:
	leaq	a(%rip), %r14
	movl	%edx, %ecx
	xorl	%r10d, %r10d
	xorl	%r12d, %r12d
	movl	$1, %r9d
	leaq	262(%r14), %r13
	.p2align 4,,10
	.p2align 3
.L91:
	cmpl	%r9d, %ecx
	jg	.L87
	movl	%edi, %r15d
	leaq	0(%r13,%r10), %rsi
	subl	%r9d, %r15d
	movslq	%r15d, %r15
	leaq	(%r15,%r14), %rax
	addq	%r15, %rsi
	movl	%ecx, %r15d
	xorl	%ecx, %ecx
	jmp	.L90
	.p2align 4,,10
	.p2align 3
.L182:
	addq	$262, %rax
	addl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L181
.L90:
	testb	$1, (%rax)
	jne	.L182
	cmpl	%r15d, %ecx
	jle	.L172
	movl	%ecx, %r15d
	movl	$1, %r12d
.L172:
	addq	$262, %rax
	xorl	%ecx, %ecx
	cmpq	%rsi, %rax
	jne	.L90
.L181:
	cmpl	%r15d, %ecx
	jg	.L133
	movl	%r15d, %ecx
.L87:
	addl	$1, %r9d
	addq	$262, %r10
	cmpl	%edi, %r9d
	jle	.L91
.L195:
	testb	%r12b, %r12b
	je	.L92
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
.L92:
	cmpl	%edi, %edx
	je	.L78
	movl	%edx, %r9d
	testl	%r11d, %r11d
	jle	.L93
.L124:
	xorl	%r10d, %r10d
	leaq	a(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L98:
	cmpl	%r8d, %edx
	jg	.L94
	movl	%edi, %eax
	xorl	%esi, %esi
	subl	%r8d, %eax
	cltq
	movq	%rax, %rcx
	salq	$6, %rcx
	addq	%rax, %rcx
	leaq	(%rax,%rcx,4), %rax
	xorl	%ecx, %ecx
	addq	%r12, %rax
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L184:
	addl	$1, %ecx
	addl	$1, %esi
	addq	$262, %rax
	cmpl	%r8d, %ecx
	jge	.L183
.L97:
	testb	$1, (%rax)
	jne	.L184
	cmpl	%esi, %edx
	jge	.L173
	movl	%esi, %edx
	movl	$1, %r10d
.L173:
	addl	$1, %ecx
	xorl	%esi, %esi
	addq	$262, %rax
	cmpl	%r8d, %ecx
	jl	.L97
.L183:
	cmpl	%edx, %esi
	jle	.L94
	movl	%esi, %edx
	movl	$1, %r10d
.L94:
	subl	$1, %r8d
	jne	.L98
	testb	%r10b, %r10b
	je	.L99
	movl	%edx, max(%rip)
	movl	%edx, %r9d
.L99:
	testl	%edi, %edi
	jle	.L141
.L93:
	movl	%r9d, %esi
	leaq	a(%rip), %r8
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movl	%r11d, %r10d
	cmpl	%edi, %esi
	jg	.L106
	.p2align 4,,10
	.p2align 3
.L189:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L103
	.p2align 4,,10
	.p2align 3
.L186:
	addl	$1, %edx
	leaq	1(%rax), %rcx
	cmpq	%r10, %rax
	je	.L185
.L139:
	movq	%rcx, %rax
.L103:
	testb	$1, (%r8,%rax)
	jne	.L186
	cmpl	%esi, %edx
	jle	.L174
	movl	%edx, %esi
	movl	$1, %r13d
.L174:
	xorl	%edx, %edx
	leaq	1(%rax), %rcx
	cmpq	%r10, %rax
	jne	.L139
.L185:
	cmpl	%edx, %esi
	jl	.L140
	movl	%esi, %edx
	cmpl	%edi, %edx
	je	.L187
.L105:
	addl	$1, %r12d
	cmpl	%edi, %r12d
	je	.L188
	movl	%edx, %esi
	addq	$261, %r8
	cmpl	%edi, %esi
	jle	.L189
.L106:
	testb	%r13b, %r13b
	je	.L142
.L198:
	movl	%esi, max(%rip)
.L108:
	movq	%r11, %rax
	movl	%esi, %edx
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	salq	$6, %rax
	addq	%r11, %rax
	leaq	(%r11,%rax,4), %rax
	movq	$-261, %r11
	leaq	0(%rbp,%rax), %r8
	subq	%rax, %r11
	cmpl	%edi, %edx
	jg	.L115
	.p2align 4,,10
	.p2align 3
.L194:
	leaq	(%r11,%r8), %rax
	xorl	%ecx, %ecx
	jmp	.L112
	.p2align 4,,10
	.p2align 3
.L191:
	addq	$261, %rax
	addl	$1, %ecx
	cmpq	%rax, %r8
	je	.L190
.L112:
	testb	$1, (%rax)
	jne	.L191
	cmpl	%ecx, %edx
	jge	.L175
	movl	%ecx, %edx
	movl	$1, %r10d
.L175:
	addq	$261, %rax
	xorl	%ecx, %ecx
	cmpq	%rax, %r8
	jne	.L112
.L190:
	cmpl	%edx, %ecx
	jg	.L144
	movl	%edx, %ecx
	cmpl	%edi, %ecx
	je	.L192
.L114:
	addl	$1, %r9d
	cmpl	%edi, %r9d
	je	.L193
	movl	%ecx, %edx
	addq	$1, %r8
	cmpl	%edi, %edx
	jle	.L194
.L115:
	testb	%r10b, %r10b
	jne	.L176
	movl	%esi, %edx
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L133:
	addl	$1, %r9d
	movl	$1, %r12d
	addq	$262, %r10
	cmpl	%edi, %r9d
	jle	.L91
	jmp	.L195
	.p2align 4,,10
	.p2align 3
.L131:
	movl	$1, %r9d
	subl	$1, %esi
	jne	.L84
	jmp	.L196
	.p2align 4,,10
	.p2align 3
.L140:
	movl	$1, %r13d
	cmpl	%edi, %edx
	jne	.L105
.L187:
	testb	%r13b, %r13b
	je	.L141
.L176:
	movl	%edx, max(%rip)
	jmp	.L78
.L69:
	movl	$0, max(%rip)
	xorl	%edx, %edx
.L119:
	leal	-1(%rdi), %r11d
	movl	%r11d, %r8d
	testl	%r11d, %r11d
	jg	.L125
	testl	%edi, %edi
	jg	.L118
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L144:
	movl	$1, %r10d
	cmpl	%edi, %ecx
	jne	.L114
.L192:
	movl	%esi, %edx
	testb	%r10b, %r10b
	je	.L78
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
	jmp	.L78
.L68:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L197
	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
.L188:
	.cfi_restore_state
	movl	%edx, %esi
	testb	%r13b, %r13b
	jne	.L198
.L142:
	movl	%r9d, %esi
	jmp	.L108
.L141:
	movl	%r9d, %edx
	jmp	.L78
.L86:
	movl	%edx, %r9d
	cmpl	%edi, %edx
	jne	.L124
	jmp	.L78
.L193:
	movl	%ecx, %edx
	jmp	.L115
.L127:
	xorl	%edx, %edx
	jmp	.L71
.L197:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 68121
a:
	.zero	68121
	.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	maxOnes
	.type	maxOnes, @function
maxOnes:
.LFB39:
	.cfi_startproc
	endbr64
	movl	max(%rip), %r8d
	cmpl	%edx, %r8d
	jg	.L1
	testl	%ecx, %ecx
	je	.L58
	cmpl	$1, %ecx
	je	.L59
	cmpl	$2, %ecx
	je	.L17
	testl	%edx, %edx
	jle	.L60
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	a(%rip), %rcx
	subl	$1, %edx
	movq	%rdi, %rax
	imulq	$262, %rdx, %rdx
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rdi
	leaq	(%rsi,%rdi), %rax
	addq	%rcx, %rax
	addq	$262, %rcx
	addq	%rsi, %rcx
	movl	%r8d, %esi
	addq	%rdi, %rcx
	xorl	%edi, %edi
	addq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L62:
	addq	$262, %rax
	addl	$1, %edx
	cmpq	%rcx, %rax
	je	.L61
.L27:
	testb	$1, (%rax)
	jne	.L62
	cmpl	%esi, %edx
	jle	.L50
	movl	%edx, %esi
	movl	$1, %edi
.L50:
	addq	$262, %rax
	xorl	%edx, %edx
	cmpq	%rcx, %rax
	jne	.L27
.L61:
	testb	%dil, %dil
	je	.L37
	movl	%esi, max(%rip)
.L19:
	cmpl	%esi, %edx
	jle	.L1
.L51:
	movl	%edx, max(%rip)
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L58:
	movslq	n(%rip), %rcx
	testl	%ecx, %ecx
	jle	.L29
	movslq	%edi, %rdi
	xorl	%edx, %edx
	xorl	%r9d, %r9d
	movq	%rdi, %rax
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rsi
	leaq	a(%rip), %rax
	movl	%r8d, %edi
	addq	%rax, %rsi
	xorl	%eax, %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L64:
	addl	$1, %edx
.L7:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L63
.L8:
	testb	$1, (%rsi,%rax)
	jne	.L64
	cmpl	%edi, %edx
	jg	.L30
	addq	$1, %rax
	xorl	%edx, %edx
	cmpq	%rax, %rcx
	jne	.L8
.L63:
	testb	%r9b, %r9b
	je	.L31
	movl	%edi, max(%rip)
.L5:
	cmpl	%edi, %edx
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	movl	%r8d, %esi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%edx, %edi
	movl	$1, %r9d
	xorl	%edx, %edx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L59:
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L34
	movslq	%esi, %rsi
	subl	$1, %edx
	leaq	a(%rip), %rax
	xorl	%edi, %edi
	leaq	261+a(%rip), %rcx
	addq	%rsi, %rax
	addq	%rsi, %rcx
	movq	%rdx, %rsi
	salq	$6, %rsi
	addq	%rdx, %rsi
	leaq	(%rdx,%rsi,4), %rdx
	movl	%r8d, %esi
	addq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L65:
	addl	$1, %edx
.L14:
	addq	$261, %rax
	cmpq	%rax, %rcx
	je	.L54
.L15:
	testb	$1, (%rax)
	jne	.L65
	cmpl	%esi, %edx
	jle	.L48
	movl	%edx, %esi
	movl	$1, %edi
.L48:
	xorl	%edx, %edx
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L54:
	testb	%dil, %dil
	je	.L20
	movl	%esi, max(%rip)
	movl	%esi, %r8d
.L20:
	cmpl	%r8d, %edx
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	testl	%edx, %edx
	jle	.L34
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	a(%rip), %rcx
	movq	%rdi, %rax
	salq	$6, %rax
	addq	%rdi, %rax
	leaq	(%rdi,%rax,4), %rdi
	leaq	(%rdi,%rsi), %rax
	addq	%rcx, %rax
	subq	$260, %rcx
	addq	%rsi, %rcx
	leal	-1(%rdx), %esi
	movq	%rsi, %rdx
	addq	%rdi, %rcx
	xorl	%edi, %edi
	salq	$6, %rdx
	addq	%rsi, %rdx
	movl	%r8d, %esi
	salq	$2, %rdx
	subq	%rdx, %rcx
	xorl	%edx, %edx
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L66:
	addl	$1, %edx
.L22:
	subq	$260, %rax
	cmpq	%rax, %rcx
	je	.L54
.L23:
	testb	$1, (%rax)
	jne	.L66
	cmpl	%esi, %edx
	jle	.L49
	movl	%edx, %esi
	movl	$1, %edi
.L49:
	xorl	%edx, %edx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L31:
	movl	%r8d, %edi
	jmp	.L5
.L29:
	movl	%r8d, %edi
	xorl	%edx, %edx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L60:
	movl	%r8d, %esi
	xorl	%edx, %edx
	jmp	.L19
.L34:
	xorl	%edx, %edx
	jmp	.L20
	.cfi_endproc
.LFE39:
	.size	maxOnes, .-maxOnes
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	261+a(%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
	leaq	14(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L117:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movq	%rbx, %rdi
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	movl	%eax, n(%rip)
	movl	%eax, %edi
	testl	%eax, %eax
	je	.L68
	jle	.L69
	leaq	a(%rip), %r14
	xorl	%r12d, %r12d
	movq	%r14, %r13
	.p2align 4,,10
	.p2align 3
.L70:
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	addq	$261, %r13
	call	gets@PLT
	movl	n(%rip), %edi
	cmpl	%r12d, %edi
	jg	.L70
	movl	$0, max(%rip)
	testl	%edi, %edi
	jle	.L127
	leaq	-260+a(%rip), %rsi
	leal	1(%rdi), %r10d
	xorl	%r9d, %r9d
	xorl	%edx, %edx
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L76:
	cmpl	%edx, %r8d
	jl	.L72
	movq	%r14, %rax
	xorl	%ecx, %ecx
	jmp	.L75
	.p2align 4,,10
	.p2align 3
.L178:
	subq	$260, %rax
	addl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L177
.L75:
	testb	$1, (%rax)
	jne	.L178
	cmpl	%edx, %ecx
	jle	.L170
	movl	%ecx, %edx
	movl	$1, %r9d
.L170:
	subq	$260, %rax
	xorl	%ecx, %ecx
	cmpq	%rsi, %rax
	jne	.L75
.L177:
	cmpl	%edx, %ecx
	jle	.L72
	movl	%ecx, %edx
	movl	$1, %r9d
.L72:
	addl	$1, %r8d
	addq	$1, %rsi
	addq	$261, %r14
	cmpl	%r10d, %r8d
	jne	.L76
	testb	%r9b, %r9b
	je	.L77
	movl	%edx, max(%rip)
.L71:
	cmpl	%edx, %edi
	jne	.L119
.L78:
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L117
.L77:
	leal	-1(%rdi), %r11d
	xorl	%edx, %edx
	movl	%r11d, %r8d
	testl	%r11d, %r11d
	jle	.L118
.L125:
	movslq	%edi, %rax
	movl	%edx, %ecx
	movl	%r11d, %esi
	xorl	%r9d, %r9d
	movq	%rax, %r10
	salq	$6, %r10
	addq	%rax, %r10
	leaq	-261(%rax,%r10,4), %r12
	leaq	a(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L84:
	cmpl	%ecx, %esi
	jl	.L80
	movl	%edi, %eax
	movl	%ecx, %r14d
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	subl	%esi, %eax
	cltq
	addq	%r12, %rax
	addq	%r10, %rax
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L180:
	addl	$1, %r13d
	addl	$1, %ecx
	subq	$260, %rax
	cmpl	%r13d, %esi
	jle	.L179
.L83:
	testb	$1, (%rax)
	jne	.L180
	cmpl	%r14d, %ecx
	jle	.L171
	movl	%ecx, %r14d
	movl	$1, %r9d
.L171:
	addl	$1, %r13d
	xorl	%ecx, %ecx
	subq	$260, %rax
	cmpl	%r13d, %esi
	jg	.L83
.L179:
	cmpl	%r14d, %ecx
	jg	.L131
	movl	%r14d, %ecx
.L80:
	subl	$1, %esi
	jne	.L84
.L196:
	testb	%r9b, %r9b
	je	.L85
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
.L85:
	testl	%edi, %edi
	jle	.L86
.L118:
	leaq	a(%rip), %r14
	movl	%edx, %ecx
	xorl	%r10d, %r10d
	xorl	%r12d, %r12d
	movl	$1, %r9d
	leaq	262(%r14), %r13
	.p2align 4,,10
	.p2align 3
.L91:
	cmpl	%r9d, %ecx
	jg	.L87
	movl	%edi, %r15d
	leaq	0(%r13,%r10), %rsi
	subl	%r9d, %r15d
	movslq	%r15d, %r15
	leaq	(%r15,%r14), %rax
	addq	%r15, %rsi
	movl	%ecx, %r15d
	xorl	%ecx, %ecx
	jmp	.L90
	.p2align 4,,10
	.p2align 3
.L182:
	addq	$262, %rax
	addl	$1, %ecx
	cmpq	%rsi, %rax
	je	.L181
.L90:
	testb	$1, (%rax)
	jne	.L182
	cmpl	%r15d, %ecx
	jle	.L172
	movl	%ecx, %r15d
	movl	$1, %r12d
.L172:
	addq	$262, %rax
	xorl	%ecx, %ecx
	cmpq	%rsi, %rax
	jne	.L90
.L181:
	cmpl	%r15d, %ecx
	jg	.L133
	movl	%r15d, %ecx
.L87:
	addl	$1, %r9d
	addq	$262, %r10
	cmpl	%edi, %r9d
	jle	.L91
.L195:
	testb	%r12b, %r12b
	je	.L92
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
.L92:
	cmpl	%edi, %edx
	je	.L78
	movl	%edx, %r9d
	testl	%r11d, %r11d
	jle	.L93
.L124:
	xorl	%r10d, %r10d
	leaq	a(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L98:
	cmpl	%r8d, %edx
	jg	.L94
	movl	%edi, %eax
	xorl	%esi, %esi
	subl	%r8d, %eax
	cltq
	movq	%rax, %rcx
	salq	$6, %rcx
	addq	%rax, %rcx
	leaq	(%rax,%rcx,4), %rax
	xorl	%ecx, %ecx
	addq	%r12, %rax
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L184:
	addl	$1, %ecx
	addl	$1, %esi
	addq	$262, %rax
	cmpl	%r8d, %ecx
	jge	.L183
.L97:
	testb	$1, (%rax)
	jne	.L184
	cmpl	%esi, %edx
	jge	.L173
	movl	%esi, %edx
	movl	$1, %r10d
.L173:
	addl	$1, %ecx
	xorl	%esi, %esi
	addq	$262, %rax
	cmpl	%r8d, %ecx
	jl	.L97
.L183:
	cmpl	%edx, %esi
	jle	.L94
	movl	%esi, %edx
	movl	$1, %r10d
.L94:
	subl	$1, %r8d
	jne	.L98
	testb	%r10b, %r10b
	je	.L99
	movl	%edx, max(%rip)
	movl	%edx, %r9d
.L99:
	testl	%edi, %edi
	jle	.L141
.L93:
	movl	%r9d, %esi
	leaq	a(%rip), %r8
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movl	%r11d, %r10d
	cmpl	%edi, %esi
	jg	.L106
	.p2align 4,,10
	.p2align 3
.L189:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L103
	.p2align 4,,10
	.p2align 3
.L186:
	addl	$1, %edx
	leaq	1(%rax), %rcx
	cmpq	%r10, %rax
	je	.L185
.L139:
	movq	%rcx, %rax
.L103:
	testb	$1, (%r8,%rax)
	jne	.L186
	cmpl	%esi, %edx
	jle	.L174
	movl	%edx, %esi
	movl	$1, %r13d
.L174:
	xorl	%edx, %edx
	leaq	1(%rax), %rcx
	cmpq	%r10, %rax
	jne	.L139
.L185:
	cmpl	%edx, %esi
	jl	.L140
	movl	%esi, %edx
	cmpl	%edi, %edx
	je	.L187
.L105:
	addl	$1, %r12d
	cmpl	%edi, %r12d
	je	.L188
	movl	%edx, %esi
	addq	$261, %r8
	cmpl	%edi, %esi
	jle	.L189
.L106:
	testb	%r13b, %r13b
	je	.L142
.L198:
	movl	%esi, max(%rip)
.L108:
	movq	%r11, %rax
	movl	%esi, %edx
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	salq	$6, %rax
	addq	%r11, %rax
	leaq	(%r11,%rax,4), %rax
	movq	$-261, %r11
	leaq	0(%rbp,%rax), %r8
	subq	%rax, %r11
	cmpl	%edi, %edx
	jg	.L115
	.p2align 4,,10
	.p2align 3
.L194:
	leaq	(%r11,%r8), %rax
	xorl	%ecx, %ecx
	jmp	.L112
	.p2align 4,,10
	.p2align 3
.L191:
	addq	$261, %rax
	addl	$1, %ecx
	cmpq	%rax, %r8
	je	.L190
.L112:
	testb	$1, (%rax)
	jne	.L191
	cmpl	%ecx, %edx
	jge	.L175
	movl	%ecx, %edx
	movl	$1, %r10d
.L175:
	addq	$261, %rax
	xorl	%ecx, %ecx
	cmpq	%rax, %r8
	jne	.L112
.L190:
	cmpl	%edx, %ecx
	jg	.L144
	movl	%edx, %ecx
	cmpl	%edi, %ecx
	je	.L192
.L114:
	addl	$1, %r9d
	cmpl	%edi, %r9d
	je	.L193
	movl	%ecx, %edx
	addq	$1, %r8
	cmpl	%edi, %edx
	jle	.L194
.L115:
	testb	%r10b, %r10b
	jne	.L176
	movl	%esi, %edx
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L133:
	addl	$1, %r9d
	movl	$1, %r12d
	addq	$262, %r10
	cmpl	%edi, %r9d
	jle	.L91
	jmp	.L195
	.p2align 4,,10
	.p2align 3
.L131:
	movl	$1, %r9d
	subl	$1, %esi
	jne	.L84
	jmp	.L196
	.p2align 4,,10
	.p2align 3
.L140:
	movl	$1, %r13d
	cmpl	%edi, %edx
	jne	.L105
.L187:
	testb	%r13b, %r13b
	je	.L141
.L176:
	movl	%edx, max(%rip)
	jmp	.L78
.L69:
	movl	$0, max(%rip)
	xorl	%edx, %edx
.L119:
	leal	-1(%rdi), %r11d
	movl	%r11d, %r8d
	testl	%r11d, %r11d
	jg	.L125
	testl	%edi, %edi
	jg	.L118
	jmp	.L78
	.p2align 4,,10
	.p2align 3
.L144:
	movl	$1, %r10d
	cmpl	%edi, %ecx
	jne	.L114
.L192:
	movl	%esi, %edx
	testb	%r10b, %r10b
	je	.L78
	movl	%ecx, max(%rip)
	movl	%ecx, %edx
	jmp	.L78
.L68:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L197
	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
.L188:
	.cfi_restore_state
	movl	%edx, %esi
	testb	%r13b, %r13b
	jne	.L198
.L142:
	movl	%r9d, %esi
	jmp	.L108
.L141:
	movl	%r9d, %edx
	jmp	.L78
.L86:
	movl	%edx, %r9d
	cmpl	%edi, %edx
	jne	.L124
	jmp	.L78
.L193:
	movl	%ecx, %edx
	jmp	.L115
.L127:
	xorl	%edx, %edx
	jmp	.L71
.L197:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 68121
a:
	.zero	68121
	.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:

// Aizu Vol-1 0151: Grid
// 2017.8.17 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
char *gets();

#define MAX 256
char a[MAX+5][MAX+5];
int n, max;

void maxOnes(int r0, int c0, int w, int dir)
{
	int r, c, k, f;
	if (w < max) return;
	if (dir == 0) {
		for (f = 0, c = 0; c < n; c++) {
			if (a[r0][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 1) {
		for (f = 0, r = 0; r < n; r++) {
			if (a[r][c0] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 2) {
		for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r--, c++) {
			if (a[r][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r++, c++) {
		if (a[r][c] & 1) f++;
		else { if (f > max) max = f; f = 0; }
	}
	if (f > max) max = f;
	return;
}

int main()
{
	int r, c, k;
	char buf[10];

	while (1) {
		gets(buf); if (!(n = atoi(buf))) break;
		for (r = 0; r < n; r++) gets(a[r]);
		max = 0;
		for (k = 1; k <= n; k++)   maxOnes(k - 1, 0, k, 2);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - 1, n - k, k, 2);
		for (k = 1; k <= n; k++)   maxOnes(0, n - k, k, 3);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - k, 0, k, 3);
		for (r = 0; r < n; r++) {
			maxOnes(r, 0, n, 0);
			if (max == n) goto Done;
		}
		for (c = 0; c < n; c++) {
			maxOnes(0, c, n, 1);
			if (max == n) goto Done;
		}
	Done: printf("%d\n", max);
	}
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
// Aizu Vol-1 0151: Grid
// 2017.8.17 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
char *gets();

#define MAX 256
char a[MAX+5][MAX+5];
int n, max;

void maxOnes(int r0, int c0, int w, int dir)
{
	int r, c, k, f;
	if (w < max) return;
	if (dir == 0) {
		for (f = 0, c = 0; c < n; c++) {
			if (a[r0][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 1) {
		for (f = 0, r = 0; r < n; r++) {
			if (a[r][c0] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	if (dir == 2) {
		for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r--, c++) {
			if (a[r][c] & 1) f++;
			else { if (f > max) max = f; f = 0; }
		}
		if (f > max) max = f;
		return;
	}
	for (f = 0, r = r0, c = c0, k = 0; k < w; k++, r++, c++) {
		if (a[r][c] & 1) f++;
		else { if (f > max) max = f; f = 0; }
	}
	if (f > max) max = f;
	return;
}

int main()
{
	int r, c, k;
	char buf[10];

	while (1) {
		gets(buf); if (!(n = atoi(buf))) break;
		for (r = 0; r < n; r++) gets(a[r]);
		max = 0;
		for (k = 1; k <= n; k++)   maxOnes(k - 1, 0, k, 2);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - 1, n - k, k, 2);
		for (k = 1; k <= n; k++)   maxOnes(0, n - k, k, 3);
		if (max == n) goto Done;
		for (k = n-1; k >= 1; k--) maxOnes(n - k, 0, k, 3);
		for (r = 0; r < n; r++) {
			maxOnes(r, 0, n, 0);
			if (max == n) goto Done;
		}
		for (c = 0; c < n; c++) {
			maxOnes(0, c, n, 1);
			if (max == n) goto Done;
		}
	Done: printf("%d\n", max);
	}
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 68121
a:
	.zero	68121
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	maxOnes
	.type	maxOnes, @function
maxOnes:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	max(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L31
	cmpl	$0, -32(%rbp)
	jne	.L4
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -4(%rbp)
	jmp	.L7
.L6:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L8
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L8:
	movl	$0, -4(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L5:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L32
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L32
.L4:
	cmpl	$1, -32(%rbp)
	jne	.L11
	movl	$0, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L12
.L16:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -4(%rbp)
	jmp	.L14
.L13:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L15
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L15:
	movl	$0, -4(%rbp)
.L14:
	addl	$1, -16(%rbp)
.L12:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L33
.L11:
	cmpl	$2, -32(%rbp)
	jne	.L18
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L19
.L23:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	jmp	.L21
.L20:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L22
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L22:
	movl	$0, -4(%rbp)
.L21:
	addl	$1, -8(%rbp)
	subl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L19:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L34
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L34
.L18:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L25
.L29:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L26
	addl	$1, -4(%rbp)
	jmp	.L27
.L26:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L28
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L28:
	movl	$0, -4(%rbp)
.L27:
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L29
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L35
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L35
.L31:
	nop
	jmp	.L1
.L32:
	nop
	jmp	.L1
.L33:
	nop
	jmp	.L1
.L34:
	nop
	jmp	.L1
.L35:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	maxOnes, .-maxOnes
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L58:
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, n(%rip)
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L62
	movl	$0, -32(%rbp)
	jmp	.L39
.L40:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	addl	$1, -32(%rbp)
.L39:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	$0, max(%rip)
	movl	$1, -24(%rbp)
	jmp	.L41
.L42:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edi
	movl	-24(%rbp), %eax
	movl	$2, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	call	maxOnes
	addl	$1, -24(%rbp)
.L41:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L42
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L63
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L45
.L46:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	n(%rip), %edx
	leal	-1(%rdx), %edi
	movl	-24(%rbp), %edx
	movl	$2, %ecx
	movl	%eax, %esi
	call	maxOnes
	subl	$1, -24(%rbp)
.L45:
	cmpl	$0, -24(%rbp)
	jg	.L46
	movl	$1, -24(%rbp)
	jmp	.L47
.L48:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	addl	$1, -24(%rbp)
.L47:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L48
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L64
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L50
.L51:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	subl	$1, -24(%rbp)
.L50:
	cmpl	$0, -24(%rbp)
	jg	.L51
	movl	$0, -32(%rbp)
	jmp	.L52
.L54:
	movl	n(%rip), %edx
	movl	-32(%rbp), %eax
	movl	$0, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L65
	addl	$1, -32(%rbp)
.L52:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L54
	movl	$0, -28(%rbp)
	jmp	.L55
.L57:
	movl	n(%rip), %edx
	movl	-28(%rbp), %eax
	movl	$1, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L66
	addl	$1, -28(%rbp)
.L55:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L57
	jmp	.L44
.L63:
	nop
	jmp	.L44
.L64:
	nop
	jmp	.L44
.L65:
	nop
	jmp	.L44
.L66:
	nop
.L44:
	movl	max(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L58
.L62:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 68121
a:
	.zero	68121
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	maxOnes
	.type	maxOnes, @function
maxOnes:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	max(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L31
	cmpl	$0, -32(%rbp)
	jne	.L4
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -4(%rbp)
	jmp	.L7
.L6:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L8
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L8:
	movl	$0, -4(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L5:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L32
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L32
.L4:
	cmpl	$1, -32(%rbp)
	jne	.L11
	movl	$0, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L12
.L16:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -4(%rbp)
	jmp	.L14
.L13:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L15
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L15:
	movl	$0, -4(%rbp)
.L14:
	addl	$1, -16(%rbp)
.L12:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L16
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L33
.L11:
	cmpl	$2, -32(%rbp)
	jne	.L18
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L19
.L23:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L20
	addl	$1, -4(%rbp)
	jmp	.L21
.L20:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L22
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L22:
	movl	$0, -4(%rbp)
.L21:
	addl	$1, -8(%rbp)
	subl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L19:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L34
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L34
.L18:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L25
.L29:
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L26
	addl	$1, -4(%rbp)
	jmp	.L27
.L26:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L28
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L28:
	movl	$0, -4(%rbp)
.L27:
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	addl	$1, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L29
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L35
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
	jmp	.L35
.L31:
	nop
	jmp	.L1
.L32:
	nop
	jmp	.L1
.L33:
	nop
	jmp	.L1
.L34:
	nop
	jmp	.L1
.L35:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	maxOnes, .-maxOnes
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L58:
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	-18(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, n(%rip)
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L62
	movl	$0, -32(%rbp)
	jmp	.L39
.L40:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$6, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	addl	$1, -32(%rbp)
.L39:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	$0, max(%rip)
	movl	$1, -24(%rbp)
	jmp	.L41
.L42:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edi
	movl	-24(%rbp), %eax
	movl	$2, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	call	maxOnes
	addl	$1, -24(%rbp)
.L41:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L42
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L63
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L45
.L46:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	n(%rip), %edx
	leal	-1(%rdx), %edi
	movl	-24(%rbp), %edx
	movl	$2, %ecx
	movl	%eax, %esi
	call	maxOnes
	subl	$1, -24(%rbp)
.L45:
	cmpl	$0, -24(%rbp)
	jg	.L46
	movl	$1, -24(%rbp)
	jmp	.L47
.L48:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	addl	$1, -24(%rbp)
.L47:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L48
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L64
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	jmp	.L50
.L51:
	movl	n(%rip), %eax
	subl	-24(%rbp), %eax
	movl	-24(%rbp), %edx
	movl	$3, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	subl	$1, -24(%rbp)
.L50:
	cmpl	$0, -24(%rbp)
	jg	.L51
	movl	$0, -32(%rbp)
	jmp	.L52
.L54:
	movl	n(%rip), %edx
	movl	-32(%rbp), %eax
	movl	$0, %ecx
	movl	$0, %esi
	movl	%eax, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L65
	addl	$1, -32(%rbp)
.L52:
	movl	n(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L54
	movl	$0, -28(%rbp)
	jmp	.L55
.L57:
	movl	n(%rip), %edx
	movl	-28(%rbp), %eax
	movl	$1, %ecx
	movl	%eax, %esi
	movl	$0, %edi
	call	maxOnes
	movl	max(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	je	.L66
	addl	$1, -28(%rbp)
.L55:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L57
	jmp	.L44
.L63:
	nop
	jmp	.L44
.L64:
	nop
	jmp	.L44
.L65:
	nop
	jmp	.L44
.L66:
	nop
.L44:
	movl	max(%rip), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L58
.L62:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
