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 n, k, step;
int a[100];
int i;

int binary_search(int x) {
	int l = 0, middle = 0, h = n - 1;

	while (l <= h) {
		middle = (l + h) / 2;
		step++;
		if (a[middle] == k) {
			return 1;
		}
		else if (a[middle] > k) {
			h = middle - 1;
		}
		else {
			l = middle + 1;
		}
	}
	return -1;
}

int main(void) {
	
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		step = 0;
		for (i = 0; i < n; i++)
			scanf("%d",&a[i]);
		scanf("%d",&k);

		binary_search(k);
		printf("%d\n",step);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	subl	$1, %ecx
	js	.L8
	movl	step(%rip), %eax
	movl	k(%rip), %r9d
	xorl	%esi, %esi
	leaq	a(%rip), %r8
	leal	1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rsi,%rcx), %eax
	movl	%edx, %r10d
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	%r9d, (%r8,%rdi,4)
	je	.L10
	jle	.L4
	leal	-1(%rax), %ecx
	addl	$1, %edx
	cmpl	%esi, %ecx
	jge	.L7
.L6:
	movl	%r10d, step(%rip)
	movl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %esi
	addl	$1, %edx
	cmpl	%ecx, %esi
	jle	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, step(%rip)
	movl	$1, %eax
	ret
.L8:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	binary_search, .-binary_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
	leaq	k(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	n(%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
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, step(%rip)
	movl	$0, %eax
	movl	$0, i(%rip)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	cltq
	movq	%rbp, %rdi
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L13
.L16:
	movq	%rbp, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	movl	k(%rip), %edi
	xorl	%ecx, %ecx
	movl	step(%rip), %r8d
	subl	$1, %edx
	js	.L17
	.p2align 4,,10
	.p2align 3
.L22:
	leal	(%rcx,%rdx), %eax
	addl	$1, %r8d
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,4), %edi
	je	.L21
	jge	.L19
	leal	-1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L22
.L21:
	movl	%r8d, step(%rip)
.L17:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
	cmpl	%edx, %ecx
	jle	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	binary_search
	.type	binary_search, @function
binary_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	subl	$1, %ecx
	js	.L8
	movl	step(%rip), %eax
	movl	k(%rip), %r9d
	xorl	%esi, %esi
	leaq	a(%rip), %r8
	leal	1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rsi,%rcx), %eax
	movl	%edx, %r10d
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	%r9d, (%r8,%rdi,4)
	je	.L10
	jle	.L4
	leal	-1(%rax), %ecx
	addl	$1, %edx
	cmpl	%esi, %ecx
	jge	.L7
.L6:
	movl	%r10d, step(%rip)
	movl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %esi
	addl	$1, %edx
	cmpl	%ecx, %esi
	jle	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, step(%rip)
	movl	$1, %eax
	ret
.L8:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	binary_search, .-binary_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
	leaq	k(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	n(%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
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, step(%rip)
	movl	$0, %eax
	movl	$0, i(%rip)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	cltq
	movq	%rbp, %rdi
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L13
.L16:
	movq	%rbp, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	movl	k(%rip), %edi
	xorl	%ecx, %ecx
	movl	step(%rip), %r8d
	subl	$1, %edx
	js	.L17
	.p2align 4,,10
	.p2align 3
.L22:
	leal	(%rcx,%rdx), %eax
	addl	$1, %r8d
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,4), %edi
	je	.L21
	jge	.L19
	leal	-1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L22
.L21:
	movl	%r8d, step(%rip)
.L17:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
	cmpl	%edx, %ecx
	jle	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	binary_search
	.type	binary_search, @function
binary_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	subl	$1, %ecx
	js	.L8
	movl	step(%rip), %eax
	movl	k(%rip), %r9d
	xorl	%esi, %esi
	leaq	a(%rip), %r8
	leal	1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rsi,%rcx), %eax
	movl	%edx, %r10d
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	%r9d, (%r8,%rdi,4)
	je	.L10
	jle	.L4
	leal	-1(%rax), %ecx
	addl	$1, %edx
	cmpl	%esi, %ecx
	jge	.L7
.L6:
	movl	%r10d, step(%rip)
	movl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %esi
	addl	$1, %edx
	cmpl	%ecx, %esi
	jle	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, step(%rip)
	movl	$1, %eax
	ret
.L8:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	binary_search, .-binary_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
	leaq	k(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	n(%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
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, step(%rip)
	movl	$0, %eax
	movl	$0, i(%rip)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	cltq
	movq	%rbp, %rdi
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L13
.L16:
	movq	%rbp, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	movl	k(%rip), %edi
	xorl	%ecx, %ecx
	movl	step(%rip), %r8d
	subl	$1, %edx
	js	.L17
	.p2align 4,,10
	.p2align 3
.L22:
	leal	(%rcx,%rdx), %eax
	addl	$1, %r8d
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,4), %edi
	je	.L21
	jge	.L19
	leal	-1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L22
.L21:
	movl	%r8d, step(%rip)
.L17:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
	cmpl	%edx, %ecx
	jle	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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 n, k, step;
int a[100];
int i;

int binary_search(int x) {
	int l = 0, middle = 0, h = n - 1;

	while (l <= h) {
		middle = (l + h) / 2;
		step++;
		if (a[middle] == k) {
			return 1;
		}
		else if (a[middle] > k) {
			h = middle - 1;
		}
		else {
			l = middle + 1;
		}
	}
	return -1;
}

int main(void) {
	
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		step = 0;
		for (i = 0; i < n; i++)
			scanf("%d",&a[i]);
		scanf("%d",&k);

		binary_search(k);
		printf("%d\n",step);
	}
	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 n, k, step;
int a[100];
int i;

int binary_search(int x) {
	int l = 0, middle = 0, h = n - 1;

	while (l <= h) {
		middle = (l + h) / 2;
		step++;
		if (a[middle] == k) {
			return 1;
		}
		else if (a[middle] > k) {
			h = middle - 1;
		}
		else {
			l = middle + 1;
		}
	}
	return -1;
}

int main(void) {
	
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		step = 0;
		for (i = 0; i < n; i++)
			scanf("%d",&a[i]);
		scanf("%d",&k);

		binary_search(k);
		printf("%d\n",step);
	}
	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
11
15
0
36
51
61
86
51
4
1
2
3
5
4
0
 7
11
15
0
42
51
61
86
51
4
1
2
4
5
4
0
 7
11
8
-2
53
51
17
109
42
4
1
0
3
1
0
0
 7
11
15
0
42
51
61
86
61
4
1
2
4
5
4
0
 7
11
8
-2
53
51
1
109
42
0
1
0
3
1
0
0
 7
0
15
0
42
51
61
48
61
0
1
3
4
5
4
0
 7
11
15
0
42
51
61
86
51
4
1
2
3
5
4
0
 7
11
20
0
42
51
61
86
51
4
1
2
4
5
4
0
 7
11
20
0
42
51
61
86
51
4
1
1
4
5
4
0
 7
11
15
23
36
51
61
86
51
4
1
2
3
7
4
0

3
3
 3
2
 3
1
 2
2
 3
 2
 3
3
 3
2
 3
2
 3
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 n, k, step;
int a[100];
int i;

int binary_search(int x) {
	int l = 0, middle = 0, h = n - 1;

	while (l <= h) {
		middle = (l + h) / 2;
		step++;
		if (a[middle] == k) {
			return 1;
		}
		else if (a[middle] > k) {
			h = middle - 1;
		}
		else {
			l = middle + 1;
		}
	}
	return -1;
}

int main(void) {
	
	while (1) {
		scanf("%d", &n);
		if (n == 0)break;
		step = 0;
		for (i = 0; i < n; i++)
			scanf("%d",&a[i]);
		scanf("%d",&k);

		binary_search(k);
		printf("%d\n",step);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary_search
	.type	binary_search, @function
binary_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	subl	$1, %ecx
	js	.L8
	movl	step(%rip), %eax
	movl	k(%rip), %r9d
	xorl	%esi, %esi
	leaq	a(%rip), %r8
	leal	1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rsi,%rcx), %eax
	movl	%edx, %r10d
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	%r9d, (%r8,%rdi,4)
	je	.L10
	jle	.L4
	leal	-1(%rax), %ecx
	addl	$1, %edx
	cmpl	%esi, %ecx
	jge	.L7
.L6:
	movl	%r10d, step(%rip)
	movl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %esi
	addl	$1, %edx
	cmpl	%ecx, %esi
	jle	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, step(%rip)
	movl	$1, %eax
	ret
.L8:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	binary_search, .-binary_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
	leaq	k(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	n(%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
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, step(%rip)
	movl	$0, %eax
	movl	$0, i(%rip)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	cltq
	movq	%rbp, %rdi
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L13
.L16:
	movq	%rbp, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	movl	k(%rip), %edi
	xorl	%ecx, %ecx
	movl	step(%rip), %r8d
	subl	$1, %edx
	js	.L17
	.p2align 4,,10
	.p2align 3
.L22:
	leal	(%rcx,%rdx), %eax
	addl	$1, %r8d
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,4), %edi
	je	.L21
	jge	.L19
	leal	-1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L22
.L21:
	movl	%r8d, step(%rip)
.L17:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
	cmpl	%edx, %ecx
	jle	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	binary_search
	.type	binary_search, @function
binary_search:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	subl	$1, %ecx
	js	.L8
	movl	step(%rip), %eax
	movl	k(%rip), %r9d
	xorl	%esi, %esi
	leaq	a(%rip), %r8
	leal	1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rsi,%rcx), %eax
	movl	%edx, %r10d
	sarl	%eax
	movslq	%eax, %rdi
	cmpl	%r9d, (%r8,%rdi,4)
	je	.L10
	jle	.L4
	leal	-1(%rax), %ecx
	addl	$1, %edx
	cmpl	%esi, %ecx
	jge	.L7
.L6:
	movl	%r10d, step(%rip)
	movl	$-1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %esi
	addl	$1, %edx
	cmpl	%ecx, %esi
	jle	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, step(%rip)
	movl	$1, %eax
	ret
.L8:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	binary_search, .-binary_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
	leaq	k(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	n(%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
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L12
	movl	$0, step(%rip)
	movl	$0, %eax
	movl	$0, i(%rip)
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	cltq
	movq	%rbp, %rdi
	leaq	(%rbx,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L13
.L16:
	movq	%rbp, %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	movl	k(%rip), %edi
	xorl	%ecx, %ecx
	movl	step(%rip), %r8d
	subl	$1, %edx
	js	.L17
	.p2align 4,,10
	.p2align 3
.L22:
	leal	(%rcx,%rdx), %eax
	addl	$1, %r8d
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	(%rbx,%rsi,4), %edi
	je	.L21
	jge	.L19
	leal	-1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L22
.L21:
	movl	%r8d, step(%rip)
.L17:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L19:
	leal	1(%rax), %ecx
	cmpl	%edx, %ecx
	jle	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400
a:
	.zero	400
	.globl	step
	.align 4
	.type	step, @object
	.size	step, 4
step:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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:
```