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 cmpnum(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 n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  qsort(a, n, sizeof(int), cmpnum);
  int size = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i-1]) {
      size++;
    }
  }
  int number_list[size][2];
  int list_number = 0;
  int number = a[0];
  int count = 0;
  for (int i = 0; i < n-1; i++) {
    count++;
    if (a[i] != a[i+1]) {
      number_list[list_number][0] = number;
      number_list[list_number][1] = count;
      list_number++;
      number = a[i+1];
      count = 0;
    }
  }
  count++;
  number_list[list_number][0] = number;
  number_list[list_number][1] = count;

  int max = number_list[0][1];
  if (number_list[1][0] == number_list[0][0]+1) {
    max += number_list[1][1];
  }
  for (int i = 1; i < size-1; i++) {
    count = number_list[i][1];
    if (number_list[i][0] == number_list[i-1][0]+1) {
      count += number_list[i-1][1];
    }
    if (number_list[i][0] == number_list[i+1][0]-1) {
      count += number_list[i+1][1];
    }
    if (count > max) {
      max = count;
    }
  }
  count = number_list[size-1][1];
  if (number_list[size-1][0] == number_list[size-2][0]+1) {
    count += number_list[size-2][1];
  }
  if (count > max) {
    max = count;
  }
  printf("%d\n", max);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmpnum
	.type	cmpnum, @function
