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

```c
 #include<stdio.h>
 int main(void)
 {
     int N,d[100];
     int i,j,k=0,l=0,tmp;

     scanf("%d",&N);

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

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(d[i]>d[j]){
           tmp=d[i];
           d[i]=d[j];
           d[j]=tmp;
         }
       }
     }

     for(i=0;i<N;i++)
       if(d[i]!=d[i+1]) k++;
       else l++;

     if(l==N) printf("1\n");
     else printf("%d\n",k);

     return 0;
 }
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"%d\n"
	.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	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %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, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L6:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L7
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %eax
	pxor	%xmm2, %xmm2
	movdqa	.LC1(%rip), %xmm4
	shrl	$2, %eax
	movdqa	%xmm2, %xmm1
	movdqa	%xmm2, %xmm3
	leal	-1(%rax), %edx
	leaq	16(%r12), %rax
	salq	$4, %rdx
	addq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L10:
	movdqu	4(%r12), %xmm0
	pcmpeqd	(%r12), %xmm0
	movq	%rax, %r12
	pcmpeqd	%xmm3, %xmm0
	psubd	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	paddd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L35
	movdqa	%xmm2, %xmm0
	movl	%r8d, %ecx
	psrldq	$8, %xmm0
	andl	$-4, %ecx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L21
.L9:
	leal	1(%rcx), %esi
	movslq	%ecx, %r9
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, 16(%rsp,%r9,4)
	je	.L12
	addl	$1, %edx
.L13:
	cmpl	%esi, %r8d
	jle	.L21
	leal	2(%rcx), %esi
	movslq	%esi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%edi, %r9d
	je	.L14
	addl	$1, %edx
.L15:
	cmpl	%esi, %r8d
	jle	.L21
	addl	$3, %ecx
	movslq	%ecx, %rcx
	cmpl	16(%rsp,%rcx,4), %r9d
	je	.L36
	addl	$1, %edx
.L21:
	cmpl	%eax, %r8d
	je	.L37
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %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
.L12:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L13
.L37:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L14:
	addl	$1, %eax
	jmp	.L15
.L36:
	addl	$1, %eax
	jmp	.L21
.L2:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L21
.L23:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L9
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"%d\n"
	.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	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %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, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L6:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L7
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %eax
	pxor	%xmm2, %xmm2
	movdqa	.LC1(%rip), %xmm4
	shrl	$2, %eax
	movdqa	%xmm2, %xmm1
	movdqa	%xmm2, %xmm3
	leal	-1(%rax), %edx
	leaq	16(%r12), %rax
	salq	$4, %rdx
	addq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L10:
	movdqu	4(%r12), %xmm0
	pcmpeqd	(%r12), %xmm0
	movq	%rax, %r12
	pcmpeqd	%xmm3, %xmm0
	psubd	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	paddd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L35
	movdqa	%xmm2, %xmm0
	movl	%r8d, %ecx
	psrldq	$8, %xmm0
	andl	$-4, %ecx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L21
.L9:
	leal	1(%rcx), %esi
	movslq	%ecx, %r9
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, 16(%rsp,%r9,4)
	je	.L12
	addl	$1, %edx
.L13:
	cmpl	%esi, %r8d
	jle	.L21
	leal	2(%rcx), %esi
	movslq	%esi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%edi, %r9d
	je	.L14
	addl	$1, %edx
.L15:
	cmpl	%esi, %r8d
	jle	.L21
	addl	$3, %ecx
	movslq	%ecx, %rcx
	cmpl	16(%rsp,%rcx,4), %r9d
	je	.L36
	addl	$1, %edx
.L21:
	cmpl	%eax, %r8d
	je	.L37
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %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
.L12:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L13
.L37:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L14:
	addl	$1, %eax
	jmp	.L15
.L36:
	addl	$1, %eax
	jmp	.L21
.L2:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L21
.L23:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L9
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"%d\n"
	.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	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %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, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L6:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L7
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %eax
	pxor	%xmm2, %xmm2
	movdqa	.LC1(%rip), %xmm4
	shrl	$2, %eax
	movdqa	%xmm2, %xmm1
	movdqa	%xmm2, %xmm3
	leal	-1(%rax), %edx
	leaq	16(%r12), %rax
	salq	$4, %rdx
	addq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L10:
	movdqu	4(%r12), %xmm0
	pcmpeqd	(%r12), %xmm0
	movq	%rax, %r12
	pcmpeqd	%xmm3, %xmm0
	psubd	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	paddd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L35
	movdqa	%xmm2, %xmm0
	movl	%r8d, %ecx
	psrldq	$8, %xmm0
	andl	$-4, %ecx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L21
.L9:
	leal	1(%rcx), %esi
	movslq	%ecx, %r9
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, 16(%rsp,%r9,4)
	je	.L12
	addl	$1, %edx
.L13:
	cmpl	%esi, %r8d
	jle	.L21
	leal	2(%rcx), %esi
	movslq	%esi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%edi, %r9d
	je	.L14
	addl	$1, %edx
.L15:
	cmpl	%esi, %r8d
	jle	.L21
	addl	$3, %ecx
	movslq	%ecx, %rcx
	cmpl	16(%rsp,%rcx,4), %r9d
	je	.L36
	addl	$1, %edx
.L21:
	cmpl	%eax, %r8d
	je	.L37
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %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
.L12:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L13
.L37:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L14:
	addl	$1, %eax
	jmp	.L15
.L36:
	addl	$1, %eax
	jmp	.L21
.L2:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L21
.L23:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L9
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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:
```
```c
 #include<stdio.h>
 int main(void)
 {
     int N,d[100];
     int i,j,k=0,l=0,tmp;

     scanf("%d",&N);

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

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(d[i]>d[j]){
           tmp=d[i];
           d[i]=d[j];
           d[j]=tmp;
         }
       }
     }

     for(i=0;i<N;i++)
       if(d[i]!=d[i+1]) k++;
       else l++;

     if(l==N) printf("1\n");
     else printf("%d\n",k);

     return 0;
 }
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
 #include<stdio.h>
 int main(void)
 {
     int N,d[100];
     int i,j,k=0,l=0,tmp;

     scanf("%d",&N);

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

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(d[i]>d[j]){
           tmp=d[i];
           d[i]=d[j];
           d[j]=tmp;
         }
       }
     }

     for(i=0;i<N;i++)
       if(d[i]!=d[i+1]) k++;
       else l++;

     if(l==N) printf("1\n");
     else printf("%d\n",k);

     return 0;
 }
```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
 #include<stdio.h>
 int main(void)
 {
     int N,d[100];
     int i,j,k=0,l=0,tmp;

     scanf("%d",&N);

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

     for(i=0;i<N;i++){
       for(j=i+1;j<N;j++){
         if(d[i]>d[j]){
           tmp=d[i];
           d[i]=d[j];
           d[j]=tmp;
         }
       }
     }

     for(i=0;i<N;i++)
       if(d[i]!=d[i+1]) k++;
       else l++;

     if(l==N) printf("1\n");
     else printf("%d\n",k);

     return 0;
 }
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"%d\n"
	.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	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %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, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L6:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L7
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %eax
	pxor	%xmm2, %xmm2
	movdqa	.LC1(%rip), %xmm4
	shrl	$2, %eax
	movdqa	%xmm2, %xmm1
	movdqa	%xmm2, %xmm3
	leal	-1(%rax), %edx
	leaq	16(%r12), %rax
	salq	$4, %rdx
	addq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L10:
	movdqu	4(%r12), %xmm0
	pcmpeqd	(%r12), %xmm0
	movq	%rax, %r12
	pcmpeqd	%xmm3, %xmm0
	psubd	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	paddd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L35
	movdqa	%xmm2, %xmm0
	movl	%r8d, %ecx
	psrldq	$8, %xmm0
	andl	$-4, %ecx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L21
.L9:
	leal	1(%rcx), %esi
	movslq	%ecx, %r9
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, 16(%rsp,%r9,4)
	je	.L12
	addl	$1, %edx
.L13:
	cmpl	%esi, %r8d
	jle	.L21
	leal	2(%rcx), %esi
	movslq	%esi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%edi, %r9d
	je	.L14
	addl	$1, %edx
.L15:
	cmpl	%esi, %r8d
	jle	.L21
	addl	$3, %ecx
	movslq	%ecx, %rcx
	cmpl	16(%rsp,%rcx,4), %r9d
	je	.L36
	addl	$1, %edx
.L21:
	cmpl	%eax, %r8d
	je	.L37
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %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
.L12:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L13
.L37:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L14:
	addl	$1, %eax
	jmp	.L15
.L36:
	addl	$1, %eax
	jmp	.L21
.L2:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L21
.L23:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L9
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC2:
	.string	"1"
.LC3:
	.string	"%d\n"
	.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	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$4, %rbp
	cmpl	%ebx, %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, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jle	.L6
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L6:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L7
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L5
.L4:
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L23
	movl	%r8d, %eax
	pxor	%xmm2, %xmm2
	movdqa	.LC1(%rip), %xmm4
	shrl	$2, %eax
	movdqa	%xmm2, %xmm1
	movdqa	%xmm2, %xmm3
	leal	-1(%rax), %edx
	leaq	16(%r12), %rax
	salq	$4, %rdx
	addq	%rax, %rdx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	addq	$16, %rax
.L10:
	movdqu	4(%r12), %xmm0
	pcmpeqd	(%r12), %xmm0
	movq	%rax, %r12
	pcmpeqd	%xmm3, %xmm0
	psubd	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	paddd	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L35
	movdqa	%xmm2, %xmm0
	movl	%r8d, %ecx
	psrldq	$8, %xmm0
	andl	$-4, %ecx
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L21
.L9:
	leal	1(%rcx), %esi
	movslq	%ecx, %r9
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, 16(%rsp,%r9,4)
	je	.L12
	addl	$1, %edx
.L13:
	cmpl	%esi, %r8d
	jle	.L21
	leal	2(%rcx), %esi
	movslq	%esi, %r9
	movl	16(%rsp,%r9,4), %r9d
	cmpl	%edi, %r9d
	je	.L14
	addl	$1, %edx
.L15:
	cmpl	%esi, %r8d
	jle	.L21
	addl	$3, %ecx
	movslq	%ecx, %rcx
	cmpl	16(%rsp,%rcx,4), %r9d
	je	.L36
	addl	$1, %edx
.L21:
	cmpl	%eax, %r8d
	je	.L37
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L20:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %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
.L12:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L13
.L37:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L14:
	addl	$1, %eax
	jmp	.L15
.L36:
	addl	$1, %eax
	jmp	.L21
.L2:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L21
.L23:
	xorl	%eax, %eax
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L9
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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:
```