Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
/* Coached by Dukkha */
#include <stdio.h>

#define N 100000

int aa[N];

long long solve(int n, int p) {
	int i, sum;
	long long cnt;

	cnt = sum = 0;
	for (i = 0; i < n; i++) {
		sum += aa[i];
		if (i % 2 == p) {
			if (sum >= 0) {
				cnt += sum + 1;
				sum = -1;
			}
		} else {
			if (sum <= 0) {
				cnt += 1 - sum;
				sum = 1;
			}
		}
	}
	return cnt;
}

int main() {
	int n, i;
	long long ans0, ans1;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans0 = solve(n, 0);
	ans1 = solve(n, 1);
	printf("%lld\n", ans0 < ans1 ? ans0 : ans1);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	aa
	.bss
	.align 32
	.type	aa, @object
	.size	aa, 400000
aa:
	.zero	400000
	.text
	.globl	solve
	.type	solve, @function
solve:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jne	.L3
	cmpl	$0, -12(%rbp)
	js	.L4
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$-1, -12(%rbp)
	jmp	.L4
.L3:
	cmpl	$0, -12(%rbp)
	jg	.L4
	movl	$1, %eax
	subl	-12(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L5
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L8:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	-32(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	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	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L6
	movslq	%edi, %rdi
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	leaq	aa(%rip), %r9
	movl	$1, %r10d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%edx, %edx
	jg	.L4
	movl	%r10d, %ecx
	subl	%edx, %ecx
	movslq	%ecx, %rdx
	addq	%rdx, %r8
	movl	$1, %edx
.L4:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L1
.L5:
	movl	%eax, %ecx
	addl	(%r9,%rax,4), %edx
	andl	$1, %ecx
	cmpl	%ecx, %esi
	jne	.L3
	testl	%edx, %edx
	js	.L4
	addl	$1, %edx
	addq	$1, %rax
	movslq	%edx, %rdx
	addq	%rdx, %r8
	movl	$-1, %edx
	cmpq	%rax, %rdi
	jne	.L5
.L1:
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%r8d, %r8d
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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), %eax
	testl	%eax, %eax
	jle	.L10
	leaq	aa(%rip), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L11
	testl	%eax, %eax
	jle	.L10
	movslq	%eax, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	xorl	%edx, %edx
	movl	$1, %r9d
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%edx, %edx
	jg	.L13
	movl	%r9d, %r8d
	subl	%edx, %r8d
	movslq	%r8d, %rdx
	addq	%rdx, %rdi
	movl	%ecx, %edx
.L13:
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L25
.L14:
	movl	%eax, %ecx
	addl	(%r12,%rax,4), %edx
	andl	$1, %ecx
	jne	.L12
	testl	%edx, %edx
	js	.L13
	addl	$1, %edx
	addq	$1, %rax
	movslq	%edx, %rdx
	addq	%rdx, %rdi
	movl	$-1, %edx
	cmpq	%rsi, %rax
	jne	.L14
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	$1, %r9d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L15:
	testl	%ecx, %ecx
	jg	.L16
	movl	%r9d, %r8d
	subl	%ecx, %r8d
	movslq	%r8d, %rcx
	addq	%rcx, %rdx
	movl	$1, %ecx
.L16:
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L18
.L17:
	addl	(%r12,%rax,4), %ecx
	testb	$1, %al
	je	.L15
	testl	%ecx, %ecx
	js	.L16
	addl	$1, %ecx
	addq	$1, %rax
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	movl	$-1, %ecx
	cmpq	%rsi, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	cmpq	%rdx, %rdi
	leaq	.LC1(%rip), %rsi
	cmovle	%rdi, %rdx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	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
.L10:
	.cfi_restore_state
	xorl	%edi, %edi
	xorl	%edx, %edx
	jmp	.L18
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	aa
	.bss
	.align 32
	.type	aa, @object
	.size	aa, 400000
aa:
	.zero	400000
	.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	solve
	.type	solve, @function
solve:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L6
	movslq	%edi, %rdi
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	leaq	aa(%rip), %r9
	movl	$1, %r10d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%edx, %edx
	jg	.L4
	movl	%r10d, %ecx
	subl	%edx, %ecx
	movslq	%ecx, %rdx
	addq	%rdx, %r8
	movl	$1, %edx
.L4:
	addq	$1, %rax
	cmpq	%rax, %rdi
	je	.L1
.L5:
	movl	%eax, %ecx
	addl	(%r9,%rax,4), %edx
	andl	$1, %ecx
	cmpl	%ecx, %esi
	jne	.L3
	testl	%edx, %edx
	js	.L4
	addl	$1, %edx
	addq	$1, %rax
	movslq	%edx, %rdx
	addq	%rdx, %r8
	movl	$-1, %edx
	cmpq	%rax, %rdi
	jne	.L5
.L1:
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%r8d, %r8d
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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), %eax
	testl	%eax, %eax
	jle	.L10
	leaq	aa(%rip), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L11
	testl	%eax, %eax
	jle	.L10
	movslq	%eax, %rsi
	xorl	%edi, %edi
	xorl	%eax, %eax
	xorl	%edx, %edx
	movl	$1, %r9d
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%edx, %edx
	jg	.L13
	movl	%r9d, %r8d
	subl	%edx, %r8d
	movslq	%r8d, %rdx
	addq	%rdx, %rdi
	movl	%ecx, %edx
.L13:
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L25
.L14:
	movl	%eax, %ecx
	addl	(%r12,%rax,4), %edx
	andl	$1, %ecx
	jne	.L12
	testl	%edx, %edx
	js	.L13
	addl	$1, %edx
	addq	$1, %rax
	movslq	%edx, %rdx
	addq	%rdx, %rdi
	movl	$-1, %edx
	cmpq	%rsi, %rax
	jne	.L14
.L25:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movl	$1, %r9d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L15:
	testl	%ecx, %ecx
	jg	.L16
	movl	%r9d, %r8d
	subl	%ecx, %r8d
	movslq	%r8d, %rcx
	addq	%rcx, %rdx
	movl	$1, %ecx
.L16:
	addq	$1, %rax
	cmpq	%rsi, %rax
	je	.L18
.L17:
	addl	(%r12,%rax,4), %ecx
	testb	$1, %al
	je	.L15
	testl	%ecx, %ecx
	js	.L16
	addl	$1, %ecx
	addq	$1, %rax
	movslq	%ecx, %rcx
	addq	%rcx, %rdx
	movl	$-1, %ecx
	cmpq	%rsi, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	cmpq	%rdx, %rdi
	leaq	.LC1(%rip), %rsi
	cmovle	%rdi, %rdx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	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
.L10:
	.cfi_restore_state
	xorl	%edi, %edi
	xorl	%edx, %edx
	jmp	.L18
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	aa
	.bss
	.align 32
	.type	aa, @object
	.size	aa, 400000
aa:
	.zero	400000
	.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:

/* Coached by Dukkha */
#include <stdio.h>

#define N 100000

int aa[N];

long long solve(int n, int p) {
	int i, sum;
	long long cnt;

	cnt = sum = 0;
	for (i = 0; i < n; i++) {
		sum += aa[i];
		if (i % 2 == p) {
			if (sum >= 0) {
				cnt += sum + 1;
				sum = -1;
			}
		} else {
			if (sum <= 0) {
				cnt += 1 - sum;
				sum = 1;
			}
		}
	}
	return cnt;
}

int main() {
	int n, i;
	long long ans0, ans1;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans0 = solve(n, 0);
	ans1 = solve(n, 1);
	printf("%lld\n", ans0 < ans1 ? ans0 : ans1);
	return 0;
}

5
3 -6 4 -8 7
 4
1 -3 1 -1
 6
-1 4 3 2 -5 0
 4
1 -5 1 -1
 6
-1 4 2 2 -5 0
 5
3 -8 4 -12 7
 4
1 -5 0 -1
 6
-1 4 1 2 -5 0
 5
3 -5 4 -12 7
 6
-1 8 1 2 -5 0

1
 3
 12
 5
 11
 7
 6
 10
 4
 14

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
/* Coached by Dukkha */
#include <stdio.h>

#define N 100000

int aa[N];

long long solve(int n, int p) {
	int i, sum;
	long long cnt;

	cnt = sum = 0;
	for (i = 0; i < n; i++) {
		sum += aa[i];
		if (i % 2 == p) {
			if (sum >= 0) {
				cnt += sum + 1;
				sum = -1;
			}
		} else {
			if (sum <= 0) {
				cnt += 1 - sum;
				sum = 1;
			}
		}
	}
	return cnt;
}

int main() {
	int n, i;
	long long ans0, ans1;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	ans0 = solve(n, 0);
	ans1 = solve(n, 1);
	printf("%lld\n", ans0 < ans1 ? ans0 : ans1);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	aa
	.bss
	.align 32
	.type	aa, @object
	.size	aa, 400000
aa:
	.zero	400000
	.text
	.globl	solve
	.type	solve, @function
solve:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jne	.L3
	cmpl	$0, -12(%rbp)
	js	.L4
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$-1, -12(%rbp)
	jmp	.L4
.L3:
	cmpl	$0, -12(%rbp)
	jg	.L4
	movl	$1, %eax
	subl	-12(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L5
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L8:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	-32(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	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	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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	aa
	.bss
	.align 32
	.type	aa, @object
	.size	aa, 400000
aa:
	.zero	400000
	.text
	.globl	solve
	.type	solve, @function
solve:
.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jne	.L3
	cmpl	$0, -12(%rbp)
	js	.L4
	movl	-12(%rbp), %eax
	addl	$1, %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$-1, -12(%rbp)
	jmp	.L4
.L3:
	cmpl	$0, -12(%rbp)
	jg	.L4
	movl	$1, %eax
	subl	-12(%rbp), %eax
	cltq
	addq	%rax, -8(%rbp)
	movl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L5
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%lld\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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -28(%rbp)
	jmp	.L8
.L9:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	aa(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L8:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	-32(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -24(%rbp)
	movl	-32(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	solve
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	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	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.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:
