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,i,p,c,ans=0;
int a[100000],x[100000],y[100000];

int main(){
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    x[i]=-1;
    y[i]=-1;
  }
  for(i=0;i<n;i++){
    p=i;
    c=0;
    while(x[p]==-1){
      x[p]=c;
      c++;
      y[p]=i;
      p=(p+a[p])%n;
    }
    if(y[p]==i)ans+=(c-x[p]);
  }
  printf("%d\n",ans);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L22
	xorl	%eax, %eax
	leaq	a(%rip), %r12
	leaq	x(%rip), %rbx
	leaq	y(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%r13, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	n(%rip), %esi
	movq	%rdx, %rax
	movl	$-1, (%rbx,%rdx,4)
	addl	$1, %eax
	movl	$-1, 0(%rbp,%rdx,4)
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L2
	movl	ans(%rip), %r13d
	movl	$0, i(%rip)
	movl	%r13d, %r10d
	testl	%esi, %esi
	jle	.L3
	movslq	%esi, %r9
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx,%r8,4), %eax
	movl	%r8d, %edi
	movl	%r8d, %edx
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edx, %rax
	addl	(%r12,%rax,4), %edx
	movl	%ecx, (%rbx,%rax,4)
	addl	$1, %ecx
	movl	%edi, 0(%rbp,%rax,4)
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$-1, %eax
	je	.L6
.L5:
	movslq	%edx, %rdi
	cmpl	%r8d, 0(%rbp,%rdi,4)
	jne	.L7
	movl	%ecx, %edi
	movl	$1, %r11d
	subl	%eax, %edi
	addl	%edi, %r10d
.L7:
	addq	$1, %r8
	cmpq	%r8, %r9
	jne	.L8
	movl	%esi, i(%rip)
	movl	%edx, p(%rip)
	movl	%ecx, c(%rip)
	testb	%r11b, %r11b
	je	.L3
	movl	%r10d, ans(%rip)
	movl	%r10d, %r13d
.L3:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L22:
	.cfi_restore_state
	movl	ans(%rip), %r13d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L22
	xorl	%eax, %eax
	leaq	a(%rip), %r12
	leaq	x(%rip), %rbx
	leaq	y(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%r13, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	n(%rip), %esi
	movq	%rdx, %rax
	movl	$-1, (%rbx,%rdx,4)
	addl	$1, %eax
	movl	$-1, 0(%rbp,%rdx,4)
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L2
	movl	ans(%rip), %r13d
	movl	$0, i(%rip)
	movl	%r13d, %r10d
	testl	%esi, %esi
	jle	.L3
	movslq	%esi, %r9
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx,%r8,4), %eax
	movl	%r8d, %edi
	movl	%r8d, %edx
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edx, %rax
	addl	(%r12,%rax,4), %edx
	movl	%ecx, (%rbx,%rax,4)
	addl	$1, %ecx
	movl	%edi, 0(%rbp,%rax,4)
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$-1, %eax
	je	.L6
.L5:
	movslq	%edx, %rdi
	cmpl	%r8d, 0(%rbp,%rdi,4)
	jne	.L7
	movl	%ecx, %edi
	movl	$1, %r11d
	subl	%eax, %edi
	addl	%edi, %r10d
.L7:
	addq	$1, %r8
	cmpq	%r8, %r9
	jne	.L8
	movl	%esi, i(%rip)
	movl	%edx, p(%rip)
	movl	%ecx, c(%rip)
	testb	%r11b, %r11b
	je	.L3
	movl	%r10d, ans(%rip)
	movl	%r10d, %r13d
.L3:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L22:
	.cfi_restore_state
	movl	ans(%rip), %r13d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L22
	xorl	%eax, %eax
	leaq	a(%rip), %r12
	leaq	x(%rip), %rbx
	leaq	y(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%r13, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	n(%rip), %esi
	movq	%rdx, %rax
	movl	$-1, (%rbx,%rdx,4)
	addl	$1, %eax
	movl	$-1, 0(%rbp,%rdx,4)
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L2
	movl	ans(%rip), %r13d
	movl	$0, i(%rip)
	movl	%r13d, %r10d
	testl	%esi, %esi
	jle	.L3
	movslq	%esi, %r9
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx,%r8,4), %eax
	movl	%r8d, %edi
	movl	%r8d, %edx
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edx, %rax
	addl	(%r12,%rax,4), %edx
	movl	%ecx, (%rbx,%rax,4)
	addl	$1, %ecx
	movl	%edi, 0(%rbp,%rax,4)
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$-1, %eax
	je	.L6
.L5:
	movslq	%edx, %rdi
	cmpl	%r8d, 0(%rbp,%rdi,4)
	jne	.L7
	movl	%ecx, %edi
	movl	$1, %r11d
	subl	%eax, %edi
	addl	%edi, %r10d
.L7:
	addq	$1, %r8
	cmpq	%r8, %r9
	jne	.L8
	movl	%esi, i(%rip)
	movl	%edx, p(%rip)
	movl	%ecx, c(%rip)
	testb	%r11b, %r11b
	je	.L3
	movl	%r10d, ans(%rip)
	movl	%r10d, %r13d
.L3:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L22:
	.cfi_restore_state
	movl	ans(%rip), %r13d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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,i,p,c,ans=0;
int a[100000],x[100000],y[100000];

int main(){
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    x[i]=-1;
    y[i]=-1;
  }
  for(i=0;i<n;i++){
    p=i;
    c=0;
    while(x[p]==-1){
      x[p]=c;
      c++;
      y[p]=i;
      p=(p+a[p])%n;
    }
    if(y[p]==i)ans+=(c-x[p]);
  }
  printf("%d\n",ans);
  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,i,p,c,ans=0;
int a[100000],x[100000],y[100000];

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

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

2
 6
 1
 3
 5
 4
 7
 8
 1
 2

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,i,p,c,ans=0;
int a[100000],x[100000],y[100000];

int main(){
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    x[i]=-1;
    y[i]=-1;
  }
  for(i=0;i<n;i++){
    p=i;
    c=0;
    while(x[p]==-1){
      x[p]=c;
      c++;
      y[p]=i;
      p=(p+a[p])%n;
    }
    if(y[p]==i)ans+=(c-x[p]);
  }
  printf("%d\n",ans);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L22
	xorl	%eax, %eax
	leaq	a(%rip), %r12
	leaq	x(%rip), %rbx
	leaq	y(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%r13, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	n(%rip), %esi
	movq	%rdx, %rax
	movl	$-1, (%rbx,%rdx,4)
	addl	$1, %eax
	movl	$-1, 0(%rbp,%rdx,4)
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L2
	movl	ans(%rip), %r13d
	movl	$0, i(%rip)
	movl	%r13d, %r10d
	testl	%esi, %esi
	jle	.L3
	movslq	%esi, %r9
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx,%r8,4), %eax
	movl	%r8d, %edi
	movl	%r8d, %edx
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edx, %rax
	addl	(%r12,%rax,4), %edx
	movl	%ecx, (%rbx,%rax,4)
	addl	$1, %ecx
	movl	%edi, 0(%rbp,%rax,4)
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$-1, %eax
	je	.L6
.L5:
	movslq	%edx, %rdi
	cmpl	%r8d, 0(%rbp,%rdi,4)
	jne	.L7
	movl	%ecx, %edi
	movl	$1, %r11d
	subl	%eax, %edi
	addl	%edi, %r10d
.L7:
	addq	$1, %r8
	cmpq	%r8, %r9
	jne	.L8
	movl	%esi, i(%rip)
	movl	%edx, p(%rip)
	movl	%ecx, c(%rip)
	testb	%r11b, %r11b
	je	.L3
	movl	%r10d, ans(%rip)
	movl	%r10d, %r13d
.L3:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L22:
	.cfi_restore_state
	movl	ans(%rip), %r13d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L22
	xorl	%eax, %eax
	leaq	a(%rip), %r12
	leaq	x(%rip), %rbx
	leaq	y(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%r13, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rdx
	movl	n(%rip), %esi
	movq	%rdx, %rax
	movl	$-1, (%rbx,%rdx,4)
	addl	$1, %eax
	movl	$-1, 0(%rbp,%rdx,4)
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L2
	movl	ans(%rip), %r13d
	movl	$0, i(%rip)
	movl	%r13d, %r10d
	testl	%esi, %esi
	jle	.L3
	movslq	%esi, %r9
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rbx,%r8,4), %eax
	movl	%r8d, %edi
	movl	%r8d, %edx
	xorl	%ecx, %ecx
	cmpl	$-1, %eax
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%edx, %rax
	addl	(%r12,%rax,4), %edx
	movl	%ecx, (%rbx,%rax,4)
	addl	$1, %ecx
	movl	%edi, 0(%rbp,%rax,4)
	movl	%edx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$-1, %eax
	je	.L6
.L5:
	movslq	%edx, %rdi
	cmpl	%r8d, 0(%rbp,%rdi,4)
	jne	.L7
	movl	%ecx, %edi
	movl	$1, %r11d
	subl	%eax, %edi
	addl	%edi, %r10d
.L7:
	addq	$1, %r8
	cmpq	%r8, %r9
	jne	.L8
	movl	%esi, i(%rip)
	movl	%edx, p(%rip)
	movl	%ecx, c(%rip)
	testb	%r11b, %r11b
	je	.L3
	movl	%r10d, ans(%rip)
	movl	%r10d, %r13d
.L3:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %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
.L22:
	.cfi_restore_state
	movl	ans(%rip), %r13d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 400000
a:
	.zero	400000
	.globl	ans
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:
```