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;
}

int main()
{
int n;
int min;
int diff;
for( ; ; ){
scanf("%d", &n);
if(n==0)break;
int data[n];
for(int i=0; i<n; i++) scanf("%d", &data[i]);
qsort(data, n, sizeof(int), compare_int);
min=data[1]-data[0];
for(int i=2; i<n; i++){
diff=data[i]-data[i-1];
if(min>diff) min=diff;
}
printf("%i\n", min);
}
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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%i\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %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
.L14:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	jmp	.L16
.L4:
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	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
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L9
.L10:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	compare_int(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -88(%rbp)
	movl	$2, -80(%rbp)
	jmp	.L11
.L13:
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-80(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -76(%rbp)
	movl	-88(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L12
	movl	-76(%rbp), %eax
	movl	%eax, -88(%rbp)
.L12:
	addl	$1, -80(%rbp)
.L11:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L13
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L14
.L16:
	call	__stack_chk_fail@PLT
.L15:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%i\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$40, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rax
	movq	%rax, -80(%rbp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	-80(%rbp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rsp, %r14
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edx
	testl	%edx, %edx
	je	.L4
	movslq	%edx, %rsi
	movq	%rsp, %rdi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rcx
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rcx
	cmpq	%rdi, %rsp
	je	.L6
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L31
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L7
	orq	$0, -8(%rsp,%rcx)
.L7:
	leaq	3(%rsp), %r12
	movq	%r12, %rax
	andq	$-4, %r12
	shrq	$2, %rax
	movq	%rax, -72(%rbp)
	testl	%edx, %edx
	jle	.L8
	movq	%r12, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$4, %r13
	cmpl	%r15d, %eax
	jg	.L9
	movslq	%eax, %rsi
.L8:
	leaq	compare_int(%rip), %rcx
	movl	$4, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %rax
	movl	-60(%rbp), %ecx
	movl	4(,%rax,4), %edx
	subl	0(,%rax,4), %edx
	cmpl	$2, %ecx
	jle	.L10
	leal	-3(%rcx), %eax
	leal	-2(%rcx), %edi
	cmpl	$2, %eax
	jbe	.L17
	movd	%edx, %xmm4
	movl	%edi, %edx
	leaq	4(%r12), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	4(%rax), %xmm2
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm2
	movl	%edi, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm1
	leal	2(%rax), %esi
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L10
.L11:
	movslq	%esi, %rax
	leal	-1(%rcx), %r9d
	leal	1(%rsi), %edi
	salq	$2, %rax
	leaq	-4(%r12,%rax), %r11
	cmpl	%r9d, %edi
	jge	.L18
	cmpl	%ecx, %esi
	jge	.L18
	addq	%r12, %rax
	movl	4(%rax), %r10d
	movl	(%rax), %edi
	movl	%r10d, %r8d
	subl	%edi, %r8d
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
	subl	(%r11), %edi
	movl	%edi, %edx
	cmpl	%edi, %r8d
	leal	2(%rsi), %edi
	cmovle	%r8d, %edx
	leal	3(%rsi), %r8d
	cmpl	%r8d, %r9d
	jle	.L14
	movl	8(%rax), %r11d
	movl	12(%rax), %r8d
	movl	%r11d, %edi
	subl	%r10d, %edi
	movl	%r8d, %r10d
	subl	%r11d, %r10d
	cmpl	%r10d, %edi
	cmovg	%r10d, %edi
	leal	5(%rsi), %r10d
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	leal	4(%rsi), %edi
	cmpl	%r10d, %r9d
	jle	.L14
	movl	16(%rax), %edi
	movl	20(%rax), %eax
	subl	%edi, %eax
	subl	%r8d, %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	leal	6(%rsi), %edi
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L14:
	movslq	%edi, %rax
	leaq	(%r12,%rax,4), %rax
	movl	(%rax), %r8d
	movl	%r8d, %esi
	subl	-4(%rax), %esi
	cmpl	%esi, %edx
	cmovg	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L10
	movl	4(%rax), %esi
	movl	%esi, %r9d
	subl	%r8d, %r9d
	cmpl	%r9d, %edx
	cmovg	%r9d, %edx
	addl	$2, %edi
	cmpl	%edi, %ecx
	jle	.L10
	movl	8(%rax), %eax
	subl	%esi, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L10:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsp
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L17:
	.cfi_restore_state
	movl	$2, %esi
	jmp	.L11
.L18:
	movl	%esi, %edi
	jmp	.L14
.L32:
	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	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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%i\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$40, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rax
	movq	%rax, -80(%rbp)
	.p2align 4,,10
	.p2align 3
.L15:
	movq	-80(%rbp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	movq	%rsp, %r14
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edx
	testl	%edx, %edx
	je	.L4
	movslq	%edx, %rsi
	movq	%rsp, %rdi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rcx
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rcx
	cmpq	%rdi, %rsp
	je	.L6
.L31:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L31
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	je	.L7
	orq	$0, -8(%rsp,%rcx)
.L7:
	leaq	3(%rsp), %r12
	movq	%r12, %rax
	andq	$-4, %r12
	shrq	$2, %rax
	movq	%rax, -72(%rbp)
	testl	%edx, %edx
	jle	.L8
	movq	%r12, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	addq	$4, %r13
	cmpl	%r15d, %eax
	jg	.L9
	movslq	%eax, %rsi
.L8:
	leaq	compare_int(%rip), %rcx
	movl	$4, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movq	-72(%rbp), %rax
	movl	-60(%rbp), %ecx
	movl	4(,%rax,4), %edx
	subl	0(,%rax,4), %edx
	cmpl	$2, %ecx
	jle	.L10
	leal	-3(%rcx), %eax
	leal	-2(%rcx), %edi
	cmpl	$2, %eax
	jbe	.L17
	movd	%edx, %xmm4
	movl	%edi, %edx
	leaq	4(%r12), %rax
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm0
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqu	4(%rax), %xmm2
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm2
	movl	%edi, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm1
	leal	2(%rax), %esi
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	cmpl	%edi, %eax
	je	.L10
.L11:
	movslq	%esi, %rax
	leal	-1(%rcx), %r9d
	leal	1(%rsi), %edi
	salq	$2, %rax
	leaq	-4(%r12,%rax), %r11
	cmpl	%r9d, %edi
	jge	.L18
	cmpl	%ecx, %esi
	jge	.L18
	addq	%r12, %rax
	movl	4(%rax), %r10d
	movl	(%rax), %edi
	movl	%r10d, %r8d
	subl	%edi, %r8d
	cmpl	%edx, %r8d
	cmovg	%edx, %r8d
	subl	(%r11), %edi
	movl	%edi, %edx
	cmpl	%edi, %r8d
	leal	2(%rsi), %edi
	cmovle	%r8d, %edx
	leal	3(%rsi), %r8d
	cmpl	%r8d, %r9d
	jle	.L14
	movl	8(%rax), %r11d
	movl	12(%rax), %r8d
	movl	%r11d, %edi
	subl	%r10d, %edi
	movl	%r8d, %r10d
	subl	%r11d, %r10d
	cmpl	%r10d, %edi
	cmovg	%r10d, %edi
	leal	5(%rsi), %r10d
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	leal	4(%rsi), %edi
	cmpl	%r10d, %r9d
	jle	.L14
	movl	16(%rax), %edi
	movl	20(%rax), %eax
	subl	%edi, %eax
	subl	%r8d, %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	leal	6(%rsi), %edi
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L14:
	movslq	%edi, %rax
	leaq	(%r12,%rax,4), %rax
	movl	(%rax), %r8d
	movl	%r8d, %esi
	subl	-4(%rax), %esi
	cmpl	%esi, %edx
	cmovg	%esi, %edx
	leal	1(%rdi), %esi
	cmpl	%esi, %ecx
	jle	.L10
	movl	4(%rax), %esi
	movl	%esi, %r9d
	subl	%r8d, %r9d
	cmpl	%r9d, %edx
	cmovg	%r9d, %edx
	addl	$2, %edi
	cmpl	%edi, %ecx
	jle	.L10
	movl	8(%rax), %eax
	subl	%esi, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
.L10:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsp
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L32
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L17:
	.cfi_restore_state
	movl	$2, %esi
	jmp	.L11
.L18:
	movl	%esi, %edi
	jmp	.L14
.L32:
	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 compare_int(const void *a, const void *b)
{
return *(int*)a - *(int*)b;
}

int main()
{
int n;
int min;
int diff;
for( ; ; ){
scanf("%d", &n);
if(n==0)break;
int data[n];
for(int i=0; i<n; i++) scanf("%d", &data[i]);
qsort(data, n, sizeof(int), compare_int);
min=data[1]-data[0];
for(int i=2; i<n; i++){
diff=data[i]-data[i-1];
if(min>diff) min=diff;
}
printf("%i\n", min);
}
return 0;
}

5
10 10 1 10 10
5
1 5 8 9 11
7
11 34 83 47 59 29 70
0
 5
10 10 1 10 10
5
1 5 8 9 11
7
11 34 83 47 59 29 48
0
 5
10 10 1 10 10
5
1 5 8 5 11
7
11 34 83 47 59 29 48
0
 5
10 10 1 10 10
5
1 5 8 5 11
7
11 34 83 47 54 29 2
0
 5
10 10 10 10 10
5
1 5 8 9 11
7
11 34 83 47 44 29 70
0
 5
10 10 1 10 10
5
1 5 8 5 11
0
11 34 83 47 54 29 2
0
 5
10 10 1 10 10
5
1 5 8 9 8
7
11 34 83 48 59 29 48
0
 5
10 10 10 1 10
5
1 5 8 13 11
7
11 34 83 47 44 29 70
0
 5
10 -1 1 10 10
5
1 5 8 9 11
7
11 34 83 47 59 29 85
0
 5
10 10 10 1 10
5
1 5 8 13 11
0
11 34 83 47 44 50 70
0

0
1
5
 0
1
1
 0
0
1
 0
0
5
 0
1
3
 0
0
 0
0
0
 0
2
3
 0
1
2
 0
2

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;
}

int main()
{
int n;
int min;
int diff;
for( ; ; ){
scanf("%d", &n);
if(n==0)break;
int data[n];
for(int i=0; i<n; i++) scanf("%d", &data[i]);
qsort(data, n, sizeof(int), compare_int);
min=data[1]-data[0];
for(int i=2; i<n; i++){
diff=data[i]-data[i-1];
if(min>diff) min=diff;
}
printf("%i\n", min);
}
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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%i\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %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
.L14:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	jmp	.L16
.L4:
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	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
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L9
.L10:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	compare_int(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -88(%rbp)
	movl	$2, -80(%rbp)
	jmp	.L11
.L13:
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-80(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -76(%rbp)
	movl	-88(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L12
	movl	-76(%rbp), %eax
	movl	%eax, -88(%rbp)
.L12:
	addl	$1, -80(%rbp)
.L11:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L13
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L14
.L16:
	call	__stack_chk_fail@PLT
.L15:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%i\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %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
.L14:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L4
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	jmp	.L16
.L4:
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	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
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L9
.L10:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	compare_int(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movq	-64(%rbp), %rax
	movl	4(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -88(%rbp)
	movl	$2, -80(%rbp)
	jmp	.L11
.L13:
	movq	-64(%rbp), %rax
	movl	-80(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-80(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -76(%rbp)
	movl	-88(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L12
	movl	-76(%rbp), %eax
	movl	%eax, -88(%rbp)
.L12:
	addl	$1, -80(%rbp)
.L11:
	movl	-92(%rbp), %eax
	cmpl	%eax, -80(%rbp)
	jl	.L13
	movl	-88(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L14
.L16:
	call	__stack_chk_fail@PLT
.L15:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
