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>

int main() {

	int N;
	int d[105];

  	scanf("%d", &N);
  
	for(int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	
	
	// 降順に並べ替える
	for(int i = 0; i < N; i++) {
		for(int j = i + 1; j < N; j++) {
			
           if(d[j] == d[i]) {
             d[i] = 0;
           }
         	
          	if(d[j] > d[i]) {
				int tmp;
				tmp = d[i];
				d[i] = d[j];
				d[j] = tmp;
			}
		}
	
	}
	
   int count = 0;
	for(int i = 0; i < N; i++) { 
		if(d[i] == 0) {
          break;
        }
        count ++;
	}
	
   printf("%d", count);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-460(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -456(%rbp)
	jmp	.L2
.L3:
	leaq	-432(%rbp), %rdx
	movl	-456(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -456(%rbp)
.L2:
	movl	-460(%rbp), %eax
	cmpl	%eax, -456(%rbp)
	jl	.L3
	movl	$0, -452(%rbp)
	jmp	.L4
.L9:
	movl	-452(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -448(%rbp)
	jmp	.L5
.L8:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-452(%rbp), %eax
	cltq
	movl	$0, -432(%rbp,%rax,4)
.L6:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	movl	%eax, -436(%rbp)
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	%edx, -432(%rbp,%rax,4)
	movl	-448(%rbp), %eax
	cltq
	movl	-436(%rbp), %edx
	movl	%edx, -432(%rbp,%rax,4)
.L7:
	addl	$1, -448(%rbp)
.L5:
	movl	-460(%rbp), %eax
	cmpl	%eax, -448(%rbp)
	jl	.L8
	addl	$1, -452(%rbp)
.L4:
	movl	-460(%rbp), %eax
	cmpl	%eax, -452(%rbp)
	jl	.L9
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L10
.L13:
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	addl	$1, -444(%rbp)
	addl	$1, -440(%rbp)
.L10:
	movl	-460(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
	jmp	.L12
.L16:
	nop
.L12:
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$456, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r12
	cmpl	%ebp, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	cmpl	$1, %r8d
	je	.L4
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r9d, %esi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rax), %ecx
	movl	-4(%rdi), %edx
	cmpl	%edx, %ecx
	jne	.L6
	movl	$0, -4(%rdi)
	movl	(%rax), %ecx
	xorl	%edx, %edx
.L6:
	cmpl	%ecx, %edx
	jge	.L7
	movl	%ecx, -4(%rdi)
	movl	%edx, (%rax)
.L7:
	addl	$1, %esi
	addq	$4, %rax
	cmpl	%esi, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	xorl	%edx, %edx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %edx
	addq	$4, %rbx
	cmpl	%edx, %r8d
	je	.L10
.L11:
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	.L23
.L10:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$456, %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
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L10
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$456, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %r12
	cmpl	%ebp, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	cmpl	$1, %r8d
	je	.L4
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdi, %rax
	movl	%r9d, %esi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rax), %ecx
	movl	-4(%rdi), %edx
	cmpl	%edx, %ecx
	jne	.L6
	movl	$0, -4(%rdi)
	movl	(%rax), %ecx
	xorl	%edx, %edx
.L6:
	cmpl	%ecx, %edx
	jge	.L7
	movl	%ecx, -4(%rdi)
	movl	%edx, (%rax)
.L7:
	addl	$1, %esi
	addq	$4, %rax
	cmpl	%esi, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	xorl	%edx, %edx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %edx
	addq	$4, %rbx
	cmpl	%edx, %r8d
	je	.L10
.L11:
	movl	(%rbx), %eax
	testl	%eax, %eax
	jne	.L23
.L10:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$456, %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
.L2:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L10
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main() {

	int N;
	int d[105];

  	scanf("%d", &N);
  
	for(int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	
	
	// 降順に並べ替える
	for(int i = 0; i < N; i++) {
		for(int j = i + 1; j < N; j++) {
			
           if(d[j] == d[i]) {
             d[i] = 0;
           }
         	
          	if(d[j] > d[i]) {
				int tmp;
				tmp = d[i];
				d[i] = d[j];
				d[j] = tmp;
			}
		}
	
	}
	
   int count = 0;
	for(int i = 0; i < N; i++) { 
		if(d[i] == 0) {
          break;
        }
        count ++;
	}
	
   printf("%d", 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>

int main() {

	int N;
	int d[105];

  	scanf("%d", &N);
  
	for(int i = 0; i < N; i++) {
		scanf("%d", &d[i]);
	}
	
	
	// 降順に並べ替える
	for(int i = 0; i < N; i++) {
		for(int j = i + 1; j < N; j++) {
			
           if(d[j] == d[i]) {
             d[i] = 0;
           }
         	
          	if(d[j] > d[i]) {
				int tmp;
				tmp = d[i];
				d[i] = d[j];
				d[j] = tmp;
			}
		}
	
	}
	
   int count = 0;
	for(int i = 0; i < N; i++) { 
		if(d[i] == 0) {
          break;
        }
        count ++;
	}
	
   printf("%d", count);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-460(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -456(%rbp)
	jmp	.L2
.L3:
	leaq	-432(%rbp), %rdx
	movl	-456(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -456(%rbp)
.L2:
	movl	-460(%rbp), %eax
	cmpl	%eax, -456(%rbp)
	jl	.L3
	movl	$0, -452(%rbp)
	jmp	.L4
.L9:
	movl	-452(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -448(%rbp)
	jmp	.L5
.L8:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-452(%rbp), %eax
	cltq
	movl	$0, -432(%rbp,%rax,4)
.L6:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	movl	%eax, -436(%rbp)
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	%edx, -432(%rbp,%rax,4)
	movl	-448(%rbp), %eax
	cltq
	movl	-436(%rbp), %edx
	movl	%edx, -432(%rbp,%rax,4)
.L7:
	addl	$1, -448(%rbp)
.L5:
	movl	-460(%rbp), %eax
	cmpl	%eax, -448(%rbp)
	jl	.L8
	addl	$1, -452(%rbp)
.L4:
	movl	-460(%rbp), %eax
	cmpl	%eax, -452(%rbp)
	jl	.L9
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L10
.L13:
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	addl	$1, -444(%rbp)
	addl	$1, -440(%rbp)
.L10:
	movl	-460(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
	jmp	.L12
.L16:
	nop
.L12:
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-460(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -456(%rbp)
	jmp	.L2
.L3:
	leaq	-432(%rbp), %rdx
	movl	-456(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -456(%rbp)
.L2:
	movl	-460(%rbp), %eax
	cmpl	%eax, -456(%rbp)
	jl	.L3
	movl	$0, -452(%rbp)
	jmp	.L4
.L9:
	movl	-452(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -448(%rbp)
	jmp	.L5
.L8:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-452(%rbp), %eax
	cltq
	movl	$0, -432(%rbp,%rax,4)
.L6:
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-452(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	movl	%eax, -436(%rbp)
	movl	-448(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %edx
	movl	-452(%rbp), %eax
	cltq
	movl	%edx, -432(%rbp,%rax,4)
	movl	-448(%rbp), %eax
	cltq
	movl	-436(%rbp), %edx
	movl	%edx, -432(%rbp,%rax,4)
.L7:
	addl	$1, -448(%rbp)
.L5:
	movl	-460(%rbp), %eax
	cmpl	%eax, -448(%rbp)
	jl	.L8
	addl	$1, -452(%rbp)
.L4:
	movl	-460(%rbp), %eax
	cmpl	%eax, -452(%rbp)
	jl	.L9
	movl	$0, -444(%rbp)
	movl	$0, -440(%rbp)
	jmp	.L10
.L13:
	movl	-440(%rbp), %eax
	cltq
	movl	-432(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L16
	addl	$1, -444(%rbp)
	addl	$1, -440(%rbp)
.L10:
	movl	-460(%rbp), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
	jmp	.L12
.L16:
	nop
.L12:
	movl	-444(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
