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 main()
{
int n, i, a[2][100]={0}, lsum=0, rsum=0, max=0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[0][i]);
}
for(i = 0; i < n; i++){
scanf("%d", &a[1][i]);
rsum += a[1][i];
}
for(i = 0; i < n; i++){
lsum += a[0][i];
if((lsum + rsum) > max){
max = lsum + rsum;
}
rsum -= a[1][i];
}
printf("%d\n", max);
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-816(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -828(%rbp)
	movl	$0, -824(%rbp)
	movl	$0, -820(%rbp)
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -832(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -832(%rbp)
.L2:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L3
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L4:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L8:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -828(%rbp)
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -820(%rbp)
	jge	.L7
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -820(%rbp)
.L7:
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	subl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L6:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L8
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$100, %ecx
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$840, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 824(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movq	%rbp, %r13
	movq	%rbp, %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebx, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L5
	leaq	416(%rsp), %r12
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addl	(%r12), %ebx
	addq	$4, %r12
	cmpl	%r14d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L5
	subl	$1, %eax
	leaq	4(%rbp), %rdi
	xorl	%edx, %edx
	leaq	(%rdi,%rax,4), %rsi
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$4, %rdi
.L6:
	addl	0(%r13), %eax
	leal	(%rax,%rbx), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	subl	400(%r13), %ebx
	movq	%rdi, %r13
	cmpq	%rdi, %rsi
	jne	.L15
.L7:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$840, %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
.L5:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L7
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$100, %ecx
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$840, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 824(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movq	%rbp, %r13
	movq	%rbp, %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebx, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L5
	leaq	416(%rsp), %r12
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addl	(%r12), %ebx
	addq	$4, %r12
	cmpl	%r14d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L5
	subl	$1, %eax
	leaq	4(%rbp), %rdi
	xorl	%edx, %edx
	leaq	(%rdi,%rax,4), %rsi
	xorl	%eax, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$4, %rdi
.L6:
	addl	0(%r13), %eax
	leal	(%rax,%rbx), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	subl	400(%r13), %ebx
	movq	%rdi, %r13
	cmpq	%rdi, %rsi
	jne	.L15
.L7:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	824(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$840, %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
.L5:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L7
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>
int main()
{
int n, i, a[2][100]={0}, lsum=0, rsum=0, max=0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[0][i]);
}
for(i = 0; i < n; i++){
scanf("%d", &a[1][i]);
rsum += a[1][i];
}
for(i = 0; i < n; i++){
lsum += a[0][i];
if((lsum + rsum) > max){
max = lsum + rsum;
}
rsum -= a[1][i];
}
printf("%d\n", max);
return 0;
}
5
3 2 2 4 1
1 2 2 2 1

14

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 main()
{
int n, i, a[2][100]={0}, lsum=0, rsum=0, max=0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a[0][i]);
}
for(i = 0; i < n; i++){
scanf("%d", &a[1][i]);
rsum += a[1][i];
}
for(i = 0; i < n; i++){
lsum += a[0][i];
if((lsum + rsum) > max){
max = lsum + rsum;
}
rsum -= a[1][i];
}
printf("%d\n", max);
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-816(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -828(%rbp)
	movl	$0, -824(%rbp)
	movl	$0, -820(%rbp)
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -832(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -832(%rbp)
.L2:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L3
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L4:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L8:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -828(%rbp)
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -820(%rbp)
	jge	.L7
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -820(%rbp)
.L7:
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	subl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L6:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L8
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
val
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$848, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-816(%rbp), %rdx
	movl	$0, %eax
	movl	$100, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -828(%rbp)
	movl	$0, -824(%rbp)
	movl	$0, -820(%rbp)
	leaq	-836(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -832(%rbp)
	jmp	.L2
.L3:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -832(%rbp)
.L2:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L3
	movl	$0, -832(%rbp)
	jmp	.L4
.L5:
	leaq	-816(%rbp), %rdx
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L4:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L5
	movl	$0, -832(%rbp)
	jmp	.L6
.L8:
	movl	-832(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	addl	%eax, -828(%rbp)
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -820(%rbp)
	jge	.L7
	movl	-828(%rbp), %edx
	movl	-824(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -820(%rbp)
.L7:
	movl	-832(%rbp), %eax
	cltq
	addq	$100, %rax
	movl	-816(%rbp,%rax,4), %eax
	subl	%eax, -824(%rbp)
	addl	$1, -832(%rbp)
.L6:
	movl	-836(%rbp), %eax
	cmpl	%eax, -832(%rbp)
	jl	.L8
	movl	-820(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
