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

```c
#include <stdio.h>
#include <stdlib.h>

#define MAX 128
int a[2][MAX];


int main(void)
{
	int n;
	int i;
	int sum, max;
	char *p;
	char buffer[4096];

	// input
	scanf("%d\n",&n);
	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[0][i]=strtol(p,&p,10);
	}

	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[1][i]=strtol(p,&p,10);
		//printf("%d\n",a[1][i]);
	}

	// search maximum path
	sum=0;
	for (i=0;i<n;++i)
	{
		sum+=a[0][i];
	}

	max=0;
	for (i=n-1;i>=0;--i)
	{
		sum+=a[1][i];
		//printf("\ti: %d, sum: %d\n",i,sum);
		if (sum>max)
		{
			max=sum;
		}
		sum-=a[0][i];
	}

	printf("%d\n",max);
	return 0;
}


```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$32, %rsp
	.cfi_def_cfa_offset 4176
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %r12
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %edx
	movq	%r12, 8(%rsp)
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	leaq	8(%rsp), %r13
	leaq	a(%rip), %r14
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rdi
.L3:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	%eax, (%r14,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jg	.L19
.L2:
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %eax
	movq	%r12, 8(%rsp)
	testl	%eax, %eax
	jle	.L4
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r13
	leaq	512+a(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	8(%rsp), %rdi
.L6:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	4(%rsp), %ecx
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L20
	testl	%ecx, %ecx
	jle	.L4
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L13
	movl	%ecx, %esi
	leaq	a(%rip), %r14
	pxor	%xmm0, %xmm0
	shrl	$2, %esi
	leaq	16(%r14), %rdi
	movq	%r14, %rax
	subl	$1, %esi
	salq	$4, %rsi
	addq	%rdi, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %cl
	je	.L9
.L7:
	movslq	%esi, %rdi
	addl	(%r14,%rdi,4), %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L9
	movslq	%edi, %rdi
	addl	$2, %esi
	addl	(%r14,%rdi,4), %eax
	cmpl	%esi, %ecx
	jle	.L9
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %eax
.L9:
	movslq	%edx, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%r12,%rdx,4), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	subl	(%r14,%rdx,4), %eax
	subq	$1, %rdx
	testl	%edx, %edx
	jns	.L10
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	4120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$4128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L11
.L13:
	xorl	%eax, %eax
	xorl	%esi, %esi
	leaq	a(%rip), %r14
	jmp	.L7
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1024
a:
	.zero	1024
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$32, %rsp
	.cfi_def_cfa_offset 4176
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %r12
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %edx
	movq	%r12, 8(%rsp)
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	leaq	8(%rsp), %r13
	leaq	a(%rip), %r14
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rdi
.L3:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	%eax, (%r14,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jg	.L19
.L2:
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %eax
	movq	%r12, 8(%rsp)
	testl	%eax, %eax
	jle	.L4
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r13
	leaq	512+a(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	8(%rsp), %rdi
.L6:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	4(%rsp), %ecx
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L20
	testl	%ecx, %ecx
	jle	.L4
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L13
	movl	%ecx, %esi
	leaq	a(%rip), %r14
	pxor	%xmm0, %xmm0
	shrl	$2, %esi
	leaq	16(%r14), %rdi
	movq	%r14, %rax
	subl	$1, %esi
	salq	$4, %rsi
	addq	%rdi, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %cl
	je	.L9
.L7:
	movslq	%esi, %rdi
	addl	(%r14,%rdi,4), %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L9
	movslq	%edi, %rdi
	addl	$2, %esi
	addl	(%r14,%rdi,4), %eax
	cmpl	%esi, %ecx
	jle	.L9
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %eax
.L9:
	movslq	%edx, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%r12,%rdx,4), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	subl	(%r14,%rdx,4), %eax
	subq	$1, %rdx
	testl	%edx, %edx
	jns	.L10
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	4120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$4128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L11
.L13:
	xorl	%eax, %eax
	xorl	%esi, %esi
	leaq	a(%rip), %r14
	jmp	.L7
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1024
a:
	.zero	1024
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$32, %rsp
	.cfi_def_cfa_offset 4176
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %r12
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %edx
	movq	%r12, 8(%rsp)
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	leaq	8(%rsp), %r13
	leaq	a(%rip), %r14
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rdi
.L3:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	%eax, (%r14,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jg	.L19
.L2:
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %eax
	movq	%r12, 8(%rsp)
	testl	%eax, %eax
	jle	.L4
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r13
	leaq	512+a(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	8(%rsp), %rdi
.L6:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	4(%rsp), %ecx
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L20
	testl	%ecx, %ecx
	jle	.L4
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L13
	movl	%ecx, %esi
	leaq	a(%rip), %r14
	pxor	%xmm0, %xmm0
	shrl	$2, %esi
	leaq	16(%r14), %rdi
	movq	%r14, %rax
	subl	$1, %esi
	salq	$4, %rsi
	addq	%rdi, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %cl
	je	.L9
.L7:
	movslq	%esi, %rdi
	addl	(%r14,%rdi,4), %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L9
	movslq	%edi, %rdi
	addl	$2, %esi
	addl	(%r14,%rdi,4), %eax
	cmpl	%esi, %ecx
	jle	.L9
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %eax
.L9:
	movslq	%edx, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%r12,%rdx,4), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	subl	(%r14,%rdx,4), %eax
	subq	$1, %rdx
	testl	%edx, %edx
	jns	.L10
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	4120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$4128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L11
.L13:
	xorl	%eax, %eax
	xorl	%esi, %esi
	leaq	a(%rip), %r14
	jmp	.L7
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1024
a:
	.zero	1024
	.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:
```
```c
#include <stdio.h>
#include <stdlib.h>

#define MAX 128
int a[2][MAX];


int main(void)
{
	int n;
	int i;
	int sum, max;
	char *p;
	char buffer[4096];

	// input
	scanf("%d\n",&n);
	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[0][i]=strtol(p,&p,10);
	}

	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[1][i]=strtol(p,&p,10);
		//printf("%d\n",a[1][i]);
	}

	// search maximum path
	sum=0;
	for (i=0;i<n;++i)
	{
		sum+=a[0][i];
	}

	max=0;
	for (i=n-1;i>=0;--i)
	{
		sum+=a[1][i];
		//printf("\ti: %d, sum: %d\n",i,sum);
		if (sum>max)
		{
			max=sum;
		}
		sum-=a[0][i];
	}

	printf("%d\n",max);
	return 0;
}


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

```c
#include <stdio.h>
#include <stdlib.h>

#define MAX 128
int a[2][MAX];


int main(void)
{
	int n;
	int i;
	int sum, max;
	char *p;
	char buffer[4096];

	// input
	scanf("%d\n",&n);
	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[0][i]=strtol(p,&p,10);
	}

	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[1][i]=strtol(p,&p,10);
		//printf("%d\n",a[1][i]);
	}

	// search maximum path
	sum=0;
	for (i=0;i<n;++i)
	{
		sum+=a[0][i];
	}

	max=0;
	for (i=n-1;i>=0;--i)
	{
		sum+=a[1][i];
		//printf("\ti: %d, sum: %d\n",i,sum);
		if (sum>max)
		{
			max=sum;
		}
		sum-=a[0][i];
	}

	printf("%d\n",max);
	return 0;
}


```

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.
Optimized Assembly Code:

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

30
 8
 14
 5
 32
 4
 31
 9
 12
 37

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

```c
#include <stdio.h>
#include <stdlib.h>

#define MAX 128
int a[2][MAX];


int main(void)
{
	int n;
	int i;
	int sum, max;
	char *p;
	char buffer[4096];

	// input
	scanf("%d\n",&n);
	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[0][i]=strtol(p,&p,10);
	}

	fgets(buffer,sizeof buffer-2,stdin);
	p=buffer;
	for (i=0;i<n;++i)
	{
		a[1][i]=strtol(p,&p,10);
		//printf("%d\n",a[1][i]);
	}

	// search maximum path
	sum=0;
	for (i=0;i<n;++i)
	{
		sum+=a[0][i];
	}

	max=0;
	for (i=n-1;i>=0;--i)
	{
		sum+=a[1][i];
		//printf("\ti: %d, sum: %d\n",i,sum);
		if (sum>max)
		{
			max=sum;
		}
		sum-=a[0][i];
	}

	printf("%d\n",max);
	return 0;
}


```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$32, %rsp
	.cfi_def_cfa_offset 4176
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %r12
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %edx
	movq	%r12, 8(%rsp)
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	leaq	8(%rsp), %r13
	leaq	a(%rip), %r14
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rdi
.L3:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	%eax, (%r14,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jg	.L19
.L2:
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %eax
	movq	%r12, 8(%rsp)
	testl	%eax, %eax
	jle	.L4
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r13
	leaq	512+a(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	8(%rsp), %rdi
.L6:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	4(%rsp), %ecx
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L20
	testl	%ecx, %ecx
	jle	.L4
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L13
	movl	%ecx, %esi
	leaq	a(%rip), %r14
	pxor	%xmm0, %xmm0
	shrl	$2, %esi
	leaq	16(%r14), %rdi
	movq	%r14, %rax
	subl	$1, %esi
	salq	$4, %rsi
	addq	%rdi, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %cl
	je	.L9
.L7:
	movslq	%esi, %rdi
	addl	(%r14,%rdi,4), %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L9
	movslq	%edi, %rdi
	addl	$2, %esi
	addl	(%r14,%rdi,4), %eax
	cmpl	%esi, %ecx
	jle	.L9
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %eax
.L9:
	movslq	%edx, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%r12,%rdx,4), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	subl	(%r14,%rdx,4), %eax
	subq	$1, %rdx
	testl	%edx, %edx
	jns	.L10
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	4120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$4128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L11
.L13:
	xorl	%eax, %eax
	xorl	%esi, %esi
	leaq	a(%rip), %r14
	jmp	.L7
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1024
a:
	.zero	1024
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4144
	orq	$0, (%rsp)
	subq	$32, %rsp
	.cfi_def_cfa_offset 4176
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4120(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	leaq	16(%rsp), %r12
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %edx
	movq	%r12, 8(%rsp)
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	leaq	8(%rsp), %r13
	leaq	a(%rip), %r14
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rdi
.L3:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	%eax, (%r14,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, 4(%rsp)
	jg	.L19
.L2:
	movq	stdin(%rip), %rdx
	movl	$4094, %esi
	movq	%r12, %rdi
	call	fgets@PLT
	movl	4(%rsp), %eax
	movq	%r12, 8(%rsp)
	testl	%eax, %eax
	jle	.L4
	movq	%r12, %rdi
	xorl	%ebx, %ebx
	leaq	8(%rsp), %r13
	leaq	512+a(%rip), %r12
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	movq	8(%rsp), %rdi
.L6:
	movl	$10, %edx
	movq	%r13, %rsi
	call	strtol@PLT
	movl	4(%rsp), %ecx
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L20
	testl	%ecx, %ecx
	jle	.L4
	leal	-1(%rcx), %edx
	cmpl	$2, %edx
	jbe	.L13
	movl	%ecx, %esi
	leaq	a(%rip), %r14
	pxor	%xmm0, %xmm0
	shrl	$2, %esi
	leaq	16(%r14), %rdi
	movq	%r14, %rax
	subl	$1, %esi
	salq	$4, %rsi
	addq	%rdi, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L8
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %cl
	je	.L9
.L7:
	movslq	%esi, %rdi
	addl	(%r14,%rdi,4), %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L9
	movslq	%edi, %rdi
	addl	$2, %esi
	addl	(%r14,%rdi,4), %eax
	cmpl	%esi, %ecx
	jle	.L9
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %eax
.L9:
	movslq	%edx, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%r12,%rdx,4), %eax
	cmpl	%eax, %r8d
	cmovl	%eax, %r8d
	subl	(%r14,%rdx,4), %eax
	subq	$1, %rdx
	testl	%edx, %edx
	jns	.L10
.L11:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	4120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$4128, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L11
.L13:
	xorl	%eax, %eax
	xorl	%esi, %esi
	leaq	a(%rip), %r14
	jmp	.L7
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1024
a:
	.zero	1024
	.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:
```