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 N;
int d_i[100];

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(){
    int tmp=0,count=0;
    scanf("%d",&N);
    for(int i=0;i<N;i++)
	scanf("%d",&d_i[i]);

    qsort(d_i,N,sizeof(int),cmpnum);

    for(int i=0;i<N;i++){
	if(tmp!=d_i[i]){
	    count++;
	    tmp=d_i[i];
	}
    }

    printf("%d\n",count);
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	d_i
	.align 32
	.type	d_i, @object
	.size	d_i, 400
d_i:
	.zero	400
	.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
	jge	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.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
	subq	$16, %rsp
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	N(%rip), %eax
	cltq
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	d_i(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	je	.L9
	addl	$1, -12(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
.L9:
	addl	$1, -4(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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	cmpnum
	.type	cmpnum, @function
cmpnum:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	leaq	d_i(%rip), %r13
	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
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %rsi
	testl	%esi, %esi
	jle	.L6
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %rsi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L7
.L6:
	movl	$4, %edx
	leaq	cmpnum(%rip), %rcx
	movq	%r13, %rdi
	call	qsort@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L11
	leaq	d_i(%rip), %rax
	leal	-1(%rdx), %ecx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rdx
	leaq	(%rdx,%rcx,4), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ecx
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	setne	%cl
	addq	$4, %rax
	movzbl	%cl, %ecx
	addl	%ecx, %r8d
	cmpq	%rsi, %rax
	jne	.L10
.L8:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L11:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L8
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	d_i
	.bss
	.align 32
	.type	d_i, @object
	.size	d_i, 400
d_i:
	.zero	400
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	leaq	d_i(%rip), %r13
	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
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %rsi
	testl	%esi, %esi
	jle	.L6
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	N(%rip), %rsi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L7
.L6:
	movl	$4, %edx
	leaq	cmpnum(%rip), %rcx
	movq	%r13, %rdi
	call	qsort@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L11
	leaq	d_i(%rip), %rax
	leal	-1(%rdx), %ecx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rdx
	leaq	(%rdx,%rcx,4), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ecx
	movl	(%rax), %edx
	cmpl	%edx, %ecx
	setne	%cl
	addq	$4, %rax
	movzbl	%cl, %ecx
	addl	%ecx, %r8d
	cmpq	%rsi, %rax
	jne	.L10
.L8:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L11:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L8
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	d_i
	.bss
	.align 32
	.type	d_i, @object
	.size	d_i, 400
d_i:
	.zero	400
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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 N;
int d_i[100];

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(){
    int tmp=0,count=0;
    scanf("%d",&N);
    for(int i=0;i<N;i++)
	scanf("%d",&d_i[i]);

    qsort(d_i,N,sizeof(int),cmpnum);

    for(int i=0;i<N;i++){
	if(tmp!=d_i[i]){
	    count++;
	    tmp=d_i[i];
	}
    }

    printf("%d\n",count);
}


7
50
30
50
100
50
80
35
 3
29
15
15
 4
10
8
14
6
 3
29
15
14
 7
50
40
91
110
50
34
59
 7
50
40
91
110
3
34
59
 3
1
1
1
 7
50
30
50
100
50
80
59
 4
10
8
16
6
 7
50
40
50
100
50
80
59

5
 2
 4
 3
 6
 7
 1
 5
 4
 5

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 N;
int d_i[100];

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(){
    int tmp=0,count=0;
    scanf("%d",&N);
    for(int i=0;i<N;i++)
	scanf("%d",&d_i[i]);

    qsort(d_i,N,sizeof(int),cmpnum);

    for(int i=0;i<N;i++){
	if(tmp!=d_i[i]){
	    count++;
	    tmp=d_i[i];
	}
    }

    printf("%d\n",count);
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	d_i
	.align 32
	.type	d_i, @object
	.size	d_i, 400
d_i:
	.zero	400
	.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
	jge	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.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
	subq	$16, %rsp
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	N(%rip), %eax
	cltq
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	d_i(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	je	.L9
	addl	$1, -12(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
.L9:
	addl	$1, -4(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	d_i
	.align 32
	.type	d_i, @object
	.size	d_i, 400
d_i:
	.zero	400
	.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
	jge	.L2
	movl	$-1, %eax
	jmp	.L3
.L2:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.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
	subq	$16, %rsp
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	N(%rip), %eax
	cltq
	leaq	cmpnum(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	d_i(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -4(%rbp)
	jmp	.L8
.L10:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	je	.L9
	addl	$1, -12(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d_i(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
.L9:
	addl	$1, -4(%rbp)
.L8:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L10
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	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:
