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 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;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movq	%rdx, -56(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L2
.L8:
	movl	$0, -16(%rbp)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L3
.L7:
	movl	-16(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	addl	$1, -8(%rbp)
	jmp	.L5
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L7
.L5:
	addl	$1, -20(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%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)
.L11:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%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)
.L13:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %ecx
	leaq	T(%rip), %rdx
	movl	%eax, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	search
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.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
	.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:

#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;
}

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 unoptimized 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;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movq	%rdx, -56(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L2
.L8:
	movl	$0, -16(%rbp)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L3
.L7:
	movl	-16(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	addl	$1, -8(%rbp)
	jmp	.L5
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L7
.L5:
	addl	$1, -20(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%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)
.L11:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%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)
.L13:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %ecx
	leaq	T(%rip), %rdx
	movl	%eax, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	search
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 400000
S:
	.zero	400000
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 200000
T:
	.zero	200000
	.text
	.globl	search
	.type	search, @function
search:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movq	%rdx, -56(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L2
.L8:
	movl	$0, -16(%rbp)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L3
.L7:
	movl	-16(%rbp), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jne	.L4
	addl	$1, -8(%rbp)
	jmp	.L5
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L6
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
.L3:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L7
.L5:
	addl	$1, -20(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jl	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	search, .-search
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%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)
.L11:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L12
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%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)
.L13:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %ecx
	leaq	T(%rip), %rdx
	movl	%eax, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	search
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
