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>
#include <stdlib.h>
#define ABS(x) ((x < 0) ? -x : x)
#define LL long long

void solve(LL *a, int n){
    int i;
    LL min = 1e15, dif, dif_abs, sum;
    //printf("%lld\n", min);
    sum = 0;
    for(i = 0; i < n; ++i) { sum += a[i]; }
    dif = -sum;
    for(i = 0; i < n-1; ++i) {
        dif += 2*a[i];
        dif_abs = ABS(dif);
        //printf("%lld ", dif_abs);
        if(dif_abs < min) { min = dif_abs; }
    }
    //printf("\n");
    printf("%lld\n", min);
}

int main(void) {
    int n, i;
    scanf("%d", &n);
    LL *a = (LL*)malloc((n+4)*sizeof(LL));
    for(i = 0; i < n; ++i) { scanf("%lld", &a[i]); }
    solve(a,n);
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB39:
	.cfi_startproc
	endbr64
	movabsq	$1000000000000000, %r8
	testl	%esi, %esi
	jle	.L2
	cmpl	$1, %esi
	je	.L8
	movl	%esi, %edx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L5
.L3:
	movslq	%edx, %rdx
	addq	(%rdi,%rdx,8), %rax
.L5:
	negq	%rax
	cmpl	$1, %esi
	jle	.L9
	movabsq	$1000000000000000, %r8
	leal	-2(%rsi), %edx
	leaq	8(%rdi,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdi), %rdx
	leaq	(%rax,%rdx,2), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovs	%rax, %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rdi
	cmpq	%rdi, %rcx
	jne	.L6
.L2:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L8:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movabsq	$1000000000000000, %r8
	jmp	.L2
	.cfi_endproc
.LFE39:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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	$16, %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), %r12d
	leal	4(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	testl	%r12d, %r12d
	jle	.L14
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	addq	$8, %rbp
	cmpl	%ebx, %r12d
	jg	.L15
.L14:
	movl	%r12d, %esi
	movq	%r14, %rdi
	call	solve
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB39:
	.cfi_startproc
	endbr64
	movabsq	$1000000000000000, %r8
	testl	%esi, %esi
	jle	.L2
	cmpl	$1, %esi
	je	.L8
	movl	%esi, %edx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L5
.L3:
	movslq	%edx, %rdx
	addq	(%rdi,%rdx,8), %rax
.L5:
	negq	%rax
	cmpl	$1, %esi
	jle	.L9
	movabsq	$1000000000000000, %r8
	leal	-2(%rsi), %edx
	leaq	8(%rdi,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdi), %rdx
	leaq	(%rax,%rdx,2), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovs	%rax, %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rdi
	cmpq	%rdi, %rcx
	jne	.L6
.L2:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L8:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movabsq	$1000000000000000, %r8
	jmp	.L2
	.cfi_endproc
.LFE39:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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	$16, %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), %r12d
	leal	4(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	testl	%r12d, %r12d
	jle	.L14
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	addq	$8, %rbp
	cmpl	%ebx, %r12d
	jg	.L15
.L14:
	movl	%r12d, %esi
	movq	%r14, %rdi
	call	solve
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB39:
	.cfi_startproc
	endbr64
	movabsq	$1000000000000000, %r8
	testl	%esi, %esi
	jle	.L2
	cmpl	$1, %esi
	je	.L8
	movl	%esi, %edx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L5
.L3:
	movslq	%edx, %rdx
	addq	(%rdi,%rdx,8), %rax
.L5:
	negq	%rax
	cmpl	$1, %esi
	jle	.L9
	movabsq	$1000000000000000, %r8
	leal	-2(%rsi), %edx
	leaq	8(%rdi,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdi), %rdx
	leaq	(%rax,%rdx,2), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovs	%rax, %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rdi
	cmpq	%rdi, %rcx
	jne	.L6
.L2:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L8:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movabsq	$1000000000000000, %r8
	jmp	.L2
	.cfi_endproc
.LFE39:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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	$16, %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), %r12d
	leal	4(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	testl	%r12d, %r12d
	jle	.L14
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	addq	$8, %rbp
	cmpl	%ebx, %r12d
	jg	.L15
.L14:
	movl	%r12d, %esi
	movq	%r14, %rdi
	call	solve
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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>
#include <stdlib.h>
#define ABS(x) ((x < 0) ? -x : x)
#define LL long long

void solve(LL *a, int n){
    int i;
    LL min = 1e15, dif, dif_abs, sum;
    //printf("%lld\n", min);
    sum = 0;
    for(i = 0; i < n; ++i) { sum += a[i]; }
    dif = -sum;
    for(i = 0; i < n-1; ++i) {
        dif += 2*a[i];
        dif_abs = ABS(dif);
        //printf("%lld ", dif_abs);
        if(dif_abs < min) { min = dif_abs; }
    }
    //printf("\n");
    printf("%lld\n", min);
}

int main(void) {
    int n, i;
    scanf("%d", &n);
    LL *a = (LL*)malloc((n+4)*sizeof(LL));
    for(i = 0; i < n; ++i) { scanf("%lld", &a[i]); }
    solve(a,n);
    return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#define ABS(x) ((x < 0) ? -x : x)
#define LL long long

void solve(LL *a, int n){
    int i;
    LL min = 1e15, dif, dif_abs, sum;
    //printf("%lld\n", min);
    sum = 0;
    for(i = 0; i < n; ++i) { sum += a[i]; }
    dif = -sum;
    for(i = 0; i < n-1; ++i) {
        dif += 2*a[i];
        dif_abs = ABS(dif);
        //printf("%lld ", dif_abs);
        if(dif_abs < min) { min = dif_abs; }
    }
    //printf("\n");
    printf("%lld\n", min);
}

int main(void) {
    int n, i;
    scanf("%d", &n);
    LL *a = (LL*)malloc((n+4)*sizeof(LL));
    for(i = 0; i < n; ++i) { scanf("%lld", &a[i]); }
    solve(a,n);
    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:

6
0 2 3 4 5 6
 2
0 -10
 6
0 2 3 7 5 6
 2
0 -19
 6
-1 2 3 7 5 6
 2
1 -19
 2
1 -33
 2
0 -33
 6
1 2 3 7 8 8
 2
-1 -33

2
 10
 1
 19
 0
 20
 34
 33
 3
 32

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>
#include <stdlib.h>
#define ABS(x) ((x < 0) ? -x : x)
#define LL long long

void solve(LL *a, int n){
    int i;
    LL min = 1e15, dif, dif_abs, sum;
    //printf("%lld\n", min);
    sum = 0;
    for(i = 0; i < n; ++i) { sum += a[i]; }
    dif = -sum;
    for(i = 0; i < n-1; ++i) {
        dif += 2*a[i];
        dif_abs = ABS(dif);
        //printf("%lld ", dif_abs);
        if(dif_abs < min) { min = dif_abs; }
    }
    //printf("\n");
    printf("%lld\n", min);
}

int main(void) {
    int n, i;
    scanf("%d", &n);
    LL *a = (LL*)malloc((n+4)*sizeof(LL));
    for(i = 0; i < n; ++i) { scanf("%lld", &a[i]); }
    solve(a,n);
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB39:
	.cfi_startproc
	endbr64
	movabsq	$1000000000000000, %r8
	testl	%esi, %esi
	jle	.L2
	cmpl	$1, %esi
	je	.L8
	movl	%esi, %edx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L5
.L3:
	movslq	%edx, %rdx
	addq	(%rdi,%rdx,8), %rax
.L5:
	negq	%rax
	cmpl	$1, %esi
	jle	.L9
	movabsq	$1000000000000000, %r8
	leal	-2(%rsi), %edx
	leaq	8(%rdi,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdi), %rdx
	leaq	(%rax,%rdx,2), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovs	%rax, %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rdi
	cmpq	%rdi, %rcx
	jne	.L6
.L2:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L8:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movabsq	$1000000000000000, %r8
	jmp	.L2
	.cfi_endproc
.LFE39:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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	$16, %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), %r12d
	leal	4(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	testl	%r12d, %r12d
	jle	.L14
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	addq	$8, %rbp
	cmpl	%ebx, %r12d
	jg	.L15
.L14:
	movl	%r12d, %esi
	movq	%r14, %rdi
	call	solve
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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	"%lld\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB39:
	.cfi_startproc
	endbr64
	movabsq	$1000000000000000, %r8
	testl	%esi, %esi
	jle	.L2
	cmpl	$1, %esi
	je	.L8
	movl	%esi, %edx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rdi,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddq	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testb	$1, %sil
	je	.L5
.L3:
	movslq	%edx, %rdx
	addq	(%rdi,%rdx,8), %rax
.L5:
	negq	%rax
	cmpl	$1, %esi
	jle	.L9
	movabsq	$1000000000000000, %r8
	leal	-2(%rsi), %edx
	leaq	8(%rdi,%rdx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdi), %rdx
	leaq	(%rax,%rdx,2), %rax
	movq	%rax, %rdx
	negq	%rdx
	cmovs	%rax, %rdx
	cmpq	%rdx, %r8
	cmovg	%rdx, %r8
	addq	$8, %rdi
	cmpq	%rdi, %rcx
	jne	.L6
.L2:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	__printf_chk@PLT
.L8:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movabsq	$1000000000000000, %r8
	jmp	.L2
	.cfi_endproc
.LFE39:
	.size	solve, .-solve
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC1(%rip), %rdi
	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	$16, %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), %r12d
	leal	4(%r12), %edi
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	testl	%r12d, %r12d
	jle	.L14
	movq	%rax, %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	addq	$8, %rbp
	cmpl	%ebx, %r12d
	jg	.L15
.L14:
	movl	%r12d, %esi
	movq	%r14, %rdi
	call	solve
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```