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

```c
main(){
  int n,m,a,b,c,d[100010],r,i;
  while(scanf("%d %d %d %d %d",&n,&a,&b,&c,&m),n){
    for(i=0;i<n;i++)scanf("%d",&d[i]);
    for(i=r=0;i<10001;i++){
      if(d[r]==m)r++;
      if(r==n)break;
      m=(a*m+b)%c;
    }
    printf("%d\n",r-n?-1:i);
  }
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d %d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2792, %rsp
	.cfi_def_cfa_offset 400160
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400088(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	28(%rsp), %rax
	leaq	44(%rsp), %r14
	movq	%rax, (%rsp)
	leaq	40(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %r9
	movq	%r14, %r8
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rcx
	xorl	%eax, %eax
	call	scanf@PLT
	movl	28(%rsp), %edi
	testl	%edi, %edi
	je	.L9
	leaq	48(%rsp), %r12
	movl	$0, %ebp
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	scanf@PLT
	movl	28(%rsp), %edi
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L3
.L11:
	movl	32(%rsp), %edx
	movl	36(%rsp), %r10d
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	40(%rsp), %r9d
	movl	44(%rsp), %r8d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	imull	%r10d, %edx
	addl	$1, %esi
	movl	$1, %r11d
	leal	(%rdx,%r9), %eax
	cltd
	idivl	%r8d
	cmpl	$10001, %esi
	je	.L22
.L8:
	movslq	%ecx, %rax
	cmpl	%edx, 48(%rsp,%rax,4)
	jne	.L4
	addl	$1, %ecx
.L4:
	cmpl	%edi, %ecx
	jne	.L5
	testb	%r11b, %r11b
	je	.L7
	movl	%edx, 32(%rsp)
.L7:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 32(%rsp)
	movl	$-1, %esi
	jmp	.L7
.L9:
	movq	400088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d %d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2792, %rsp
	.cfi_def_cfa_offset 400160
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400088(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	28(%rsp), %rax
	leaq	44(%rsp), %r14
	movq	%rax, (%rsp)
	leaq	40(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %r9
	movq	%r14, %r8
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rcx
	xorl	%eax, %eax
	call	scanf@PLT
	movl	28(%rsp), %edi
	testl	%edi, %edi
	je	.L9
	leaq	48(%rsp), %r12
	movl	$0, %ebp
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	scanf@PLT
	movl	28(%rsp), %edi
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L3
.L11:
	movl	32(%rsp), %edx
	movl	36(%rsp), %r10d
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	40(%rsp), %r9d
	movl	44(%rsp), %r8d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	imull	%r10d, %edx
	addl	$1, %esi
	movl	$1, %r11d
	leal	(%rdx,%r9), %eax
	cltd
	idivl	%r8d
	cmpl	$10001, %esi
	je	.L22
.L8:
	movslq	%ecx, %rax
	cmpl	%edx, 48(%rsp,%rax,4)
	jne	.L4
	addl	$1, %ecx
.L4:
	cmpl	%edi, %ecx
	jne	.L5
	testb	%r11b, %r11b
	je	.L7
	movl	%edx, 32(%rsp)
.L7:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 32(%rsp)
	movl	$-1, %esi
	jmp	.L7
.L9:
	movq	400088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d %d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2792, %rsp
	.cfi_def_cfa_offset 400160
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400088(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	28(%rsp), %rax
	leaq	44(%rsp), %r14
	movq	%rax, (%rsp)
	leaq	40(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %r9
	movq	%r14, %r8
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rcx
	xorl	%eax, %eax
	call	scanf@PLT
	movl	28(%rsp), %edi
	testl	%edi, %edi
	je	.L9
	leaq	48(%rsp), %r12
	movl	$0, %ebp
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	scanf@PLT
	movl	28(%rsp), %edi
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L3
.L11:
	movl	32(%rsp), %edx
	movl	36(%rsp), %r10d
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	40(%rsp), %r9d
	movl	44(%rsp), %r8d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	imull	%r10d, %edx
	addl	$1, %esi
	movl	$1, %r11d
	leal	(%rdx,%r9), %eax
	cltd
	idivl	%r8d
	cmpl	$10001, %esi
	je	.L22
.L8:
	movslq	%ecx, %rax
	cmpl	%edx, 48(%rsp,%rax,4)
	jne	.L4
	addl	$1, %ecx
.L4:
	cmpl	%edi, %ecx
	jne	.L5
	testb	%r11b, %r11b
	je	.L7
	movl	%edx, 32(%rsp)
.L7:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 32(%rsp)
	movl	$-1, %esi
	jmp	.L7
.L9:
	movq	400088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.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
main(){
  int n,m,a,b,c,d[100010],r,i;
  while(scanf("%d %d %d %d %d",&n,&a,&b,&c,&m),n){
    for(i=0;i<n;i++)scanf("%d",&d[i]);
    for(i=r=0;i<10001;i++){
      if(d[r]==m)r++;
      if(r==n)break;
      m=(a*m+b)%c;
    }
    printf("%d\n",r-n?-1:i);
  }
  return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
main(){
  int n,m,a,b,c,d[100010],r,i;
  while(scanf("%d %d %d %d %d",&n,&a,&b,&c,&m),n){
    for(i=0;i<n;i++)scanf("%d",&d[i]);
    for(i=r=0;i<10001;i++){
      if(d[r]==m)r++;
      if(r==n)break;
      m=(a*m+b)%c;
    }
    printf("%d\n",r-n?-1:i);
  }
  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:

1 5 7 11 10
10
2 5 7 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
2 1 2 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 5 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 2 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 5 11 10
2 4
2 1 0 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 2 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 5 11 20
2 4
2 1 0 256 0
128 255
2 0 0 1 0
1751 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 1 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 7 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 2 10000 0
1 0
2 1 1 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
11
2 5 5 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 2 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
20
2 5 5 11 10
2 4
2 1 0 256 0
128 255
2 0 0 1 0
1264 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 2 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 5 11 10
2 4
2 1 0 256 0
128 255
2 0 0 1 0
1751 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 0 10000 0
1 0
3 1 1 10000 0
2 1
0 0 0 0 0
 1 5 7 11 10
10
2 5 3 11 10
2 4
2 1 1 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 2 10000 0
1 0
2 1 1 10000 0
2 1
0 0 0 0 0
 1 5 7 5 10
10
2 1 5 11 10
2 4
2 1 0 256 0
128 255
2 0 0 1 0
1234 5678
2 1 1 100 0
99 98
2 1 1 100 0
99 99
2 1 1 10000 0
1 0
3 1 2 10000 0
2 1
0 0 0 0 0

0
3
255
-1
198
199
10000
-1
 0
-1
255
-1
198
199
10000
-1
 0
-1
-1
-1
198
199
10000
-1
 0
3
-1
-1
198
199
10000
-1
 0
3
255
-1
198
199
-1
-1
 -1
-1
255
-1
198
199
10000
-1
 -1
-1
-1
-1
198
199
10000
-1
 0
-1
-1
-1
198
199
-1
-1
 0
-1
255
-1
198
199
-1
-1
 0
12
-1
-1
198
199
10000
-1

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

```c
main(){
  int n,m,a,b,c,d[100010],r,i;
  while(scanf("%d %d %d %d %d",&n,&a,&b,&c,&m),n){
    for(i=0;i<n;i++)scanf("%d",&d[i]);
    for(i=r=0;i<10001;i++){
      if(d[r]==m)r++;
      if(r==n)break;
      m=(a*m+b)%c;
    }
    printf("%d\n",r-n?-1:i);
  }
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d %d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2792, %rsp
	.cfi_def_cfa_offset 400160
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400088(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	28(%rsp), %rax
	leaq	44(%rsp), %r14
	movq	%rax, (%rsp)
	leaq	40(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %r9
	movq	%r14, %r8
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rcx
	xorl	%eax, %eax
	call	scanf@PLT
	movl	28(%rsp), %edi
	testl	%edi, %edi
	je	.L9
	leaq	48(%rsp), %r12
	movl	$0, %ebp
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	scanf@PLT
	movl	28(%rsp), %edi
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L3
.L11:
	movl	32(%rsp), %edx
	movl	36(%rsp), %r10d
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	40(%rsp), %r9d
	movl	44(%rsp), %r8d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	imull	%r10d, %edx
	addl	$1, %esi
	movl	$1, %r11d
	leal	(%rdx,%r9), %eax
	cltd
	idivl	%r8d
	cmpl	$10001, %esi
	je	.L22
.L8:
	movslq	%ecx, %rax
	cmpl	%edx, 48(%rsp,%rax,4)
	jne	.L4
	addl	$1, %ecx
.L4:
	cmpl	%edi, %ecx
	jne	.L5
	testb	%r11b, %r11b
	je	.L7
	movl	%edx, 32(%rsp)
.L7:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 32(%rsp)
	movl	$-1, %esi
	jmp	.L7
.L9:
	movq	400088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d %d %d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2792, %rsp
	.cfi_def_cfa_offset 400160
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 400088(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	32(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	28(%rsp), %rax
	leaq	44(%rsp), %r14
	movq	%rax, (%rsp)
	leaq	40(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	movq	%r15, %r9
	movq	%r14, %r8
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rcx
	xorl	%eax, %eax
	call	scanf@PLT
	movl	28(%rsp), %edi
	testl	%edi, %edi
	je	.L9
	leaq	48(%rsp), %r12
	movl	$0, %ebp
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	scanf@PLT
	movl	28(%rsp), %edi
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L3
.L11:
	movl	32(%rsp), %edx
	movl	36(%rsp), %r10d
	xorl	%r11d, %r11d
	xorl	%esi, %esi
	movl	40(%rsp), %r9d
	movl	44(%rsp), %r8d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	imull	%r10d, %edx
	addl	$1, %esi
	movl	$1, %r11d
	leal	(%rdx,%r9), %eax
	cltd
	idivl	%r8d
	cmpl	$10001, %esi
	je	.L22
.L8:
	movslq	%ecx, %rax
	cmpl	%edx, 48(%rsp,%rax,4)
	jne	.L4
	addl	$1, %ecx
.L4:
	cmpl	%edi, %ecx
	jne	.L5
	testb	%r11b, %r11b
	je	.L7
	movl	%edx, 32(%rsp)
.L7:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%edx, 32(%rsp)
	movl	$-1, %esi
	jmp	.L7
.L9:
	movq	400088(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400104, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.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:
```