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 search(int key, int X[], int n);

int main(){
  int n,q,key,i=0,count=0;
    int S[10000];
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    i = 0;
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(search(key, S, n)){
	count++;
      }
    }
    printf("%d\n",count);
    
    return 0;
}

int search(int key, int X[], int n){
  int i = 0;
  X[n] = key;
  while(X[i]!=key){
    i++;
    if(i==n){
      return 0;
    }
  }
  return 1;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L3
.L2:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r13
	leaq	20(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	12(%rsp), %edx
	movq	%rax, %rcx
	movl	%edx, 16(%rsp,%rax,4)
	movq	%r14, %rax
	subl	$1, %ecx
	leaq	0(%rbp,%rcx,4), %rcx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L6
.L5:
	cmpl	(%rax), %edx
	jne	.L7
	addl	$1, %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L9
.L4:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$40040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edx, %rax
	movl	%edi, (%rsi,%rax,4)
	leal	-1(%rdx), %eax
	leaq	4(%rsi,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	cmpq	%rax, %rsi
	je	.L23
.L20:
	cmpl	%edi, (%rsi)
	jne	.L22
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	search, .-search
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L3
.L2:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r13
	leaq	20(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	12(%rsp), %edx
	movq	%rax, %rcx
	movl	%edx, 16(%rsp,%rax,4)
	movq	%r14, %rax
	subl	$1, %ecx
	leaq	0(%rbp,%rcx,4), %rcx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L6
.L5:
	cmpl	(%rax), %edx
	jne	.L7
	addl	$1, %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L9
.L4:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$40040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edx, %rax
	movl	%edi, (%rsi,%rax,4)
	leal	-1(%rdx), %eax
	leaq	4(%rsi,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	cmpq	%rax, %rsi
	je	.L23
.L20:
	cmpl	%edi, (%rsi)
	jne	.L22
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	search, .-search
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L3
.L2:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r13
	leaq	20(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	12(%rsp), %edx
	movq	%rax, %rcx
	movl	%edx, 16(%rsp,%rax,4)
	movq	%r14, %rax
	subl	$1, %ecx
	leaq	0(%rbp,%rcx,4), %rcx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L6
.L5:
	cmpl	(%rax), %edx
	jne	.L7
	addl	$1, %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L9
.L4:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$40040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edx, %rax
	movl	%edi, (%rsi,%rax,4)
	leal	-1(%rdx), %eax
	leaq	4(%rsi,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	cmpq	%rax, %rsi
	je	.L23
.L20:
	cmpl	%edi, (%rsi)
	jne	.L22
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	search, .-search
	.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 search(int key, int X[], int n);

int main(){
  int n,q,key,i=0,count=0;
    int S[10000];
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    i = 0;
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(search(key, S, n)){
	count++;
      }
    }
    printf("%d\n",count);
    
    return 0;
}

int search(int key, int X[], int n){
  int i = 0;
  X[n] = key;
  while(X[i]!=key){
    i++;
    if(i==n){
      return 0;
    }
  }
  return 1;
}

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

```c
#include <stdio.h>

int search(int key, int X[], int n);

int main(){
  int n,q,key,i=0,count=0;
    int S[10000];
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    i = 0;
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(search(key, S, n)){
	count++;
      }
    }
    printf("%d\n",count);
    
    return 0;
}

int search(int key, int X[], int n){
  int i = 0;
  X[n] = key;
  while(X[i]!=key){
    i++;
    if(i==n){
      return 0;
    }
  }
  return 1;
}

```

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:

5
1 2 3 4 5
3
3 4 1

3

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 search(int key, int X[], int n);

int main(){
  int n,q,key,i=0,count=0;
    int S[10000];
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&S[i]);
    }
    i = 0;
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(search(key, S, n)){
	count++;
      }
    }
    printf("%d\n",count);
    
    return 0;
}

int search(int key, int X[], int n){
  int i = 0;
  X[n] = key;
  while(X[i]!=key){
    i++;
    if(i==n){
      return 0;
    }
  }
  return 1;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L3
.L2:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r13
	leaq	20(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	12(%rsp), %edx
	movq	%rax, %rcx
	movl	%edx, 16(%rsp,%rax,4)
	movq	%r14, %rax
	subl	$1, %ecx
	leaq	0(%rbp,%rcx,4), %rcx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L6
.L5:
	cmpl	(%rax), %edx
	jne	.L7
	addl	$1, %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L9
.L4:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$40040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edx, %rax
	movl	%edi, (%rsi,%rax,4)
	leal	-1(%rdx), %eax
	leaq	4(%rsi,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	cmpq	%rax, %rsi
	je	.L23
.L20:
	cmpl	%edi, (%rsi)
	jne	.L22
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	search, .-search
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40096
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L3
.L2:
	leaq	8(%rsp), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	16(%rsp), %r14
	leaq	12(%rsp), %r13
	leaq	20(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	12(%rsp), %edx
	movq	%rax, %rcx
	movl	%edx, 16(%rsp,%rax,4)
	movq	%r14, %rax
	subl	$1, %ecx
	leaq	0(%rbp,%rcx,4), %rcx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L6
.L5:
	cmpl	(%rax), %edx
	jne	.L7
	addl	$1, %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 8(%rsp)
	jg	.L9
.L4:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$40040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB24:
	.cfi_startproc
	endbr64
	movslq	%edx, %rax
	movl	%edi, (%rsi,%rax,4)
	leal	-1(%rdx), %eax
	leaq	4(%rsi,%rax,4), %rax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$4, %rsi
	cmpq	%rax, %rsi
	je	.L23
.L20:
	cmpl	%edi, (%rsi)
	jne	.L22
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	search, .-search
	.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:
```