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

```c
sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char f[10];
char buf[2200000];
sz;
main()
{
	read(0,buf,2200000);
	for(;;)
	{
		k=buf[sz++];
		if(k<'0'||k>'9')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(k<'0'||k>'9')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		if(!cnt[i])
		{
			buf[sz++]='0';
		}
		else
		{
			if(cnt[i-1]!=cnt[i])
			{
				k=0;
				t=cnt[i];
				while(t)
				{
					f[k++]=t%10;
					t/=10;
				}
				acc=k;
			}
			else k=acc;
			while(k--)buf[sz++]=f[k]+'0';
		}
		buf[sz++]='\n';
	}
	write(1,buf,sz);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum
	.bss
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 10
f:
	.zero	10
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 2200000
buf:
	.zero	2200000
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2200000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
.L3:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L2
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L2
	movl	N(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, N(%rip)
	jmp	.L3
.L2:
	movl	$0, i(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L5
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L5
	movl	x(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, x(%rip)
	jmp	.L6
.L5:
	movl	x(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	leaq	cnt(%rip), %rdx
	movl	%ecx, (%rsi,%rdx)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	sum(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$0, sz(%rip)
	movl	sz(%rip), %eax
	movl	%eax, i(%rip)
	movl	N(%rip), %eax
	movl	%eax, t(%rip)
	jmp	.L8
.L10:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	acc(%rip), %eax
	addl	%edx, %eax
	movl	%eax, acc(%rip)
.L9:
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	imull	%eax, %edx
	movl	acc(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	t(%rip), %eax
	subl	$1, %eax
	movl	%eax, t(%rip)
.L8:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$1, i(%rip)
	jmp	.L12
.L21:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L13
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$48, (%rax,%rdx)
	jmp	.L14
.L13:
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$0, k(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L16
.L17:
	movl	t(%rip), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	k(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, k(%rip)
	cltq
	leaq	f(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, t(%rip)
.L16:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L17
	movl	k(%rip), %eax
	movl	%eax, acc(%rip)
	jmp	.L19
.L15:
	movl	acc(%rip), %eax
	movl	%eax, k(%rip)
	jmp	.L19
.L20:
	movl	k(%rip), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	48(%rax), %ecx
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L19:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L20
.L14:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$10, (%rax,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	sz(%rip), %eax
	movl	%eax, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.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.
user
	.file	"temp.c"
	.text
	.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
	movl	$2200000, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	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
	leaq	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	read@PLT
	movslq	sz(%rip), %rdx
	movl	N(%rip), %r8d
	leaq	-1+buf(%rip), %rsi
	movq	%rdx, %rax
	leal	1(%rdx), %edi
	movsbl	0(%rbp,%rdx), %edx
	addl	$2, %eax
	leal	-48(%rdx), %ecx
	movl	%edx, k(%rip)
	cltq
	cmpl	$9, %ecx
	ja	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leal	(%r8,%r8,4), %ecx
	movl	%eax, %edi
	leal	-48(%rdx,%rcx,2), %r8d
	movsbl	(%rsi,%rax), %edx
	addq	$1, %rax
	leal	-48(%rdx), %ecx
	cmpl	$9, %ecx
	jbe	.L4
	movl	%r8d, N(%rip)
	movl	%edx, k(%rip)
.L3:
	testl	%r8d, %r8d
	jle	.L5
	xorl	%r11d, %r11d
	leaq	cnt(%rip), %r9
	leaq	sum(%rip), %rbx
	leaq	-1+buf(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%edi, %rax
	leal	1(%rdi), %ecx
	movsbl	0(%rbp,%rax), %edx
	leal	-48(%rdx), %eax
	cmpl	$9, %eax
	ja	.L29
	leal	2(%rdi), %eax
	xorl	%ecx, %ecx
	cltq
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rcx,4), %ecx
	movl	%eax, %edi
	leal	-48(%rdx,%rcx,2), %ecx
	movsbl	(%r10,%rax), %edx
	addq	$1, %rax
	leal	-48(%rdx), %esi
	cmpl	$9, %esi
	jbe	.L7
.L6:
	movslq	%ecx, %rsi
	addl	$1, %r11d
	movslq	(%r9,%rsi,4), %rax
	leal	1(%rax), %r12d
	addl	$1, (%rbx,%rax,4)
	movl	%r12d, (%r9,%rsi,4)
	cmpl	%r11d, %r8d
	jne	.L8
	movl	%ecx, x(%rip)
	movl	%edx, k(%rip)
	movl	$0, sz(%rip)
.L9:
	movl	acc(%rip), %r12d
	movslq	%r8d, %rbx
	xorl	%edx, %edx
	xorl	%edi, %edi
	leaq	sum(%rip), %r13
	movl	%r12d, %ecx
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %eax
	movl	%ebx, %r11d
	leal	-1(%rdx), %r10d
	imull	%ebx, %eax
	cmpl	%ecx, %eax
	jg	.L15
	movslq	%edx, %rsi
	addl	%ebx, %eax
	leaq	0(%r13,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r10d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r11d, %eax
	cmpl	%edi, %ecx
	jge	.L12
	movl	$1, %edi
.L15:
	movl	%r10d, (%r9,%rbx,4)
	subq	$1, %rbx
	movl	%ebx, %esi
	testl	%ebx, %ebx
	jne	.L11
	movl	$0, t(%rip)
	testb	%dil, %dil
	je	.L16
	movl	%ecx, acc(%rip)
	movl	%ecx, %r12d
.L16:
	movl	$1, i(%rip)
	testl	%r8d, %r8d
	jle	.L18
	leaq	cnt(%rip), %rcx
	leal	-1(%r8), %eax
	movl	k(%rip), %ebx
	xorl	%r11d, %r11d
	leaq	4(%rcx), %rdx
	leaq	f(%rip), %rdi
	movl	$10, %r10d
	leaq	(%rdx,%rax,4), %r9
	xorl	%edx, %edx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L84:
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movb	$48, 0(%rbp,%rsi)
.L20:
	leal	1(%rax), %esi
	addq	$4, %rcx
	cltq
	movb	$10, 0(%rbp,%rax)
	cmpq	%r9, %rcx
	je	.L83
.L25:
	movl	4(%rcx), %eax
	testl	%eax, %eax
	je	.L84
	cmpl	(%rcx), %eax
	jne	.L85
	leal	-1(%r12), %ebx
	testl	%r12d, %r12d
	je	.L38
	movslq	%ebx, %rdx
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%rsi)
	leal	-2(%r12), %edx
	testl	%ebx, %ebx
	je	.L24
.L28:
	movslq	%edx, %rsi
	leal	1(%rax), %r13d
	leal	-1(%rdx), %r15d
	movslq	%eax, %r14
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	testl	%edx, %edx
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	2(%rax), %r14d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	leal	-2(%rdx), %r13d
	testl	%r15d, %r15d
	je	.L24
	movslq	%r13d, %rsi
	movslq	%r14d, %r14
	leal	3(%rax), %r15d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	leal	-3(%rdx), %r14d
	testl	%r13d, %r13d
	je	.L24
	movslq	%r14d, %rsi
	movslq	%r15d, %r15
	leal	4(%rax), %r13d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r15)
	leal	-4(%rdx), %r15d
	testl	%r14d, %r14d
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	5(%rax), %r14d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	leal	-5(%rdx), %r13d
	testl	%r15d, %r15d
	je	.L24
	movslq	%r13d, %rsi
	movslq	%r14d, %r14
	leal	6(%rax), %r15d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	leal	-6(%rdx), %r14d
	testl	%r13d, %r13d
	je	.L24
	movslq	%r14d, %rsi
	movslq	%r15d, %r15
	leal	7(%rax), %r13d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r15)
	leal	-7(%rdx), %r15d
	testl	%r14d, %r14d
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	8(%rax), %r14d
	subl	$8, %edx
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	testl	%r15d, %r15d
	je	.L24
	movslq	%edx, %rdx
	movslq	%r14d, %r14
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%r14)
.L24:
	addl	%ebx, %eax
	movl	$1, %edx
	movl	$-1, %ebx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L83:
	addl	$1, %r8d
	movl	%esi, sz(%rip)
	movl	%r8d, i(%rip)
	testb	%r11b, %r11b
	je	.L26
	movl	%r12d, acc(%rip)
	movl	$0, t(%rip)
.L26:
	testb	%dl, %dl
	je	.L18
	movl	%ebx, k(%rip)
.L18:
	movl	sz(%rip), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	write@PLT
	addq	$8, %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
	.p2align 4,,10
	.p2align 3
.L85:
	.cfi_restore_state
	movslq	%eax, %r11
	cltd
	imulq	$1717986919, %r11, %r11
	sarq	$34, %r11
	subl	%edx, %r11d
	leal	(%r11,%r11,4), %ebx
	addl	%ebx, %ebx
	subl	%ebx, %eax
	movl	%r11d, %ebx
	movb	%al, (%rdi)
	movl	%eax, %edx
	testl	%r11d, %r11d
	je	.L22
	movslq	%r11d, %rdx
	movl	%r11d, %eax
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %eax
	sarq	$34, %rdx
	subl	%eax, %edx
	leal	(%rdx,%rdx,4), %eax
	addl	%eax, %eax
	subl	%eax, %r11d
	movb	%r11b, 1+f(%rip)
	testl	%edx, %edx
	je	.L30
	movslq	%edx, %rax
	movl	%edx, %r11d
	imulq	$1717986919, %rax, %rax
	sarl	$31, %r11d
	sarq	$34, %rax
	subl	%r11d, %eax
	leal	(%rax,%rax,4), %r11d
	addl	%r11d, %r11d
	subl	%r11d, %edx
	movb	%dl, 2+f(%rip)
	testl	%eax, %eax
	je	.L31
	cltd
	idivl	%r10d
	movb	%dl, 3+f(%rip)
	testl	%eax, %eax
	je	.L32
	cltd
	idivl	%r10d
	movb	%dl, 4+f(%rip)
	testl	%eax, %eax
	je	.L33
	cltd
	idivl	%r10d
	movb	%dl, 5+f(%rip)
	testl	%eax, %eax
	je	.L34
	cltd
	idivl	%r10d
	movb	%dl, 6+f(%rip)
	testl	%eax, %eax
	je	.L35
	cltd
	idivl	%r10d
	movb	%dl, 7+f(%rip)
	testl	%eax, %eax
	je	.L36
	cltd
	idivl	%r10d
	movb	%dl, 8+f(%rip)
	testl	%eax, %eax
	je	.L37
	movb	%al, 9+f(%rip)
	movl	$9, %ebx
	movl	$10, %r12d
.L23:
	movslq	%ebx, %rdx
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movl	$1, %r11d
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%rsi)
	leal	-1(%rbx), %edx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L29:
	movl	%ecx, %edi
	xorl	%ecx, %ecx
	jmp	.L6
.L38:
	movl	%esi, %eax
	movl	$1, %edx
	orl	$-1, %ebx
	jmp	.L20
.L34:
	movl	$5, %ebx
	movl	$6, %r12d
	jmp	.L23
.L5:
	movl	$0, sz(%rip)
	movl	%r8d, t(%rip)
	jne	.L86
	movl	$1, i(%rip)
	jmp	.L18
.L30:
	movl	$1, %ebx
	movl	$2, %r12d
	jmp	.L23
.L31:
	movl	$2, %ebx
	movl	$3, %r12d
	jmp	.L23
.L32:
	movl	$3, %ebx
	movl	$4, %r12d
	jmp	.L23
.L33:
	movl	$4, %ebx
	movl	$5, %r12d
	jmp	.L23
.L35:
	movl	$6, %ebx
	movl	$7, %r12d
	jmp	.L23
.L36:
	movl	$7, %ebx
	movl	$8, %r12d
	jmp	.L23
.L37:
	movl	$8, %ebx
	movl	$9, %r12d
	jmp	.L23
.L86:
	leaq	cnt(%rip), %r9
	jmp	.L9
.L22:
	leal	1(%rsi), %eax
	addl	$48, %edx
	movslq	%esi, %rsi
	movl	$1, %r11d
	movb	%dl, 0(%rbp,%rsi)
	movl	$1, %r12d
	jmp	.L24
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	sz
	.bss
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 2200000
buf:
	.zero	2200000
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 10
f:
	.zero	10
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	t
	.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	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
	.file	"temp.c"
	.text
	.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
	movl	$2200000, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	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
	leaq	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	read@PLT
	movslq	sz(%rip), %rdx
	movl	N(%rip), %r8d
	leaq	-1+buf(%rip), %rsi
	movq	%rdx, %rax
	leal	1(%rdx), %edi
	movsbl	0(%rbp,%rdx), %edx
	addl	$2, %eax
	leal	-48(%rdx), %ecx
	movl	%edx, k(%rip)
	cltq
	cmpl	$9, %ecx
	ja	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leal	(%r8,%r8,4), %ecx
	movl	%eax, %edi
	leal	-48(%rdx,%rcx,2), %r8d
	movsbl	(%rsi,%rax), %edx
	addq	$1, %rax
	leal	-48(%rdx), %ecx
	cmpl	$9, %ecx
	jbe	.L4
	movl	%r8d, N(%rip)
	movl	%edx, k(%rip)
.L3:
	testl	%r8d, %r8d
	jle	.L5
	xorl	%r11d, %r11d
	leaq	cnt(%rip), %r9
	leaq	sum(%rip), %rbx
	leaq	-1+buf(%rip), %r10
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%edi, %rax
	leal	1(%rdi), %ecx
	movsbl	0(%rbp,%rax), %edx
	leal	-48(%rdx), %eax
	cmpl	$9, %eax
	ja	.L29
	leal	2(%rdi), %eax
	xorl	%ecx, %ecx
	cltq
	.p2align 4,,10
	.p2align 3
.L7:
	leal	(%rcx,%rcx,4), %ecx
	movl	%eax, %edi
	leal	-48(%rdx,%rcx,2), %ecx
	movsbl	(%r10,%rax), %edx
	addq	$1, %rax
	leal	-48(%rdx), %esi
	cmpl	$9, %esi
	jbe	.L7
.L6:
	movslq	%ecx, %rsi
	addl	$1, %r11d
	movslq	(%r9,%rsi,4), %rax
	leal	1(%rax), %r12d
	addl	$1, (%rbx,%rax,4)
	movl	%r12d, (%r9,%rsi,4)
	cmpl	%r11d, %r8d
	jne	.L8
	movl	%ecx, x(%rip)
	movl	%edx, k(%rip)
	movl	$0, sz(%rip)
.L9:
	movl	acc(%rip), %r12d
	movslq	%r8d, %rbx
	xorl	%edx, %edx
	xorl	%edi, %edi
	leaq	sum(%rip), %r13
	movl	%r12d, %ecx
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edx, %eax
	movl	%ebx, %r11d
	leal	-1(%rdx), %r10d
	imull	%ebx, %eax
	cmpl	%ecx, %eax
	jg	.L15
	movslq	%edx, %rsi
	addl	%ebx, %eax
	leaq	0(%r13,%rsi,4), %rsi
	.p2align 4,,10
	.p2align 3
.L12:
	addl	(%rsi), %ecx
	movl	%eax, %edi
	movl	%edx, %r10d
	addq	$4, %rsi
	addl	$1, %edx
	addl	%r11d, %eax
	cmpl	%edi, %ecx
	jge	.L12
	movl	$1, %edi
.L15:
	movl	%r10d, (%r9,%rbx,4)
	subq	$1, %rbx
	movl	%ebx, %esi
	testl	%ebx, %ebx
	jne	.L11
	movl	$0, t(%rip)
	testb	%dil, %dil
	je	.L16
	movl	%ecx, acc(%rip)
	movl	%ecx, %r12d
.L16:
	movl	$1, i(%rip)
	testl	%r8d, %r8d
	jle	.L18
	leaq	cnt(%rip), %rcx
	leal	-1(%r8), %eax
	movl	k(%rip), %ebx
	xorl	%r11d, %r11d
	leaq	4(%rcx), %rdx
	leaq	f(%rip), %rdi
	movl	$10, %r10d
	leaq	(%rdx,%rax,4), %r9
	xorl	%edx, %edx
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L84:
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movb	$48, 0(%rbp,%rsi)
.L20:
	leal	1(%rax), %esi
	addq	$4, %rcx
	cltq
	movb	$10, 0(%rbp,%rax)
	cmpq	%r9, %rcx
	je	.L83
.L25:
	movl	4(%rcx), %eax
	testl	%eax, %eax
	je	.L84
	cmpl	(%rcx), %eax
	jne	.L85
	leal	-1(%r12), %ebx
	testl	%r12d, %r12d
	je	.L38
	movslq	%ebx, %rdx
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%rsi)
	leal	-2(%r12), %edx
	testl	%ebx, %ebx
	je	.L24
.L28:
	movslq	%edx, %rsi
	leal	1(%rax), %r13d
	leal	-1(%rdx), %r15d
	movslq	%eax, %r14
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	testl	%edx, %edx
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	2(%rax), %r14d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	leal	-2(%rdx), %r13d
	testl	%r15d, %r15d
	je	.L24
	movslq	%r13d, %rsi
	movslq	%r14d, %r14
	leal	3(%rax), %r15d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	leal	-3(%rdx), %r14d
	testl	%r13d, %r13d
	je	.L24
	movslq	%r14d, %rsi
	movslq	%r15d, %r15
	leal	4(%rax), %r13d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r15)
	leal	-4(%rdx), %r15d
	testl	%r14d, %r14d
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	5(%rax), %r14d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	leal	-5(%rdx), %r13d
	testl	%r15d, %r15d
	je	.L24
	movslq	%r13d, %rsi
	movslq	%r14d, %r14
	leal	6(%rax), %r15d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r14)
	leal	-6(%rdx), %r14d
	testl	%r13d, %r13d
	je	.L24
	movslq	%r14d, %rsi
	movslq	%r15d, %r15
	leal	7(%rax), %r13d
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r15)
	leal	-7(%rdx), %r15d
	testl	%r14d, %r14d
	je	.L24
	movslq	%r15d, %rsi
	movslq	%r13d, %r13
	leal	8(%rax), %r14d
	subl	$8, %edx
	movzbl	(%rdi,%rsi), %esi
	addl	$48, %esi
	movb	%sil, 0(%rbp,%r13)
	testl	%r15d, %r15d
	je	.L24
	movslq	%edx, %rdx
	movslq	%r14d, %r14
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%r14)
.L24:
	addl	%ebx, %eax
	movl	$1, %edx
	movl	$-1, %ebx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L83:
	addl	$1, %r8d
	movl	%esi, sz(%rip)
	movl	%r8d, i(%rip)
	testb	%r11b, %r11b
	je	.L26
	movl	%r12d, acc(%rip)
	movl	$0, t(%rip)
.L26:
	testb	%dl, %dl
	je	.L18
	movl	%ebx, k(%rip)
.L18:
	movl	sz(%rip), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	write@PLT
	addq	$8, %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
	.p2align 4,,10
	.p2align 3
.L85:
	.cfi_restore_state
	movslq	%eax, %r11
	cltd
	imulq	$1717986919, %r11, %r11
	sarq	$34, %r11
	subl	%edx, %r11d
	leal	(%r11,%r11,4), %ebx
	addl	%ebx, %ebx
	subl	%ebx, %eax
	movl	%r11d, %ebx
	movb	%al, (%rdi)
	movl	%eax, %edx
	testl	%r11d, %r11d
	je	.L22
	movslq	%r11d, %rdx
	movl	%r11d, %eax
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %eax
	sarq	$34, %rdx
	subl	%eax, %edx
	leal	(%rdx,%rdx,4), %eax
	addl	%eax, %eax
	subl	%eax, %r11d
	movb	%r11b, 1+f(%rip)
	testl	%edx, %edx
	je	.L30
	movslq	%edx, %rax
	movl	%edx, %r11d
	imulq	$1717986919, %rax, %rax
	sarl	$31, %r11d
	sarq	$34, %rax
	subl	%r11d, %eax
	leal	(%rax,%rax,4), %r11d
	addl	%r11d, %r11d
	subl	%r11d, %edx
	movb	%dl, 2+f(%rip)
	testl	%eax, %eax
	je	.L31
	cltd
	idivl	%r10d
	movb	%dl, 3+f(%rip)
	testl	%eax, %eax
	je	.L32
	cltd
	idivl	%r10d
	movb	%dl, 4+f(%rip)
	testl	%eax, %eax
	je	.L33
	cltd
	idivl	%r10d
	movb	%dl, 5+f(%rip)
	testl	%eax, %eax
	je	.L34
	cltd
	idivl	%r10d
	movb	%dl, 6+f(%rip)
	testl	%eax, %eax
	je	.L35
	cltd
	idivl	%r10d
	movb	%dl, 7+f(%rip)
	testl	%eax, %eax
	je	.L36
	cltd
	idivl	%r10d
	movb	%dl, 8+f(%rip)
	testl	%eax, %eax
	je	.L37
	movb	%al, 9+f(%rip)
	movl	$9, %ebx
	movl	$10, %r12d
.L23:
	movslq	%ebx, %rdx
	leal	1(%rsi), %eax
	movslq	%esi, %rsi
	movl	$1, %r11d
	movzbl	(%rdi,%rdx), %edx
	addl	$48, %edx
	movb	%dl, 0(%rbp,%rsi)
	leal	-1(%rbx), %edx
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L29:
	movl	%ecx, %edi
	xorl	%ecx, %ecx
	jmp	.L6
.L38:
	movl	%esi, %eax
	movl	$1, %edx
	orl	$-1, %ebx
	jmp	.L20
.L34:
	movl	$5, %ebx
	movl	$6, %r12d
	jmp	.L23
.L5:
	movl	$0, sz(%rip)
	movl	%r8d, t(%rip)
	jne	.L86
	movl	$1, i(%rip)
	jmp	.L18
.L30:
	movl	$1, %ebx
	movl	$2, %r12d
	jmp	.L23
.L31:
	movl	$2, %ebx
	movl	$3, %r12d
	jmp	.L23
.L32:
	movl	$3, %ebx
	movl	$4, %r12d
	jmp	.L23
.L33:
	movl	$4, %ebx
	movl	$5, %r12d
	jmp	.L23
.L35:
	movl	$6, %ebx
	movl	$7, %r12d
	jmp	.L23
.L36:
	movl	$7, %ebx
	movl	$8, %r12d
	jmp	.L23
.L37:
	movl	$8, %ebx
	movl	$9, %r12d
	jmp	.L23
.L86:
	leaq	cnt(%rip), %r9
	jmp	.L9
.L22:
	leal	1(%rsi), %eax
	addl	$48, %edx
	movslq	%esi, %rsi
	movl	$1, %r11d
	movb	%dl, 0(%rbp,%rsi)
	movl	$1, %r12d
	jmp	.L24
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	sz
	.bss
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 2200000
buf:
	.zero	2200000
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 10
f:
	.zero	10
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	t
	.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	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:

sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char f[10];
char buf[2200000];
sz;
main()
{
	read(0,buf,2200000);
	for(;;)
	{
		k=buf[sz++];
		if(k<'0'||k>'9')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(k<'0'||k>'9')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		if(!cnt[i])
		{
			buf[sz++]='0';
		}
		else
		{
			if(cnt[i-1]!=cnt[i])
			{
				k=0;
				t=cnt[i];
				while(t)
				{
					f[k++]=t%10;
					t/=10;
				}
				acc=k;
			}
			else k=acc;
			while(k--)buf[sz++]=f[k]+'0';
		}
		buf[sz++]='\n';
	}
	write(1,buf,sz);
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
sum[3<<17],cnt[3<<17];
N,i,acc,t,k,x;
char f[10];
char buf[2200000];
sz;
main()
{
	read(0,buf,2200000);
	for(;;)
	{
		k=buf[sz++];
		if(k<'0'||k>'9')break;
		N=N*10+k-'0';
	}
	for(i=0;i<N;i++)
	{
		x=0;
		for(;;)
		{
			k=buf[sz++];
			if(k<'0'||k>'9')break;
			x=x*10+k-'0';
		}
		++sum[cnt[x]++];
	}
	i=sz=0;
	for(t=N;t;t--)
	{
		while(acc>=i*t)acc+=sum[i++];
		cnt[t]=i-1;
	}
	for(i=1;i<=N;i++)
	{
		if(!cnt[i])
		{
			buf[sz++]='0';
		}
		else
		{
			if(cnt[i-1]!=cnt[i])
			{
				k=0;
				t=cnt[i];
				while(t)
				{
					f[k++]=t%10;
					t/=10;
				}
				acc=k;
			}
			else k=acc;
			while(k--)buf[sz++]=f[k]+'0';
		}
		buf[sz++]='\n';
	}
	write(1,buf,sz);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum
	.bss
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 10
f:
	.zero	10
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 2200000
buf:
	.zero	2200000
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2200000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
.L3:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L2
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L2
	movl	N(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, N(%rip)
	jmp	.L3
.L2:
	movl	$0, i(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L5
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L5
	movl	x(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, x(%rip)
	jmp	.L6
.L5:
	movl	x(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	leaq	cnt(%rip), %rdx
	movl	%ecx, (%rsi,%rdx)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	sum(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$0, sz(%rip)
	movl	sz(%rip), %eax
	movl	%eax, i(%rip)
	movl	N(%rip), %eax
	movl	%eax, t(%rip)
	jmp	.L8
.L10:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	acc(%rip), %eax
	addl	%edx, %eax
	movl	%eax, acc(%rip)
.L9:
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	imull	%eax, %edx
	movl	acc(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	t(%rip), %eax
	subl	$1, %eax
	movl	%eax, t(%rip)
.L8:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$1, i(%rip)
	jmp	.L12
.L21:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L13
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$48, (%rax,%rdx)
	jmp	.L14
.L13:
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$0, k(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L16
.L17:
	movl	t(%rip), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	k(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, k(%rip)
	cltq
	leaq	f(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, t(%rip)
.L16:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L17
	movl	k(%rip), %eax
	movl	%eax, acc(%rip)
	jmp	.L19
.L15:
	movl	acc(%rip), %eax
	movl	%eax, k(%rip)
	jmp	.L19
.L20:
	movl	k(%rip), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	48(%rax), %ecx
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L19:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L20
.L14:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$10, (%rax,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	sz(%rip), %eax
	movl	%eax, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.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.
train
	.file	"temp.c"
	.text
	.globl	sum
	.bss
	.align 32
	.type	sum, @object
	.size	sum, 1572864
sum:
	.zero	1572864
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 1572864
cnt:
	.zero	1572864
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	acc
	.align 4
	.type	acc, @object
	.size	acc, 4
acc:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	f
	.align 8
	.type	f, @object
	.size	f, 10
f:
	.zero	10
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 2200000
buf:
	.zero	2200000
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2200000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
.L3:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L2
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L2
	movl	N(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, N(%rip)
	jmp	.L3
.L2:
	movl	$0, i(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, k(%rip)
	movl	k(%rip), %eax
	cmpl	$47, %eax
	jle	.L5
	movl	k(%rip), %eax
	cmpl	$57, %eax
	jg	.L5
	movl	x(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	k(%rip), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, x(%rip)
	jmp	.L6
.L5:
	movl	x(%rip), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rsi
	leaq	cnt(%rip), %rdx
	movl	%ecx, (%rsi,%rdx)
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	sum(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$0, sz(%rip)
	movl	sz(%rip), %eax
	movl	%eax, i(%rip)
	movl	N(%rip), %eax
	movl	%eax, t(%rip)
	jmp	.L8
.L10:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sum(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	acc(%rip), %eax
	addl	%edx, %eax
	movl	%eax, acc(%rip)
.L9:
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	imull	%eax, %edx
	movl	acc(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	i(%rip), %edx
	movl	t(%rip), %eax
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	t(%rip), %eax
	subl	$1, %eax
	movl	%eax, t(%rip)
.L8:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L9
	movl	$1, i(%rip)
	jmp	.L12
.L21:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L13
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$48, (%rax,%rdx)
	jmp	.L14
.L13:
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cnt(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$0, k(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L16
.L17:
	movl	t(%rip), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	k(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, k(%rip)
	cltq
	leaq	f(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, t(%rip)
.L16:
	movl	t(%rip), %eax
	testl	%eax, %eax
	jne	.L17
	movl	k(%rip), %eax
	movl	%eax, acc(%rip)
	jmp	.L19
.L15:
	movl	acc(%rip), %eax
	movl	%eax, k(%rip)
	jmp	.L19
.L20:
	movl	k(%rip), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	leal	48(%rax), %ecx
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	%cl, (%rax,%rdx)
.L19:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L20
.L14:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movb	$10, (%rax,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L12:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	sz(%rip), %eax
	movl	%eax, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.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:
