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(){
  int N;
  scanf("%d",&N);

  int d[101]={0};
  int e[101]={0};
  int i,j;
  for(i=0;i<N;i++){
    scanf("%d",&e[i]);
    for(j=0;j<N;j++){
      if(d[j]==0){
		d[j]=e[i];
        break;
      }else if(d[j]==e[i]){
		break;
      }
    }
  }
  int cnt=0;
  for(i=0;i<N;i++){
    if(d[i]!=0){
      cnt++;
    }
  }
  printf("%d",cnt);
  return 0;
}```

Assembly Code:

```assembly
	.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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$856, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	leaq	432(%rsp), %r12
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$50, %ecx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	rep stosq
	movl	12(%rsp), %eax
	movl	$0, (%rdi)
	testl	%eax, %eax
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L9
	movl	(%r12), %esi
	movslq	%r9d, %r8
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %edx
	je	.L6
	addq	$1, %rax
	cmpq	%r8, %rax
	je	.L6
.L7:
	movl	(%rbx,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	jne	.L5
	movl	%esi, 16(%rsp,%rcx,4)
.L6:
	addl	$1, %r13d
	addq	$4, %r12
	cmpl	%r9d, %r13d
	jl	.L8
	testl	%r9d, %r9d
	jle	.L9
	leal	-1(%r9), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%r9d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	movdqa	%xmm0, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm2, %xmm1
	addq	$16, %rbx
	pcmpeqd	-16(%rbx), %xmm1
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rbx, %rax
	jne	.L11
	movdqa	%xmm0, %xmm1
	movl	%r9d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r9b
	je	.L3
.L10:
	movslq	%eax, %rcx
	cmpl	$1, 16(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	sbbl	$-1, %edx
	cmpl	%r9d, %ecx
	jge	.L3
	movslq	%ecx, %rcx
	cmpl	$0, 16(%rsp,%rcx,4)
	jne	.L26
.L14:
	addl	$2, %eax
	cmpl	%r9d, %eax
	jge	.L3
	cltq
	cmpl	$0, 16(%rsp,%rax,4)
	jne	.L27
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$856, %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
.L26:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L14
.L27:
	addl	$1, %edx
	jmp	.L3
.L9:
	xorl	%edx, %edx
	jmp	.L3
.L18:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L28:
	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:
```

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"
	.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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$856, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	leaq	432(%rsp), %r12
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$50, %ecx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	rep stosq
	movl	12(%rsp), %eax
	movl	$0, (%rdi)
	testl	%eax, %eax
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L9
	movl	(%r12), %esi
	movslq	%r9d, %r8
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %edx
	je	.L6
	addq	$1, %rax
	cmpq	%r8, %rax
	je	.L6
.L7:
	movl	(%rbx,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	jne	.L5
	movl	%esi, 16(%rsp,%rcx,4)
.L6:
	addl	$1, %r13d
	addq	$4, %r12
	cmpl	%r9d, %r13d
	jl	.L8
	testl	%r9d, %r9d
	jle	.L9
	leal	-1(%r9), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%r9d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	movdqa	%xmm0, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm2, %xmm1
	addq	$16, %rbx
	pcmpeqd	-16(%rbx), %xmm1
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rbx, %rax
	jne	.L11
	movdqa	%xmm0, %xmm1
	movl	%r9d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r9b
	je	.L3
.L10:
	movslq	%eax, %rcx
	cmpl	$1, 16(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	sbbl	$-1, %edx
	cmpl	%r9d, %ecx
	jge	.L3
	movslq	%ecx, %rcx
	cmpl	$0, 16(%rsp,%rcx,4)
	jne	.L26
.L14:
	addl	$2, %eax
	cmpl	%r9d, %eax
	jge	.L3
	cltq
	cmpl	$0, 16(%rsp,%rax,4)
	jne	.L27
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$856, %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
.L26:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L14
.L27:
	addl	$1, %edx
	jmp	.L3
.L9:
	xorl	%edx, %edx
	jmp	.L3
.L18:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L28:
	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
```assembly
	.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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$856, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	leaq	432(%rsp), %r12
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$50, %ecx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	rep stosq
	movl	12(%rsp), %eax
	movl	$0, (%rdi)
	testl	%eax, %eax
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L9
	movl	(%r12), %esi
	movslq	%r9d, %r8
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %edx
	je	.L6
	addq	$1, %rax
	cmpq	%r8, %rax
	je	.L6
.L7:
	movl	(%rbx,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	jne	.L5
	movl	%esi, 16(%rsp,%rcx,4)
.L6:
	addl	$1, %r13d
	addq	$4, %r12
	cmpl	%r9d, %r13d
	jl	.L8
	testl	%r9d, %r9d
	jle	.L9
	leal	-1(%r9), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%r9d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	movdqa	%xmm0, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm2, %xmm1
	addq	$16, %rbx
	pcmpeqd	-16(%rbx), %xmm1
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rbx, %rax
	jne	.L11
	movdqa	%xmm0, %xmm1
	movl	%r9d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r9b
	je	.L3
.L10:
	movslq	%eax, %rcx
	cmpl	$1, 16(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	sbbl	$-1, %edx
	cmpl	%r9d, %ecx
	jge	.L3
	movslq	%ecx, %rcx
	cmpl	$0, 16(%rsp,%rcx,4)
	jne	.L26
.L14:
	addl	$2, %eax
	cmpl	%r9d, %eax
	jge	.L3
	cltq
	cmpl	$0, 16(%rsp,%rax,4)
	jne	.L27
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$856, %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
.L26:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L14
.L27:
	addl	$1, %edx
	jmp	.L3
.L9:
	xorl	%edx, %edx
	jmp	.L3
.L18:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L28:
	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:
```
```c
#include<stdio.h>

int main(){
  int N;
  scanf("%d",&N);

  int d[101]={0};
  int e[101]={0};
  int i,j;
  for(i=0;i<N;i++){
    scanf("%d",&e[i]);
    for(j=0;j<N;j++){
      if(d[j]==0){
		d[j]=e[i];
        break;
      }else if(d[j]==e[i]){
		break;
      }
    }
  }
  int cnt=0;
  for(i=0;i<N;i++){
    if(d[i]!=0){
      cnt++;
    }
  }
  printf("%d",cnt);
  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(){
  int N;
  scanf("%d",&N);

  int d[101]={0};
  int e[101]={0};
  int i,j;
  for(i=0;i<N;i++){
    scanf("%d",&e[i]);
    for(j=0;j<N;j++){
      if(d[j]==0){
		d[j]=e[i];
        break;
      }else if(d[j]==e[i]){
		break;
      }
    }
  }
  int cnt=0;
  for(i=0;i<N;i++){
    if(d[i]!=0){
      cnt++;
    }
  }
  printf("%d",cnt);
  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(){
  int N;
  scanf("%d",&N);

  int d[101]={0};
  int e[101]={0};
  int i,j;
  for(i=0;i<N;i++){
    scanf("%d",&e[i]);
    for(j=0;j<N;j++){
      if(d[j]==0){
		d[j]=e[i];
        break;
      }else if(d[j]==e[i]){
		break;
      }
    }
  }
  int cnt=0;
  for(i=0;i<N;i++){
    if(d[i]!=0){
      cnt++;
    }
  }
  printf("%d",cnt);
  return 0;
}```

Assembly Code:

```assembly
	.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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$856, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	leaq	432(%rsp), %r12
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$50, %ecx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	rep stosq
	movl	12(%rsp), %eax
	movl	$0, (%rdi)
	testl	%eax, %eax
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L9
	movl	(%r12), %esi
	movslq	%r9d, %r8
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %edx
	je	.L6
	addq	$1, %rax
	cmpq	%r8, %rax
	je	.L6
.L7:
	movl	(%rbx,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	jne	.L5
	movl	%esi, 16(%rsp,%rcx,4)
.L6:
	addl	$1, %r13d
	addq	$4, %r12
	cmpl	%r9d, %r13d
	jl	.L8
	testl	%r9d, %r9d
	jle	.L9
	leal	-1(%r9), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%r9d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	movdqa	%xmm0, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm2, %xmm1
	addq	$16, %rbx
	pcmpeqd	-16(%rbx), %xmm1
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rbx, %rax
	jne	.L11
	movdqa	%xmm0, %xmm1
	movl	%r9d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r9b
	je	.L3
.L10:
	movslq	%eax, %rcx
	cmpl	$1, 16(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	sbbl	$-1, %edx
	cmpl	%r9d, %ecx
	jge	.L3
	movslq	%ecx, %rcx
	cmpl	$0, 16(%rsp,%rcx,4)
	jne	.L26
.L14:
	addl	$2, %eax
	cmpl	%r9d, %eax
	jge	.L3
	cltq
	cmpl	$0, 16(%rsp,%rax,4)
	jne	.L27
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$856, %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
.L26:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L14
.L27:
	addl	$1, %edx
	jmp	.L3
.L9:
	xorl	%edx, %edx
	jmp	.L3
.L18:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L28:
	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:
```

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"
	.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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rdi
	subq	$856, %rsp
	.cfi_def_cfa_offset 896
	movq	%fs:40, %rax
	movq	%rax, 840(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %rbx
	leaq	432(%rsp), %r12
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$50, %ecx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	rep stosq
	movl	12(%rsp), %eax
	movl	$0, (%rdi)
	testl	%eax, %eax
	jle	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L9
	movl	(%r12), %esi
	movslq	%r9d, %r8
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	cmpl	%esi, %edx
	je	.L6
	addq	$1, %rax
	cmpq	%r8, %rax
	je	.L6
.L7:
	movl	(%rbx,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	jne	.L5
	movl	%esi, 16(%rsp,%rcx,4)
.L6:
	addl	$1, %r13d
	addq	$4, %r12
	cmpl	%r9d, %r13d
	jl	.L8
	testl	%r9d, %r9d
	jle	.L9
	leal	-1(%r9), %eax
	cmpl	$2, %eax
	jbe	.L18
	movl	%r9d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	movdqa	%xmm0, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	32(%rsp,%rax), %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm2, %xmm1
	addq	$16, %rbx
	pcmpeqd	-16(%rbx), %xmm1
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rbx, %rax
	jne	.L11
	movdqa	%xmm0, %xmm1
	movl	%r9d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r9b
	je	.L3
.L10:
	movslq	%eax, %rcx
	cmpl	$1, 16(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	sbbl	$-1, %edx
	cmpl	%r9d, %ecx
	jge	.L3
	movslq	%ecx, %rcx
	cmpl	$0, 16(%rsp,%rcx,4)
	jne	.L26
.L14:
	addl	$2, %eax
	cmpl	%r9d, %eax
	jge	.L3
	cltq
	cmpl	$0, 16(%rsp,%rax,4)
	jne	.L27
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	840(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$856, %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
.L26:
	.cfi_restore_state
	addl	$1, %edx
	jmp	.L14
.L27:
	addl	$1, %edx
	jmp	.L3
.L9:
	xorl	%edx, %edx
	jmp	.L3
.L18:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L28:
	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:
```