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

```c


#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 600000

	int anX[100002];
	char sInput[MAX_STRING+1]="";

int main() {
	char* psInput;

	int i=0;
	int nPointNumber=0;
	int nFailed=0;
	int nTimeCounter=1;
	int nLeftTime=0;
	int nXDistance=0;
	int nYDistance=0;
	int nSumDistance=0;
	int nTempNumber=0;
	int nMagicNumber=0;
	int nSubTotal=0;
	int nTotal=0;
	int nOrgRoute=0;
	int nShortCutRoute=0;

	// read line 1
	gets(sInput);
	nPointNumber = atoi(sInput);

	anX[0]=0;

	// read line 2 ~
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=1;i<=nPointNumber;i++){
		anX[i] = atoi(psInput);
		psInput = strtok(NULL," ");
	}
	anX[nPointNumber+1]=0;

	for(i=1;i<=nPointNumber+1;i++){
		nSubTotal=nSubTotal+abs(anX[i]-anX[i-1]);
	}

	for(nMagicNumber=1;nMagicNumber<=nPointNumber;nMagicNumber++){
		nOrgRoute = abs(anX[nMagicNumber]-anX[nMagicNumber-1])+abs(anX[nMagicNumber+1]-anX[nMagicNumber]);
		nShortCutRoute = abs(anX[nMagicNumber+1]-anX[nMagicNumber-1]);

		printf("%d\n",nSubTotal-nOrgRoute+nShortCutRoute);
	}
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	anX
	.bss
	.align 32
	.type	anX, @object
	.size	anX, 400008
anX:
	.zero	400008
	.globl	sInput
	.align 32
	.type	sInput, @object
	.size	sInput, 600001
sInput:
	.zero	600001
	.section	.rodata
.LC0:
	.string	" "
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	$0, -64(%rbp)
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -52(%rbp)
	movl	$0, anX(%rip)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	movl	$1, -64(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	addl	$1, -64(%rbp)
.L2:
	movl	-64(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L3
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -64(%rbp)
	jmp	.L4
.L5:
	movl	-64(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-64(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, -56(%rbp)
	addl	$1, -64(%rbp)
.L4:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -64(%rbp)
	jle	.L5
	movl	$1, -60(%rbp)
	jmp	.L6
.L7:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %esi
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -16(%rbp)
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-56(%rbp), %eax
	subl	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -60(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	" "
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	sInput(%rip), %r15
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	anX(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	gets@PLT
	xorl	%esi, %esi
	movl	$10, %edx
	movq	%r15, %rdi
	call	strtol@PLT
	movq	%r15, %rdi
	movl	$0, anX(%rip)
	movq	%rax, %r13
	movl	%eax, %ebp
	xorl	%eax, %eax
	call	gets@PLT
	movq	%r14, %rsi
	movq	%r15, %rdi
	call	strtok@PLT
	testl	%r13d, %r13d
	jle	.L2
	movq	%rax, %rdi
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	xorl	%edi, %edi
	movq	%r14, %rsi
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	call	strtok@PLT
	movq	%rax, %rdi
	cmpl	%ebx, %ebp
	jge	.L3
	leal	1(%r13), %ecx
	movl	$1, %esi
	movslq	%ecx, %rax
	testl	%ecx, %ecx
	movl	$0, (%r12,%rax,4)
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L31
	leaq	anX(%rip), %rax
	pxor	%xmm1, %xmm1
	movl	%esi, %edx
	shrl	$2, %edx
	leaq	16(%rax), %rdi
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	4(%rax), %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm0
	psubd	%xmm2, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L5
	movdqa	%xmm1, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm1
	leal	1(%rdx), %eax
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %ebx
	cmpl	%esi, %edx
	je	.L6
.L12:
	movslq	%eax, %rdx
	movq	%rdx, %rsi
	leaq	-4(%r12,%rdx,4), %rdi
	cmpl	%r13d, %eax
	jge	.L7
	cmpl	%eax, %ecx
	jl	.L7
	movl	(%rdi), %esi
	leaq	4+anX(%rip), %r8
.L8:
	movl	(%r12,%rdx,4), %r9d
	movl	%r9d, %edi
	subl	%esi, %edi
	movl	(%r8,%rdx,4), %esi
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	movl	%esi, %edi
	subl	%r9d, %edi
	addl	%ebx, %eax
	movl	%edi, %ebx
	negl	%ebx
	cmovs	%edi, %ebx
	addl	%eax, %ebx
	leal	2(%rdx), %eax
	addq	$2, %rdx
	leal	1(%rdx), %edi
	cmpl	%ecx, %edi
	jl	.L8
	movslq	%eax, %rsi
.L7:
	movl	(%r12,%rsi,4), %edi
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	movl	%edi, %esi
	subl	(%r12,%rdx,4), %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	addl	%edx, %ebx
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jg	.L9
	movslq	%edx, %rdx
	movl	(%r12,%rdx,4), %r8d
	movl	%r8d, %esi
	subl	%edi, %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	addl	$2, %eax
	addl	%edx, %ebx
	cmpl	%ecx, %eax
	jg	.L9
	cltq
	movl	(%r12,%rax,4), %eax
	subl	%r8d, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %ebx
.L9:
	testl	%r13d, %r13d
	jle	.L18
.L6:
	leaq	anX(%rip), %r13
	movl	$1, %r14d
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L11:
	movl	4(%r13), %edi
	movl	8(%r13), %eax
	addl	$1, %r14d
	movl	%edi, %edx
	subl	0(%r13), %edx
	movl	%eax, %esi
	movl	%edx, %ecx
	negl	%ecx
	cmovs	%edx, %ecx
	subl	%edi, %esi
	movl	$1, %edi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	subl	0(%r13), %eax
	movq	%r12, %rsi
	addl	%edx, %ecx
	movl	%ebx, %edx
	subl	%ecx, %edx
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addq	$4, %r13
	addl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%ebp, %r14d
	jle	.L11
.L18:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.L2:
	.cfi_restore_state
	leal	1(%r13), %eax
	movslq	%eax, %rsi
	movl	$0, (%r12,%rsi,4)
	cmpl	$1, %eax
	jne	.L18
	movl	$1, %ecx
	xorl	%ebx, %ebx
	jmp	.L7
.L31:
	xorl	%ebx, %ebx
	movl	$1, %eax
	jmp	.L12
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	sInput
	.bss
	.align 32
	.type	sInput, @object
	.size	sInput, 600001
sInput:
	.zero	600001
	.globl	anX
	.align 32
	.type	anX, @object
	.size	anX, 400008
anX:
	.zero	400008
	.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	" "
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	sInput(%rip), %r15
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	anX(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	gets@PLT
	xorl	%esi, %esi
	movl	$10, %edx
	movq	%r15, %rdi
	call	strtol@PLT
	movq	%r15, %rdi
	movl	$0, anX(%rip)
	movq	%rax, %r13
	movl	%eax, %ebp
	xorl	%eax, %eax
	call	gets@PLT
	movq	%r14, %rsi
	movq	%r15, %rdi
	call	strtok@PLT
	testl	%r13d, %r13d
	jle	.L2
	movq	%rax, %rdi
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	xorl	%edi, %edi
	movq	%r14, %rsi
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	call	strtok@PLT
	movq	%rax, %rdi
	cmpl	%ebx, %ebp
	jge	.L3
	leal	1(%r13), %ecx
	movl	$1, %esi
	movslq	%ecx, %rax
	testl	%ecx, %ecx
	movl	$0, (%r12,%rax,4)
	cmovg	%ecx, %esi
	cmpl	$3, %ecx
	jle	.L31
	leaq	anX(%rip), %rax
	pxor	%xmm1, %xmm1
	movl	%esi, %edx
	shrl	$2, %edx
	leaq	16(%rax), %rdi
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rdi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	4(%rax), %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm2
	psrad	$31, %xmm2
	pxor	%xmm2, %xmm0
	psubd	%xmm2, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L5
	movdqa	%xmm1, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm1
	leal	1(%rdx), %eax
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %ebx
	cmpl	%esi, %edx
	je	.L6
.L12:
	movslq	%eax, %rdx
	movq	%rdx, %rsi
	leaq	-4(%r12,%rdx,4), %rdi
	cmpl	%r13d, %eax
	jge	.L7
	cmpl	%eax, %ecx
	jl	.L7
	movl	(%rdi), %esi
	leaq	4+anX(%rip), %r8
.L8:
	movl	(%r12,%rdx,4), %r9d
	movl	%r9d, %edi
	subl	%esi, %edi
	movl	(%r8,%rdx,4), %esi
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	movl	%esi, %edi
	subl	%r9d, %edi
	addl	%ebx, %eax
	movl	%edi, %ebx
	negl	%ebx
	cmovs	%edi, %ebx
	addl	%eax, %ebx
	leal	2(%rdx), %eax
	addq	$2, %rdx
	leal	1(%rdx), %edi
	cmpl	%ecx, %edi
	jl	.L8
	movslq	%eax, %rsi
.L7:
	movl	(%r12,%rsi,4), %edi
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	movl	%edi, %esi
	subl	(%r12,%rdx,4), %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	addl	%edx, %ebx
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jg	.L9
	movslq	%edx, %rdx
	movl	(%r12,%rdx,4), %r8d
	movl	%r8d, %esi
	subl	%edi, %esi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	addl	$2, %eax
	addl	%edx, %ebx
	cmpl	%ecx, %eax
	jg	.L9
	cltq
	movl	(%r12,%rax,4), %eax
	subl	%r8d, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, %ebx
.L9:
	testl	%r13d, %r13d
	jle	.L18
.L6:
	leaq	anX(%rip), %r13
	movl	$1, %r14d
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L11:
	movl	4(%r13), %edi
	movl	8(%r13), %eax
	addl	$1, %r14d
	movl	%edi, %edx
	subl	0(%r13), %edx
	movl	%eax, %esi
	movl	%edx, %ecx
	negl	%ecx
	cmovs	%edx, %ecx
	subl	%edi, %esi
	movl	$1, %edi
	movl	%esi, %edx
	negl	%edx
	cmovs	%esi, %edx
	subl	0(%r13), %eax
	movq	%r12, %rsi
	addl	%edx, %ecx
	movl	%ebx, %edx
	subl	%ecx, %edx
	movl	%eax, %ecx
	negl	%ecx
	cmovns	%ecx, %eax
	addq	$4, %r13
	addl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%ebp, %r14d
	jle	.L11
.L18:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	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
.L2:
	.cfi_restore_state
	leal	1(%r13), %eax
	movslq	%eax, %rsi
	movl	$0, (%r12,%rsi,4)
	cmpl	$1, %eax
	jne	.L18
	movl	$1, %ecx
	xorl	%ebx, %ebx
	jmp	.L7
.L31:
	xorl	%ebx, %ebx
	movl	$1, %eax
	jmp	.L12
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	sInput
	.bss
	.align 32
	.type	sInput, @object
	.size	sInput, 600001
sInput:
	.zero	600001
	.globl	anX
	.align 32
	.type	anX, @object
	.size	anX, 400008
anX:
	.zero	400008
	.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:



#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 600000

	int anX[100002];
	char sInput[MAX_STRING+1]="";

int main() {
	char* psInput;

	int i=0;
	int nPointNumber=0;
	int nFailed=0;
	int nTimeCounter=1;
	int nLeftTime=0;
	int nXDistance=0;
	int nYDistance=0;
	int nSumDistance=0;
	int nTempNumber=0;
	int nMagicNumber=0;
	int nSubTotal=0;
	int nTotal=0;
	int nOrgRoute=0;
	int nShortCutRoute=0;

	// read line 1
	gets(sInput);
	nPointNumber = atoi(sInput);

	anX[0]=0;

	// read line 2 ~
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=1;i<=nPointNumber;i++){
		anX[i] = atoi(psInput);
		psInput = strtok(NULL," ");
	}
	anX[nPointNumber+1]=0;

	for(i=1;i<=nPointNumber+1;i++){
		nSubTotal=nSubTotal+abs(anX[i]-anX[i-1]);
	}

	for(nMagicNumber=1;nMagicNumber<=nPointNumber;nMagicNumber++){
		nOrgRoute = abs(anX[nMagicNumber]-anX[nMagicNumber-1])+abs(anX[nMagicNumber+1]-anX[nMagicNumber]);
		nShortCutRoute = abs(anX[nMagicNumber+1]-anX[nMagicNumber-1]);

		printf("%d\n",nSubTotal-nOrgRoute+nShortCutRoute);
	}
    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


#pragma warning(disable:4996)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_STRING 600000

	int anX[100002];
	char sInput[MAX_STRING+1]="";

int main() {
	char* psInput;

	int i=0;
	int nPointNumber=0;
	int nFailed=0;
	int nTimeCounter=1;
	int nLeftTime=0;
	int nXDistance=0;
	int nYDistance=0;
	int nSumDistance=0;
	int nTempNumber=0;
	int nMagicNumber=0;
	int nSubTotal=0;
	int nTotal=0;
	int nOrgRoute=0;
	int nShortCutRoute=0;

	// read line 1
	gets(sInput);
	nPointNumber = atoi(sInput);

	anX[0]=0;

	// read line 2 ~
	gets(sInput);
	psInput = strtok(sInput," ");
	for (i=1;i<=nPointNumber;i++){
		anX[i] = atoi(psInput);
		psInput = strtok(NULL," ");
	}
	anX[nPointNumber+1]=0;

	for(i=1;i<=nPointNumber+1;i++){
		nSubTotal=nSubTotal+abs(anX[i]-anX[i-1]);
	}

	for(nMagicNumber=1;nMagicNumber<=nPointNumber;nMagicNumber++){
		nOrgRoute = abs(anX[nMagicNumber]-anX[nMagicNumber-1])+abs(anX[nMagicNumber+1]-anX[nMagicNumber]);
		nShortCutRoute = abs(anX[nMagicNumber+1]-anX[nMagicNumber-1]);

		printf("%d\n",nSubTotal-nOrgRoute+nShortCutRoute);
	}
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	anX
	.bss
	.align 32
	.type	anX, @object
	.size	anX, 400008
anX:
	.zero	400008
	.globl	sInput
	.align 32
	.type	sInput, @object
	.size	sInput, 600001
sInput:
	.zero	600001
	.section	.rodata
.LC0:
	.string	" "
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	$0, -64(%rbp)
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -52(%rbp)
	movl	$0, anX(%rip)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	movl	$1, -64(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	addl	$1, -64(%rbp)
.L2:
	movl	-64(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L3
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -64(%rbp)
	jmp	.L4
.L5:
	movl	-64(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-64(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, -56(%rbp)
	addl	$1, -64(%rbp)
.L4:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -64(%rbp)
	jle	.L5
	movl	$1, -60(%rbp)
	jmp	.L6
.L7:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %esi
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -16(%rbp)
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-56(%rbp), %eax
	subl	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -60(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	anX
	.bss
	.align 32
	.type	anX, @object
	.size	anX, 400008
anX:
	.zero	400008
	.globl	sInput
	.align 32
	.type	sInput, @object
	.size	sInput, 600001
sInput:
	.zero	600001
	.section	.rodata
.LC0:
	.string	" "
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movl	$0, -64(%rbp)
	movl	$0, -52(%rbp)
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$0, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -60(%rbp)
	movl	$0, -56(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -52(%rbp)
	movl	$0, anX(%rip)
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	sInput(%rip), %rax
	movq	%rax, %rdi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	movl	$1, -64(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	-64(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	strtok@PLT
	movq	%rax, -8(%rbp)
	addl	$1, -64(%rbp)
.L2:
	movl	-64(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L3
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -64(%rbp)
	jmp	.L4
.L5:
	movl	-64(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-64(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%eax, -56(%rbp)
	addl	$1, -64(%rbp)
.L4:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -64(%rbp)
	jle	.L5
	movl	$1, -60(%rbp)
	jmp	.L6
.L7:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %esi
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addl	%esi, %eax
	movl	%eax, -16(%rbp)
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	anX(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-60(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	anX(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-56(%rbp), %eax
	subl	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -60(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	-52(%rbp), %eax
	jle	.L7
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
