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 N,A[100001],count[100001];


int main(void){
    int i,j,k;

    scanf("%d",&N);

    for(i = 1;i <= N;i++)
        scanf("%d",&A[i]);

    for(i = 1;i <= 100000;i++)
        count[A[i]]++;

    j = 0;
    for(i = 1;i <= 100000;i++)
        if(count[i] > 1)
            j += count[i] - 1;

    k = (j + 1) / 2 * 2;

    N -= k;

    if(N >= 1)
        printf("%d\n",N);
    else
        printf("1\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 400004
count:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"1"
	.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	$16, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	count(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L4:
	cmpl	$100000, -12(%rbp)
	jle	.L5
	movl	$0, -8(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jle	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	addl	%eax, -8(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L6:
	cmpl	$100000, -12(%rbp)
	jle	.L8
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	-4(%rbp), %eax
	movl	%eax, N(%rip)
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L9
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L10:
	movl	$0, %eax
	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"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	4+A(%rip), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jge	.L3
.L2:
	leaq	4+A(%rip), %rax
	leaq	count(%rip), %rsi
	leaq	400000(%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	(%rax), %rcx
	addq	$4, %rax
	addl	$1, (%rsi,%rcx,4)
	cmpq	%rdi, %rax
	jne	.L4
	leaq	4+count(%rip), %rax
	movdqa	.LC1(%rip), %xmm4
	pxor	%xmm1, %xmm1
	pcmpeqd	%xmm3, %xmm3
	leaq	400000(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	pcmpgtd	%xmm4, %xmm0
	paddd	%xmm3, %xmm2
	pand	%xmm2, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rcx
	jne	.L5
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	addl	$1, %eax
	andl	$-2, %eax
	subl	%eax, %edx
	movl	%edx, N(%rip)
	testl	%edx, %edx
	jle	.L6
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L7:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	count
	.bss
	.align 32
	.type	count, @object
	.size	count, 400004
count:
	.zero	400004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	4+A(%rip), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	N(%rip), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jge	.L3
.L2:
	leaq	4+A(%rip), %rax
	leaq	count(%rip), %rsi
	leaq	400000(%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	(%rax), %rcx
	addq	$4, %rax
	addl	$1, (%rsi,%rcx,4)
	cmpq	%rdi, %rax
	jne	.L4
	leaq	4+count(%rip), %rax
	movdqa	.LC1(%rip), %xmm4
	pxor	%xmm1, %xmm1
	pcmpeqd	%xmm3, %xmm3
	leaq	400000(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	pcmpgtd	%xmm4, %xmm0
	paddd	%xmm3, %xmm2
	pand	%xmm2, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rcx
	jne	.L5
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	addl	$1, %eax
	andl	$-2, %eax
	subl	%eax, %edx
	movl	%edx, N(%rip)
	testl	%edx, %edx
	jle	.L6
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L7:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L7
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	count
	.bss
	.align 32
	.type	count, @object
	.size	count, 400004
count:
	.zero	400004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 N,A[100001],count[100001];


int main(void){
    int i,j,k;

    scanf("%d",&N);

    for(i = 1;i <= N;i++)
        scanf("%d",&A[i]);

    for(i = 1;i <= 100000;i++)
        count[A[i]]++;

    j = 0;
    for(i = 1;i <= 100000;i++)
        if(count[i] > 1)
            j += count[i] - 1;

    k = (j + 1) / 2 * 2;

    N -= k;

    if(N >= 1)
        printf("%d\n",N);
    else
        printf("1\n");
    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
 15
0 -4 1 8 0 1 -1 -25 49 -3 -35 -2 -8 2 -9
 5
1 2 0 3 11
 15
1 3 5 1 1 3 2 0 8 6 2 6 11 1 1
 5
1 2 0 3 18

5
 7
 3
 9
 11
 5
 9
 5
 7
 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 N,A[100001],count[100001];


int main(void){
    int i,j,k;

    scanf("%d",&N);

    for(i = 1;i <= N;i++)
        scanf("%d",&A[i]);

    for(i = 1;i <= 100000;i++)
        count[A[i]]++;

    j = 0;
    for(i = 1;i <= 100000;i++)
        if(count[i] > 1)
            j += count[i] - 1;

    k = (j + 1) / 2 * 2;

    N -= k;

    if(N >= 1)
        printf("%d\n",N);
    else
        printf("1\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 400004
count:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"1"
	.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	$16, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	count(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L4:
	cmpl	$100000, -12(%rbp)
	jle	.L5
	movl	$0, -8(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jle	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	addl	%eax, -8(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L6:
	cmpl	$100000, -12(%rbp)
	jle	.L8
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	-4(%rbp), %eax
	movl	%eax, N(%rip)
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L9
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L10:
	movl	$0, %eax
	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
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 400004
count:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"1"
	.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	$16, %rsp
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	count(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
.L4:
	cmpl	$100000, -12(%rbp)
	jle	.L5
	movl	$0, -8(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jle	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	addl	%eax, -8(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L6:
	cmpl	$100000, -12(%rbp)
	jle	.L8
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	-4(%rbp), %eax
	movl	%eax, N(%rip)
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L9
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L9:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L10:
	movl	$0, %eax
	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:
