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 S[100000];
int T[50000];
 
int search(int* S, int n, int* T, int q){
    int i;
    int left, mid, right;
    int ans = 0;
    for(i=0; i<q;i++){
        left = 0;
        right = n-1; 
        while(left <= right){
            mid = (left + right)/2;
            if(T[i] == S[mid]){
                ans++;
                break;
            }
            if(T[i] > S[mid]) left = mid + 1;
            else right = mid - 1;
        }
    }
    return ans;
}
 
 
int main(void){
    int n,q;
    int i;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i=0;i<q;i++){
        scanf("%d", &T[i]);
    }
     
    printf("%d\n", search(S,n,T,q));
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L9
	leal	-1(%rcx), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r9
	leal	-1(%rsi), %r10d
	leaq	4(%rdx,%rax,4), %rbx
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%r10d, %r10d
	js	.L3
	movl	(%rdx), %r8d
	movl	%r10d, %esi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	je	.L17
.L4:
	jle	.L5
	leal	1(%rax), %ecx
	cmpl	%esi, %ecx
	jle	.L7
.L3:
	addq	$4, %rdx
	cmpq	%rdx, %rbx
	jne	.L8
.L18:
	movl	%r11d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	leal	-1(%rax), %esi
	cmpl	%ecx, %esi
	jl	.L3
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	jne	.L4
.L17:
	addq	$4, %rdx
	addl	$1, %r11d
	cmpq	%rdx, %rbx
	jne	.L8
	jmp	.L18
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	search, .-search
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	S(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, (%rsp)
	jg	.L21
.L20:
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	T(%rip), %r14
	testl	%ecx, %ecx
	jle	.L22
	movq	%r14, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jg	.L23
.L22:
	movl	(%rsp), %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	search
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.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
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L9
	leal	-1(%rcx), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r9
	leal	-1(%rsi), %r10d
	leaq	4(%rdx,%rax,4), %rbx
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%r10d, %r10d
	js	.L3
	movl	(%rdx), %r8d
	movl	%r10d, %esi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	je	.L17
.L4:
	jle	.L5
	leal	1(%rax), %ecx
	cmpl	%esi, %ecx
	jle	.L7
.L3:
	addq	$4, %rdx
	cmpq	%rdx, %rbx
	jne	.L8
.L18:
	movl	%r11d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	leal	-1(%rax), %esi
	cmpl	%ecx, %esi
	jl	.L3
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	jne	.L4
.L17:
	addq	$4, %rdx
	addl	$1, %r11d
	cmpq	%rdx, %rbx
	jne	.L8
	jmp	.L18
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	search, .-search
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	S(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, (%rsp)
	jg	.L21
.L20:
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	T(%rip), %r14
	testl	%ecx, %ecx
	jle	.L22
	movq	%r14, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jg	.L23
.L22:
	movl	(%rsp), %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	search
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.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
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L9
	leal	-1(%rcx), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r9
	leal	-1(%rsi), %r10d
	leaq	4(%rdx,%rax,4), %rbx
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%r10d, %r10d
	js	.L3
	movl	(%rdx), %r8d
	movl	%r10d, %esi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	je	.L17
.L4:
	jle	.L5
	leal	1(%rax), %ecx
	cmpl	%esi, %ecx
	jle	.L7
.L3:
	addq	$4, %rdx
	cmpq	%rdx, %rbx
	jne	.L8
.L18:
	movl	%r11d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	leal	-1(%rax), %esi
	cmpl	%ecx, %esi
	jl	.L3
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	jne	.L4
.L17:
	addq	$4, %rdx
	addl	$1, %r11d
	cmpq	%rdx, %rbx
	jne	.L8
	jmp	.L18
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	search, .-search
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	S(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, (%rsp)
	jg	.L21
.L20:
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	T(%rip), %r14
	testl	%ecx, %ecx
	jle	.L22
	movq	%r14, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jg	.L23
.L22:
	movl	(%rsp), %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	search
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.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 S[100000];
int T[50000];
 
int search(int* S, int n, int* T, int q){
    int i;
    int left, mid, right;
    int ans = 0;
    for(i=0; i<q;i++){
        left = 0;
        right = n-1; 
        while(left <= right){
            mid = (left + right)/2;
            if(T[i] == S[mid]){
                ans++;
                break;
            }
            if(T[i] > S[mid]) left = mid + 1;
            else right = mid - 1;
        }
    }
    return ans;
}
 
 
int main(void){
    int n,q;
    int i;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i=0;i<q;i++){
        scanf("%d", &T[i]);
    }
     
    printf("%d\n", search(S,n,T,q));
    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 S[100000];
int T[50000];
 
int search(int* S, int n, int* T, int q){
    int i;
    int left, mid, right;
    int ans = 0;
    for(i=0; i<q;i++){
        left = 0;
        right = n-1; 
        while(left <= right){
            mid = (left + right)/2;
            if(T[i] == S[mid]){
                ans++;
                break;
            }
            if(T[i] > S[mid]) left = mid + 1;
            else right = mid - 1;
        }
    }
    return ans;
}
 
 
int main(void){
    int n,q;
    int i;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i=0;i<q;i++){
        scanf("%d", &T[i]);
    }
     
    printf("%d\n", search(S,n,T,q));
    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:

5
1 0 2 2 3
2
1 2
 3
2 2 3
1
5
 5
1 0 4 2 3
2
1 1
 5
1 2 3 4 1
5
2 4 1
 5
1 2 3 4 5
3
1 4 1
 5
1 0 4 2 3
2
1 2
 3
1 2 3
1
4
 5
1 4 3 4 5
3
1 4 1
 3
1 2 4
1
4
 5
1 4 3 4 6
3
1 4 1

2
 0
 2
 3
 3
 1
 0
 3
 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 S[100000];
int T[50000];
 
int search(int* S, int n, int* T, int q){
    int i;
    int left, mid, right;
    int ans = 0;
    for(i=0; i<q;i++){
        left = 0;
        right = n-1; 
        while(left <= right){
            mid = (left + right)/2;
            if(T[i] == S[mid]){
                ans++;
                break;
            }
            if(T[i] > S[mid]) left = mid + 1;
            else right = mid - 1;
        }
    }
    return ans;
}
 
 
int main(void){
    int n,q;
    int i;
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for(i=0;i<q;i++){
        scanf("%d", &T[i]);
    }
     
    printf("%d\n", search(S,n,T,q));
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L9
	leal	-1(%rcx), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r9
	leal	-1(%rsi), %r10d
	leaq	4(%rdx,%rax,4), %rbx
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%r10d, %r10d
	js	.L3
	movl	(%rdx), %r8d
	movl	%r10d, %esi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	je	.L17
.L4:
	jle	.L5
	leal	1(%rax), %ecx
	cmpl	%esi, %ecx
	jle	.L7
.L3:
	addq	$4, %rdx
	cmpq	%rdx, %rbx
	jne	.L8
.L18:
	movl	%r11d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	leal	-1(%rax), %esi
	cmpl	%ecx, %esi
	jl	.L3
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	jne	.L4
.L17:
	addq	$4, %rdx
	addl	$1, %r11d
	cmpq	%rdx, %rbx
	jne	.L8
	jmp	.L18
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	search, .-search
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	S(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, (%rsp)
	jg	.L21
.L20:
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	T(%rip), %r14
	testl	%ecx, %ecx
	jle	.L22
	movq	%r14, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jg	.L23
.L22:
	movl	(%rsp), %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	search
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.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
	.p2align 4
	.globl	search
	.type	search, @function
search:
.LFB23:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L9
	leal	-1(%rcx), %eax
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %r9
	leal	-1(%rsi), %r10d
	leaq	4(%rdx,%rax,4), %rbx
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	testl	%r10d, %r10d
	js	.L3
	movl	(%rdx), %r8d
	movl	%r10d, %esi
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	je	.L17
.L4:
	jle	.L5
	leal	1(%rax), %ecx
	cmpl	%esi, %ecx
	jle	.L7
.L3:
	addq	$4, %rdx
	cmpq	%rdx, %rbx
	jne	.L8
.L18:
	movl	%r11d, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	.cfi_restore_state
	leal	-1(%rax), %esi
	cmpl	%ecx, %esi
	jl	.L3
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	(%r9,%rdi,4), %r8d
	jne	.L4
.L17:
	addq	$4, %rdx
	addl	$1, %r11d
	cmpq	%rdx, %rbx
	jne	.L8
	jmp	.L18
.L9:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	search, .-search
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	S(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, (%rsp)
	jg	.L21
.L20:
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	T(%rip), %r14
	testl	%ecx, %ecx
	jle	.L22
	movq	%r14, %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	addq	$4, %rbp
	cmpl	%ebx, %ecx
	jg	.L23
.L22:
	movl	(%rsp), %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	call	search
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.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:
```