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>
#define ll long long
ll dp[400][400];
ll presum[401];
ll getsum(int l,int r){
	l++;r++;
	return presum[r]-presum[l-1];
}
int a[400];
ll min(ll a, ll b){
	return a < b ? a: b;
}
ll mincost(int l,int r){
	if(dp[l][r]!=0) return dp[l][r];
	if (r-l+1==2) return a[l]+a[r];
	if (l==r) return 0;
	
	ll mc = __LONG_LONG_MAX__;
	for(int i = l+1;i<=r;i++){
		ll L  =  mincost(l,i-1) ;
		ll R = mincost(i,r) ;
		mc = min(mc, L + R );
	}

	return dp[l][r] = mc + getsum(l,r);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) presum[i] = presum[i-1] + a[i-1];
	printf("%lld",mincost(0,n-1) );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 1280000
dp:
	.zero	1280000
	.globl	presum
	.align 32
	.type	presum, @object
	.size	presum, 3208
presum:
	.zero	3208
	.text
	.globl	getsum
	.type	getsum, @function
getsum:
.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)
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	presum(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getsum, .-getsum
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600
a:
	.zero	1600
	.text
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.globl	mincost
	.type	mincost, @function
mincost:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L6
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L7
.L6:
	movl	-40(%rbp), %eax
	subl	-36(%rbp), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	jmp	.L7
.L8:
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L9
	movl	$0, %eax
	jmp	.L7
.L9:
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L10
.L11:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L10:
	movl	-28(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L11
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	getsum
	movq	-24(%rbp), %rdx
	leaq	(%rax,%rdx), %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	mincost, .-mincost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	$1, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L15:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	mincost
	movq	%rax, %rsi
	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	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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
	.type	mincost.part.0, @function
mincost.part.0:
.LFB27:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	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
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leal	1(%rdi), %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	cmpl	%esi, %ebx
	jg	.L9
	movslq	%edi, %r14
	movslq	%esi, %rcx
	movslq	%ebx, %rbx
	movabsq	$9223372036854775807, %r13
	leaq	(%r14,%r14,4), %rax
	leaq	dp(%rip), %rdi
	movq	%rcx, 8(%rsp)
	leaq	(%rax,%rax,4), %r8
	movq	%rdi, 24(%rsp)
	movq	%r8, %rax
	salq	$7, %r8
	movq	%r14, 16(%rsp)
	salq	$4, %rax
	addq	%rdi, %r8
	addq	%rcx, %rax
	movq	%r8, %r14
	movl	%r15d, %ecx
	leaq	(%rdi,%rax,8), %rdx
	movq	%rdx, %r15
.L8:
	movq	-8(%r14,%rbx,8), %rbp
	movl	%ebx, %edx
	movl	%ebx, %r9d
	leal	-1(%rbx), %esi
	testq	%rbp, %rbp
	jne	.L3
	movl	%ebx, %eax
	subl	%ecx, %eax
	cmpl	$2, %eax
	je	.L14
	cmpl	%esi, %ecx
	je	.L3
	movl	%ecx, %edi
	movl	%ecx, 36(%rsp)
	movl	%ebx, 44(%rsp)
	movl	%ebx, 40(%rsp)
	call	mincost.part.0
	movl	44(%rsp), %edx
	movl	40(%rsp), %r9d
	movl	36(%rsp), %ecx
	movq	%rax, %rbp
.L3:
	movq	3200(%r15), %rax
	testq	%rax, %rax
	jne	.L12
	movl	%r12d, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	je	.L15
	cmpl	%ebx, %r12d
	je	.L6
	movl	%r12d, %esi
	movl	%r9d, %edi
	movl	%ecx, 36(%rsp)
	call	mincost.part.0
	movl	36(%rsp), %ecx
	addq	%rax, %rbp
.L6:
	cmpq	%rbp, %r13
	cmovg	%rbp, %r13
	addq	$1, %rbx
	addq	$3200, %r15
	cmpl	%ebx, %r12d
	jge	.L8
	movq	16(%rsp), %r14
.L2:
	addl	$1, %r12d
	leaq	presum(%rip), %rdx
	movq	24(%rsp), %rsi
	movslq	%r12d, %r12
	movq	(%rdx,%r12,8), %rax
	addq	%r13, %rax
	subq	(%rdx,%r14,8), %rax
	leaq	(%r14,%r14,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	addq	8(%rsp), %rdx
	movq	%rax, (%rsi,%rdx,8)
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movq	8(%rsp), %rax
	leaq	a(%rip), %rdi
	movl	(%rdi,%rax,4), %eax
	addl	(%rdi,%rbx,4), %eax
	cltq
.L12:
	addq	%rax, %rbp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	-4+a(%rip), %rax
	movq	16(%rsp), %rsi
	movl	(%rax,%rbx,4), %ebp
	addq	$4, %rax
	addl	(%rax,%rsi,4), %ebp
	movslq	%ebp, %rbp
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	movabsq	$9223372036854775807, %r13
	movslq	%esi, %rax
	movslq	%edi, %r14
	movq	%rax, 8(%rsp)
	leaq	dp(%rip), %rax
	movq	%rax, 24(%rsp)
	jmp	.L2
	.cfi_endproc
.LFE27:
	.size	mincost.part.0, .-mincost.part.0
	.p2align 4
	.globl	getsum
	.type	getsum, @function
getsum:
.LFB23:
	.cfi_startproc
	endbr64
	addl	$1, %esi
	leaq	presum(%rip), %rdx
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	movq	(%rdx,%rsi,8), %rax
	subq	(%rdx,%rdi,8), %rax
	ret
	.cfi_endproc
.LFE23:
	.size	getsum, .-getsum
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	min, .-min
	.p2align 4
	.globl	mincost
	.type	mincost, @function
mincost:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdx
	movslq	%esi, %rcx
	leaq	dp(%rip), %r8
	leaq	(%rdx,%rdx,4), %rax
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movq	(%r8,%rax,8), %rax
	testq	%rax, %rax
	jne	.L18
	movl	%esi, %r8d
	subl	%edi, %r8d
	cmpl	$1, %r8d
	je	.L21
	cmpl	%esi, %edi
	je	.L18
	jmp	mincost.part.0
	.p2align 4,,10
	.p2align 3
.L18:
	ret
	.p2align 4,,10
	.p2align 3
.L21:
	leaq	a(%rip), %rsi
	movl	(%rsi,%rcx,4), %eax
	addl	(%rsi,%rdx,4), %eax
	cltq
	ret
	.cfi_endproc
.LFE25:
	.size	mincost, .-mincost
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	jle	.L23
	leaq	a(%rip), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L24
	testl	%esi, %esi
	jle	.L23
	movq	presum(%rip), %rdx
	movslq	%esi, %r8
	xorl	%eax, %eax
	leaq	8+presum(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	(%r12,%rax,4), %rcx
	addq	%rcx, %rdx
	movq	%rdx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L25
.L23:
	subl	$1, %esi
	xorl	%edi, %edi
	call	mincost
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600
a:
	.zero	1600
	.globl	presum
	.align 32
	.type	presum, @object
	.size	presum, 3208
presum:
	.zero	3208
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 1280000
dp:
	.zero	1280000
	.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
	.type	mincost.part.0, @function
mincost.part.0:
.LFB27:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r15d
	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
	movl	%esi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leal	1(%rdi), %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	cmpl	%esi, %ebx
	jg	.L9
	movslq	%edi, %r14
	movslq	%esi, %rcx
	movslq	%ebx, %rbx
	movabsq	$9223372036854775807, %r13
	leaq	(%r14,%r14,4), %rax
	leaq	dp(%rip), %rdi
	movq	%rcx, 8(%rsp)
	leaq	(%rax,%rax,4), %r8
	movq	%rdi, 24(%rsp)
	movq	%r8, %rax
	salq	$7, %r8
	movq	%r14, 16(%rsp)
	salq	$4, %rax
	addq	%rdi, %r8
	addq	%rcx, %rax
	movq	%r8, %r14
	movl	%r15d, %ecx
	leaq	(%rdi,%rax,8), %rdx
	movq	%rdx, %r15
.L8:
	movq	-8(%r14,%rbx,8), %rbp
	movl	%ebx, %edx
	movl	%ebx, %r9d
	leal	-1(%rbx), %esi
	testq	%rbp, %rbp
	jne	.L3
	movl	%ebx, %eax
	subl	%ecx, %eax
	cmpl	$2, %eax
	je	.L14
	cmpl	%esi, %ecx
	je	.L3
	movl	%ecx, %edi
	movl	%ecx, 36(%rsp)
	movl	%ebx, 44(%rsp)
	movl	%ebx, 40(%rsp)
	call	mincost.part.0
	movl	44(%rsp), %edx
	movl	40(%rsp), %r9d
	movl	36(%rsp), %ecx
	movq	%rax, %rbp
.L3:
	movq	3200(%r15), %rax
	testq	%rax, %rax
	jne	.L12
	movl	%r12d, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	je	.L15
	cmpl	%ebx, %r12d
	je	.L6
	movl	%r12d, %esi
	movl	%r9d, %edi
	movl	%ecx, 36(%rsp)
	call	mincost.part.0
	movl	36(%rsp), %ecx
	addq	%rax, %rbp
.L6:
	cmpq	%rbp, %r13
	cmovg	%rbp, %r13
	addq	$1, %rbx
	addq	$3200, %r15
	cmpl	%ebx, %r12d
	jge	.L8
	movq	16(%rsp), %r14
.L2:
	addl	$1, %r12d
	leaq	presum(%rip), %rdx
	movq	24(%rsp), %rsi
	movslq	%r12d, %r12
	movq	(%rdx,%r12,8), %rax
	addq	%r13, %rax
	subq	(%rdx,%r14,8), %rax
	leaq	(%r14,%r14,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	addq	8(%rsp), %rdx
	movq	%rax, (%rsi,%rdx,8)
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movq	8(%rsp), %rax
	leaq	a(%rip), %rdi
	movl	(%rdi,%rax,4), %eax
	addl	(%rdi,%rbx,4), %eax
	cltq
.L12:
	addq	%rax, %rbp
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	-4+a(%rip), %rax
	movq	16(%rsp), %rsi
	movl	(%rax,%rbx,4), %ebp
	addq	$4, %rax
	addl	(%rax,%rsi,4), %ebp
	movslq	%ebp, %rbp
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	movabsq	$9223372036854775807, %r13
	movslq	%esi, %rax
	movslq	%edi, %r14
	movq	%rax, 8(%rsp)
	leaq	dp(%rip), %rax
	movq	%rax, 24(%rsp)
	jmp	.L2
	.cfi_endproc
.LFE27:
	.size	mincost.part.0, .-mincost.part.0
	.p2align 4
	.globl	getsum
	.type	getsum, @function
getsum:
.LFB23:
	.cfi_startproc
	endbr64
	addl	$1, %esi
	leaq	presum(%rip), %rdx
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	movq	(%rdx,%rsi,8), %rax
	subq	(%rdx,%rdi,8), %rax
	ret
	.cfi_endproc
.LFE23:
	.size	getsum, .-getsum
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB24:
	.cfi_startproc
	endbr64
	cmpq	%rdi, %rsi
	movq	%rdi, %rax
	cmovle	%rsi, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	min, .-min
	.p2align 4
	.globl	mincost
	.type	mincost, @function
mincost:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdx
	movslq	%esi, %rcx
	leaq	dp(%rip), %r8
	leaq	(%rdx,%rdx,4), %rax
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	addq	%rcx, %rax
	movq	(%r8,%rax,8), %rax
	testq	%rax, %rax
	jne	.L18
	movl	%esi, %r8d
	subl	%edi, %r8d
	cmpl	$1, %r8d
	je	.L21
	cmpl	%esi, %edi
	je	.L18
	jmp	mincost.part.0
	.p2align 4,,10
	.p2align 3
.L18:
	ret
	.p2align 4,,10
	.p2align 3
.L21:
	leaq	a(%rip), %rsi
	movl	(%rsi,%rcx,4), %eax
	addl	(%rsi,%rdx,4), %eax
	cltq
	ret
	.cfi_endproc
.LFE25:
	.size	mincost, .-mincost
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	jle	.L23
	leaq	a(%rip), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L24
	testl	%esi, %esi
	jle	.L23
	movq	presum(%rip), %rdx
	movslq	%esi, %r8
	xorl	%eax, %eax
	leaq	8+presum(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	(%r12,%rax,4), %rcx
	addq	%rcx, %rdx
	movq	%rdx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L25
.L23:
	subl	$1, %esi
	xorl	%edi, %edi
	call	mincost
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600
a:
	.zero	1600
	.globl	presum
	.align 32
	.type	presum, @object
	.size	presum, 3208
presum:
	.zero	3208
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 1280000
dp:
	.zero	1280000
	.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>
#define ll long long
ll dp[400][400];
ll presum[401];
ll getsum(int l,int r){
	l++;r++;
	return presum[r]-presum[l-1];
}
int a[400];
ll min(ll a, ll b){
	return a < b ? a: b;
}
ll mincost(int l,int r){
	if(dp[l][r]!=0) return dp[l][r];
	if (r-l+1==2) return a[l]+a[r];
	if (l==r) return 0;
	
	ll mc = __LONG_LONG_MAX__;
	for(int i = l+1;i<=r;i++){
		ll L  =  mincost(l,i-1) ;
		ll R = mincost(i,r) ;
		mc = min(mc, L + R );
	}

	return dp[l][r] = mc + getsum(l,r);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) presum[i] = presum[i-1] + a[i-1];
	printf("%lld",mincost(0,n-1) );
}
6
7 9 8 6 1 1
 5
10 8 10 10 10
 3
1001000000 1000000000 1000000000
 4
10 20 30 46
 6
7 9 13 6 1 1
 5
19 8 10 10 10
 3
1001000000 1000000001 1000000000
 4
10 5 30 46
 6
7 9 13 6 1 2
 5
19 8 10 10 1

74 114 5001000000 196 84 132 5001000002 151 88 106
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>
#define ll long long
ll dp[400][400];
ll presum[401];
ll getsum(int l,int r){
	l++;r++;
	return presum[r]-presum[l-1];
}
int a[400];
ll min(ll a, ll b){
	return a < b ? a: b;
}
ll mincost(int l,int r){
	if(dp[l][r]!=0) return dp[l][r];
	if (r-l+1==2) return a[l]+a[r];
	if (l==r) return 0;
	
	ll mc = __LONG_LONG_MAX__;
	for(int i = l+1;i<=r;i++){
		ll L  =  mincost(l,i-1) ;
		ll R = mincost(i,r) ;
		mc = min(mc, L + R );
	}

	return dp[l][r] = mc + getsum(l,r);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) presum[i] = presum[i-1] + a[i-1];
	printf("%lld",mincost(0,n-1) );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 1280000
dp:
	.zero	1280000
	.globl	presum
	.align 32
	.type	presum, @object
	.size	presum, 3208
presum:
	.zero	3208
	.text
	.globl	getsum
	.type	getsum, @function
getsum:
.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)
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	presum(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getsum, .-getsum
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600
a:
	.zero	1600
	.text
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.globl	mincost
	.type	mincost, @function
mincost:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L6
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L7
.L6:
	movl	-40(%rbp), %eax
	subl	-36(%rbp), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	jmp	.L7
.L8:
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L9
	movl	$0, %eax
	jmp	.L7
.L9:
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L10
.L11:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L10:
	movl	-28(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L11
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	getsum
	movq	-24(%rbp), %rdx
	leaq	(%rax,%rdx), %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	mincost, .-mincost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	$1, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L15:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	mincost
	movq	%rax, %rsi
	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	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 1280000
dp:
	.zero	1280000
	.globl	presum
	.align 32
	.type	presum, @object
	.size	presum, 3208
presum:
	.zero	3208
	.text
	.globl	getsum
	.type	getsum, @function
getsum:
.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)
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	presum(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	getsum, .-getsum
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600
a:
	.zero	1600
	.text
	.globl	min
	.type	min, @function
min:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	min, .-min
	.globl	mincost
	.type	mincost, @function
mincost:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L6
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L7
.L6:
	movl	-40(%rbp), %eax
	subl	-36(%rbp), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	jmp	.L7
.L8:
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L9
	movl	$0, %eax
	jmp	.L7
.L9:
	movabsq	$9223372036854775807, %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L10
.L11:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mincost
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rdx
	movq	-8(%rbp), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	min
	movq	%rax, -24(%rbp)
	addl	$1, -28(%rbp)
.L10:
	movl	-28(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L11
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	getsum
	movq	-24(%rbp), %rdx
	leaq	(%rax,%rdx), %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dp(%rip), %rax
	movq	(%rdx,%rax), %rax
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	mincost, .-mincost
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L14
	movl	$1, -12(%rbp)
	jmp	.L15
.L16:
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-12(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, %rcx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	presum(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L15:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	mincost
	movq	%rax, %rsi
	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	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
