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>

long long gcd(long long x,long long y)
{
  if(y==0){
    return x;
  }else{
    return (gcd(y,x%y));
  }
}

long long gcdary(long long a[],long long n)
{
  if(n==1){
    return a[0];
  }else if(n==2){
    return (gcd(a[0],a[1]));
  }else{
    return (gcd(a[0],gcdary(&a[1],n-1)));
  }
}


int main(void)
{
  long N,X;
  long long x[200000];
  long long dist[200000];
  scanf("%ld %ld",&N,&X);
  for(long i=0;i<N;i++){
    scanf("%lld",&x[i]);
  }


  for(long i=0;i<N;i++){
    dist[i]=abs(X-x[i]);
  }

  printf("%lld\n",gcdary(dist,N));
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	gcdary
	.type	gcdary, @function
gcdary:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$1, -16(%rbp)
	jne	.L5
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	jmp	.L6
.L5:
	cmpq	$2, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L6
.L7:
	movq	-16(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcdary, .-gcdary
	.section	.rodata
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-3198976(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3200040(%rbp), %rdx
	leaq	-3200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -3200032(%rbp)
	jmp	.L9
.L10:
	leaq	-3200016(%rbp), %rdx
	movq	-3200032(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -3200032(%rbp)
.L9:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200032(%rbp)
	jl	.L10
	movq	$0, -3200024(%rbp)
	jmp	.L11
.L12:
	movq	-3200040(%rbp), %rax
	movl	%eax, %edx
	movq	-3200024(%rbp), %rax
	movq	-3200016(%rbp,%rax,8), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movslq	%eax, %rdx
	movq	-3200024(%rbp), %rax
	movq	%rdx, -1600016(%rbp,%rax,8)
	addq	$1, -3200024(%rbp)
.L11:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200024(%rbp)
	jl	.L12
	movq	-3200048(%rbp), %rdx
	leaq	-1600016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %r8
.L2:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.p2align 4
	.globl	gcdary
	.type	gcdary, @function
gcdary:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	cmpq	$1, %rsi
	je	.L55
	cmpq	$2, %rsi
	jne	.L15
	movq	8(%rdi), %r8
	movq	(%rdi), %rax
	testq	%r8, %r8
	jne	.L16
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L56:
	movq	%rdx, %r8
.L16:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L56
.L12:
	movq	%r8, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	leaq	-1(%rsi), %rax
	je	.L57
	cmpq	$2, %rax
	jne	.L19
	movq	16(%rdi), %r8
	movq	8(%rdi), %rax
	testq	%r8, %r8
	jne	.L21
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%rdx, %r8
.L21:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L58
.L20:
	movq	(%rbx), %rax
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdx, %r8
.L29:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L38
	movq	%r8, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L55:
	.cfi_restore_state
	movq	(%rdi), %r8
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	leaq	-2(%rsi), %rax
	cmpq	$3, %rsi
	je	.L59
	cmpq	$2, %rax
	jne	.L24
	movq	24(%rdi), %r8
	movq	16(%rdi), %rax
	testq	%r8, %r8
	jne	.L26
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%rdx, %r8
.L26:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L60
.L25:
	movq	8(%rbx), %rax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L61:
	movq	%rdx, %r8
.L28:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L61
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L57:
	movq	8(%rdi), %r8
.L18:
	movq	(%rbx), %rax
	testq	%r8, %r8
	jne	.L29
.L37:
	movq	%rax, %r8
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	subq	$3, %rsi
	leaq	24(%rdi), %rdi
	call	gcdary
	movq	%rax, %r8
	movq	16(%rbx), %rax
	testq	%r8, %r8
	jne	.L27
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rdx, %r8
.L27:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L62
	jmp	.L25
.L59:
	movq	16(%rdi), %r8
.L23:
	movq	8(%rbx), %rax
	testq	%r8, %r8
	jne	.L28
.L36:
	movq	%rax, %r8
	jmp	.L18
.L35:
	movq	%rax, %r8
	jmp	.L23
	.cfi_endproc
.LFE40:
	.size	gcdary, .-gcdary
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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	-3198976(%rsp), %r11
	.cfi_def_cfa 11, 3199016
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1064, %rsp
	.cfi_def_cfa_offset 3200080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 3200024(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	8(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L79
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L65:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	addq	$8, %r12
	cmpq	%rbp, %rsi
	jg	.L65
	testq	%rsi, %rsi
	jle	.L79
	leaq	-1(%rsi), %rax
	movq	8(%rsp), %rcx
	cmpq	$2, %rax
	jbe	.L71
	movq	%rsi, %rdx
	movd	%ecx, %xmm5
	leaq	1600016(%rsp), %rdi
	shrq	$2, %rdx
	pshufd	$0, %xmm5, %xmm4
	pxor	%xmm3, %xmm3
	movq	%rdi, %rax
	salq	$5, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L67:
	movdqa	%xmm4, %xmm0
	movdqa	(%rbx), %xmm1
	addq	$32, %rbx
	addq	$32, %rax
	shufps	$136, -16(%rbx), %xmm1
	psubd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrad	$31, %xmm1
	pxor	%xmm1, %xmm0
	psubd	%xmm1, %xmm0
	movdqa	%xmm3, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	movaps	%xmm2, -32(%rax)
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rbx
	jne	.L67
	movq	%rsi, %rax
	andq	$-4, %rax
	testb	$3, %sil
	je	.L64
.L66:
	movl	%ecx, %r8d
	subl	16(%rsp,%rax,8), %r8d
	movl	%r8d, %edx
	negl	%edx
	cmovs	%r8d, %edx
	leaq	1(%rax), %r8
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%rax,8)
	cmpq	%r8, %rsi
	jle	.L64
	movl	%ecx, %r9d
	subl	16(%rsp,%r8,8), %r9d
	movl	%r9d, %edx
	negl	%edx
	cmovs	%r9d, %edx
	addq	$2, %rax
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%r8,8)
	cmpq	%rax, %rsi
	jle	.L64
	subl	16(%rsp,%rax,8), %ecx
	movl	%ecx, %edx
	negl	%edx
	cmovs	%ecx, %edx
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%rax,8)
.L64:
	call	gcdary
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	3200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$3200040, %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
.L79:
	.cfi_restore_state
	leaq	1600016(%rsp), %rdi
	jmp	.L64
.L71:
	xorl	%eax, %eax
	leaq	1600016(%rsp), %rdi
	jmp	.L66
.L80:
	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	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %r8
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %r8
.L2:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L11
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.p2align 4
	.globl	gcdary
	.type	gcdary, @function
gcdary:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	cmpq	$1, %rsi
	je	.L55
	cmpq	$2, %rsi
	jne	.L15
	movq	8(%rdi), %r8
	movq	(%rdi), %rax
	testq	%r8, %r8
	jne	.L16
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L56:
	movq	%rdx, %r8
.L16:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L56
.L12:
	movq	%r8, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	leaq	-1(%rsi), %rax
	je	.L57
	cmpq	$2, %rax
	jne	.L19
	movq	16(%rdi), %r8
	movq	8(%rdi), %rax
	testq	%r8, %r8
	jne	.L21
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%rdx, %r8
.L21:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L58
.L20:
	movq	(%rbx), %rax
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdx, %r8
.L29:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L38
	movq	%r8, %rax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L55:
	.cfi_restore_state
	movq	(%rdi), %r8
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	.cfi_restore_state
	leaq	-2(%rsi), %rax
	cmpq	$3, %rsi
	je	.L59
	cmpq	$2, %rax
	jne	.L24
	movq	24(%rdi), %r8
	movq	16(%rdi), %rax
	testq	%r8, %r8
	jne	.L26
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L60:
	movq	%rdx, %r8
.L26:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L60
.L25:
	movq	8(%rbx), %rax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L61:
	movq	%rdx, %r8
.L28:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L61
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L57:
	movq	8(%rdi), %r8
.L18:
	movq	(%rbx), %rax
	testq	%r8, %r8
	jne	.L29
.L37:
	movq	%rax, %r8
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	subq	$3, %rsi
	leaq	24(%rdi), %rdi
	call	gcdary
	movq	%rax, %r8
	movq	16(%rbx), %rax
	testq	%r8, %r8
	jne	.L27
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rdx, %r8
.L27:
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L62
	jmp	.L25
.L59:
	movq	16(%rdi), %r8
.L23:
	movq	8(%rbx), %rax
	testq	%r8, %r8
	jne	.L28
.L36:
	movq	%rax, %r8
	jmp	.L18
.L35:
	movq	%rax, %r8
	jmp	.L23
	.cfi_endproc
.LFE40:
	.size	gcdary, .-gcdary
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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	-3198976(%rsp), %r11
	.cfi_def_cfa 11, 3199016
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1064, %rsp
	.cfi_def_cfa_offset 3200080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 3200024(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	8(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L79
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L65:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	addq	$8, %r12
	cmpq	%rbp, %rsi
	jg	.L65
	testq	%rsi, %rsi
	jle	.L79
	leaq	-1(%rsi), %rax
	movq	8(%rsp), %rcx
	cmpq	$2, %rax
	jbe	.L71
	movq	%rsi, %rdx
	movd	%ecx, %xmm5
	leaq	1600016(%rsp), %rdi
	shrq	$2, %rdx
	pshufd	$0, %xmm5, %xmm4
	pxor	%xmm3, %xmm3
	movq	%rdi, %rax
	salq	$5, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L67:
	movdqa	%xmm4, %xmm0
	movdqa	(%rbx), %xmm1
	addq	$32, %rbx
	addq	$32, %rax
	shufps	$136, -16(%rbx), %xmm1
	psubd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrad	$31, %xmm1
	pxor	%xmm1, %xmm0
	psubd	%xmm1, %xmm0
	movdqa	%xmm3, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	movaps	%xmm2, -32(%rax)
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rbx
	jne	.L67
	movq	%rsi, %rax
	andq	$-4, %rax
	testb	$3, %sil
	je	.L64
.L66:
	movl	%ecx, %r8d
	subl	16(%rsp,%rax,8), %r8d
	movl	%r8d, %edx
	negl	%edx
	cmovs	%r8d, %edx
	leaq	1(%rax), %r8
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%rax,8)
	cmpq	%r8, %rsi
	jle	.L64
	movl	%ecx, %r9d
	subl	16(%rsp,%r8,8), %r9d
	movl	%r9d, %edx
	negl	%edx
	cmovs	%r9d, %edx
	addq	$2, %rax
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%r8,8)
	cmpq	%rax, %rsi
	jle	.L64
	subl	16(%rsp,%rax,8), %ecx
	movl	%ecx, %edx
	negl	%edx
	cmovs	%ecx, %edx
	movslq	%edx, %rdx
	movq	%rdx, 1600016(%rsp,%rax,8)
.L64:
	call	gcdary
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	3200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$3200040, %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
.L79:
	.cfi_restore_state
	leaq	1600016(%rsp), %rdi
	jmp	.L64
.L71:
	xorl	%eax, %eax
	leaq	1600016(%rsp), %rdi
	jmp	.L66
.L80:
	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>

long long gcd(long long x,long long y)
{
  if(y==0){
    return x;
  }else{
    return (gcd(y,x%y));
  }
}

long long gcdary(long long a[],long long n)
{
  if(n==1){
    return a[0];
  }else if(n==2){
    return (gcd(a[0],a[1]));
  }else{
    return (gcd(a[0],gcdary(&a[1],n-1)));
  }
}


int main(void)
{
  long N,X;
  long long x[200000];
  long long dist[200000];
  scanf("%ld %ld",&N,&X);
  for(long i=0;i<N;i++){
    scanf("%lld",&x[i]);
  }


  for(long i=0;i<N;i++){
    dist[i]=abs(X-x[i]);
  }

  printf("%lld\n",gcdary(dist,N));
  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>

long long gcd(long long x,long long y)
{
  if(y==0){
    return x;
  }else{
    return (gcd(y,x%y));
  }
}

long long gcdary(long long a[],long long n)
{
  if(n==1){
    return a[0];
  }else if(n==2){
    return (gcd(a[0],a[1]));
  }else{
    return (gcd(a[0],gcdary(&a[1],n-1)));
  }
}


int main(void)
{
  long N,X;
  long long x[200000];
  long long dist[200000];
  scanf("%ld %ld",&N,&X);
  for(long i=0;i<N;i++){
    scanf("%lld",&x[i]);
  }


  for(long i=0;i<N;i++){
    dist[i]=abs(X-x[i]);
  }

  printf("%lld\n",gcdary(dist,N));
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	gcdary
	.type	gcdary, @function
gcdary:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$1, -16(%rbp)
	jne	.L5
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	jmp	.L6
.L5:
	cmpq	$2, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L6
.L7:
	movq	-16(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcdary, .-gcdary
	.section	.rodata
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-3198976(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3200040(%rbp), %rdx
	leaq	-3200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -3200032(%rbp)
	jmp	.L9
.L10:
	leaq	-3200016(%rbp), %rdx
	movq	-3200032(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -3200032(%rbp)
.L9:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200032(%rbp)
	jl	.L10
	movq	$0, -3200024(%rbp)
	jmp	.L11
.L12:
	movq	-3200040(%rbp), %rax
	movl	%eax, %edx
	movq	-3200024(%rbp), %rax
	movq	-3200016(%rbp,%rax,8), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movslq	%eax, %rdx
	movq	-3200024(%rbp), %rax
	movq	%rdx, -1600016(%rbp,%rax,8)
	addq	$1, -3200024(%rbp)
.L11:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200024(%rbp)
	jl	.L12
	movq	-3200048(%rbp), %rdx
	leaq	-1600016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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	gcd
	.type	gcd, @function
gcd:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$0, -16(%rbp)
	jne	.L2
	movq	-8(%rbp), %rax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	gcd, .-gcd
	.globl	gcdary
	.type	gcdary, @function
gcdary:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	cmpq	$1, -16(%rbp)
	jne	.L5
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	jmp	.L6
.L5:
	cmpq	$2, -16(%rbp)
	jne	.L7
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	jmp	.L6
.L7:
	movq	-16(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$8, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	gcdary, .-gcdary
	.section	.rodata
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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
	leaq	-3198976(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1072, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3200040(%rbp), %rdx
	leaq	-3200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -3200032(%rbp)
	jmp	.L9
.L10:
	leaq	-3200016(%rbp), %rdx
	movq	-3200032(%rbp), %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$1, -3200032(%rbp)
.L9:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200032(%rbp)
	jl	.L10
	movq	$0, -3200024(%rbp)
	jmp	.L11
.L12:
	movq	-3200040(%rbp), %rax
	movl	%eax, %edx
	movq	-3200024(%rbp), %rax
	movq	-3200016(%rbp,%rax,8), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	movslq	%eax, %rdx
	movq	-3200024(%rbp), %rax
	movq	%rdx, -1600016(%rbp,%rax,8)
	addq	$1, -3200024(%rbp)
.L11:
	movq	-3200048(%rbp), %rax
	cmpq	%rax, -3200024(%rbp)
	jl	.L12
	movq	-3200048(%rbp), %rdx
	leaq	-1600016(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcdary
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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:
