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

```c
rd(){
	int x=0,k;
	for(;;)
	{
		k=getchar_unlocked();
		if(k<'0'||k>'9')break;
		x=x*10+k-'0';
	}
	return x;
}
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t;
main()
{
	N=rd();
	for(i=0;i<N;i++)
	{
		++sum[cnt[rd()]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)printf("%d\n",ans[i]);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	rd
	.type	rd, @function
rd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r12,%r12,4), %edx
	leal	-48(%rax,%rdx,2), %r12d
.L3:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L6
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	rd, .-rd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L9:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L37
	movl	%ebx, N(%rip)
	leaq	cnt(%rip), %r12
	leaq	sum(%rip), %rbp
	movl	$0, i(%rip)
	testl	%ebx, %ebx
	je	.L38
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ebx, %ebx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L39:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L13:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L39
	movslq	%ebx, %rbx
	movslq	N(%rip), %r8
	movslq	(%r12,%rbx,4), %rax
	leal	1(%rax), %edx
	addl	$1, 0(%rbp,%rax,4)
	movl	i(%rip), %eax
	movl	%edx, (%r12,%rbx,4)
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%r8d, %eax
	jl	.L10
	movl	%r8d, t(%rip)
	testl	%r8d, %r8d
	jle	.L16
	movl	acc(%rip), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	ans(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%edx, %eax
	movl	%r8d, %r10d
	leal	-1(%rdx), %r9d
	imull	%r8d, %eax
	cmpl	%eax, %ecx
	jl	.L21
	movslq	%edx, %rsi
	addl	%r8d, %eax
	leaq	0(%rbp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r9d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r10d, %eax
	cmpl	%edi, %ecx
	jge	.L18
	movl	$1, %esi
.L21:
	movl	%r9d, (%rbx,%r8,4)
	subq	$1, %r8
	testl	%r8d, %r8d
	jg	.L17
	movl	$0, t(%rip)
	testb	%sil, %sil
	je	.L16
	movl	%ecx, acc(%rip)
.L16:
	movl	N(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	leaq	ans(%rip), %rbx
	leaq	.LC0(%rip), %rbp
	testl	%edx, %edx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L23:
	cltq
	movq	%rbp, %rdi
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jle	.L23
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L38:
	.cfi_restore_state
	movl	$0, t(%rip)
	jmp	.L16
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.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
	.globl	ans
	.align 32
	.type	ans, @object
	.size	ans, 1572864
ans:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	sum
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.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	rd
	.type	rd, @function
rd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r12,%r12,4), %edx
	leal	-48(%rax,%rdx,2), %r12d
.L3:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L6
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	rd, .-rd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L9:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L37
	movl	%ebx, N(%rip)
	leaq	cnt(%rip), %r12
	leaq	sum(%rip), %rbp
	movl	$0, i(%rip)
	testl	%ebx, %ebx
	je	.L38
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ebx, %ebx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L39:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L13:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L39
	movslq	%ebx, %rbx
	movslq	N(%rip), %r8
	movslq	(%r12,%rbx,4), %rax
	leal	1(%rax), %edx
	addl	$1, 0(%rbp,%rax,4)
	movl	i(%rip), %eax
	movl	%edx, (%r12,%rbx,4)
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%r8d, %eax
	jl	.L10
	movl	%r8d, t(%rip)
	testl	%r8d, %r8d
	jle	.L16
	movl	acc(%rip), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	ans(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%edx, %eax
	movl	%r8d, %r10d
	leal	-1(%rdx), %r9d
	imull	%r8d, %eax
	cmpl	%eax, %ecx
	jl	.L21
	movslq	%edx, %rsi
	addl	%r8d, %eax
	leaq	0(%rbp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r9d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r10d, %eax
	cmpl	%edi, %ecx
	jge	.L18
	movl	$1, %esi
.L21:
	movl	%r9d, (%rbx,%r8,4)
	subq	$1, %r8
	testl	%r8d, %r8d
	jg	.L17
	movl	$0, t(%rip)
	testb	%sil, %sil
	je	.L16
	movl	%ecx, acc(%rip)
.L16:
	movl	N(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	leaq	ans(%rip), %rbx
	leaq	.LC0(%rip), %rbp
	testl	%edx, %edx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L23:
	cltq
	movq	%rbp, %rdi
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jle	.L23
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L38:
	.cfi_restore_state
	movl	$0, t(%rip)
	jmp	.L16
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.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
	.globl	ans
	.align 32
	.type	ans, @object
	.size	ans, 1572864
ans:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	sum
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.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	rd
	.type	rd, @function
rd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r12,%r12,4), %edx
	leal	-48(%rax,%rdx,2), %r12d
.L3:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L6
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	rd, .-rd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L9:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L37
	movl	%ebx, N(%rip)
	leaq	cnt(%rip), %r12
	leaq	sum(%rip), %rbp
	movl	$0, i(%rip)
	testl	%ebx, %ebx
	je	.L38
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ebx, %ebx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L39:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L13:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L39
	movslq	%ebx, %rbx
	movslq	N(%rip), %r8
	movslq	(%r12,%rbx,4), %rax
	leal	1(%rax), %edx
	addl	$1, 0(%rbp,%rax,4)
	movl	i(%rip), %eax
	movl	%edx, (%r12,%rbx,4)
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%r8d, %eax
	jl	.L10
	movl	%r8d, t(%rip)
	testl	%r8d, %r8d
	jle	.L16
	movl	acc(%rip), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	ans(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%edx, %eax
	movl	%r8d, %r10d
	leal	-1(%rdx), %r9d
	imull	%r8d, %eax
	cmpl	%eax, %ecx
	jl	.L21
	movslq	%edx, %rsi
	addl	%r8d, %eax
	leaq	0(%rbp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r9d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r10d, %eax
	cmpl	%edi, %ecx
	jge	.L18
	movl	$1, %esi
.L21:
	movl	%r9d, (%rbx,%r8,4)
	subq	$1, %r8
	testl	%r8d, %r8d
	jg	.L17
	movl	$0, t(%rip)
	testb	%sil, %sil
	je	.L16
	movl	%ecx, acc(%rip)
.L16:
	movl	N(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	leaq	ans(%rip), %rbx
	leaq	.LC0(%rip), %rbp
	testl	%edx, %edx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L23:
	cltq
	movq	%rbp, %rdi
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jle	.L23
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L38:
	.cfi_restore_state
	movl	$0, t(%rip)
	jmp	.L16
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.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
	.globl	ans
	.align 32
	.type	ans, @object
	.size	ans, 1572864
ans:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	sum
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.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
rd(){
	int x=0,k;
	for(;;)
	{
		k=getchar_unlocked();
		if(k<'0'||k>'9')break;
		x=x*10+k-'0';
	}
	return x;
}
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t;
main()
{
	N=rd();
	for(i=0;i<N;i++)
	{
		++sum[cnt[rd()]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)printf("%d\n",ans[i]);
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
rd(){
	int x=0,k;
	for(;;)
	{
		k=getchar_unlocked();
		if(k<'0'||k>'9')break;
		x=x*10+k-'0';
	}
	return x;
}
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t;
main()
{
	N=rd();
	for(i=0;i<N;i++)
	{
		++sum[cnt[rd()]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)printf("%d\n",ans[i]);
}```

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:

4
1 3 1 3
 4
1 3 3 2
 3
2 2 2
 4
2 3 2 2
 5
1 2 3 3 5
 5
2 2 3 3 5
 4
2 3 4 1
 4
2 2 2 2
 5
4 2 2 4 4
 3
2 2 1

4
2
0
0
 4
2
1
0
 3
0
0
 4
1
0
0
 5
2
1
1
0
 5
2
1
0
0
 4
2
1
1
 4
0
0
0
 5
2
0
0
0
 3
1
0

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

```c
rd(){
	int x=0,k;
	for(;;)
	{
		k=getchar_unlocked();
		if(k<'0'||k>'9')break;
		x=x*10+k-'0';
	}
	return x;
}
sum[3<<17],cnt[3<<17],ans[3<<17];
N,i,acc,t;
main()
{
	N=rd();
	for(i=0;i<N;i++)
	{
		++sum[cnt[rd()]++];
	}
	i=0;
	for(t=N;t>0;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		ans[t]=i-1;
	}
	for(i=1;i<=N;i++)printf("%d\n",ans[i]);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	rd
	.type	rd, @function
rd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r12,%r12,4), %edx
	leal	-48(%rax,%rdx,2), %r12d
.L3:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L6
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	rd, .-rd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L9:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L37
	movl	%ebx, N(%rip)
	leaq	cnt(%rip), %r12
	leaq	sum(%rip), %rbp
	movl	$0, i(%rip)
	testl	%ebx, %ebx
	je	.L38
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ebx, %ebx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L39:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L13:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L39
	movslq	%ebx, %rbx
	movslq	N(%rip), %r8
	movslq	(%r12,%rbx,4), %rax
	leal	1(%rax), %edx
	addl	$1, 0(%rbp,%rax,4)
	movl	i(%rip), %eax
	movl	%edx, (%r12,%rbx,4)
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%r8d, %eax
	jl	.L10
	movl	%r8d, t(%rip)
	testl	%r8d, %r8d
	jle	.L16
	movl	acc(%rip), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	ans(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%edx, %eax
	movl	%r8d, %r10d
	leal	-1(%rdx), %r9d
	imull	%r8d, %eax
	cmpl	%eax, %ecx
	jl	.L21
	movslq	%edx, %rsi
	addl	%r8d, %eax
	leaq	0(%rbp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r9d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r10d, %eax
	cmpl	%edi, %ecx
	jge	.L18
	movl	$1, %esi
.L21:
	movl	%r9d, (%rbx,%r8,4)
	subq	$1, %r8
	testl	%r8d, %r8d
	jg	.L17
	movl	$0, t(%rip)
	testb	%sil, %sil
	je	.L16
	movl	%ecx, acc(%rip)
.L16:
	movl	N(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	leaq	ans(%rip), %rbx
	leaq	.LC0(%rip), %rbp
	testl	%edx, %edx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L23:
	cltq
	movq	%rbp, %rdi
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jle	.L23
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L38:
	.cfi_restore_state
	movl	$0, t(%rip)
	jmp	.L16
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.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
	.globl	ans
	.align 32
	.type	ans, @object
	.size	ans, 1572864
ans:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	sum
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.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	rd
	.type	rd, @function
rd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%r12,%r12,4), %edx
	leal	-48(%rax,%rdx,2), %r12d
.L3:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L6
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	rd, .-rd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L9:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L37
	movl	%ebx, N(%rip)
	leaq	cnt(%rip), %r12
	leaq	sum(%rip), %rbp
	movl	$0, i(%rip)
	testl	%ebx, %ebx
	je	.L38
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%ebx, %ebx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L39:
	leal	(%rbx,%rbx,4), %edx
	leal	-48(%rax,%rdx,2), %ebx
.L13:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	leal	-48(%rax), %edx
	cmpl	$9, %edx
	jbe	.L39
	movslq	%ebx, %rbx
	movslq	N(%rip), %r8
	movslq	(%r12,%rbx,4), %rax
	leal	1(%rax), %edx
	addl	$1, 0(%rbp,%rax,4)
	movl	i(%rip), %eax
	movl	%edx, (%r12,%rbx,4)
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%r8d, %eax
	jl	.L10
	movl	%r8d, t(%rip)
	testl	%r8d, %r8d
	jle	.L16
	movl	acc(%rip), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	leaq	ans(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%edx, %eax
	movl	%r8d, %r10d
	leal	-1(%rdx), %r9d
	imull	%r8d, %eax
	cmpl	%eax, %ecx
	jl	.L21
	movslq	%edx, %rsi
	addl	%r8d, %eax
	leaq	0(%rbp,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L18:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r9d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r10d, %eax
	cmpl	%edi, %ecx
	jge	.L18
	movl	$1, %esi
.L21:
	movl	%r9d, (%rbx,%r8,4)
	subq	$1, %r8
	testl	%r8d, %r8d
	jg	.L17
	movl	$0, t(%rip)
	testb	%sil, %sil
	je	.L16
	movl	%ecx, acc(%rip)
.L16:
	movl	N(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	leaq	ans(%rip), %rbx
	leaq	.LC0(%rip), %rbp
	testl	%edx, %edx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L23:
	cltq
	movq	%rbp, %rdi
	movl	(%rbx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jle	.L23
.L35:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L38:
	.cfi_restore_state
	movl	$0, t(%rip)
	jmp	.L16
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.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
	.globl	ans
	.align 32
	.type	ans, @object
	.size	ans, 1572864
ans:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	sum
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.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:
```