cmpnum:
.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), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmpnum, .-cmpnum
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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	$120, %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	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	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, -80(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L9
.L10:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L9:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	movl	-128(%rbp), %eax
	movslq	%eax, %rsi
	movq	-80(%rbp), %rax
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L11
.L13:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L12
	addl	$1, -120(%rbp)
.L12:
	addl	$1, -116(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L13
	movl	-120(%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,8), %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
.L14:
	cmpq	%rdx, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L15:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L16
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L16:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -112(%rbp)
	movq	-80(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L17
.L19:
	addl	$1, -104(%rbp)
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L18
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	addl	$1, -112(%rbp)
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
.L18:
	addl	$1, -100(%rbp)
.L17:
	movl	-128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L19
	addl	$1, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jne	.L20
	movq	-64(%rbp), %rax
	movl	12(%rax), %eax
	addl	%eax, -96(%rbp)
.L20:
	movl	$1, -92(%rbp)
	jmp	.L21
.L25:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L22:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	subl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L23
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L23:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L24
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L24:
	addl	$1, -92(%rbp)
.L21:
	movl	-120(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L25
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L26
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L26:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L27
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L27:
	movl	-96(%rbp), %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	.L29
	call	__stack_chk_fail@PLT
.L29:
	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	cmpnum
	.type	cmpnum, @function
cmpnum:
.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	cmpnum, .-cmpnum
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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
	.cfi_offset 15, -24
	leaq	.LC0(%rip), %r15
	pushq	%r14
	leaq	-68(%rbp), %rsi
	movq	%r15, %rdi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.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
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rsi
	movq	%rsp, %rdi
	leaq	15(,%rsi,4), %rdx
	movq	%rsi, %rax
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rdi
	andq	$-16, %rcx
	cmpq	%rdi, %rsp
	je	.L7
.L70:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L70
.L7:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L71
.L8:
	leaq	3(%rsp), %r12
	movq	%r12, %r14
	andq	$-4, %r12
	shrq	$2, %r14
	testl	%eax, %eax
	jle	.L9
	movq	%r12, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-68(%rbp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L10
	movslq	%eax, %rsi
.L9:
	leaq	cmpnum(%rip), %rcx
	movl	$4, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movl	-68(%rbp), %ecx
	cmpl	$1, %ecx
	jle	.L11
	leal	-2(%rcx), %eax
	leal	-1(%rcx), %r9d
	cmpl	$2, %eax
	jbe	.L46
	movl	%r9d, %edx
	pxor	%xmm1, %xmm1
	movq	%r12, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	4(%rax), %xmm0
	movdqu	(%rax), %xmm4
	addq	$16, %rax
	pcmpeqd	%xmm4, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L13
	movdqa	%xmm1, %xmm0
	movl	%r9d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	leal	1(%rax), %edx
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %esi
	addl	$1, %esi
	cmpl	%eax, %r9d
	je	.L14
.L12:
	movslq	%edx, %rax
	leal	1(%rdx), %edi
	movq	%rax, %r8
	leaq	-4(%r12,%rax,4), %r10
	cmpl	%r9d, %edi
	jge	.L15
	cmpl	%edx, %ecx
	jle	.L15
	movl	(%r10), %edi
.L18:
	movl	(%r12,%rax,4), %edx
	cmpl	%edi, %edx
	je	.L17
	addl	$1, %esi
.L17:
	movl	4(%r12,%rax,4), %edi
	cmpl	%edi, %edx
	je	.L23
	addl	$1, %esi
.L23:
	leal	2(%rax), %edx
	addq	$2, %rax
	leal	1(%rax), %r8d
	cmpl	%r8d, %r9d
	jg	.L18
	movslq	%edx, %r8
	leal	1(%rdx), %edi
.L15:
	leaq	(%r12,%r8,4), %rax
	movl	(%rax), %r8d
	cmpl	%r8d, -4(%rax)
	je	.L19
	addl	$1, %esi
.L19:
	cmpl	%edi, %ecx
	jle	.L14
	movl	4(%rax), %edi
	cmpl	%edi, %r8d
	je	.L20
	addl	$1, %esi
.L20:
	addl	$2, %edx
	cmpl	%edx, %ecx
	jle	.L14
	cmpl	%edi, 8(%rax)
	je	.L14
	addl	$1, %esi
.L14:
	movslq	%esi, %rax
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L43
.L72:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L72
.L43:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L73
.L44:
	movd	0(,%r14,4), %xmm0
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	movq	%rsp, %rbx
	movq	%rbx, %r10
	movd	%xmm0, %r11d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	%edi, %rcx
	addq	$1, %rax
	movd	%edx, %xmm0
	addl	$1, %edi
	movq	%xmm1, (%rbx,%rcx,8)
	cmpl	%eax, %r9d
	jle	.L48
	xorl	%ecx, %ecx
.L26:
	movl	%edx, %r11d
.L27:
	leal	1(%rcx), %r8d
	movl	4(%r12,%rax,4), %edx
	movdqa	%xmm0, %xmm1
	movd	%r8d, %xmm3
	punpckldq	%xmm3, %xmm1
	cmpl	%r11d, %edx
	jne	.L25
	addq	$1, %rax
	addl	$2, %ecx
	cmpl	%eax, %r9d
	jle	.L24
	movl	%r8d, %ecx
	jmp	.L26
.L48:
	movl	$1, %ecx
.L24:
	movd	%ecx, %xmm5
	movslq	%edi, %rdi
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%r10,%rdi,8)
	movl	(%r10), %eax
	movl	8(%r10), %ecx
	movl	4(%r10), %edi
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L28
	addl	12(%r10), %edi
.L28:
	leal	-1(%rsi), %r11d
	cmpl	$1, %r11d
	jle	.L29
	cmpl	$4, %esi
	jle	.L49
	leal	-5(%rsi), %r8d
	leaq	4(%r10), %r9
	movl	$1, %ebx
	andl	$-2, %r8d
	addl	$3, %r8d
	jmp	.L36
.L34:
	cmpl	%edx, %r12d
	cmovl	%edx, %r12d
	cmpl	%r12d, %edi
	cmovl	%r12d, %edi
	addq	$16, %r9
	cmpl	%r8d, %ebx
	je	.L30
.L35:
	addl	$1, %eax
.L36:
	movl	8(%r9), %edx
	movl	%edx, %r12d
	cmpl	%ecx, %eax
	jne	.L31
	addl	(%r9), %r12d
.L31:
	movl	12(%r9), %eax
	leal	-1(%rax), %r13d
	cmpl	%ecx, %r13d
	movl	16(%r9), %r13d
	jne	.L32
	addl	%r13d, %r12d
.L32:
	addl	$1, %ecx
	addl	%r13d, %edx
	cmpl	%ecx, %eax
	movl	20(%r9), %ecx
	cmovne	%r13d, %edx
	addl	$2, %ebx
	leal	-1(%rcx), %r13d
	cmpl	%r13d, %eax
	jne	.L34
	addl	24(%r9), %edx
	cmpl	%r12d, %edx
	cmovl	%r12d, %edx
	cmpl	%edx, %edi
	cmovl	%edx, %edi
	addq	$16, %r9
	cmpl	%r8d, %ebx
	jne	.L35
.L30:
	movslq	%r8d, %rax
	leaq	(%r10,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L40:
	movl	-8(%rax), %ebx
	movl	(%rax), %r9d
	movl	4(%rax), %edx
	leal	1(%rbx), %ecx
	cmpl	%ecx, %r9d
	jne	.L37
	addl	-4(%rax), %edx
.L37:
	movl	8(%rax), %ebx
	addl	$1, %r8d
	leal	-1(%rbx), %ecx
	cmpl	%ecx, %r9d
	jne	.L38
	addl	12(%rax), %edx
.L38:
	cmpl	%edx, %edi
	cmovl	%edx, %edi
	addq	$8, %rax
	cmpl	%r8d, %r11d
	jg	.L40
.L29:
	subl	$2, %esi
	movslq	%r11d, %r11
	movslq	%esi, %rsi
	movl	4(%r10,%r11,8), %edx
	movl	(%r10,%rsi,8), %eax
	addl	$1, %eax
	cmpl	%eax, (%r10,%r11,8)
	jne	.L41
	addl	4(%r10,%rsi,8), %edx
.L41:
	cmpl	%edi, %edx
	leaq	.LC1(%rip), %rsi
	cmovl	%edi, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L74
	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
.L71:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rcx)
	jmp	.L8
.L73:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L44
.L11:
	movl	$1, %ecx
	movl	$1, %esi
	leaq	-64(%rbp), %r10
	xorl	%edi, %edi
	movd	0(,%r14,4), %xmm0
	jmp	.L24
.L46:
	movl	$1, %edx
	movl	$1, %esi
	jmp	.L12
.L49:
	movl	$1, %r8d
	jmp	.L30
.L74:
	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	cmpnum
	.type	cmpnum, @function
cmpnum:
.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	cmpnum, .-cmpnum
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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
	.cfi_offset 15, -24
	leaq	.LC0(%rip), %r15
	pushq	%r14
	leaq	-68(%rbp), %rsi
	movq	%r15, %rdi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.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
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rsi
	movq	%rsp, %rdi
	leaq	15(,%rsi,4), %rdx
	movq	%rsi, %rax
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rdi
	andq	$-16, %rcx
	cmpq	%rdi, %rsp
	je	.L7
.L70:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L70
.L7:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L71
.L8:
	leaq	3(%rsp), %r12
	movq	%r12, %r14
	andq	$-4, %r12
	shrq	$2, %r14
	testl	%eax, %eax
	jle	.L9
	movq	%r12, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-68(%rbp), %eax
	addq	$4, %r13
	cmpl	%ebx, %eax
	jg	.L10
	movslq	%eax, %rsi
.L9:
	leaq	cmpnum(%rip), %rcx
	movl	$4, %edx
	movq	%r12, %rdi
	call	qsort@PLT
	movl	-68(%rbp), %ecx
	cmpl	$1, %ecx
	jle	.L11
	leal	-2(%rcx), %eax
	leal	-1(%rcx), %r9d
	cmpl	$2, %eax
	jbe	.L46
	movl	%r9d, %edx
	pxor	%xmm1, %xmm1
	movq	%r12, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	4(%rax), %xmm0
	movdqu	(%rax), %xmm4
	addq	$16, %rax
	pcmpeqd	%xmm4, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L13
	movdqa	%xmm1, %xmm0
	movl	%r9d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	leal	1(%rax), %edx
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %esi
	addl	$1, %esi
	cmpl	%eax, %r9d
	je	.L14
.L12:
	movslq	%edx, %rax
	leal	1(%rdx), %edi
	movq	%rax, %r8
	leaq	-4(%r12,%rax,4), %r10
	cmpl	%r9d, %edi
	jge	.L15
	cmpl	%edx, %ecx
	jle	.L15
	movl	(%r10), %edi
.L18:
	movl	(%r12,%rax,4), %edx
	cmpl	%edi, %edx
	je	.L17
	addl	$1, %esi
.L17:
	movl	4(%r12,%rax,4), %edi
	cmpl	%edi, %edx
	je	.L23
	addl	$1, %esi
.L23:
	leal	2(%rax), %edx
	addq	$2, %rax
	leal	1(%rax), %r8d
	cmpl	%r8d, %r9d
	jg	.L18
	movslq	%edx, %r8
	leal	1(%rdx), %edi
.L15:
	leaq	(%r12,%r8,4), %rax
	movl	(%rax), %r8d
	cmpl	%r8d, -4(%rax)
	je	.L19
	addl	$1, %esi
.L19:
	cmpl	%edi, %ecx
	jle	.L14
	movl	4(%rax), %edi
	cmpl	%edi, %r8d
	je	.L20
	addl	$1, %esi
.L20:
	addl	$2, %edx
	cmpl	%edx, %ecx
	jle	.L14
	cmpl	%edi, 8(%rax)
	je	.L14
	addl	$1, %esi
.L14:
	movslq	%esi, %rax
	movq	%rsp, %rcx
	leaq	15(,%rax,8), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L43
.L72:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L72
.L43:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L73
.L44:
	movd	0(,%r14,4), %xmm0
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	movq	%rsp, %rbx
	movq	%rbx, %r10
	movd	%xmm0, %r11d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	%edi, %rcx
	addq	$1, %rax
	movd	%edx, %xmm0
	addl	$1, %edi
	movq	%xmm1, (%rbx,%rcx,8)
	cmpl	%eax, %r9d
	jle	.L48
	xorl	%ecx, %ecx
.L26:
	movl	%edx, %r11d
.L27:
	leal	1(%rcx), %r8d
	movl	4(%r12,%rax,4), %edx
	movdqa	%xmm0, %xmm1
	movd	%r8d, %xmm3
	punpckldq	%xmm3, %xmm1
	cmpl	%r11d, %edx
	jne	.L25
	addq	$1, %rax
	addl	$2, %ecx
	cmpl	%eax, %r9d
	jle	.L24
	movl	%r8d, %ecx
	jmp	.L26
.L48:
	movl	$1, %ecx
.L24:
	movd	%ecx, %xmm5
	movslq	%edi, %rdi
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%r10,%rdi,8)
	movl	(%r10), %eax
	movl	8(%r10), %ecx
	movl	4(%r10), %edi
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L28
	addl	12(%r10), %edi
.L28:
	leal	-1(%rsi), %r11d
	cmpl	$1, %r11d
	jle	.L29
	cmpl	$4, %esi
	jle	.L49
	leal	-5(%rsi), %r8d
	leaq	4(%r10), %r9
	movl	$1, %ebx
	andl	$-2, %r8d
	addl	$3, %r8d
	jmp	.L36
.L34:
	cmpl	%edx, %r12d
	cmovl	%edx, %r12d
	cmpl	%r12d, %edi
	cmovl	%r12d, %edi
	addq	$16, %r9
	cmpl	%r8d, %ebx
	je	.L30
.L35:
	addl	$1, %eax
.L36:
	movl	8(%r9), %edx
	movl	%edx, %r12d
	cmpl	%ecx, %eax
	jne	.L31
	addl	(%r9), %r12d
.L31:
	movl	12(%r9), %eax
	leal	-1(%rax), %r13d
	cmpl	%ecx, %r13d
	movl	16(%r9), %r13d
	jne	.L32
	addl	%r13d, %r12d
.L32:
	addl	$1, %ecx
	addl	%r13d, %edx
	cmpl	%ecx, %eax
	movl	20(%r9), %ecx
	cmovne	%r13d, %edx
	addl	$2, %ebx
	leal	-1(%rcx), %r13d
	cmpl	%r13d, %eax
	jne	.L34
	addl	24(%r9), %edx
	cmpl	%r12d, %edx
	cmovl	%r12d, %edx
	cmpl	%edx, %edi
	cmovl	%edx, %edi
	addq	$16, %r9
	cmpl	%r8d, %ebx
	jne	.L35
.L30:
	movslq	%r8d, %rax
	leaq	(%r10,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L40:
	movl	-8(%rax), %ebx
	movl	(%rax), %r9d
	movl	4(%rax), %edx
	leal	1(%rbx), %ecx
	cmpl	%ecx, %r9d
	jne	.L37
	addl	-4(%rax), %edx
.L37:
	movl	8(%rax), %ebx
	addl	$1, %r8d
	leal	-1(%rbx), %ecx
	cmpl	%ecx, %r9d
	jne	.L38
	addl	12(%rax), %edx
.L38:
	cmpl	%edx, %edi
	cmovl	%edx, %edi
	addq	$8, %rax
	cmpl	%r8d, %r11d
	jg	.L40
.L29:
	subl	$2, %esi
	movslq	%r11d, %r11
	movslq	%esi, %rsi
	movl	4(%r10,%r11,8), %edx
	movl	(%r10,%rsi,8), %eax
	addl	$1, %eax
	cmpl	%eax, (%r10,%r11,8)
	jne	.L41
	addl	4(%r10,%rsi,8), %edx
.L41:
	cmpl	%edi, %edx
	leaq	.LC1(%rip), %rsi
	cmovl	%edi, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L74
	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
.L71:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rcx)
	jmp	.L8
.L73:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L44
.L11:
	movl	$1, %ecx
	movl	$1, %esi
	leaq	-64(%rbp), %r10
	xorl	%edi, %edi
	movd	0(,%r14,4), %xmm0
	jmp	.L24
.L46:
	movl	$1, %edx
	movl	$1, %esi
	jmp	.L12
.L49:
	movl	$1, %r8d
	jmp	.L30
.L74:
	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 cmpnum(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 n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  qsort(a, n, sizeof(int), cmpnum);
  int size = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i-1]) {
      size++;
    }
  }
  int number_list[size][2];
  int list_number = 0;
  int number = a[0];
  int count = 0;
  for (int i = 0; i < n-1; i++) {
    count++;
    if (a[i] != a[i+1]) {
      number_list[list_number][0] = number;
      number_list[list_number][1] = count;
      list_number++;
      number = a[i+1];
      count = 0;
    }
  }
  count++;
  number_list[list_number][0] = number;
  number_list[list_number][1] = count;

  int max = number_list[0][1];
  if (number_list[1][0] == number_list[0][0]+1) {
    max += number_list[1][1];
  }
  for (int i = 1; i < size-1; i++) {
    count = number_list[i][1];
    if (number_list[i][0] == number_list[i-1][0]+1) {
      count += number_list[i-1][1];
    }
    if (number_list[i][0] == number_list[i+1][0]-1) {
      count += number_list[i+1][1];
    }
    if (count > max) {
      max = count;
    }
  }
  count = number_list[size-1][1];
  if (number_list[size-1][0] == number_list[size-2][0]+1) {
    count += number_list[size-2][1];
  }
  if (count > max) {
    max = count;
  }
  printf("%d\n", max);

  return 0;
}
7
3 1 4 1 5 9 2

4

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 cmpnum(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 n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  qsort(a, n, sizeof(int), cmpnum);
  int size = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i-1]) {
      size++;
    }
  }
  int number_list[size][2];
  int list_number = 0;
  int number = a[0];
  int count = 0;
  for (int i = 0; i < n-1; i++) {
    count++;
    if (a[i] != a[i+1]) {
      number_list[list_number][0] = number;
      number_list[list_number][1] = count;
      list_number++;
      number = a[i+1];
      count = 0;
    }
  }
  count++;
  number_list[list_number][0] = number;
  number_list[list_number][1] = count;

  int max = number_list[0][1];
  if (number_list[1][0] == number_list[0][0]+1) {
    max += number_list[1][1];
  }
  for (int i = 1; i < size-1; i++) {
    count = number_list[i][1];
    if (number_list[i][0] == number_list[i-1][0]+1) {
      count += number_list[i-1][1];
    }
    if (number_list[i][0] == number_list[i+1][0]-1) {
      count += number_list[i+1][1];
    }
    if (count > max) {
      max = count;
    }
  }
  count = number_list[size-1][1];
  if (number_list[size-1][0] == number_list[size-2][0]+1) {
    count += number_list[size-2][1];
  }
  if (count > max) {
    max = count;
  }
  printf("%d\n", max);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmpnum
	.type	cmpnum, @function
