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>
int main(void) {
	int a[2][1000];
	int n,ans;

	scanf("%d", &n);
	for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    int max=0;
    int hako;
    int cnt1;
    int cnt2;
    int i,j,k;
    for(i = 0; i < n; i++){
        int sum=0;
        for(k=0;k<=i;k++){
            sum+=a[0][k];
        }
        for(j=i;j<n;j++){
            sum+=a[1][j];
        }
        if(max<sum){
            max=sum;
        }
    }
    
	printf("%d\n", max);
	return 0;
}
```

Assembly Code:

```assembly
	.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	%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	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L8
	leaq	4016(%rsp), %rbp
	xorl	%r12d, %r12d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$4, %r14
	cmpl	%r12d, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L8
	movl	$1, %edi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	leaq	16(%rbx), %r10
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$2, %ecx
	jle	.L20
	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
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	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	.L13
.L11:
	movslq	%eax, %r11
	addl	16(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%r11d, %ecx
	jl	.L13
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	16(%rsp,%r11,4), %edx
	cmpl	%eax, %ecx
	jl	.L13
	cltq
	addl	16(%rsp,%rax,4), %edx
.L13:
	movl	%esi, %r12d
	movl	%esi, %eax
	subl	%ecx, %r12d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r12d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L21
	cmpl	%esi, %ecx
	jge	.L21
	movl	%r12d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %r11
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rax, %r11
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r12d, %r11d
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r11,%rcx), %eax
	cmpl	%r12d, %r11d
	je	.L16
