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 10000
#define Q 500
#define NOT_FOUND -1



int count=0,n;

int linear(int a[],int key){
  int i=0;
  a[n]=key;
  while(a[i]!=key)
    i++;
  if(i==n)return NOT_FOUND;
  return i;
}




int main(){
  int a[N],b[Q],i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&b[i]);

  for(i=0;i<q;i++)
    if(linear(a,b[i])!=NOT_FOUND)count++;

  printf("%d\n",count);
  return 0;
}



```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	linear
	.type	linear, @function
linear:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	n(%rip), %rax
	movl	%esi, (%rdi,%rax,4)
	cmpl	(%rdi), %esi
	je	.L5
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpl	%esi, -4(%rdi,%rax,4)
	jne	.L3
.L2:
	cmpl	%r8d, n(%rip)
	je	.L8
.L1:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%r8d, %r8d
	jmp	.L2
.L8:
	movl	$-1, %r8d
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	linear, .-linear
	.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	-40960(%rsp), %r11
	.cfi_def_cfa 11, 41000
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1080, %rsp
	.cfi_def_cfa_offset 42080
	leaq	.LC0(%rip), %r12
	leaq	n(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 42024(%rsp)
	xorl	%eax, %eax
	leaq	2016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L13
.L14:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	leaq	16(%rsp), %r13
	movq	%r13, %rbp
	testl	%eax, %eax
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L16
	movl	count(%rip), %r12d
	movl	%r12d, %r8d
	testl	%eax, %eax
	jle	.L15
	movslq	n(%rip), %rdx
	subl	$1, %eax
	leaq	4(%r13), %rdi
	xorl	%r10d, %r10d
	leaq	2016(%rsp), %rsi
	leaq	(%rdi,%rax,4), %r11
	leaq	(%rsi,%rdx,4), %rbx
	movq	%rdx, %r9
	movl	0(%r13), %edx
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	je	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpl	-4(%rsi,%rax,4), %edx
	jne	.L18
.L17:
	cmpl	%ecx, %r9d
	je	.L19
	addl	$1, %r8d
	movl	$1, %r10d
.L19:
	movq	%rdi, %r13
	cmpq	%rdi, %r11
	je	.L32
	movl	0(%r13), %edx
	addq	$4, %rdi
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	jne	.L36
.L22:
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r10b, %r10b
	je	.L15
	movl	%r8d, count(%rip)
	movl	%r8d, %r12d
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	42024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$42040, %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
.L35:
	.cfi_restore_state
	movl	count(%rip), %r12d
	jmp	.L15
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.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	linear
	.type	linear, @function
linear:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	n(%rip), %rax
	movl	%esi, (%rdi,%rax,4)
	cmpl	(%rdi), %esi
	je	.L5
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpl	%esi, -4(%rdi,%rax,4)
	jne	.L3
.L2:
	cmpl	%r8d, n(%rip)
	je	.L8
.L1:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%r8d, %r8d
	jmp	.L2
.L8:
	movl	$-1, %r8d
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	linear, .-linear
	.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	-40960(%rsp), %r11
	.cfi_def_cfa 11, 41000
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1080, %rsp
	.cfi_def_cfa_offset 42080
	leaq	.LC0(%rip), %r12
	leaq	n(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 42024(%rsp)
	xorl	%eax, %eax
	leaq	2016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L13
.L14:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	leaq	16(%rsp), %r13
	movq	%r13, %rbp
	testl	%eax, %eax
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L16
	movl	count(%rip), %r12d
	movl	%r12d, %r8d
	testl	%eax, %eax
	jle	.L15
	movslq	n(%rip), %rdx
	subl	$1, %eax
	leaq	4(%r13), %rdi
	xorl	%r10d, %r10d
	leaq	2016(%rsp), %rsi
	leaq	(%rdi,%rax,4), %r11
	leaq	(%rsi,%rdx,4), %rbx
	movq	%rdx, %r9
	movl	0(%r13), %edx
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	je	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpl	-4(%rsi,%rax,4), %edx
	jne	.L18
.L17:
	cmpl	%ecx, %r9d
	je	.L19
	addl	$1, %r8d
	movl	$1, %r10d
.L19:
	movq	%rdi, %r13
	cmpq	%rdi, %r11
	je	.L32
	movl	0(%r13), %edx
	addq	$4, %rdi
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	jne	.L36
.L22:
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r10b, %r10b
	je	.L15
	movl	%r8d, count(%rip)
	movl	%r8d, %r12d
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	42024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$42040, %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
.L35:
	.cfi_restore_state
	movl	count(%rip), %r12d
	jmp	.L15
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.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	linear
	.type	linear, @function
linear:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	n(%rip), %rax
	movl	%esi, (%rdi,%rax,4)
	cmpl	(%rdi), %esi
	je	.L5
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpl	%esi, -4(%rdi,%rax,4)
	jne	.L3
.L2:
	cmpl	%r8d, n(%rip)
	je	.L8
.L1:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%r8d, %r8d
	jmp	.L2
.L8:
	movl	$-1, %r8d
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	linear, .-linear
	.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	-40960(%rsp), %r11
	.cfi_def_cfa 11, 41000
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1080, %rsp
	.cfi_def_cfa_offset 42080
	leaq	.LC0(%rip), %r12
	leaq	n(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 42024(%rsp)
	xorl	%eax, %eax
	leaq	2016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L13
.L14:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	leaq	16(%rsp), %r13
	movq	%r13, %rbp
	testl	%eax, %eax
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L16
	movl	count(%rip), %r12d
	movl	%r12d, %r8d
	testl	%eax, %eax
	jle	.L15
	movslq	n(%rip), %rdx
	subl	$1, %eax
	leaq	4(%r13), %rdi
	xorl	%r10d, %r10d
	leaq	2016(%rsp), %rsi
	leaq	(%rdi,%rax,4), %r11
	leaq	(%rsi,%rdx,4), %rbx
	movq	%rdx, %r9
	movl	0(%r13), %edx
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	je	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpl	-4(%rsi,%rax,4), %edx
	jne	.L18
.L17:
	cmpl	%ecx, %r9d
	je	.L19
	addl	$1, %r8d
	movl	$1, %r10d
.L19:
	movq	%rdi, %r13
	cmpq	%rdi, %r11
	je	.L32
	movl	0(%r13), %edx
	addq	$4, %rdi
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	jne	.L36
.L22:
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r10b, %r10b
	je	.L15
	movl	%r8d, count(%rip)
	movl	%r8d, %r12d
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	42024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$42040, %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
.L35:
	.cfi_restore_state
	movl	count(%rip), %r12d
	jmp	.L15
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.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>
#define N 10000
#define Q 500
#define NOT_FOUND -1



int count=0,n;

int linear(int a[],int key){
  int i=0;
  a[n]=key;
  while(a[i]!=key)
    i++;
  if(i==n)return NOT_FOUND;
  return i;
}




int main(){
  int a[N],b[Q],i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&b[i]);

  for(i=0;i<q;i++)
    if(linear(a,b[i])!=NOT_FOUND)count++;

  printf("%d\n",count);
  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 10000
#define Q 500
#define NOT_FOUND -1



int count=0,n;

int linear(int a[],int key){
  int i=0;
  a[n]=key;
  while(a[i]!=key)
    i++;
  if(i==n)return NOT_FOUND;
  return i;
}




int main(){
  int a[N],b[Q],i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&b[i]);

  for(i=0;i<q;i++)
    if(linear(a,b[i])!=NOT_FOUND)count++;

  printf("%d\n",count);
  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 2 3 4 5
3
3 4 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>
#define N 10000
#define Q 500
#define NOT_FOUND -1



int count=0,n;

int linear(int a[],int key){
  int i=0;
  a[n]=key;
  while(a[i]!=key)
    i++;
  if(i==n)return NOT_FOUND;
  return i;
}




int main(){
  int a[N],b[Q],i,q;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&b[i]);

  for(i=0;i<q;i++)
    if(linear(a,b[i])!=NOT_FOUND)count++;

  printf("%d\n",count);
  return 0;
}



```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	linear
	.type	linear, @function
linear:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	n(%rip), %rax
	movl	%esi, (%rdi,%rax,4)
	cmpl	(%rdi), %esi
	je	.L5
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpl	%esi, -4(%rdi,%rax,4)
	jne	.L3
.L2:
	cmpl	%r8d, n(%rip)
	je	.L8
.L1:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%r8d, %r8d
	jmp	.L2
.L8:
	movl	$-1, %r8d
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	linear, .-linear
	.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	-40960(%rsp), %r11
	.cfi_def_cfa 11, 41000
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1080, %rsp
	.cfi_def_cfa_offset 42080
	leaq	.LC0(%rip), %r12
	leaq	n(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 42024(%rsp)
	xorl	%eax, %eax
	leaq	2016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L13
.L14:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	leaq	16(%rsp), %r13
	movq	%r13, %rbp
	testl	%eax, %eax
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L16
	movl	count(%rip), %r12d
	movl	%r12d, %r8d
	testl	%eax, %eax
	jle	.L15
	movslq	n(%rip), %rdx
	subl	$1, %eax
	leaq	4(%r13), %rdi
	xorl	%r10d, %r10d
	leaq	2016(%rsp), %rsi
	leaq	(%rdi,%rax,4), %r11
	leaq	(%rsi,%rdx,4), %rbx
	movq	%rdx, %r9
	movl	0(%r13), %edx
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	je	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpl	-4(%rsi,%rax,4), %edx
	jne	.L18
.L17:
	cmpl	%ecx, %r9d
	je	.L19
	addl	$1, %r8d
	movl	$1, %r10d
.L19:
	movq	%rdi, %r13
	cmpq	%rdi, %r11
	je	.L32
	movl	0(%r13), %edx
	addq	$4, %rdi
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	jne	.L36
.L22:
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r10b, %r10b
	je	.L15
	movl	%r8d, count(%rip)
	movl	%r8d, %r12d
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	42024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$42040, %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
.L35:
	.cfi_restore_state
	movl	count(%rip), %r12d
	jmp	.L15
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.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	linear
	.type	linear, @function
linear:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	n(%rip), %rax
	movl	%esi, (%rdi,%rax,4)
	cmpl	(%rdi), %esi
	je	.L5
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r8d
	addq	$1, %rax
	cmpl	%esi, -4(%rdi,%rax,4)
	jne	.L3
.L2:
	cmpl	%r8d, n(%rip)
	je	.L8
.L1:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%r8d, %r8d
	jmp	.L2
.L8:
	movl	$-1, %r8d
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	linear, .-linear
	.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	-40960(%rsp), %r11
	.cfi_def_cfa 11, 41000
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1080, %rsp
	.cfi_def_cfa_offset 42080
	leaq	.LC0(%rip), %r12
	leaq	n(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 42024(%rsp)
	xorl	%eax, %eax
	leaq	2016(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r12, %rdi
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, n(%rip)
	jg	.L13
.L14:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	leaq	16(%rsp), %r13
	movq	%r13, %rbp
	testl	%eax, %eax
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	addq	$4, %rbp
	cmpl	%ebx, %eax
	jg	.L16
	movl	count(%rip), %r12d
	movl	%r12d, %r8d
	testl	%eax, %eax
	jle	.L15
	movslq	n(%rip), %rdx
	subl	$1, %eax
	leaq	4(%r13), %rdi
	xorl	%r10d, %r10d
	leaq	2016(%rsp), %rsi
	leaq	(%rdi,%rax,4), %r11
	leaq	(%rsi,%rdx,4), %rbx
	movq	%rdx, %r9
	movl	0(%r13), %edx
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	je	.L22
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpl	-4(%rsi,%rax,4), %edx
	jne	.L18
.L17:
	cmpl	%ecx, %r9d
	je	.L19
	addl	$1, %r8d
	movl	$1, %r10d
.L19:
	movq	%rdi, %r13
	cmpq	%rdi, %r11
	je	.L32
	movl	0(%r13), %edx
	addq	$4, %rdi
	movl	%edx, (%rbx)
	cmpl	2016(%rsp), %edx
	jne	.L36
.L22:
	xorl	%ecx, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L32:
	testb	%r10b, %r10b
	je	.L15
	movl	%r8d, count(%rip)
	movl	%r8d, %r12d
.L15:
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	42024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$42040, %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
.L35:
	.cfi_restore_state
	movl	count(%rip), %r12d
	jmp	.L15
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.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:
```