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 <stdlib.h>
int comp(const void *a, const void *b){
	return *(int *)a-*(int *)b;
}
int main(){
	int N;
	int M;
	int X[100000];
	scanf("%d",&N);
	scanf("%d",&M);
	if(N>=M){
		printf("0");
		return 0;
	}
	int i;
	int Y[100000];
	for(i=0;i<M;i++){
		scanf("%d",&X[i]);
	}
	qsort(X,M,sizeof(int),comp);
	for(i=0;i<M-1;i++){
		Y[i]=X[i+1]-X[i];
	}
	qsort(Y,M-1,sizeof(int),comp);
	int ans;
	ans=X[M-1]-X[0];
	for(i=0;i<N-1;i++){
		ans=ans-Y[M-2-i];
	}
	printf("%d",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800032(%rbp), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	$48, %edi
	call	putchar@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -800024(%rbp)
	jmp	.L6
.L7:
	leaq	-800016(%rbp), %rdx
	movl	-800024(%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
	addl	$1, -800024(%rbp)
.L6:
	movl	-800028(%rbp), %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L7
	movl	-800028(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-800016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -800024(%rbp)
	jmp	.L8
.L9:
	movl	-800024(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800024(%rbp)
.L8:
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L9
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	movl	-800016(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -800020(%rbp)
	movl	$0, -800024(%rbp)
	jmp	.L10
.L11:
	movl	-800028(%rbp), %eax
	subl	$2, %eax
	subl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	subl	%eax, -800020(%rbp)
	addl	$1, -800024(%rbp)
.L10:
	movl	-800032(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L11
	movl	-800020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L5:
	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
.LFE7:
	.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	comp
	.type	comp, @function
comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	comp, .-comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798760
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1320, %rsp
	.cfi_def_cfa_offset 800080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rsi
	cmpl	%esi, 8(%rsp)
	jge	.L4
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	movq	%rbx, %r13
	testl	%esi, %esi
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rsi
	addq	$4, %r13
	cmpl	%r12d, %esi
	jg	.L8
.L6:
	leaq	comp(%rip), %r12
	movl	$4, %edx
	movq	%rbx, %rdi
	movq	%r12, %rcx
	call	qsort@PLT
	movl	12(%rsp), %esi
	leal	-1(%rsi), %ecx
	testl	%ecx, %ecx
	jle	.L34
	leal	-2(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%ecx, %edi
	movq	%rbx, %rax
	leaq	400016(%rsp), %rbx
	shrl	$2, %edi
	movq	%rbx, %rdx
	subl	$1, %edi
	salq	$4, %rdi
	leaq	32(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	4(%rax), %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	addq	$16, %rdx
	movaps	%xmm0, -16(%rdx)
	cmpq	%rax, %rdi
	jne	.L13
	movl	%ecx, %edx
	andl	$-4, %edx
	movl	%edx, %eax
	cmpl	%edx, %ecx
	je	.L15
.L12:
	subl	%edx, %esi
	leal	-1(%rsi), %edi
	cmpl	$2, %esi
	je	.L17
	addl	$1, %edx
	salq	$2, %rdx
	movq	16(%rsp,%rdx), %xmm0
	movq	12(%rsp,%rdx), %xmm1
	psubd	%xmm1, %xmm0
	movq	%xmm0, 400012(%rsp,%rdx)
	movl	%edi, %edx
	andl	$-2, %edx
	addl	%edx, %eax
	cmpl	%edx, %edi
	je	.L15
.L17:
	movslq	%eax, %rdx
	addl	$1, %eax
	cltq
	movl	16(%rsp,%rax,4), %eax
	subl	16(%rsp,%rdx,4), %eax
	movl	%eax, 400016(%rsp,%rdx,4)
.L15:
	movslq	%ecx, %rsi
	movl	$4, %edx
	movq	%r12, %rcx
	movq	%rbx, %rdi
	call	qsort@PLT
	movslq	12(%rsp), %rax
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r8d
	movl	8(%rsp), %edx
	subl	16(%rsp), %r8d
	leal	-1(%rdx), %ecx
	testl	%ecx, %ecx
	jle	.L11
	subl	$2, %edx
	leal	-2(%rax), %edi
	cmpl	$2, %edx
	jbe	.L24
	movl	%ecx, %esi
	leaq	-20(%rbx,%rax,4), %rdx
	pxor	%xmm1, %xmm1
	shrl	$2, %esi
	leaq	-16(%rdx), %rax
	leal	-1(%rsi), %r9d
	movq	%rax, %rsi
	salq	$4, %r9
	subq	%r9, %rsi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L35:
	subq	$16, %rax
.L20:
	movdqu	(%rdx), %xmm0
	movq	%rax, %rdx
	pshufd	$27, %xmm0, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rsi, %rax
	jne	.L35
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	addl	%eax, %r8d
	movl	%ecx, %eax
	andl	$-4, %eax
	testb	$3, %cl
	je	.L11
.L19:
	movl	%edi, %edx
	leal	1(%rax), %esi
	subl	%eax, %edx
	movslq	%edx, %rdx
	subl	400016(%rsp,%rdx,4), %r8d
	cmpl	%esi, %ecx
	jle	.L11
	movl	%edi, %edx
	addl	$2, %eax
	subl	%esi, %edx
	movslq	%edx, %rdx
	subl	400016(%rsp,%rdx,4), %r8d
	cmpl	%eax, %ecx
	jle	.L11
	subl	%eax, %edi
	movslq	%edi, %rdi
	subl	400016(%rsp,%rdi,4), %r8d
.L11:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L7:
	movq	800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$800040, %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
.L4:
	.cfi_restore_state
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L7
.L34:
	leaq	400016(%rsp), %rbx
	jmp	.L15
.L24:
	xorl	%eax, %eax
	jmp	.L19
.L23:
	xorl	%edx, %edx
	xorl	%eax, %eax
	leaq	400016(%rsp), %rbx
	jmp	.L12
.L36:
	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
	.file	"temp.c"
	.text
	.p2align 4
	.globl	comp
	.type	comp, @function
comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	comp, .-comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798760
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1320, %rsp
	.cfi_def_cfa_offset 800080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rsi
	cmpl	%esi, 8(%rsp)
	jge	.L4
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	movq	%rbx, %r13
	testl	%esi, %esi
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rsi
	addq	$4, %r13
	cmpl	%r12d, %esi
	jg	.L8
.L6:
	leaq	comp(%rip), %r12
	movl	$4, %edx
	movq	%rbx, %rdi
	movq	%r12, %rcx
	call	qsort@PLT
	movl	12(%rsp), %esi
	leal	-1(%rsi), %ecx
	testl	%ecx, %ecx
	jle	.L34
	leal	-2(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%ecx, %edi
	movq	%rbx, %rax
	leaq	400016(%rsp), %rbx
	shrl	$2, %edi
	movq	%rbx, %rdx
	subl	$1, %edi
	salq	$4, %rdi
	leaq	32(%rsp,%rdi), %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	4(%rax), %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	addq	$16, %rdx
	movaps	%xmm0, -16(%rdx)
	cmpq	%rax, %rdi
	jne	.L13
	movl	%ecx, %edx
	andl	$-4, %edx
	movl	%edx, %eax
	cmpl	%edx, %ecx
	je	.L15
.L12:
	subl	%edx, %esi
	leal	-1(%rsi), %edi
	cmpl	$2, %esi
	je	.L17
	addl	$1, %edx
	salq	$2, %rdx
	movq	16(%rsp,%rdx), %xmm0
	movq	12(%rsp,%rdx), %xmm1
	psubd	%xmm1, %xmm0
	movq	%xmm0, 400012(%rsp,%rdx)
	movl	%edi, %edx
	andl	$-2, %edx
	addl	%edx, %eax
	cmpl	%edx, %edi
	je	.L15
.L17:
	movslq	%eax, %rdx
	addl	$1, %eax
	cltq
	movl	16(%rsp,%rax,4), %eax
	subl	16(%rsp,%rdx,4), %eax
	movl	%eax, 400016(%rsp,%rdx,4)
.L15:
	movslq	%ecx, %rsi
	movl	$4, %edx
	movq	%r12, %rcx
	movq	%rbx, %rdi
	call	qsort@PLT
	movslq	12(%rsp), %rax
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r8d
	movl	8(%rsp), %edx
	subl	16(%rsp), %r8d
	leal	-1(%rdx), %ecx
	testl	%ecx, %ecx
	jle	.L11
	subl	$2, %edx
	leal	-2(%rax), %edi
	cmpl	$2, %edx
	jbe	.L24
	movl	%ecx, %esi
	leaq	-20(%rbx,%rax,4), %rdx
	pxor	%xmm1, %xmm1
	shrl	$2, %esi
	leaq	-16(%rdx), %rax
	leal	-1(%rsi), %r9d
	movq	%rax, %rsi
	salq	$4, %r9
	subq	%r9, %rsi
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L35:
	subq	$16, %rax
.L20:
	movdqu	(%rdx), %xmm0
	movq	%rax, %rdx
	pshufd	$27, %xmm0, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rsi, %rax
	jne	.L35
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	addl	%eax, %r8d
	movl	%ecx, %eax
	andl	$-4, %eax
	testb	$3, %cl
	je	.L11
.L19:
	movl	%edi, %edx
	leal	1(%rax), %esi
	subl	%eax, %edx
	movslq	%edx, %rdx
	subl	400016(%rsp,%rdx,4), %r8d
	cmpl	%esi, %ecx
	jle	.L11
	movl	%edi, %edx
	addl	$2, %eax
	subl	%esi, %edx
	movslq	%edx, %rdx
	subl	400016(%rsp,%rdx,4), %r8d
	cmpl	%eax, %ecx
	jle	.L11
	subl	%eax, %edi
	movslq	%edi, %rdi
	subl	400016(%rsp,%rdi,4), %r8d
.L11:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L7:
	movq	800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$800040, %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
.L4:
	.cfi_restore_state
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L7
.L34:
	leaq	400016(%rsp), %rbx
	jmp	.L15
.L24:
	xorl	%eax, %eax
	jmp	.L19
.L23:
	xorl	%edx, %edx
	xorl	%eax, %eax
	leaq	400016(%rsp), %rbx
	jmp	.L12
.L36:
	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:

#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b){
	return *(int *)a-*(int *)b;
}
int main(){
	int N;
	int M;
	int X[100000];
	scanf("%d",&N);
	scanf("%d",&M);
	if(N>=M){
		printf("0");
		return 0;
	}
	int i;
	int Y[100000];
	for(i=0;i<M;i++){
		scanf("%d",&X[i]);
	}
	qsort(X,M,sizeof(int),comp);
	for(i=0;i<M-1;i++){
		Y[i]=X[i+1]-X[i];
	}
	qsort(Y,M-1,sizeof(int),comp);
	int ans;
	ans=X[M-1]-X[0];
	for(i=0;i<N-1;i++){
		ans=ans-Y[M-2-i];
	}
	printf("%d",ans);
}
3 7
-10 -1 0 9 -100 2 17
 100 1
-151489
 3 7
-8 -1 0 9 -100 2 17
 3 7
-10 -3 0 9 -100 2 18
 2 5
10 12 1 4 14
 6 7
-8 -1 0 9 -100 2 17
 2 5
10 12 1 4 21
 2 7
-8 -1 0 9 -100 2 17
 3 7
-10 -3 0 9 -5 0 17
 3 7
-8 -1 0 9 -100 0 17

18 0 17 19 7 1 11 25 10 16
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 <stdlib.h>
int comp(const void *a, const void *b){
	return *(int *)a-*(int *)b;
}
int main(){
	int N;
	int M;
	int X[100000];
	scanf("%d",&N);
	scanf("%d",&M);
	if(N>=M){
		printf("0");
		return 0;
	}
	int i;
	int Y[100000];
	for(i=0;i<M;i++){
		scanf("%d",&X[i]);
	}
	qsort(X,M,sizeof(int),comp);
	for(i=0;i<M-1;i++){
		Y[i]=X[i+1]-X[i];
	}
	qsort(Y,M-1,sizeof(int),comp);
	int ans;
	ans=X[M-1]-X[0];
	for(i=0;i<N-1;i++){
		ans=ans-Y[M-2-i];
	}
	printf("%d",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800032(%rbp), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	$48, %edi
	call	putchar@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -800024(%rbp)
	jmp	.L6
.L7:
	leaq	-800016(%rbp), %rdx
	movl	-800024(%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
	addl	$1, -800024(%rbp)
.L6:
	movl	-800028(%rbp), %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L7
	movl	-800028(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-800016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -800024(%rbp)
	jmp	.L8
.L9:
	movl	-800024(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800024(%rbp)
.L8:
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L9
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	movl	-800016(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -800020(%rbp)
	movl	$0, -800024(%rbp)
	jmp	.L10
.L11:
	movl	-800028(%rbp), %eax
	subl	$2, %eax
	subl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	subl	%eax, -800020(%rbp)
	addl	$1, -800024(%rbp)
.L10:
	movl	-800032(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L11
	movl	-800020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L5:
	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
.LFE7:
	.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	comp
	.type	comp, @function
comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp, .-comp
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800032(%rbp), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	$48, %edi
	call	putchar@PLT
	movl	$0, %eax
	jmp	.L5
.L4:
	movl	$0, -800024(%rbp)
	jmp	.L6
.L7:
	leaq	-800016(%rbp), %rdx
	movl	-800024(%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
	addl	$1, -800024(%rbp)
.L6:
	movl	-800028(%rbp), %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L7
	movl	-800028(%rbp), %eax
	movslq	%eax, %rsi
	leaq	-800016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -800024(%rbp)
	jmp	.L8
.L9:
	movl	-800024(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	subl	%eax, %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800024(%rbp)
.L8:
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L9
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	leaq	-400016(%rbp), %rax
	leaq	comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-800028(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	movl	-800016(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -800020(%rbp)
	movl	$0, -800024(%rbp)
	jmp	.L10
.L11:
	movl	-800028(%rbp), %eax
	subl	$2, %eax
	subl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	subl	%eax, -800020(%rbp)
	addl	$1, -800024(%rbp)
.L10:
	movl	-800032(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -800024(%rbp)
	jl	.L11
	movl	-800020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L5:
	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
.LFE7:
	.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:
