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(void){
    int n;
    scanf("%d", &n);

    int a[2][n];
    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++){
            scanf("%d", &a[i][j]);
        }
    }

    int ans;
    int max = -1;
    for(int i=0; i<n; i++){
        ans = 0;
        for(int j=0; j<=i; j++){
            ans += a[0][j];
        }
        for(int j=i; j<n; j++){
            ans += a[1][j];
        }
        max = MAX(max, ans);
    }

    printf("%d\n", max);
    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	"%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	%r12
	pushq	%rbx
	subq	$96, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rbx
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L10:
	movl	$0, -80(%rbp)
	jmp	.L8
.L9:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-80(%rbp), %eax
	movslq	%eax, %rcx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L8:
	movl	-88(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L9
	addl	$1, -84(%rbp)
.L7:
	cmpl	$1, -84(%rbp)
	jle	.L10
	movl	$-1, -72(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	$0, -76(%rbp)
	movl	$0, -64(%rbp)
	jmp	.L12
.L13:
	movq	-48(%rbp), %rax
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -64(%rbp)
.L12:
	movl	-64(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jle	.L13
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-48(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -60(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L15
	movl	-76(%rbp), %edx
	movl	-72(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MAX
	movl	%eax, -72(%rbp)
	addl	$1, -68(%rbp)
.L11:
	movl	-88(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	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	"%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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	leaq	.LC0(%rip), %r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	leaq	0(,%rax,4), %rbx
	movq	%rax, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	movq	%rbx, -72(%rbp)
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L5
.L39:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L39
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L40
.L6:
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L13
	movq	-72(%rbp), %r12
	movq	%rbx, %r13
	xorl	%r15d, %r15d
	shrq	$2, %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$4, %r13
	cmpl	%r15d, %eax
	jg	.L10
	testl	%eax, %eax
	jle	.L13
	movq	-72(%rbp), %r13
	xorl	%r15d, %r15d
	addq	%rbx, %r13
	movq	%r13, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rdx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%rdx, -72(%rbp)
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rdx
	movl	-60(%rbp), %esi
	addl	$1, %r15d
	addq	$4, %rdx
	cmpl	%r15d, %esi
	jg	.L14
	testl	%esi, %esi
	jle	.L13
	movl	$1, %edi
	xorl	%ecx, %ecx
	leaq	16(%rbx), %r10
	movl	$-1, %r8d
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	$2, %ecx
	jle	.L25
	movl	%edi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %edx
	movq	%rbx, %rax
	salq	$4, %rdx
	addq	%r10, %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L17
	movdqa	%xmm0, %xmm1
	movl	%edi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %dil
	je	.L18
.L16:
	movslq	%eax, %r11
	leal	1(%rax), %r14d
	leaq	(%rbx,%r11,4), %r11
	addl	(%r11), %edx
	cmpl	%r14d, %ecx
	jl	.L18
	addl	$2, %eax
	addl	4(%r11), %edx
	cmpl	%eax, %ecx
	jl	.L18
	addl	8(%r11), %edx
.L18:
	movl	%esi, %r11d
	movl	%esi, %eax
	subl	%ecx, %r11d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r11d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L26
	cmpl	%esi, %ecx
	jge	.L26
	movl	%r11d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r13,%rax), %r14
	movq	%r13, %rax
	.p2align 4,,10
	.p2align 3
.L20:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rax, %r14
	jne	.L20
	movdqa	%xmm0, %xmm1
	movl	%r11d, %r14d
	psrldq	$8, %xmm1
	andl	$-4, %r14d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r14,%rcx), %eax
	cmpl	%r11d, %r14d
	je	.L21
.L19:
	movslq	%eax, %r11
	addq	%r12, %r11
	addl	(%rbx,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L21
	movslq	%r11d, %r11
	addl	$2, %eax
	addq	%r12, %r11
	addl	(%rbx,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L21
	cltq
	addq	%r12, %rax
	addl	(%rbx,%rax,4), %edx
.L21:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %r13
	cmpl	%esi, %ecx
	jne	.L12
.L22:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L41
	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
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L16
.L40:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L13:
	orl	$-1, %r8d
	jmp	.L22
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.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	"%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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	leaq	.LC0(%rip), %r14
	leaq	-60(%rbp), %rsi
	pushq	%r13
	movq	%r14, %rdi
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rsi
	leaq	0(,%rax,4), %rbx
	movq	%rax, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	movq	%rbx, -72(%rbp)
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L5
.L39:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L39
.L5:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L40
.L6:
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L13
	movq	-72(%rbp), %r12
	movq	%rbx, %r13
	xorl	%r15d, %r15d
	shrq	$2, %r12
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$4, %r13
	cmpl	%r15d, %eax
	jg	.L10
	testl	%eax, %eax
	jle	.L13
	movq	-72(%rbp), %r13
	xorl	%r15d, %r15d
	addq	%rbx, %r13
	movq	%r13, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rdx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	movq	%rdx, -72(%rbp)
	call	__isoc99_scanf@PLT
	movq	-72(%rbp), %rdx
	movl	-60(%rbp), %esi
	addl	$1, %r15d
	addq	$4, %rdx
	cmpl	%r15d, %esi
	jg	.L14
	testl	%esi, %esi
	jle	.L13
	movl	$1, %edi
	xorl	%ecx, %ecx
	leaq	16(%rbx), %r10
	movl	$-1, %r8d
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	$2, %ecx
	jle	.L25
	movl	%edi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %edx
	movq	%rbx, %rax
	salq	$4, %rdx
	addq	%r10, %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L17
	movdqa	%xmm0, %xmm1
	movl	%edi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %dil
	je	.L18
.L16:
	movslq	%eax, %r11
	leal	1(%rax), %r14d
	leaq	(%rbx,%r11,4), %r11
	addl	(%r11), %edx
	cmpl	%r14d, %ecx
	jl	.L18
	addl	$2, %eax
	addl	4(%r11), %edx
	cmpl	%eax, %ecx
	jl	.L18
	addl	8(%r11), %edx
.L18:
	movl	%esi, %r11d
	movl	%esi, %eax
	subl	%ecx, %r11d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r11d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L26
	cmpl	%esi, %ecx
	jge	.L26
	movl	%r11d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r13,%rax), %r14
	movq	%r13, %rax
	.p2align 4,,10
	.p2align 3
.L20:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rax, %r14
	jne	.L20
	movdqa	%xmm0, %xmm1
	movl	%r11d, %r14d
	psrldq	$8, %xmm1
	andl	$-4, %r14d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r14,%rcx), %eax
	cmpl	%r11d, %r14d
	je	.L21
.L19:
	movslq	%eax, %r11
	addq	%r12, %r11
	addl	(%rbx,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L21
	movslq	%r11d, %r11
	addl	$2, %eax
	addq	%r12, %r11
	addl	(%rbx,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L21
	cltq
	addq	%r12, %rax
	addl	(%rbx,%rax,4), %edx
.L21:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %r13
	cmpl	%esi, %ecx
	jne	.L12
.L22:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L41
	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
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L16
.L40:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L6
.L13:
	orl	$-1, %r8d
	jmp	.L22
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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 MAX(int a, int b){return a>b?a:b;}

int main(void){
    int n;
    scanf("%d", &n);

    int a[2][n];
    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++){
            scanf("%d", &a[i][j]);
        }
    }

    int ans;
    int max = -1;
    for(int i=0; i<n; i++){
        ans = 0;
        for(int j=0; j<=i; j++){
            ans += a[0][j];
        }
        for(int j=i; j<n; j++){
            ans += a[1][j];
        }
        max = MAX(max, ans);
    }

    printf("%d\n", max);
    return 0;
}
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 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(void){
    int n;
    scanf("%d", &n);

    int a[2][n];
    for(int i=0; i<2; i++){
        for(int j=0; j<n; j++){
            scanf("%d", &a[i][j]);
        }
    }

    int ans;
    int max = -1;
    for(int i=0; i<n; i++){
        ans = 0;
        for(int j=0; j<=i; j++){
            ans += a[0][j];
        }
        for(int j=i; j<n; j++){
            ans += a[1][j];
        }
        max = MAX(max, ans);
    }

    printf("%d\n", max);
    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	"%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	%r12
	pushq	%rbx
	subq	$96, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rbx
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L10:
	movl	$0, -80(%rbp)
	jmp	.L8
.L9:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-80(%rbp), %eax
	movslq	%eax, %rcx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L8:
	movl	-88(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L9
	addl	$1, -84(%rbp)
.L7:
	cmpl	$1, -84(%rbp)
	jle	.L10
	movl	$-1, -72(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	$0, -76(%rbp)
	movl	$0, -64(%rbp)
	jmp	.L12
.L13:
	movq	-48(%rbp), %rax
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -64(%rbp)
.L12:
	movl	-64(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jle	.L13
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-48(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -60(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L15
	movl	-76(%rbp), %edx
	movl	-72(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MAX
	movl	%eax, -72(%rbp)
	addl	$1, -68(%rbp)
.L11:
	movl	-88(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	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	"%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	%r12
	pushq	%rbx
	subq	$96, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	leaq	-88(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-88(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rbx
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L10:
	movl	$0, -80(%rbp)
	jmp	.L8
.L9:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-80(%rbp), %eax
	movslq	%eax, %rcx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -80(%rbp)
.L8:
	movl	-88(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L9
	addl	$1, -84(%rbp)
.L7:
	cmpl	$1, -84(%rbp)
	jle	.L10
	movl	$-1, -72(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	$0, -76(%rbp)
	movl	$0, -64(%rbp)
	jmp	.L12
.L13:
	movq	-48(%rbp), %rax
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -64(%rbp)
.L12:
	movl	-64(%rbp), %eax
	cmpl	-68(%rbp), %eax
	jle	.L13
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
	jmp	.L14
.L15:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-48(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -60(%rbp)
.L14:
	movl	-88(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L15
	movl	-76(%rbp), %edx
	movl	-72(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MAX
	movl	%eax, -72(%rbp)
	addl	$1, -68(%rbp)
.L11:
	movl	-88(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	-72(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	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:
