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>
#include <math.h>

int main(void){
  int n,a[100005],d[100005];
  long long ans;
  scanf("%d",&n);
  for(int i=0;i<=n+1;i++){
    if(i==n+1||i==0){
      a[i]==0;
      continue;
    }
    scanf("%d",&a[i]);

  }

  for(int i=0;i<=n;i++){

    d[i]=fabs(a[i+1]-a[i]);
    ans+=d[i];
  }

  long long ans1[100005]={ans};

  for(int i=0;i<n;i++){

    ans1[i]=ans-d[i]-d[i+1]+fabs(a[i+2]-a[i]);
      printf("%lld\n",ans1[i]);
     }



  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC2:
	.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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1600132(%rbp)
	jmp	.L2
.L6:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	je	.L13
	cmpl	$0, -1600132(%rbp)
	je	.L13
	leaq	-1600112(%rbp), %rdx
	movl	-1600132(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L13:
	nop
.L5:
	addl	$1, -1600132(%rbp)
.L2:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	jle	.L6
	movl	$0, -1600128(%rbp)
	jmp	.L7
.L8:
	movl	-1600128(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm1
	andpd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	%edx, -1200080(%rbp,%rax,4)
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -1600120(%rbp)
	addl	$1, -1600128(%rbp)
.L7:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600128(%rbp)
	jle	.L8
	leaq	-800048(%rbp), %rax
	movl	$800040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movq	-1600120(%rbp), %rax
	movq	%rax, -800048(%rbp)
	movl	$0, -1600124(%rbp)
	jmp	.L9
.L10:
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-1600120(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-1600124(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	subq	%rax, %rdx
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rdx, %xmm1
	movl	-1600124(%rbp), %eax
	addl	$2, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm2
	andpd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2siq	%xmm0, %rdx
	movl	-1600124(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	movl	-1600124(%rbp), %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1600124(%rbp)
.L9:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600124(%rbp)
	jl	.L10
	movl	$0, %eax
	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
	.section	.rodata
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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"
.LC3:
	.string	"%lld\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
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1376, %rsp
	.cfi_def_cfa_offset 800144
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800088(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	cmpl	$-1, %eax
	jl	.L13
	je	.L13
	leaq	36(%rsp), %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%ebx, %eax
	jne	.L44
	leal	1(%rax), %esi
	addq	$4, %r12
	movl	%esi, %ebx
	cmpl	%esi, %eax
	jge	.L8
.L7:
	cmpl	$2, %eax
	jle	.L20
	leaq	32(%rsp), %r13
	pxor	%xmm2, %xmm2
	pxor	%xmm5, %xmm5
	movl	%esi, %edi
	shrl	$2, %edi
	leaq	400064(%rsp), %r14
	movapd	.LC1(%rip), %xmm3
	movq	%r13, %rdx
	subl	$1, %edi
	movq	%r14, %rcx
	salq	$4, %rdi
	leaq	400080(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	4(%rdx), %xmm1
	psubd	(%rdx), %xmm1
	addq	$16, %rcx
	addq	$16, %rdx
	cvtdq2pd	%xmm1, %xmm0
	pshufd	$238, %xmm1, %xmm1
	andpd	%xmm3, %xmm0
	cvtdq2pd	%xmm1, %xmm1
	andpd	%xmm3, %xmm1
	cvttpd2dq	%xmm0, %xmm0
	cvttpd2dq	%xmm1, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm4
	movaps	%xmm0, -16(%rcx)
	punpckldq	%xmm1, %xmm4
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm4, %xmm2
	paddq	%xmm0, %xmm2
	cmpq	%rcx, %rdi
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddq	%xmm0, %xmm2
	movq	%xmm2, %rbp
	cmpl	%esi, %edx
	je	.L45
.L9:
	movslq	%edx, %rsi
	leal	1(%rdx), %ecx
	leaq	0(%r13,%rsi,4), %rdi
	cmpl	%eax, %ecx
	jge	.L41
	cmpl	%eax, %edx
	jg	.L41
	movq	.LC2(%rip), %xmm7
	addl	$2, %edx
	movl	(%rdi), %edi
	leaq	400064(%rsp), %r14
	movslq	%edx, %rcx
	movaps	%xmm7, (%rsp)
.L16:
	movl	-4(%r13,%rcx,4), %r9d
	pxor	%xmm0, %xmm0
	movapd	(%rsp), %xmm7
	movl	%r9d, %edx
	subl	%edi, %edx
	movl	0(%r13,%rcx,4), %edi
	cvtsi2sdl	%edx, %xmm0
	movl	%ecx, %edx
	movl	%edi, %r10d
	subl	%r9d, %r10d
	andpd	%xmm7, %xmm0
	cvttsd2sil	%xmm0, %esi
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r10d, %xmm0
	movslq	%esi, %r8
	andpd	%xmm7, %xmm0
	addq	%rbp, %r8
	cvttsd2sil	%xmm0, %ebp
	movd	%esi, %xmm0
	movd	%ebp, %xmm7
	movslq	%ebp, %rbp
	punpckldq	%xmm7, %xmm0
	addq	%r8, %rbp
	movq	%xmm0, -8(%r14,%rcx,4)
	addq	$2, %rcx
	leal	-1(%rcx), %esi
	cmpl	%eax, %esi
	jl	.L16
	movslq	%edx, %rsi
	leal	1(%rdx), %ecx
.L15:
	movslq	%ecx, %r8
	pxor	%xmm0, %xmm0
	movapd	(%rsp), %xmm5
	movl	32(%rsp,%r8,4), %r9d
	movl	%r9d, %edi
	subl	32(%rsp,%rsi,4), %edi
	cvtsi2sdl	%edi, %xmm0
	andpd	%xmm5, %xmm0
	cvttsd2sil	%xmm0, %edi
	movl	%edi, 400064(%rsp,%rsi,4)
	movslq	%edi, %rdi
	addq	%rdi, %rbp
	cmpl	%eax, %ecx
	jg	.L17
	leal	2(%rdx), %r10d
	pxor	%xmm0, %xmm0
	movslq	%r10d, %rsi
	movl	32(%rsp,%rsi,4), %edi
	movl	%edi, %ecx
	subl	%r9d, %ecx
	cvtsi2sdl	%ecx, %xmm0
	andpd	%xmm5, %xmm0
	cvttsd2sil	%xmm0, %ecx
	movl	%ecx, 400064(%rsp,%r8,4)
	movslq	%ecx, %rcx
	addq	%rcx, %rbp
	cmpl	%eax, %r10d
	jg	.L42
	addl	$3, %edx
	pxor	%xmm0, %xmm0
	movslq	%edx, %rdx
	movl	32(%rsp,%rdx,4), %eax
	subl	%edi, %eax
	cvtsi2sdl	%eax, %xmm0
	andpd	(%rsp), %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 400064(%rsp,%rsi,4)
	cltq
	addq	%rax, %rbp
.L42:
	leaq	400064(%rsp), %r14
.L12:
	xorl	%ebx, %ebx
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r14,%rbx,4), %rdx
	movq	%rbp, %rax
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movq	%r12, %rsi
	movl	$1, %edi
	subq	%rdx, %rax
	movslq	4(%r14,%rbx,4), %rdx
	subq	%rdx, %rax
	cvtsi2sdq	%rax, %xmm0
	movl	8(%r13,%rbx,4), %eax
	subl	0(%r13,%rbx,4), %eax
	addq	$1, %rbx
	cvtsi2sdl	%eax, %xmm1
	andpd	(%rsp), %xmm1
	xorl	%eax, %eax
	addsd	%xmm1, %xmm0
	cvttsd2siq	%xmm0, %rdx
	call	__printf_chk@PLT
	cmpl	%ebx, 28(%rsp)
	jg	.L18
.L13:
	movq	800088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	addq	$800096, %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
.L44:
	.cfi_restore_state
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	addq	$4, %r12
	cmpl	%eax, %ebx
	jle	.L8
	testl	%eax, %eax
	js	.L13
	leal	1(%rax), %esi
	jmp	.L7
.L17:
	leaq	400064(%rsp), %r14
	testl	%eax, %eax
	jg	.L12
	jmp	.L13
.L45:
	movq	.LC2(%rip), %xmm7
	movaps	%xmm7, (%rsp)
	jmp	.L12
.L20:
	xorl	%edx, %edx
	leaq	32(%rsp), %r13
	jmp	.L9
.L41:
	movq	.LC2(%rip), %xmm7
	movaps	%xmm7, (%rsp)
	jmp	.L15
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	-1
	.long	2147483647
	.align 16
.LC2:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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"
.LC3:
	.string	"%lld\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
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1376, %rsp
	.cfi_def_cfa_offset 800144
	leaq	.LC0(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800088(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	cmpl	$-1, %eax
	jl	.L13
	je	.L13
	leaq	36(%rsp), %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%ebx, %eax
	jne	.L44
	leal	1(%rax), %esi
	addq	$4, %r12
	movl	%esi, %ebx
	cmpl	%esi, %eax
	jge	.L8
.L7:
	cmpl	$2, %eax
	jle	.L20
	leaq	32(%rsp), %r13
	pxor	%xmm2, %xmm2
	pxor	%xmm5, %xmm5
	movl	%esi, %edi
	shrl	$2, %edi
	leaq	400064(%rsp), %r14
	movapd	.LC1(%rip), %xmm3
	movq	%r13, %rdx
	subl	$1, %edi
	movq	%r14, %rcx
	salq	$4, %rdi
	leaq	400080(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	4(%rdx), %xmm1
	psubd	(%rdx), %xmm1
	addq	$16, %rcx
	addq	$16, %rdx
	cvtdq2pd	%xmm1, %xmm0
	pshufd	$238, %xmm1, %xmm1
	andpd	%xmm3, %xmm0
	cvtdq2pd	%xmm1, %xmm1
	andpd	%xmm3, %xmm1
	cvttpd2dq	%xmm0, %xmm0
	cvttpd2dq	%xmm1, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm4
	movaps	%xmm0, -16(%rcx)
	punpckldq	%xmm1, %xmm4
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm4, %xmm2
	paddq	%xmm0, %xmm2
	cmpq	%rcx, %rdi
	jne	.L10
	movdqa	%xmm2, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddq	%xmm0, %xmm2
	movq	%xmm2, %rbp
	cmpl	%esi, %edx
	je	.L45
.L9:
	movslq	%edx, %rsi
	leal	1(%rdx), %ecx
	leaq	0(%r13,%rsi,4), %rdi
	cmpl	%eax, %ecx
	jge	.L41
	cmpl	%eax, %edx
	jg	.L41
	movq	.LC2(%rip), %xmm7
	addl	$2, %edx
	movl	(%rdi), %edi
	leaq	400064(%rsp), %r14
	movslq	%edx, %rcx
	movaps	%xmm7, (%rsp)
.L16:
	movl	-4(%r13,%rcx,4), %r9d
	pxor	%xmm0, %xmm0
	movapd	(%rsp), %xmm7
	movl	%r9d, %edx
	subl	%edi, %edx
	movl	0(%r13,%rcx,4), %edi
	cvtsi2sdl	%edx, %xmm0
	movl	%ecx, %edx
	movl	%edi, %r10d
	subl	%r9d, %r10d
	andpd	%xmm7, %xmm0
	cvttsd2sil	%xmm0, %esi
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r10d, %xmm0
	movslq	%esi, %r8
	andpd	%xmm7, %xmm0
	addq	%rbp, %r8
	cvttsd2sil	%xmm0, %ebp
	movd	%esi, %xmm0
	movd	%ebp, %xmm7
	movslq	%ebp, %rbp
	punpckldq	%xmm7, %xmm0
	addq	%r8, %rbp
	movq	%xmm0, -8(%r14,%rcx,4)
	addq	$2, %rcx
	leal	-1(%rcx), %esi
	cmpl	%eax, %esi
	jl	.L16
	movslq	%edx, %rsi
	leal	1(%rdx), %ecx
.L15:
	movslq	%ecx, %r8
	pxor	%xmm0, %xmm0
	movapd	(%rsp), %xmm5
	movl	32(%rsp,%r8,4), %r9d
	movl	%r9d, %edi
	subl	32(%rsp,%rsi,4), %edi
	cvtsi2sdl	%edi, %xmm0
	andpd	%xmm5, %xmm0
	cvttsd2sil	%xmm0, %edi
	movl	%edi, 400064(%rsp,%rsi,4)
	movslq	%edi, %rdi
	addq	%rdi, %rbp
	cmpl	%eax, %ecx
	jg	.L17
	leal	2(%rdx), %r10d
	pxor	%xmm0, %xmm0
	movslq	%r10d, %rsi
	movl	32(%rsp,%rsi,4), %edi
	movl	%edi, %ecx
	subl	%r9d, %ecx
	cvtsi2sdl	%ecx, %xmm0
	andpd	%xmm5, %xmm0
	cvttsd2sil	%xmm0, %ecx
	movl	%ecx, 400064(%rsp,%r8,4)
	movslq	%ecx, %rcx
	addq	%rcx, %rbp
	cmpl	%eax, %r10d
	jg	.L42
	addl	$3, %edx
	pxor	%xmm0, %xmm0
	movslq	%edx, %rdx
	movl	32(%rsp,%rdx,4), %eax
	subl	%edi, %eax
	cvtsi2sdl	%eax, %xmm0
	andpd	(%rsp), %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, 400064(%rsp,%rsi,4)
	cltq
	addq	%rax, %rbp
.L42:
	leaq	400064(%rsp), %r14
.L12:
	xorl	%ebx, %ebx
	leaq	.LC3(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r14,%rbx,4), %rdx
	movq	%rbp, %rax
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movq	%r12, %rsi
	movl	$1, %edi
	subq	%rdx, %rax
	movslq	4(%r14,%rbx,4), %rdx
	subq	%rdx, %rax
	cvtsi2sdq	%rax, %xmm0
	movl	8(%r13,%rbx,4), %eax
	subl	0(%r13,%rbx,4), %eax
	addq	$1, %rbx
	cvtsi2sdl	%eax, %xmm1
	andpd	(%rsp), %xmm1
	xorl	%eax, %eax
	addsd	%xmm1, %xmm0
	cvttsd2siq	%xmm0, %rdx
	call	__printf_chk@PLT
	cmpl	%ebx, 28(%rsp)
	jg	.L18
.L13:
	movq	800088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L46
	addq	$800096, %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
.L44:
	.cfi_restore_state
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	addq	$4, %r12
	cmpl	%eax, %ebx
	jle	.L8
	testl	%eax, %eax
	js	.L13
	leal	1(%rax), %esi
	jmp	.L7
.L17:
	leaq	400064(%rsp), %r14
	testl	%eax, %eax
	jg	.L12
	jmp	.L13
.L45:
	movq	.LC2(%rip), %xmm7
	movaps	%xmm7, (%rsp)
	jmp	.L12
.L20:
	xorl	%edx, %edx
	leaq	32(%rsp), %r13
	jmp	.L9
.L41:
	movq	.LC2(%rip), %xmm7
	movaps	%xmm7, (%rsp)
	jmp	.L15
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	-1
	.long	2147483647
	.align 16
.LC2:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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>
#include <math.h>

int main(void){
  int n,a[100005],d[100005];
  long long ans;
  scanf("%d",&n);
  for(int i=0;i<=n+1;i++){
    if(i==n+1||i==0){
      a[i]==0;
      continue;
    }
    scanf("%d",&a[i]);

  }

  for(int i=0;i<=n;i++){

    d[i]=fabs(a[i+1]-a[i]);
    ans+=d[i];
  }

  long long ans1[100005]={ans};

  for(int i=0;i<n;i++){

    ans1[i]=ans-d[i]-d[i+1]+fabs(a[i+2]-a[i]);
      printf("%lld\n",ans1[i]);
     }



  return 0;
}

6
-679 -3431 -3258 3095 -3291 -4462
 5
1 1 0 2 0
 3
2 5 -1
 6
-679 -3431 -3258 3095 -3291 -2101
 5
1 0 0 2 0
 3
2 5 -2
 6
-679 -3431 -3258 3095 -4122 -2101
 5
1 0 0 2 1
 3
3 5 -2
 6
-679 -52 -3258 3095 -4122 -2101

21976
21630
21976
9270
21976
19634
 6
6
4
2
6
 12
6
10
 19634
19288
19634
6928
17254
19634
 4
6
6
2
6
 14
8
10
 21296
20950
21296
8590
17254
21296
 4
6
6
4
6
 14
10
10
 20950
20950
15792
9498
18162
22204

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>
#include <math.h>

int main(void){
  int n,a[100005],d[100005];
  long long ans;
  scanf("%d",&n);
  for(int i=0;i<=n+1;i++){
    if(i==n+1||i==0){
      a[i]==0;
      continue;
    }
    scanf("%d",&a[i]);

  }

  for(int i=0;i<=n;i++){

    d[i]=fabs(a[i+1]-a[i]);
    ans+=d[i];
  }

  long long ans1[100005]={ans};

  for(int i=0;i<n;i++){

    ans1[i]=ans-d[i]-d[i+1]+fabs(a[i+2]-a[i]);
      printf("%lld\n",ans1[i]);
     }



  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC2:
	.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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1600132(%rbp)
	jmp	.L2
.L6:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	je	.L13
	cmpl	$0, -1600132(%rbp)
	je	.L13
	leaq	-1600112(%rbp), %rdx
	movl	-1600132(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L13:
	nop
.L5:
	addl	$1, -1600132(%rbp)
.L2:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	jle	.L6
	movl	$0, -1600128(%rbp)
	jmp	.L7
.L8:
	movl	-1600128(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm1
	andpd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	%edx, -1200080(%rbp,%rax,4)
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -1600120(%rbp)
	addl	$1, -1600128(%rbp)
.L7:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600128(%rbp)
	jle	.L8
	leaq	-800048(%rbp), %rax
	movl	$800040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movq	-1600120(%rbp), %rax
	movq	%rax, -800048(%rbp)
	movl	$0, -1600124(%rbp)
	jmp	.L9
.L10:
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-1600120(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-1600124(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	subq	%rax, %rdx
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rdx, %xmm1
	movl	-1600124(%rbp), %eax
	addl	$2, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm2
	andpd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2siq	%xmm0, %rdx
	movl	-1600124(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	movl	-1600124(%rbp), %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1600124(%rbp)
.L9:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600124(%rbp)
	jl	.L10
	movl	$0, %eax
	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
	.section	.rodata
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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"
.LC2:
	.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	-1597440(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2704, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1600136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1600132(%rbp)
	jmp	.L2
.L6:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	je	.L13
	cmpl	$0, -1600132(%rbp)
	je	.L13
	leaq	-1600112(%rbp), %rdx
	movl	-1600132(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L13:
	nop
.L5:
	addl	$1, -1600132(%rbp)
.L2:
	movl	-1600136(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -1600132(%rbp)
	jle	.L6
	movl	$0, -1600128(%rbp)
	jmp	.L7
.L8:
	movl	-1600128(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm1
	andpd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %edx
	movl	-1600128(%rbp), %eax
	cltq
	movl	%edx, -1200080(%rbp,%rax,4)
	movl	-1600128(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -1600120(%rbp)
	addl	$1, -1600128(%rbp)
.L7:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600128(%rbp)
	jle	.L8
	leaq	-800048(%rbp), %rax
	movl	$800040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movq	-1600120(%rbp), %rax
	movq	%rax, -800048(%rbp)
	movl	$0, -1600124(%rbp)
	jmp	.L9
.L10:
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movq	-1600120(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-1600124(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1200080(%rbp,%rax,4), %eax
	cltq
	subq	%rax, %rdx
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rdx, %xmm1
	movl	-1600124(%rbp), %eax
	addl	$2, %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %edx
	movl	-1600124(%rbp), %eax
	cltq
	movl	-1600112(%rbp,%rax,4), %eax
	subl	%eax, %edx
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edx, %xmm0
	movq	.LC1(%rip), %xmm2
	andpd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2siq	%xmm0, %rdx
	movl	-1600124(%rbp), %eax
	cltq
	movq	%rdx, -800048(%rbp,%rax,8)
	movl	-1600124(%rbp), %eax
	cltq
	movq	-800048(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1600124(%rbp)
.L9:
	movl	-1600136(%rbp), %eax
	cmpl	%eax, -1600124(%rbp)
	jl	.L10
	movl	$0, %eax
	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
	.section	.rodata
	.align 16
.LC1:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.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:
