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

```c
#include <stdio.h>
#include <stdlib.h>

int compare(const void *n1, const void *n2){
	if(*(int *)n1 > *(int *)n2)
		return 1;
	else if(*(int *)n1 < *(int *)n2)
		return -1;
	else
		return 0;
}

int main(void){
	int min = 1 << 29;
	int n, temp;
	int num[100] = {0};

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d", &num[i]);
	}

	qsort(num, n, sizeof(num[0]), compare);

	if(num[0] == num[n-1]) {
		printf("0");
		return 0;
	}

	for(int i=num[0]; i < num[n-1]; i++) {
		temp = 0;
		for(int j=0; j < n; j++) {
			temp += (i - num[j])*(i - num[j]);
		}
		if(min > temp)
			min = temp;
	}
	printf("%d", min);

	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.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
	movl	$50, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L7
.L6:
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %edx
	leal	-1(%rdi), %ebx
	movslq	%ebx, %rax
	movl	16(%rsp,%rax,4), %r11d
	cmpl	%r11d, %edx
	je	.L8
	jge	.L18
	movl	%edi, %eax
	movl	%edi, %r10d
	movl	$536870912, %r9d
	shrl	$2, %eax
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L16
	cmpl	$2, %ebx
	jbe	.L19
	movd	%edx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L13:
	movdqa	%xmm3, %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L13
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%edi, %r10d
	je	.L16
.L12:
	movslq	%ecx, %r8
	movl	%edx, %r13d
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	leal	1(%rcx), %r8d
	cmpl	%r8d, %edi
	jle	.L16
	movslq	%r8d, %r8
	movl	%edx, %r13d
	addl	$2, %ecx
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	cmpl	%ecx, %edi
	jle	.L16
	movslq	%ecx, %rcx
	movl	%edx, %r8d
	subl	16(%rsp,%rcx,4), %r8d
	movl	%r8d, %ecx
	imull	%r8d, %ecx
	addl	%ecx, %eax
.L16:
	cmpl	%eax, %r9d
	cmovg	%eax, %r9d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L10
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$440, %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
.L19:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L12
.L8:
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L11
.L18:
	movl	$536870912, %r9d
	jmp	.L9
.L23:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.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
	movl	$50, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L7
.L6:
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %edx
	leal	-1(%rdi), %ebx
	movslq	%ebx, %rax
	movl	16(%rsp,%rax,4), %r11d
	cmpl	%r11d, %edx
	je	.L8
	jge	.L18
	movl	%edi, %eax
	movl	%edi, %r10d
	movl	$536870912, %r9d
	shrl	$2, %eax
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L16
	cmpl	$2, %ebx
	jbe	.L19
	movd	%edx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L13:
	movdqa	%xmm3, %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L13
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%edi, %r10d
	je	.L16
.L12:
	movslq	%ecx, %r8
	movl	%edx, %r13d
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	leal	1(%rcx), %r8d
	cmpl	%r8d, %edi
	jle	.L16
	movslq	%r8d, %r8
	movl	%edx, %r13d
	addl	$2, %ecx
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	cmpl	%ecx, %edi
	jle	.L16
	movslq	%ecx, %rcx
	movl	%edx, %r8d
	subl	16(%rsp,%rcx,4), %r8d
	movl	%r8d, %ecx
	imull	%r8d, %ecx
	addl	%ecx, %eax
.L16:
	cmpl	%eax, %r9d
	cmovg	%eax, %r9d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L10
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$440, %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
.L19:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L12
.L8:
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L11
.L18:
	movl	$536870912, %r9d
	jmp	.L9
.L23:
	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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.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
	movl	$50, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L7
.L6:
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %edx
	leal	-1(%rdi), %ebx
	movslq	%ebx, %rax
	movl	16(%rsp,%rax,4), %r11d
	cmpl	%r11d, %edx
	je	.L8
	jge	.L18
	movl	%edi, %eax
	movl	%edi, %r10d
	movl	$536870912, %r9d
	shrl	$2, %eax
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L16
	cmpl	$2, %ebx
	jbe	.L19
	movd	%edx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L13:
	movdqa	%xmm3, %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L13
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%edi, %r10d
	je	.L16
.L12:
	movslq	%ecx, %r8
	movl	%edx, %r13d
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	leal	1(%rcx), %r8d
	cmpl	%r8d, %edi
	jle	.L16
	movslq	%r8d, %r8
	movl	%edx, %r13d
	addl	$2, %ecx
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	cmpl	%ecx, %edi
	jle	.L16
	movslq	%ecx, %rcx
	movl	%edx, %r8d
	subl	16(%rsp,%rcx,4), %r8d
	movl	%r8d, %ecx
	imull	%r8d, %ecx
	addl	%ecx, %eax
.L16:
	cmpl	%eax, %r9d
	cmovg	%eax, %r9d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L10
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$440, %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
.L19:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L12
.L8:
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L11
.L18:
	movl	$536870912, %r9d
	jmp	.L9
.L23:
	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:
```
```c
#include <stdio.h>
#include <stdlib.h>

int compare(const void *n1, const void *n2){
	if(*(int *)n1 > *(int *)n2)
		return 1;
	else if(*(int *)n1 < *(int *)n2)
		return -1;
	else
		return 0;
}

int main(void){
	int min = 1 << 29;
	int n, temp;
	int num[100] = {0};

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d", &num[i]);
	}

	qsort(num, n, sizeof(num[0]), compare);

	if(num[0] == num[n-1]) {
		printf("0");
		return 0;
	}

	for(int i=num[0]; i < num[n-1]; i++) {
		temp = 0;
		for(int j=0; j < n; j++) {
			temp += (i - num[j])*(i - num[j]);
		}
		if(min > temp)
			min = temp;
	}
	printf("%d", min);

	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>

int compare(const void *n1, const void *n2){
	if(*(int *)n1 > *(int *)n2)
		return 1;
	else if(*(int *)n1 < *(int *)n2)
		return -1;
	else
		return 0;
}

int main(void){
	int min = 1 << 29;
	int n, temp;
	int num[100] = {0};

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d", &num[i]);
	}

	qsort(num, n, sizeof(num[0]), compare);

	if(num[0] == num[n-1]) {
		printf("0");
		return 0;
	}

	for(int i=num[0]; i < num[n-1]; i++) {
		temp = 0;
		for(int j=0; j < n; j++) {
			temp += (i - num[j])*(i - num[j]);
		}
		if(min > temp)
			min = temp;
	}
	printf("%d", min);

	return 0;
}
```

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.
Optimized Assembly Code:

2
5 8
 3
1 1 6
 3
4 3 5
 4
-100 -45 -100 -100
 2
5 11
 3
1 1 8
 3
3 3 5
 3
0 1 8
 3
3 0 5
 2
10 6

5 17 2 2269 18 33 3 38 13 8
Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>

int compare(const void *n1, const void *n2){
	if(*(int *)n1 > *(int *)n2)
		return 1;
	else if(*(int *)n1 < *(int *)n2)
		return -1;
	else
		return 0;
}

int main(void){
	int min = 1 << 29;
	int n, temp;
	int num[100] = {0};

	scanf("%d", &n);
	for(int i=0; i < n; i++) {
		scanf("%d", &num[i]);
	}

	qsort(num, n, sizeof(num[0]), compare);

	if(num[0] == num[n-1]) {
		printf("0");
		return 0;
	}

	for(int i=num[0]; i < num[n-1]; i++) {
		temp = 0;
		for(int j=0; j < n; j++) {
			temp += (i - num[j])*(i - num[j]);
		}
		if(min > temp)
			min = temp;
	}
	printf("%d", min);

	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.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
	movl	$50, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L7
.L6:
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %edx
	leal	-1(%rdi), %ebx
	movslq	%ebx, %rax
	movl	16(%rsp,%rax,4), %r11d
	cmpl	%r11d, %edx
	je	.L8
	jge	.L18
	movl	%edi, %eax
	movl	%edi, %r10d
	movl	$536870912, %r9d
	shrl	$2, %eax
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L16
	cmpl	$2, %ebx
	jbe	.L19
	movd	%edx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L13:
	movdqa	%xmm3, %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L13
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%edi, %r10d
	je	.L16
.L12:
	movslq	%ecx, %r8
	movl	%edx, %r13d
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	leal	1(%rcx), %r8d
	cmpl	%r8d, %edi
	jle	.L16
	movslq	%r8d, %r8
	movl	%edx, %r13d
	addl	$2, %ecx
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	cmpl	%ecx, %edi
	jle	.L16
	movslq	%ecx, %rcx
	movl	%edx, %r8d
	subl	16(%rsp,%rcx,4), %r8d
	movl	%r8d, %ecx
	imull	%r8d, %ecx
	addl	%ecx, %eax
.L16:
	cmpl	%eax, %r9d
	cmovg	%eax, %r9d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L10
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$440, %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
.L19:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L12
.L8:
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L11
.L18:
	movl	$536870912, %r9d
	jmp	.L9
.L23:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.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
	movl	$50, %ecx
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L7
.L6:
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbp, %rdi
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movl	12(%rsp), %edi
	movl	16(%rsp), %edx
	leal	-1(%rdi), %ebx
	movslq	%ebx, %rax
	movl	16(%rsp,%rax,4), %r11d
	cmpl	%r11d, %edx
	je	.L8
	jge	.L18
	movl	%edi, %eax
	movl	%edi, %r10d
	movl	$536870912, %r9d
	shrl	$2, %eax
	andl	$-4, %r10d
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	testl	%edi, %edi
	jle	.L16
	cmpl	$2, %ebx
	jbe	.L19
	movd	%edx, %xmm4
	movq	%rbp, %rax
	pxor	%xmm2, %xmm2
	pshufd	$0, %xmm4, %xmm3
	.p2align 4,,10
	.p2align 3
.L13:
	movdqa	%xmm3, %xmm0
	psubd	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pmuludq	%xmm0, %xmm1
	psrlq	$32, %xmm0
	pmuludq	%xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	pshufd	$8, %xmm0, %xmm0
	punpckldq	%xmm0, %xmm1
	paddd	%xmm1, %xmm2
	cmpq	%rsi, %rax
	jne	.L13
	movdqa	%xmm2, %xmm0
	movl	%r10d, %ecx
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movd	%xmm2, %eax
	cmpl	%edi, %r10d
	je	.L16
.L12:
	movslq	%ecx, %r8
	movl	%edx, %r13d
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	leal	1(%rcx), %r8d
	cmpl	%r8d, %edi
	jle	.L16
	movslq	%r8d, %r8
	movl	%edx, %r13d
	addl	$2, %ecx
	subl	16(%rsp,%r8,4), %r13d
	movl	%r13d, %r8d
	imull	%r13d, %r8d
	addl	%r8d, %eax
	cmpl	%ecx, %edi
	jle	.L16
	movslq	%ecx, %rcx
	movl	%edx, %r8d
	subl	16(%rsp,%rcx,4), %r8d
	movl	%r8d, %ecx
	imull	%r8d, %ecx
	addl	%ecx, %eax
.L16:
	cmpl	%eax, %r9d
	cmovg	%eax, %r9d
	addl	$1, %edx
	cmpl	%edx, %r11d
	jne	.L10
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$440, %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
.L19:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L12
.L8:
	movl	$48, %edi
	call	putchar@PLT
	jmp	.L11
.L18:
	movl	$536870912, %r9d
	jmp	.L9
.L23:
	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:
```