.L14:
	movslq	%eax, %r11
	addl	4016(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L16
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	4016(%rsp,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L16
	cltq
	addl	4016(%rsp,%rax,4), %edx
.L16:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %rbp
	cmpl	%esi, %ecx
	jne	.L7
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$8032, %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
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L8:
	xorl	%r8d, %r8d
	jmp	.L17
.L34:
	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:
```

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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L8
	leaq	4016(%rsp), %rbp
	xorl	%r12d, %r12d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$4, %r14
	cmpl	%r12d, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L8
	movl	$1, %edi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	leaq	16(%rbx), %r10
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$2, %ecx
	jle	.L20
	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
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	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	.L13
.L11:
	movslq	%eax, %r11
	addl	16(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%r11d, %ecx
	jl	.L13
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	16(%rsp,%r11,4), %edx
	cmpl	%eax, %ecx
	jl	.L13
	cltq
	addl	16(%rsp,%rax,4), %edx
.L13:
	movl	%esi, %r12d
	movl	%esi, %eax
	subl	%ecx, %r12d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r12d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L21
	cmpl	%esi, %ecx
	jge	.L21
	movl	%r12d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %r11
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rax, %r11
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r12d, %r11d
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r11,%rcx), %eax
	cmpl	%r12d, %r11d
	je	.L16
.L14:
	movslq	%eax, %r11
	addl	4016(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L16
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	4016(%rsp,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L16
	cltq
	addl	4016(%rsp,%rax,4), %edx
.L16:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %rbp
	cmpl	%esi, %ecx
	jne	.L7
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$8032, %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
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L8:
	xorl	%r8d, %r8d
	jmp	.L17
.L34:
	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
```assembly
	.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	%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	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L8
	leaq	4016(%rsp), %rbp
	xorl	%r12d, %r12d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$4, %r14
	cmpl	%r12d, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L8
	movl	$1, %edi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	leaq	16(%rbx), %r10
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$2, %ecx
	jle	.L20
	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
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	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	.L13
.L11:
	movslq	%eax, %r11
	addl	16(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%r11d, %ecx
	jl	.L13
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	16(%rsp,%r11,4), %edx
	cmpl	%eax, %ecx
	jl	.L13
	cltq
	addl	16(%rsp,%rax,4), %edx
.L13:
	movl	%esi, %r12d
	movl	%esi, %eax
	subl	%ecx, %r12d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r12d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L21
	cmpl	%esi, %ecx
	jge	.L21
	movl	%r12d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %r11
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rax, %r11
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r12d, %r11d
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r11,%rcx), %eax
	cmpl	%r12d, %r11d
	je	.L16
.L14:
	movslq	%eax, %r11
	addl	4016(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L16
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	4016(%rsp,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L16
	cltq
	addl	4016(%rsp,%rax,4), %edx
.L16:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %rbp
	cmpl	%esi, %ecx
	jne	.L7
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$8032, %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
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L8:
	xorl	%r8d, %r8d
	jmp	.L17
.L34:
	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:
```
```c
#include <stdio.h>
int main(void) {
	int a[2][1000];
	int n,ans;

	scanf("%d", &n);
	for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    int max=0;
    int hako;
    int cnt1;
    int cnt2;
    int i,j,k;
    for(i = 0; i < n; i++){
        int sum=0;
        for(k=0;k<=i;k++){
            sum+=a[0][k];
        }
        for(j=i;j<n;j++){
            sum+=a[1][j];
        }
        if(max<sum){
            max=sum;
        }
    }
    
	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>
int main(void) {
	int a[2][1000];
	int n,ans;

	scanf("%d", &n);
	for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    int max=0;
    int hako;
    int cnt1;
    int cnt2;
    int i,j,k;
    for(i = 0; i < n; i++){
        int sum=0;
        for(k=0;k<=i;k++){
            sum+=a[0][k];
        }
        for(j=i;j<n;j++){
            sum+=a[1][j];
        }
        if(max<sum){
            max=sum;
        }
    }
    
	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>
int main(void) {
	int a[2][1000];
	int n,ans;

	scanf("%d", &n);
	for(int i=0;i<2;i++){
        for(int j=0;j<n;j++){
            scanf("%d",&a[i][j]);
        }
    }
    int max=0;
    int hako;
    int cnt1;
    int cnt2;
    int i,j,k;
    for(i = 0; i < n; i++){
        int sum=0;
        for(k=0;k<=i;k++){
            sum+=a[0][k];
        }
        for(j=i;j<n;j++){
            sum+=a[1][j];
        }
        if(max<sum){
            max=sum;
        }
    }
    
	printf("%d\n", max);
	return 0;
}
```

Assembly Code:

```assembly
	.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	%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	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L8
	leaq	4016(%rsp), %rbp
	xorl	%r12d, %r12d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$4, %r14
	cmpl	%r12d, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L8
	movl	$1, %edi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	leaq	16(%rbx), %r10
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$2, %ecx
	jle	.L20
	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
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	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	.L13
.L11:
	movslq	%eax, %r11
	addl	16(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%r11d, %ecx
	jl	.L13
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	16(%rsp,%r11,4), %edx
	cmpl	%eax, %ecx
	jl	.L13
	cltq
	addl	16(%rsp,%rax,4), %edx
.L13:
	movl	%esi, %r12d
	movl	%esi, %eax
	subl	%ecx, %r12d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r12d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L21
	cmpl	%esi, %ecx
	jge	.L21
	movl	%r12d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %r11
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rax, %r11
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r12d, %r11d
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r11,%rcx), %eax
	cmpl	%r12d, %r11d
	je	.L16
.L14:
	movslq	%eax, %r11
	addl	4016(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L16
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	4016(%rsp,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L16
	cltq
	addl	4016(%rsp,%rax,4), %edx
.L16:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %rbp
	cmpl	%esi, %ecx
	jne	.L7
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$8032, %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
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L8:
	xorl	%r8d, %r8d
	jmp	.L17
.L34:
	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:
```

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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$3936, %rsp
	.cfi_def_cfa_offset 8080
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r12
	cmpl	%ebp, %eax
	jg	.L5
	testl	%eax, %eax
	jle	.L8
	leaq	4016(%rsp), %rbp
	xorl	%r12d, %r12d
	movq	%rbp, %r14
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$4, %r14
	cmpl	%r12d, %esi
	jg	.L9
	testl	%esi, %esi
	jle	.L8
	movl	$1, %edi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	leaq	16(%rbx), %r10
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$2, %ecx
	jle	.L20
	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
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L12
	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	.L13
.L11:
	movslq	%eax, %r11
	addl	16(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%r11d, %ecx
	jl	.L13
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	16(%rsp,%r11,4), %edx
	cmpl	%eax, %ecx
	jl	.L13
	cltq
	addl	16(%rsp,%rax,4), %edx
.L13:
	movl	%esi, %r12d
	movl	%esi, %eax
	subl	%ecx, %r12d
	cmpl	%esi, %ecx
	cmovge	%r9d, %r12d
	subl	%edi, %eax
	cmpl	$2, %eax
	jbe	.L21
	cmpl	%esi, %ecx
	jge	.L21
	movl	%r12d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %r11
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rax, %r11
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r12d, %r11d
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	leal	(%r11,%rcx), %eax
	cmpl	%r12d, %r11d
	je	.L16
.L14:
	movslq	%eax, %r11
	addl	4016(%rsp,%r11,4), %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L16
	movslq	%r11d, %r11
	addl	$2, %eax
	addl	4016(%rsp,%r11,4), %edx
	cmpl	%esi, %eax
	jge	.L16
	cltq
	addl	4016(%rsp,%rax,4), %edx
.L16:
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
	addl	$1, %ecx
	addl	$1, %edi
	addq	$4, %rbp
	cmpl	%esi, %ecx
	jne	.L7
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$8032, %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
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L8:
	xorl	%r8d, %r8d
	jmp	.L17
.L34:
	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:
```