cmpnum:
.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), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmpnum, .-cmpnum
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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	$120, %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	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	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, -80(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L9
.L10:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L9:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	movl	-128(%rbp), %eax
	movslq	%eax, %rsi
	movq	-80(%rbp), %rax
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L11
.L13:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L12
	addl	$1, -120(%rbp)
.L12:
	addl	$1, -116(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L13
	movl	-120(%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,8), %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
.L14:
	cmpq	%rdx, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L15:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L16
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L16:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -112(%rbp)
	movq	-80(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L17
.L19:
	addl	$1, -104(%rbp)
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L18
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	addl	$1, -112(%rbp)
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
.L18:
	addl	$1, -100(%rbp)
.L17:
	movl	-128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L19
	addl	$1, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jne	.L20
	movq	-64(%rbp), %rax
	movl	12(%rax), %eax
	addl	%eax, -96(%rbp)
.L20:
	movl	$1, -92(%rbp)
	jmp	.L21
.L25:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L22:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	subl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L23
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L23:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L24
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L24:
	addl	$1, -92(%rbp)
.L21:
	movl	-120(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L25
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L26
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L26:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L27
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L27:
	movl	-96(%rbp), %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	.L29
	call	__stack_chk_fail@PLT
.L29:
	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	cmpnum
	.type	cmpnum, @function
cmpnum:
.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), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmpnum, .-cmpnum
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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	$120, %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	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	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, -80(%rbp)
	movl	$0, -124(%rbp)
	jmp	.L9
.L10:
	movl	-124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -124(%rbp)
.L9:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	movl	-128(%rbp), %eax
	movslq	%eax, %rsi
	movq	-80(%rbp), %rax
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L11
.L13:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-116(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L12
	addl	$1, -120(%rbp)
.L12:
	addl	$1, -116(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L13
	movl	-120(%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,8), %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
.L14:
	cmpq	%rdx, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L15:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L16
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L16:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -112(%rbp)
	movq	-80(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	jmp	.L17
.L19:
	addl	$1, -104(%rbp)
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L18
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	addl	$1, -112(%rbp)
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -108(%rbp)
	movl	$0, -104(%rbp)
.L18:
	addl	$1, -100(%rbp)
.L17:
	movl	-128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -100(%rbp)
	jl	.L19
	addl	$1, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-108(%rbp), %ecx
	movl	%ecx, (%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movl	-104(%rbp), %ecx
	movl	%ecx, 4(%rax,%rdx,8)
	movq	-64(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	-64(%rbp), %rax
	movl	8(%rax), %edx
	movq	-64(%rbp), %rax
	movl	(%rax), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jne	.L20
	movq	-64(%rbp), %rax
	movl	12(%rax), %eax
	addl	%eax, -96(%rbp)
.L20:
	movl	$1, -92(%rbp)
	jmp	.L21
.L25:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L22
	movl	-92(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L22:
	movq	-64(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	subl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L23
	movl	-92(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L23:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L24
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L24:
	addl	$1, -92(%rbp)
.L21:
	movl	-120(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -92(%rbp)
	jl	.L25
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, -104(%rbp)
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %ecx
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	$1, %eax
	cmpl	%eax, %ecx
	jne	.L26
	movl	-120(%rbp), %eax
	leal	-2(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, -104(%rbp)
.L26:
	movl	-104(%rbp), %eax
	cmpl	-96(%rbp), %eax
	jle	.L27
	movl	-104(%rbp), %eax
	movl	%eax, -96(%rbp)
.L27:
	movl	-96(%rbp), %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	.L29
	call	__stack_chk_fail@PLT
.L29:
	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:
