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

```c
// abc053d: Card Eater
#include <stdio.h>
#include <stdlib.h>

#define upto(i,s,e,d) for(int i=(s);i<=(e);i+=(d))
#define downto(i,s,e,d) for(int i=(s);i>=(e);i-=(d))
#define in(n) scanf("%d",n)
#define out(d) printf("%d\n",d)

typedef struct {int a,c;} pair;
#define MAX 100000
pair d[MAX+1];

int desc(const void *a, const void *b) {
  int ret = ((pair*)b)->c - ((pair*)a)->c;
  if(ret>0) return 1;
  if(ret<0) return -1;
  return 0;
}

int main(){
  int n;in(&n);
  int dn=1;
  int setnum = 0;
  upto(i,0,n-1,1){
    int a;in(&a);
    if(d[a].c==0) setnum++;
    d[a].a = a;
    d[a].c++;
    if(dn<a)dn=a;
  }

  qsort(d+1,dn,sizeof(pair),desc);

  int cardNum = n;
  int i = 1;
  while(i<=setnum){
    if(d[i].c<2){// c<2
      i++;
      continue;
    }

    if(d[i].c>2){// c>2
      d[i].c-=2;
      cardNum-=2;
      continue;
    }

    if(d[i].c==2){// c=2
      if(i==setnum){//last
        d[i].c-=2;
      }else{
        d[i].c--;
        d[i+1].c--;
      }
      cardNum-=2;
      i++;
    }
  }
  out(cardNum);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.text
	.globl	desc
	.type	desc, @function
desc:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jns	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	desc, .-desc
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L6
.L9:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L7
	addl	$1, -24(%rbp)
.L7:
	movl	-32(%rbp), %edx
	movl	-32(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L8
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L6:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	cltq
	leaq	8+d(%rip), %rdi
	leaq	desc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L10
.L15:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jg	.L11
	addl	$1, -12(%rbp)
	jmp	.L10
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$2, -16(%rbp)
	jmp	.L10
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jne	.L10
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L13
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	subl	$2, -16(%rbp)
	addl	$1, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L15
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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	desc
	.type	desc, @function
desc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	4(%rsi), %edx
	xorl	%eax, %eax
	subl	4(%rdi), %edx
	setne	%al
	negl	%eax
	testl	%edx, %edx
	movl	$1, %edx
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	desc, .-desc
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movl	$1, %r14d
	leaq	4(%rsp), %r12
	leaq	d(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rcx
	movl	4(%rbx,%rcx,8), %edx
	movd	%ecx, %xmm0
	cmpl	$1, %edx
	adcl	$0, %r13d
	addl	$1, %edx
	cmpl	%ecx, %r14d
	movd	%edx, %xmm1
	cmovl	%ecx, %r14d
	addl	$1, %r15d
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	cmpl	%r15d, (%rsp)
	jg	.L8
	movslq	%r14d, %rsi
	leaq	desc(%rip), %rcx
	movl	$8, %edx
	leaq	8+d(%rip), %rdi
	call	qsort@PLT
	movl	(%rsp), %r8d
	testl	%r13d, %r13d
	je	.L10
	movl	$1, %edx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L26:
	subl	$2, %eax
	movl	%eax, 4(%rbx,%rcx,8)
.L12:
	cmpl	%r13d, %edx
	jg	.L10
.L16:
	movslq	%edx, %rcx
	movl	4(%rbx,%rcx,8), %eax
	cmpl	$1, %eax
	jle	.L25
	subl	$2, %r8d
	cmpl	$2, %eax
	jne	.L26
	leal	1(%rdx), %eax
	cmpl	%edx, %r13d
	je	.L27
	movslq	%eax, %rdx
	movl	$1, 4(%rbx,%rcx,8)
	subl	$1, 4(%rbx,%rdx,8)
	movl	%eax, %edx
.L29:
	cmpl	%r13d, %edx
	jle	.L16
.L10:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, 4(%rbx,%rcx,8)
	movl	%eax, %edx
	jmp	.L29
.L6:
	leaq	desc(%rip), %rcx
	movl	$8, %edx
	movl	$1, %esi
	leaq	8+d(%rip), %rdi
	call	qsort@PLT
	movl	(%rsp), %r8d
	jmp	.L10
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.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	desc
	.type	desc, @function
desc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	4(%rsi), %edx
	xorl	%eax, %eax
	subl	4(%rdi), %edx
	setne	%al
	negl	%eax
	testl	%edx, %edx
	movl	$1, %edx
	cmovg	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	desc, .-desc
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	movl	$1, %r14d
	leaq	4(%rsp), %r12
	leaq	d(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rcx
	movl	4(%rbx,%rcx,8), %edx
	movd	%ecx, %xmm0
	cmpl	$1, %edx
	adcl	$0, %r13d
	addl	$1, %edx
	cmpl	%ecx, %r14d
	movd	%edx, %xmm1
	cmovl	%ecx, %r14d
	addl	$1, %r15d
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rbx,%rcx,8)
	cmpl	%r15d, (%rsp)
	jg	.L8
	movslq	%r14d, %rsi
	leaq	desc(%rip), %rcx
	movl	$8, %edx
	leaq	8+d(%rip), %rdi
	call	qsort@PLT
	movl	(%rsp), %r8d
	testl	%r13d, %r13d
	je	.L10
	movl	$1, %edx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L26:
	subl	$2, %eax
	movl	%eax, 4(%rbx,%rcx,8)
.L12:
	cmpl	%r13d, %edx
	jg	.L10
.L16:
	movslq	%edx, %rcx
	movl	4(%rbx,%rcx,8), %eax
	cmpl	$1, %eax
	jle	.L25
	subl	$2, %r8d
	cmpl	$2, %eax
	jne	.L26
	leal	1(%rdx), %eax
	cmpl	%edx, %r13d
	je	.L27
	movslq	%eax, %rdx
	movl	$1, 4(%rbx,%rcx,8)
	subl	$1, 4(%rbx,%rdx,8)
	movl	%eax, %edx
.L29:
	cmpl	%r13d, %edx
	jle	.L16
.L10:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, 4(%rbx,%rcx,8)
	movl	%eax, %edx
	jmp	.L29
.L6:
	leaq	desc(%rip), %rcx
	movl	$8, %edx
	movl	$1, %esi
	leaq	8+d(%rip), %rdi
	call	qsort@PLT
	movl	(%rsp), %r8d
	jmp	.L10
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.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:

// abc053d: Card Eater
#include <stdio.h>
#include <stdlib.h>

#define upto(i,s,e,d) for(int i=(s);i<=(e);i+=(d))
#define downto(i,s,e,d) for(int i=(s);i>=(e);i-=(d))
#define in(n) scanf("%d",n)
#define out(d) printf("%d\n",d)

typedef struct {int a,c;} pair;
#define MAX 100000
pair d[MAX+1];

int desc(const void *a, const void *b) {
  int ret = ((pair*)b)->c - ((pair*)a)->c;
  if(ret>0) return 1;
  if(ret<0) return -1;
  return 0;
}

int main(){
  int n;in(&n);
  int dn=1;
  int setnum = 0;
  upto(i,0,n-1,1){
    int a;in(&a);
    if(d[a].c==0) setnum++;
    d[a].a = a;
    d[a].c++;
    if(dn<a)dn=a;
  }

  qsort(d+1,dn,sizeof(pair),desc);

  int cardNum = n;
  int i = 1;
  while(i<=setnum){
    if(d[i].c<2){// c<2
      i++;
      continue;
    }

    if(d[i].c>2){// c>2
      d[i].c-=2;
      cardNum-=2;
      continue;
    }

    if(d[i].c==2){// c=2
      if(i==setnum){//last
        d[i].c-=2;
      }else{
        d[i].c--;
        d[i+1].c--;
      }
      cardNum-=2;
      i++;
    }
  }
  out(cardNum);

  return 0;
}
5
1 2 0 3 7
 15
1 3 5 2 1 3 2 0 8 6 2 6 11 1 1
 5
2 2 -1 9 16
 15
1 12 6 0 1 2 2 0 8 6 4 6 21 1 3
 15
1 2 9 -1 0 12 1 -1 1 11 -2 4 13 4 3
 5
-4 -4 0 0 0

5
 7
 3
 9
 11
 5

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

```c
// abc053d: Card Eater
#include <stdio.h>
#include <stdlib.h>

#define upto(i,s,e,d) for(int i=(s);i<=(e);i+=(d))
#define downto(i,s,e,d) for(int i=(s);i>=(e);i-=(d))
#define in(n) scanf("%d",n)
#define out(d) printf("%d\n",d)

typedef struct {int a,c;} pair;
#define MAX 100000
pair d[MAX+1];

int desc(const void *a, const void *b) {
  int ret = ((pair*)b)->c - ((pair*)a)->c;
  if(ret>0) return 1;
  if(ret<0) return -1;
  return 0;
}

int main(){
  int n;in(&n);
  int dn=1;
  int setnum = 0;
  upto(i,0,n-1,1){
    int a;in(&a);
    if(d[a].c==0) setnum++;
    d[a].a = a;
    d[a].c++;
    if(dn<a)dn=a;
  }

  qsort(d+1,dn,sizeof(pair),desc);

  int cardNum = n;
  int i = 1;
  while(i<=setnum){
    if(d[i].c<2){// c<2
      i++;
      continue;
    }

    if(d[i].c>2){// c>2
      d[i].c-=2;
      cardNum-=2;
      continue;
    }

    if(d[i].c==2){// c=2
      if(i==setnum){//last
        d[i].c-=2;
      }else{
        d[i].c--;
        d[i+1].c--;
      }
      cardNum-=2;
      i++;
    }
  }
  out(cardNum);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.text
	.globl	desc
	.type	desc, @function
desc:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jns	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	desc, .-desc
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L6
.L9:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L7
	addl	$1, -24(%rbp)
.L7:
	movl	-32(%rbp), %edx
	movl	-32(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L8
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L6:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	cltq
	leaq	8+d(%rip), %rdi
	leaq	desc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L10
.L15:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jg	.L11
	addl	$1, -12(%rbp)
	jmp	.L10
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$2, -16(%rbp)
	jmp	.L10
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jne	.L10
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L13
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	subl	$2, -16(%rbp)
	addl	$1, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L15
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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	d
	.bss
	.align 32
	.type	d, @object
	.size	d, 800008
d:
	.zero	800008
	.text
	.globl	desc
	.type	desc, @function
desc:
.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, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	cmpl	$0, -4(%rbp)
	jns	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	desc, .-desc
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -28(%rbp)
	movl	$0, -24(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L6
.L9:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L7
	addl	$1, -24(%rbp)
.L7:
	movl	-32(%rbp), %edx
	movl	-32(%rbp), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jge	.L8
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L6:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	-28(%rbp), %eax
	cltq
	leaq	8+d(%rip), %rdi
	leaq	desc(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	movl	-36(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L10
.L15:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jg	.L11
	addl	$1, -12(%rbp)
	jmp	.L10
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$2, -16(%rbp)
	jmp	.L10
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$2, %eax
	jne	.L10
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L13
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L14:
	subl	$2, -16(%rbp)
	addl	$1, -12(%rbp)
.L10:
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L15
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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:
