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;
	scanf("%d", &n);
	int i;
	long long int a[100005];
	for (i = 0; i <= n; i++)
		scanf("%lld", &a[i]);
	long long int max[100005], min[100005];
	max[n] = min[n] = a[n];
	for (i = n - 1; i >= 0; i--)
	{
		max[i] = max[i + 1] + a[i];
		min[i] = (min[i + 1] + 1) / 2 + a[i];
	}
	if (min[0] > 1)
	{
		printf("-1\n");
		return 0;
	}
	long long int ans = 0;
	long long int p = 1;
	for (i = 0; i <= n; i++)
	{
		ans += p;
		p = (p - a[i]) * 2;
		if (p > max[i + 1])
			p = max[i + 1];
	}
	printf("%lld\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400168(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400164(%rbp)
	jmp	.L2
.L3:
	leaq	-2400144(%rbp), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2400164(%rbp)
.L2:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L3
	movl	-2400168(%rbp), %edx
	movl	-2400168(%rbp), %eax
	movslq	%edx, %rdx
	movq	-2400144(%rbp,%rdx,8), %rcx
	movslq	%eax, %rdx
	movq	%rcx, -800048(%rbp,%rdx,8)
	movl	-2400168(%rbp), %ecx
	cltq
	movq	-800048(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400168(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2400164(%rbp)
	jmp	.L4
.L5:
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	addq	$1, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	subl	$1, -2400164(%rbp)
.L4:
	cmpl	$0, -2400164(%rbp)
	jns	.L5
	movq	-800048(%rbp), %rax
	cmpq	$1, %rax
	jle	.L6
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L11
.L6:
	movq	$0, -2400160(%rbp)
	movq	$1, -2400152(%rbp)
	movl	$0, -2400164(%rbp)
	jmp	.L8
.L10:
	movq	-2400152(%rbp), %rax
	addq	%rax, -2400160(%rbp)
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rdx
	movq	-2400152(%rbp), %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -2400152(%rbp)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -2400152(%rbp)
	jle	.L9
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	movq	%rax, -2400152(%rbp)
.L9:
	addl	$1, -2400164(%rbp)
.L8:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L10
	movq	-2400160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"%lld"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-2396160(%rsp), %r11
	.cfi_def_cfa 11, 2396192
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$4000, %rsp
	.cfi_def_cfa_offset 2400192
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 2400152(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	js	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$8, %rbp
	cmpl	%ebx, %esi
	jge	.L3
.L2:
	movslq	%esi, %rdx
	movq	16(%rsp,%rdx,8), %rax
	movq	%rax, 1600112(%rsp,%rdx,8)
	movq	%rax, 800064(%rsp,%rdx,8)
	movl	%esi, %eax
	subl	$1, %eax
	js	.L4
	leaq	0(,%rdx,8), %rcx
	cltq
	leaq	16(%rsp), %r8
	movq	1600112(%rsp,%rcx), %rdx
	movq	800064(%rsp,%rcx), %rdi
	leaq	800064(%rsp), %r10
	leaq	1600112(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, %rdx
	addq	(%r8,%rax,8), %rdi
	movq	%rdx, %rcx
	movq	%rdi, (%r10,%rax,8)
	shrq	$63, %rcx
	addq	%rcx, %rdx
	sarq	%rdx
	addq	(%r8,%rax,8), %rdx
	movq	%rdx, (%r9,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jns	.L5
.L4:
	cmpq	$1, 1600112(%rsp)
	jg	.L6
	xorl	%r9d, %r9d
	testl	%esi, %esi
	js	.L8
	addl	$1, %esi
	xorl	%edx, %edx
	movl	$1, %eax
	xorl	%r9d, %r9d
	movslq	%esi, %rsi
	leaq	16(%rsp), %r8
	leaq	800072(%rsp), %rdi
	salq	$3, %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rdi,%rdx), %rcx
	addq	%rax, %r9
	subq	(%r8,%rdx), %rax
	addq	%rax, %rax
	cmpq	%rcx, %rax
	cmovg	%rcx, %rax
	addq	$8, %rdx
	cmpq	%rdx, %rsi
	jne	.L10
.L8:
	movq	%r9, %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	movq	2400152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$2400160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L9
.L17:
	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	"%lld"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-2396160(%rsp), %r11
	.cfi_def_cfa 11, 2396192
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$4000, %rsp
	.cfi_def_cfa_offset 2400192
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 2400152(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	js	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	addq	$8, %rbp
	cmpl	%ebx, %esi
	jge	.L3
.L2:
	movslq	%esi, %rdx
	movq	16(%rsp,%rdx,8), %rax
	movq	%rax, 1600112(%rsp,%rdx,8)
	movq	%rax, 800064(%rsp,%rdx,8)
	movl	%esi, %eax
	subl	$1, %eax
	js	.L4
	leaq	0(,%rdx,8), %rcx
	cltq
	leaq	16(%rsp), %r8
	movq	1600112(%rsp,%rcx), %rdx
	movq	800064(%rsp,%rcx), %rdi
	leaq	800064(%rsp), %r10
	leaq	1600112(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, %rdx
	addq	(%r8,%rax,8), %rdi
	movq	%rdx, %rcx
	movq	%rdi, (%r10,%rax,8)
	shrq	$63, %rcx
	addq	%rcx, %rdx
	sarq	%rdx
	addq	(%r8,%rax,8), %rdx
	movq	%rdx, (%r9,%rax,8)
	subq	$1, %rax
	testl	%eax, %eax
	jns	.L5
.L4:
	cmpq	$1, 1600112(%rsp)
	jg	.L6
	xorl	%r9d, %r9d
	testl	%esi, %esi
	js	.L8
	addl	$1, %esi
	xorl	%edx, %edx
	movl	$1, %eax
	xorl	%r9d, %r9d
	movslq	%esi, %rsi
	leaq	16(%rsp), %r8
	leaq	800072(%rsp), %rdi
	salq	$3, %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rdi,%rdx), %rcx
	addq	%rax, %r9
	subq	(%r8,%rdx), %rax
	addq	%rax, %rax
	cmpq	%rcx, %rax
	cmovg	%rcx, %rax
	addq	$8, %rdx
	cmpq	%rdx, %rsi
	jne	.L10
.L8:
	movq	%r9, %rdx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	movq	2400152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$2400160, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L9
.L17:
	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;
	scanf("%d", &n);
	int i;
	long long int a[100005];
	for (i = 0; i <= n; i++)
		scanf("%lld", &a[i]);
	long long int max[100005], min[100005];
	max[n] = min[n] = a[n];
	for (i = n - 1; i >= 0; i--)
	{
		max[i] = max[i + 1] + a[i];
		min[i] = (min[i + 1] + 1) / 2 + a[i];
	}
	if (min[0] > 1)
	{
		printf("-1\n");
		return 0;
	}
	long long int ans = 0;
	long long int p = 1;
	for (i = 0; i <= n; i++)
	{
		ans += p;
		p = (p - a[i]) * 2;
		if (p > max[i + 1])
			p = max[i + 1];
	}
	printf("%lld\n", ans);
	return 0;
}
4
0 0 0 0 2
 3
0 1 1 1
 10
0 0 1 0 2 3 5 8 13 21 34
 2
0 3 2
 10
0 0 1 0 2 3 5 8 13 23 34
 10
0 0 1 0 3 3 5 8 13 23 34
 2
-1 3 2
 10
0 0 1 1 3 3 5 8 13 23 34
 2
-2 3 2
 4
0 1 0 1 2

9
 6
 294
 -1
 298
 284
 7
 236
 8
 10

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;
	scanf("%d", &n);
	int i;
	long long int a[100005];
	for (i = 0; i <= n; i++)
		scanf("%lld", &a[i]);
	long long int max[100005], min[100005];
	max[n] = min[n] = a[n];
	for (i = n - 1; i >= 0; i--)
	{
		max[i] = max[i + 1] + a[i];
		min[i] = (min[i + 1] + 1) / 2 + a[i];
	}
	if (min[0] > 1)
	{
		printf("-1\n");
		return 0;
	}
	long long int ans = 0;
	long long int p = 1;
	for (i = 0; i <= n; i++)
	{
		ans += p;
		p = (p - a[i]) * 2;
		if (p > max[i + 1])
			p = max[i + 1];
	}
	printf("%lld\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400168(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400164(%rbp)
	jmp	.L2
.L3:
	leaq	-2400144(%rbp), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2400164(%rbp)
.L2:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L3
	movl	-2400168(%rbp), %edx
	movl	-2400168(%rbp), %eax
	movslq	%edx, %rdx
	movq	-2400144(%rbp,%rdx,8), %rcx
	movslq	%eax, %rdx
	movq	%rcx, -800048(%rbp,%rdx,8)
	movl	-2400168(%rbp), %ecx
	cltq
	movq	-800048(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400168(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2400164(%rbp)
	jmp	.L4
.L5:
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	addq	$1, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	subl	$1, -2400164(%rbp)
.L4:
	cmpl	$0, -2400164(%rbp)
	jns	.L5
	movq	-800048(%rbp), %rax
	cmpq	$1, %rax
	jle	.L6
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L11
.L6:
	movq	$0, -2400160(%rbp)
	movq	$1, -2400152(%rbp)
	movl	$0, -2400164(%rbp)
	jmp	.L8
.L10:
	movq	-2400152(%rbp), %rax
	addq	%rax, -2400160(%rbp)
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rdx
	movq	-2400152(%rbp), %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -2400152(%rbp)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -2400152(%rbp)
	jle	.L9
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	movq	%rax, -2400152(%rbp)
.L9:
	addl	$1, -2400164(%rbp)
.L8:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L10
	movq	-2400160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	-2396160(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2400168(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2400164(%rbp)
	jmp	.L2
.L3:
	leaq	-2400144(%rbp), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2400164(%rbp)
.L2:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L3
	movl	-2400168(%rbp), %edx
	movl	-2400168(%rbp), %eax
	movslq	%edx, %rdx
	movq	-2400144(%rbp,%rdx,8), %rcx
	movslq	%eax, %rdx
	movq	%rcx, -800048(%rbp,%rdx,8)
	movl	-2400168(%rbp), %ecx
	cltq
	movq	-800048(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400168(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2400164(%rbp)
	jmp	.L4
.L5:
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -1600096(%rbp,%rax,8)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	addq	$1, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rax
	addq	%rax, %rdx
	movl	-2400164(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	subl	$1, -2400164(%rbp)
.L4:
	cmpl	$0, -2400164(%rbp)
	jns	.L5
	movq	-800048(%rbp), %rax
	cmpq	$1, %rax
	jle	.L6
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L11
.L6:
	movq	$0, -2400160(%rbp)
	movq	$1, -2400152(%rbp)
	movl	$0, -2400164(%rbp)
	jmp	.L8
.L10:
	movq	-2400152(%rbp), %rax
	addq	%rax, -2400160(%rbp)
	movl	-2400164(%rbp), %eax
	cltq
	movq	-2400144(%rbp,%rax,8), %rdx
	movq	-2400152(%rbp), %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -2400152(%rbp)
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	cmpq	%rax, -2400152(%rbp)
	jle	.L9
	movl	-2400164(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	-1600096(%rbp,%rax,8), %rax
	movq	%rax, -2400152(%rbp)
.L9:
	addl	$1, -2400164(%rbp)
.L8:
	movl	-2400168(%rbp), %eax
	cmpl	%eax, -2400164(%rbp)
	jle	.L10
	movq	-2400160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
