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 compare_int(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
void gcd(int *a,int *b){
  int r,temp;
  if(a<b){
    temp=*a;*a=*b;*b=temp;
  }
  r=*a%*b;
  while(r!=0){
    *a=*b;
    *b=r;
    r=*a%*b;
  }
}
int main(void)
{
  int n,lx,a,b;
  scanf("%d%d",&n,&lx);
  int x[n],absx[n];
  for(int i=0;i<n;i++){
    scanf("%d",&x[i]);
    absx[i]=abs(lx-x[i]);
  }
  //qsort(x,n,sizeof(int),compare_int);
  for(int i=0;i<n-1;i++){
    a=absx[i];b=absx[i+1];
    gcd(&a,&b);
    absx[i+1]=b;
  }
  printf("%d",absx[n-1]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	compare_int
	.type	compare_int, @function
compare_int:
.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	compare_int, .-compare_int
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jnb	.L4
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
.L4:
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
	jmp	.L5
.L6:
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
.L5:
	cmpl	$0, -8(%rbp)
	jne	.L6
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L14
.L15:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	$0, -92(%rbp)
	jmp	.L16
.L17:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -104(%rbp)
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -100(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movl	-100(%rbp), %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L16:
	movl	-112(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L17
	movl	-112(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	compare_int
	.type	compare_int, @function
compare_int:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare_int, .-compare_int
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpq	%rsi, %rdi
	jnb	.L4
	movl	(%rdi), %eax
	movl	%r8d, (%rdi)
	movl	%eax, (%rsi)
	movl	%eax, %r8d
.L4:
	movl	(%rdi), %eax
	cltd
	idivl	%r8d
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L5
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edx, %ecx
.L5:
	movl	%r8d, (%rdi)
	movl	%ecx, %r8d
	movl	%ecx, (%rsi)
	movl	(%rdi), %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L7
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	ret
	.cfi_endproc
.LFE40:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-56(%rbp), %rdx
	movq	%rsp, %rsi
	movq	%rdx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L12
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L37
.L12:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L38
.L13:
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	movq	%rsp, %r13
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L14:
	cmpq	%rsi, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L38:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L13
.L15:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L39
.L16:
	movq	%rsp, %rbx
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L17
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r13, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	subl	0(%r13), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addq	$4, %r13
	movl	%eax, (%rbx,%r14,4)
	movl	-56(%rbp), %eax
	addq	$1, %r14
	cmpl	%r14d, %eax
	jg	.L18
.L17:
	leal	-1(%rax), %r11d
	testl	%r11d, %r11d
	jle	.L19
	subl	$2, %eax
	leaq	4(%rbx), %rdi
	leaq	-48(%rbp), %r9
	leaq	8(%rbx,%rax,4), %r10
	leaq	-44(%rbp), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movl	-4(%rdi), %eax
	movl	(%rdi), %ecx
	cmpq	%r8, %r9
	jnb	.L20
	movl	%ecx, %edx
	movl	%eax, %ecx
	movl	%edx, %eax
.L20:
	cltd
	idivl	%ecx
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L22
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%edx, %esi
.L22:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L26
.L21:
	movl	%esi, (%rdi)
	addq	$4, %rdi
	cmpq	%rdi, %r10
	jne	.L23
.L19:
	movslq	%r11d, %r11
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	movl	(%rbx,%r11,4), %edx
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L41
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L40:
	.cfi_restore_state
	movl	%ecx, %esi
	jmp	.L21
.L39:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L16
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.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	compare_int
	.type	compare_int, @function
compare_int:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare_int, .-compare_int
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	cmpq	%rsi, %rdi
	jnb	.L4
	movl	(%rdi), %eax
	movl	%r8d, (%rdi)
	movl	%eax, (%rsi)
	movl	%eax, %r8d
.L4:
	movl	(%rdi), %eax
	cltd
	idivl	%r8d
	movl	%edx, %ecx
	testl	%edx, %edx
	jne	.L5
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edx, %ecx
.L5:
	movl	%r8d, (%rdi)
	movl	%ecx, %r8d
	movl	%ecx, (%rsi)
	movl	(%rdi), %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L7
	ret
	.p2align 4,,10
	.p2align 3
.L9:
	ret
	.cfi_endproc
.LFE40:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r14
	pushq	%r13
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-56(%rbp), %rdx
	movq	%rsp, %rsi
	movq	%rdx, %rax
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rdi
	movq	%rdx, %rcx
	andq	$-4096, %rdi
	andq	$-16, %rcx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L12
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L37
.L12:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L38
.L13:
	movq	%rdx, %rcx
	movq	%rsp, %rsi
	andq	$-4096, %rdx
	movq	%rsp, %r13
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L14:
	cmpq	%rsi, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L38:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L13
.L15:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L39
.L16:
	movq	%rsp, %rbx
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L17
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r13, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	subl	0(%r13), %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	addq	$4, %r13
	movl	%eax, (%rbx,%r14,4)
	movl	-56(%rbp), %eax
	addq	$1, %r14
	cmpl	%r14d, %eax
	jg	.L18
.L17:
	leal	-1(%rax), %r11d
	testl	%r11d, %r11d
	jle	.L19
	subl	$2, %eax
	leaq	4(%rbx), %rdi
	leaq	-48(%rbp), %r9
	leaq	8(%rbx,%rax,4), %r10
	leaq	-44(%rbp), %r8
	.p2align 4,,10
	.p2align 3
.L23:
	movl	-4(%rdi), %eax
	movl	(%rdi), %ecx
	cmpq	%r8, %r9
	jnb	.L20
	movl	%ecx, %edx
	movl	%eax, %ecx
	movl	%edx, %eax
.L20:
	cltd
	idivl	%ecx
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L22
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%edx, %esi
.L22:
	movl	%ecx, %eax
	movl	%esi, %ecx
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L26
.L21:
	movl	%esi, (%rdi)
	addq	$4, %rdi
	cmpq	%rdi, %r10
	jne	.L23
.L19:
	movslq	%r11d, %r11
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	movl	(%rbx,%r11,4), %edx
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L41
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L40:
	.cfi_restore_state
	movl	%ecx, %esi
	jmp	.L21
.L39:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L16
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.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 compare_int(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
void gcd(int *a,int *b){
  int r,temp;
  if(a<b){
    temp=*a;*a=*b;*b=temp;
  }
  r=*a%*b;
  while(r!=0){
    *a=*b;
    *b=r;
    r=*a%*b;
  }
}
int main(void)
{
  int n,lx,a,b;
  scanf("%d%d",&n,&lx);
  int x[n],absx[n];
  for(int i=0;i<n;i++){
    scanf("%d",&x[i]);
    absx[i]=abs(lx-x[i]);
  }
  //qsort(x,n,sizeof(int),compare_int);
  for(int i=0;i<n-1;i++){
    a=absx[i];b=absx[i+1];
    gcd(&a,&b);
    absx[i+1]=b;
  }
  printf("%d",absx[n-1]);
  return 0;
}

3 81
33 79 57
 1 1
1010000000
 3 81
33 70 57
 1 1
1010000100
 3 81
33 42 57
 1 0
1010000100
 1 0
1010010100
 1 1
1010010100
 1 1
1000000100
 1 0
1010000000

2 1009999999 1 1010000099 3 1010000100 1010010100 1010010099 1000000099 1010000000
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 compare_int(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
void gcd(int *a,int *b){
  int r,temp;
  if(a<b){
    temp=*a;*a=*b;*b=temp;
  }
  r=*a%*b;
  while(r!=0){
    *a=*b;
    *b=r;
    r=*a%*b;
  }
}
int main(void)
{
  int n,lx,a,b;
  scanf("%d%d",&n,&lx);
  int x[n],absx[n];
  for(int i=0;i<n;i++){
    scanf("%d",&x[i]);
    absx[i]=abs(lx-x[i]);
  }
  //qsort(x,n,sizeof(int),compare_int);
  for(int i=0;i<n-1;i++){
    a=absx[i];b=absx[i+1];
    gcd(&a,&b);
    absx[i+1]=b;
  }
  printf("%d",absx[n-1]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	compare_int
	.type	compare_int, @function
compare_int:
.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	compare_int, .-compare_int
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jnb	.L4
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
.L4:
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
	jmp	.L5
.L6:
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
.L5:
	cmpl	$0, -8(%rbp)
	jne	.L6
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L14
.L15:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	$0, -92(%rbp)
	jmp	.L16
.L17:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -104(%rbp)
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -100(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movl	-100(%rbp), %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L16:
	movl	-112(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L17
	movl	-112(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	compare_int
	.type	compare_int, @function
compare_int:
.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	compare_int, .-compare_int
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jnb	.L4
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
.L4:
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
	jmp	.L5
.L6:
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-8(%rbp), %edx
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movq	-32(%rbp), %rdx
	movl	(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -8(%rbp)
.L5:
	cmpl	$0, -8(%rbp)
	jne	.L6
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcd, .-gcd
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L14
.L15:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-108(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L14:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L15
	movl	$0, -92(%rbp)
	jmp	.L16
.L17:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -104(%rbp)
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -100(%rbp)
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movl	-100(%rbp), %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -92(%rbp)
.L16:
	movl	-112(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L17
	movl	-112(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
