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>
#define N 100000

int a[N];

int bin_search(int start,int last,int key){
	int mid=(last-start)/2+start;
	
	if(start > last)return 0;
	
	if(a[mid]==key)return 1;
	
	if(key > a[mid])return bin_search(mid+1,last,key);
	else return bin_search(0,mid-1,key);
	
}



int main(){
	int n,q,i,x;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&x);
		printf("%d\n",bin_search(0,n-1,x));
	}
	
	return 0;
	
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	bin_search
	.type	bin_search, @function
bin_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	movl	%esi, %edx
	movl	%esi, %ecx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	addl	%edi, %eax
	cmpl	%esi, %edi
	jg	.L8
	leaq	a(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	je	.L7
.L11:
	jge	.L4
	leal	1(%rax), %edx
	movl	%ecx, %esi
	subl	%edx, %esi
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	addl	%edx, %eax
	cmpl	%ecx, %edx
	jle	.L3
.L8:
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rax), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	testl	%ecx, %ecx
	js	.L8
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	jne	.L11
.L7:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	bin_search, .-bin_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
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebx, 12(%rsp)
	jg	.L16
.L17:
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	20(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	a(%rip), %r14
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	12(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	testl	%edx, %edx
	js	.L26
.L19:
	movslq	%eax, %rsi
	cmpl	(%r14,%rsi,4), %ecx
	je	.L25
	jle	.L34
	leal	1(%rax), %esi
	movl	%edx, %edi
	subl	%esi, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%esi, %eax
	cmpl	%edx, %esi
	jle	.L19
.L26:
	xorl	%edx, %edx
.L18:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L14
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$32, %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
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L18
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.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	bin_search
	.type	bin_search, @function
bin_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	movl	%esi, %edx
	movl	%esi, %ecx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	addl	%edi, %eax
	cmpl	%esi, %edi
	jg	.L8
	leaq	a(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	je	.L7
.L11:
	jge	.L4
	leal	1(%rax), %edx
	movl	%ecx, %esi
	subl	%edx, %esi
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	addl	%edx, %eax
	cmpl	%ecx, %edx
	jle	.L3
.L8:
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rax), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	testl	%ecx, %ecx
	js	.L8
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	jne	.L11
.L7:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	bin_search, .-bin_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
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebx, 12(%rsp)
	jg	.L16
.L17:
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	20(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	a(%rip), %r14
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	12(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	testl	%edx, %edx
	js	.L26
.L19:
	movslq	%eax, %rsi
	cmpl	(%r14,%rsi,4), %ecx
	je	.L25
	jle	.L34
	leal	1(%rax), %esi
	movl	%edx, %edi
	subl	%esi, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%esi, %eax
	cmpl	%edx, %esi
	jle	.L19
.L26:
	xorl	%edx, %edx
.L18:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L14
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$32, %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
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L18
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.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	bin_search
	.type	bin_search, @function
bin_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	movl	%esi, %edx
	movl	%esi, %ecx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	addl	%edi, %eax
	cmpl	%esi, %edi
	jg	.L8
	leaq	a(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	je	.L7
.L11:
	jge	.L4
	leal	1(%rax), %edx
	movl	%ecx, %esi
	subl	%edx, %esi
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	addl	%edx, %eax
	cmpl	%ecx, %edx
	jle	.L3
.L8:
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rax), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	testl	%ecx, %ecx
	js	.L8
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	jne	.L11
.L7:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	bin_search, .-bin_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
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebx, 12(%rsp)
	jg	.L16
.L17:
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	20(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	a(%rip), %r14
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	12(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	testl	%edx, %edx
	js	.L26
.L19:
	movslq	%eax, %rsi
	cmpl	(%r14,%rsi,4), %ecx
	je	.L25
	jle	.L34
	leal	1(%rax), %esi
	movl	%edx, %edi
	subl	%esi, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%esi, %eax
	cmpl	%edx, %esi
	jle	.L19
.L26:
	xorl	%edx, %edx
.L18:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L14
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$32, %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
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L18
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.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>
#define N 100000

int a[N];

int bin_search(int start,int last,int key){
	int mid=(last-start)/2+start;
	
	if(start > last)return 0;
	
	if(a[mid]==key)return 1;
	
	if(key > a[mid])return bin_search(mid+1,last,key);
	else return bin_search(0,mid-1,key);
	
}



int main(){
	int n,q,i,x;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&x);
		printf("%d\n",bin_search(0,n-1,x));
	}
	
	return 0;
	
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#define N 100000

int a[N];

int bin_search(int start,int last,int key){
	int mid=(last-start)/2+start;
	
	if(start > last)return 0;
	
	if(a[mid]==key)return 1;
	
	if(key > a[mid])return bin_search(mid+1,last,key);
	else return bin_search(0,mid-1,key);
	
}



int main(){
	int n,q,i,x;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&x);
		printf("%d\n",bin_search(0,n-1,x));
	}
	
	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:

4
1 2 2 4
3
2
3
6
 4
1 1 2 4
3
0
3
8
 4
0 1 2 7
3
0
7
10
 4
0 1 2 6
3
0
3
6
 4
1 2 1 4
2
0
3
8
 4
0 1 2 7
1
0
5
3
 4
0 2 3 4
3
2
3
4
 4
0 1 2 7
1
-1
5
3
 4
0 2 1 3
3
-1
3
6
 4
0 2 2 1
3
4
3
0

1
0
0
 0
0
0
 1
1
0
 1
0
1
 0
0
 1
 1
1
1
 0
 0
1
0
 0
0
1

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>
#define N 100000

int a[N];

int bin_search(int start,int last,int key){
	int mid=(last-start)/2+start;
	
	if(start > last)return 0;
	
	if(a[mid]==key)return 1;
	
	if(key > a[mid])return bin_search(mid+1,last,key);
	else return bin_search(0,mid-1,key);
	
}



int main(){
	int n,q,i,x;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&x);
		printf("%d\n",bin_search(0,n-1,x));
	}
	
	return 0;
	
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	bin_search
	.type	bin_search, @function
bin_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	movl	%esi, %edx
	movl	%esi, %ecx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	addl	%edi, %eax
	cmpl	%esi, %edi
	jg	.L8
	leaq	a(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	je	.L7
.L11:
	jge	.L4
	leal	1(%rax), %edx
	movl	%ecx, %esi
	subl	%edx, %esi
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	addl	%edx, %eax
	cmpl	%ecx, %edx
	jle	.L3
.L8:
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rax), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	testl	%ecx, %ecx
	js	.L8
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	jne	.L11
.L7:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	bin_search, .-bin_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
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebx, 12(%rsp)
	jg	.L16
.L17:
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	20(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	a(%rip), %r14
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	12(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	testl	%edx, %edx
	js	.L26
.L19:
	movslq	%eax, %rsi
	cmpl	(%r14,%rsi,4), %ecx
	je	.L25
	jle	.L34
	leal	1(%rax), %esi
	movl	%edx, %edi
	subl	%esi, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%esi, %eax
	cmpl	%edx, %esi
	jle	.L19
.L26:
	xorl	%edx, %edx
.L18:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L14
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$32, %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
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L18
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.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	bin_search
	.type	bin_search, @function
bin_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	movl	%esi, %edx
	movl	%esi, %ecx
	subl	%edi, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	addl	%edi, %eax
	cmpl	%esi, %edi
	jg	.L8
	leaq	a(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	je	.L7
.L11:
	jge	.L4
	leal	1(%rax), %edx
	movl	%ecx, %esi
	subl	%edx, %esi
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	addl	%edx, %eax
	cmpl	%ecx, %edx
	jle	.L3
.L8:
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	-1(%rax), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	testl	%ecx, %ecx
	js	.L8
	movslq	%eax, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	jne	.L11
.L7:
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	bin_search, .-bin_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
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	xorl	%ebx, %ebx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebx, 12(%rsp)
	jg	.L16
.L17:
	leaq	16(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	leaq	20(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	a(%rip), %r14
	testl	%eax, %eax
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	12(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%rax), %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	testl	%edx, %edx
	js	.L26
.L19:
	movslq	%eax, %rsi
	cmpl	(%r14,%rsi,4), %ecx
	je	.L25
	jle	.L34
	leal	1(%rax), %esi
	movl	%edx, %edi
	subl	%esi, %edi
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	addl	%esi, %eax
	cmpl	%edx, %esi
	jle	.L19
.L26:
	xorl	%edx, %edx
.L18:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L14
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$32, %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
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L18
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.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:
```