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 binary (int S[], int key, int n) {
  int mid, left = 0, right = n, f = 0;
  while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key) {
            f = 1;
            break;
        }
        else if (key < S[mid]) {
            right = mid;
        }
        else if (key > S[mid]) {
            left = mid + 1;
        }
  }
  return f;
}

int main (void) {
  int S[100000], n, q, i, key, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d", &key);
    if (binary (S, key, n)) {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary
	.type	binary, @function
binary:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r8,%rdx), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	cmpl	%esi, (%rdi,%rcx,4)
	je	.L7
	jle	.L10
	movl	%eax, %edx
.L4:
	cmpl	%edx, %r8d
	jl	.L6
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	jge	.L4
	leal	1(%rax), %r8d
	jmp	.L4
	.cfi_endproc
.LFE23:
	.size	binary, .-binary
	.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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L13
.L12:
	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	.L14
	xorl	%r13d, %r13d
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	16(%rsp,%rsi,4), %edi
	je	.L16
	jge	.L29
	movl	%eax, %edx
.L17:
	cmpl	%ecx, %edx
	jg	.L19
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
.L14:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	addl	$1, %r12d
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L29:
	jle	.L17
	leal	1(%rax), %ecx
	jmp	.L17
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary
	.type	binary, @function
binary:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r8,%rdx), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	cmpl	%esi, (%rdi,%rcx,4)
	je	.L7
	jle	.L10
	movl	%eax, %edx
.L4:
	cmpl	%edx, %r8d
	jl	.L6
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	jge	.L4
	leal	1(%rax), %r8d
	jmp	.L4
	.cfi_endproc
.LFE23:
	.size	binary, .-binary
	.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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L13
.L12:
	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	.L14
	xorl	%r13d, %r13d
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	16(%rsp,%rsi,4), %edi
	je	.L16
	jge	.L29
	movl	%eax, %edx
.L17:
	cmpl	%ecx, %edx
	jg	.L19
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
.L14:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	addl	$1, %r12d
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L29:
	jle	.L17
	leal	1(%rax), %ecx
	jmp	.L17
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```
rule
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary
	.type	binary, @function
binary:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r8,%rdx), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	cmpl	%esi, (%rdi,%rcx,4)
	je	.L7
	jle	.L10
	movl	%eax, %edx
.L4:
	cmpl	%edx, %r8d
	jl	.L6
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	jge	.L4
	leal	1(%rax), %r8d
	jmp	.L4
	.cfi_endproc
.LFE23:
	.size	binary, .-binary
	.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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L13
.L12:
	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	.L14
	xorl	%r13d, %r13d
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	16(%rsp,%rsi,4), %edi
	je	.L16
	jge	.L29
	movl	%eax, %edx
.L17:
	cmpl	%ecx, %edx
	jg	.L19
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
.L14:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	addl	$1, %r12d
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L29:
	jle	.L17
	leal	1(%rax), %ecx
	jmp	.L17
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```
```c
#include <stdio.h>

int binary (int S[], int key, int n) {
  int mid, left = 0, right = n, f = 0;
  while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key) {
            f = 1;
            break;
        }
        else if (key < S[mid]) {
            right = mid;
        }
        else if (key > S[mid]) {
            left = mid + 1;
        }
  }
  return f;
}

int main (void) {
  int S[100000], n, q, i, key, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d", &key);
    if (binary (S, key, n)) {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

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

```c
#include <stdio.h>

int binary (int S[], int key, int n) {
  int mid, left = 0, right = n, f = 0;
  while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key) {
            f = 1;
            break;
        }
        else if (key < S[mid]) {
            right = mid;
        }
        else if (key > S[mid]) {
            left = mid + 1;
        }
  }
  return f;
}

int main (void) {
  int S[100000], n, q, i, key, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d", &key);
    if (binary (S, key, n)) {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

```

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

1
 0
 0
 4
 3
 0
 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 binary (int S[], int key, int n) {
  int mid, left = 0, right = n, f = 0;
  while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == key) {
            f = 1;
            break;
        }
        else if (key < S[mid]) {
            right = mid;
        }
        else if (key > S[mid]) {
            left = mid + 1;
        }
  }
  return f;
}

int main (void) {
  int S[100000], n, q, i, key, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &S[i]);
  }
  scanf("%d", &q);
  for (i = 0; i < q; ++i) {
    scanf("%d", &key);
    if (binary (S, key, n)) {
      cnt++;
    }
  }
  printf("%d\n", cnt);
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary
	.type	binary, @function
binary:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r8,%rdx), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	cmpl	%esi, (%rdi,%rcx,4)
	je	.L7
	jle	.L10
	movl	%eax, %edx
.L4:
	cmpl	%edx, %r8d
	jl	.L6
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	jge	.L4
	leal	1(%rax), %r8d
	jmp	.L4
	.cfi_endproc
.LFE23:
	.size	binary, .-binary
	.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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L13
.L12:
	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	.L14
	xorl	%r13d, %r13d
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	16(%rsp,%rsi,4), %edi
	je	.L16
	jge	.L29
	movl	%eax, %edx
.L17:
	cmpl	%ecx, %edx
	jg	.L19
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
.L14:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	addl	$1, %r12d
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L29:
	jle	.L17
	leal	1(%rax), %ecx
	jmp	.L17
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	binary
	.type	binary, @function
binary:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r8,%rdx), %ecx
	movl	%ecx, %eax
	shrl	$31, %eax
	addl	%ecx, %eax
	sarl	%eax
	movslq	%eax, %rcx
	cmpl	%esi, (%rdi,%rcx,4)
	je	.L7
	jle	.L10
	movl	%eax, %edx
.L4:
	cmpl	%edx, %r8d
	jl	.L6
	xorl	%eax, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	jge	.L4
	leal	1(%rax), %r8d
	jmp	.L4
	.cfi_endproc
.LFE23:
	.size	binary, .-binary
	.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	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r12
	cmpl	%ebp, 4(%rsp)
	jg	.L13
.L12:
	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	.L14
	xorl	%r13d, %r13d
	leaq	12(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L19:
	leal	(%rdx,%rcx), %eax
	sarl	%eax
	movslq	%eax, %rsi
	cmpl	16(%rsp,%rsi,4), %edi
	je	.L16
	jge	.L29
	movl	%eax, %edx
.L17:
	cmpl	%ecx, %edx
	jg	.L19
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
.L14:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	addl	$1, %r12d
	addl	$1, %r13d
	cmpl	%r13d, 8(%rsp)
	jg	.L20
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L29:
	jle	.L17
	leal	1(%rax), %ecx
	jmp	.L17
.L30:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:
```