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

```c
char buf[10000000],out[11];
sz;
cnt[60];
main()
{
	read(0,buf,10000000);
	long N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;buf[sz]>='0';)
	{
		long A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		for(int i=0;i<60;i++)
		{
			cnt[i]+=A&1;
			A>>=1;
		}
	}
	int ans=0;
	for(int i=59;i>=0;i--)
	{
		ans=(ans*2+(N-cnt[i])*cnt[i])%1000000007;
	}
	int outsz=10;
	do{
		out[--outsz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+outsz,10-outsz);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 10000000
buf:
	.zero	10000000
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 11
out:
	.zero	11
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 240
cnt:
	.zero	240
	.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
	subq	$48, %rsp
	movl	$10000000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movq	$0, -16(%rbp)
.L4:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -34(%rbp)
	cmpb	$47, -34(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-34(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -16(%rbp)
	jmp	.L4
.L18:
	nop
	jmp	.L5
.L11:
	movq	$0, -8(%rbp)
.L8:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -33(%rbp)
	cmpb	$47, -33(%rbp)
	jle	.L19
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-33(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	jmp	.L8
.L19:
	nop
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	andl	$1, %eax
	addl	%edx, %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	sarq	-8(%rbp)
	addl	$1, -32(%rbp)
.L9:
	cmpl	$59, -32(%rbp)
	jle	.L10
.L5:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L11
	movl	$0, -28(%rbp)
	movl	$59, -24(%rbp)
	jmp	.L12
.L13:
	movl	-28(%rbp), %eax
	addl	%eax, %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	%eax, -28(%rbp)
	subl	$1, -24(%rbp)
.L12:
	cmpl	$0, -24(%rbp)
	jns	.L13
	movl	$10, -20(%rbp)
.L14:
	movl	-28(%rbp), %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	%ecx, %eax
	addl	$48, %eax
	subl	$1, -20(%rbp)
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-28(%rbp), %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, -28(%rbp)
	cmpl	$0, -28(%rbp)
	jne	.L14
	movl	$10, %eax
	subl	-20(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	out(%rip), %rcx
	addq	%rdx, %rcx
	movl	%eax, %edx
	movq	%rcx, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	leave
	.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	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	buf(%rip), %rbx
	movl	$10000000, %edx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movslq	sz(%rip), %rax
	leal	1(%rax), %r9d
	movq	%rax, %rdx
	movsbq	(%rbx,%rax), %rax
	movl	%r9d, sz(%rip)
	cmpb	$47, %al
	jle	.L29
	addl	$2, %edx
	xorl	%esi, %esi
	leaq	-2+buf(%rip), %r10
	movslq	%edx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	(%rsi,%rsi,4), %rcx
	movl	%edx, %r9d
	addq	$1, %rdx
	leaq	-48(%rax,%rcx,2), %rsi
	movsbq	(%r10,%rdx), %rax
	cmpb	$47, %al
	jg	.L5
	movl	%r9d, sz(%rip)
.L6:
	movslq	%r9d, %rax
	leaq	cnt(%rip), %rdi
	leaq	-2+buf(%rip), %r10
	movsbq	(%rbx,%rax), %rax
	leaq	240(%rdi), %r8
	cmpb	$47, %al
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	leal	2(%r9), %ecx
	xorl	%edx, %edx
	movslq	%ecx, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rdx,%rdx,4), %rdx
	movl	%ecx, %r9d
	addq	$1, %rcx
	leaq	-48(%rax,%rdx,2), %rdx
	movsbq	(%r10,%rcx), %rax
	cmpb	$47, %al
	jg	.L7
	leaq	cnt(%rip), %rax
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%edx, %ecx
	sarq	%rdx
	andl	$1, %ecx
	addl	%ecx, (%rax)
	addq	$4, %rax
	cmpq	%rax, %r8
	jne	.L8
	movslq	%r9d, %rax
	movsbq	(%rbx,%rax), %rax
	cmpb	$47, %al
	jg	.L3
	movl	%r9d, sz(%rip)
.L4:
	leaq	236+cnt(%rip), %r8
	xorl	%eax, %eax
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	(%r8), %rdx
	movq	%rsi, %rcx
	addl	%eax, %eax
	cltq
	subq	%rdx, %rcx
	imulq	%rdx, %rcx
	addq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%ecx, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	movq	%r8, %rdx
	subq	$4, %r8
	cmpq	%rdx, %rdi
	jne	.L10
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$34, %rdx
	subl	%ecx, %edx
	leal	(%rdx,%rdx,4), %ecx
	addl	%ecx, %ecx
	subl	%ecx, %eax
	addl	$48, %eax
	movb	%al, 9+out(%rip)
	testl	%edx, %edx
	je	.L12
	movslq	%edx, %rcx
	movl	%edx, %eax
	imulq	$1717986919, %rcx, %rcx
	sarl	$31, %eax
	sarq	$34, %rcx
	subl	%eax, %ecx
	movl	%edx, %eax
	leal	(%rcx,%rcx,4), %esi
	addl	%esi, %esi
	subl	%esi, %eax
	addl	$48, %eax
	movb	%al, 8+out(%rip)
	testl	%ecx, %ecx
	je	.L13
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %eax
	sarq	$34, %rdx
	subl	%eax, %edx
	movl	%ecx, %eax
	leal	(%rdx,%rdx,4), %esi
	addl	%esi, %esi
	subl	%esi, %eax
	addl	$48, %eax
	movb	%al, 7+out(%rip)
	testl	%edx, %edx
	je	.L14
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %ecx
	sarq	$34, %rax
	subl	%ecx, %eax
	leal	(%rax,%rax,4), %ecx
	addl	%ecx, %ecx
	subl	%ecx, %edx
	addl	$48, %edx
	movb	%dl, 6+out(%rip)
	testl	%eax, %eax
	je	.L15
	movl	$10, %ecx
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 5+out(%rip)
	testl	%eax, %eax
	je	.L16
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 4+out(%rip)
	testl	%eax, %eax
	je	.L17
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 3+out(%rip)
	testl	%eax, %eax
	je	.L18
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 2+out(%rip)
	testl	%eax, %eax
	je	.L19
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 1+out(%rip)
	testl	%eax, %eax
	je	.L20
	addl	$48, %eax
	movb	%al, out(%rip)
	xorl	%eax, %eax
.L11:
	leaq	out(%rip), %rcx
	movl	$10, %edx
	movl	$1, %edi
	subl	%eax, %edx
	leaq	(%rax,%rcx), %rsi
	xorl	%eax, %eax
	call	write@PLT
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	movl	$4, %eax
	jmp	.L11
.L12:
	movl	$9, %eax
	jmp	.L11
.L13:
	movl	$8, %eax
	jmp	.L11
.L29:
	xorl	%esi, %esi
	jmp	.L6
.L14:
	movl	$7, %eax
	jmp	.L11
.L15:
	movl	$6, %eax
	jmp	.L11
.L16:
	movl	$5, %eax
	jmp	.L11
.L18:
	movl	$3, %eax
	jmp	.L11
.L20:
	movl	$1, %eax
	jmp	.L11
.L19:
	movl	$2, %eax
	jmp	.L11
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 240
cnt:
	.zero	240
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 11
out:
	.zero	11
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 10000000
buf:
	.zero	10000000
	.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	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	buf(%rip), %rbx
	movl	$10000000, %edx
	xorl	%edi, %edi
	movq	%rbx, %rsi
	xorl	%eax, %eax
	call	read@PLT
	movslq	sz(%rip), %rax
	leal	1(%rax), %r9d
	movq	%rax, %rdx
	movsbq	(%rbx,%rax), %rax
	movl	%r9d, sz(%rip)
	cmpb	$47, %al
	jle	.L29
	addl	$2, %edx
	xorl	%esi, %esi
	leaq	-2+buf(%rip), %r10
	movslq	%edx, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	(%rsi,%rsi,4), %rcx
	movl	%edx, %r9d
	addq	$1, %rdx
	leaq	-48(%rax,%rcx,2), %rsi
	movsbq	(%r10,%rdx), %rax
	cmpb	$47, %al
	jg	.L5
	movl	%r9d, sz(%rip)
.L6:
	movslq	%r9d, %rax
	leaq	cnt(%rip), %rdi
	leaq	-2+buf(%rip), %r10
	movsbq	(%rbx,%rax), %rax
	leaq	240(%rdi), %r8
	cmpb	$47, %al
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	leal	2(%r9), %ecx
	xorl	%edx, %edx
	movslq	%ecx, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%rdx,%rdx,4), %rdx
	movl	%ecx, %r9d
	addq	$1, %rcx
	leaq	-48(%rax,%rdx,2), %rdx
	movsbq	(%r10,%rcx), %rax
	cmpb	$47, %al
	jg	.L7
	leaq	cnt(%rip), %rax
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%edx, %ecx
	sarq	%rdx
	andl	$1, %ecx
	addl	%ecx, (%rax)
	addq	$4, %rax
	cmpq	%rax, %r8
	jne	.L8
	movslq	%r9d, %rax
	movsbq	(%rbx,%rax), %rax
	cmpb	$47, %al
	jg	.L3
	movl	%r9d, sz(%rip)
.L4:
	leaq	236+cnt(%rip), %r8
	xorl	%eax, %eax
	movabsq	$-8543223828751151131, %r9
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	(%r8), %rdx
	movq	%rsi, %rcx
	addl	%eax, %eax
	cltq
	subq	%rdx, %rcx
	imulq	%rdx, %rcx
	addq	%rax, %rcx
	movq	%rcx, %rax
	imulq	%r9
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	movl	%ecx, %eax
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	movq	%r8, %rdx
	subq	$4, %r8
	cmpq	%rdx, %rdi
	jne	.L10
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$34, %rdx
	subl	%ecx, %edx
	leal	(%rdx,%rdx,4), %ecx
	addl	%ecx, %ecx
	subl	%ecx, %eax
	addl	$48, %eax
	movb	%al, 9+out(%rip)
	testl	%edx, %edx
	je	.L12
	movslq	%edx, %rcx
	movl	%edx, %eax
	imulq	$1717986919, %rcx, %rcx
	sarl	$31, %eax
	sarq	$34, %rcx
	subl	%eax, %ecx
	movl	%edx, %eax
	leal	(%rcx,%rcx,4), %esi
	addl	%esi, %esi
	subl	%esi, %eax
	addl	$48, %eax
	movb	%al, 8+out(%rip)
	testl	%ecx, %ecx
	je	.L13
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %eax
	sarq	$34, %rdx
	subl	%eax, %edx
	movl	%ecx, %eax
	leal	(%rdx,%rdx,4), %esi
	addl	%esi, %esi
	subl	%esi, %eax
	addl	$48, %eax
	movb	%al, 7+out(%rip)
	testl	%edx, %edx
	je	.L14
	movslq	%edx, %rax
	movl	%edx, %ecx
	imulq	$1717986919, %rax, %rax
	sarl	$31, %ecx
	sarq	$34, %rax
	subl	%ecx, %eax
	leal	(%rax,%rax,4), %ecx
	addl	%ecx, %ecx
	subl	%ecx, %edx
	addl	$48, %edx
	movb	%dl, 6+out(%rip)
	testl	%eax, %eax
	je	.L15
	movl	$10, %ecx
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 5+out(%rip)
	testl	%eax, %eax
	je	.L16
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 4+out(%rip)
	testl	%eax, %eax
	je	.L17
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 3+out(%rip)
	testl	%eax, %eax
	je	.L18
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 2+out(%rip)
	testl	%eax, %eax
	je	.L19
	cltd
	idivl	%ecx
	addl	$48, %edx
	movb	%dl, 1+out(%rip)
	testl	%eax, %eax
	je	.L20
	addl	$48, %eax
	movb	%al, out(%rip)
	xorl	%eax, %eax
.L11:
	leaq	out(%rip), %rcx
	movl	$10, %edx
	movl	$1, %edi
	subl	%eax, %edx
	leaq	(%rax,%rcx), %rsi
	xorl	%eax, %eax
	call	write@PLT
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	movl	$4, %eax
	jmp	.L11
.L12:
	movl	$9, %eax
	jmp	.L11
.L13:
	movl	$8, %eax
	jmp	.L11
.L29:
	xorl	%esi, %esi
	jmp	.L6
.L14:
	movl	$7, %eax
	jmp	.L11
.L15:
	movl	$6, %eax
	jmp	.L11
.L16:
	movl	$5, %eax
	jmp	.L11
.L18:
	movl	$3, %eax
	jmp	.L11
.L20:
	movl	$1, %eax
	jmp	.L11
.L19:
	movl	$2, %eax
	jmp	.L11
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	cnt
	.bss
	.align 32
	.type	cnt, @object
	.size	cnt, 240
cnt:
	.zero	240
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 11
out:
	.zero	11
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 10000000
buf:
	.zero	10000000
	.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:

char buf[10000000],out[11];
sz;
cnt[60];
main()
{
	read(0,buf,10000000);
	long N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;buf[sz]>='0';)
	{
		long A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		for(int i=0;i<60;i++)
		{
			cnt[i]+=A&1;
			A>>=1;
		}
	}
	int ans=0;
	for(int i=59;i>=0;i--)
	{
		ans=(ans*2+(N-cnt[i])*cnt[i])%1000000007;
	}
	int outsz=10;
	do{
		out[--outsz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+outsz,10-outsz);
}

3
1 2 1
 10
1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820
 10
3 1 4 1 5 9 2 6 5 6
 3
1 4 1
 10
1 14 159 2653 58979 376446 2643383 27950288 419716939 9375105820
 10
3 1 4 1 5 9 2 6 5 2
 10
1 14 159 2653 58979 376446 2643383 33596518 419716939 9375105820
 10
3 1 4 1 6 9 2 6 5 2
 10
1 3 159 2653 58979 376446 2643383 33596518 419716939 9375105820
 10
1 3 159 2653 58979 376446 2643383 40072772 419716939 9375105820

6 103715608 244 10 104328928 240 144630974 243 144630991 190239349
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
char buf[10000000],out[11];
sz;
cnt[60];
main()
{
	read(0,buf,10000000);
	long N=0;
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;buf[sz]>='0';)
	{
		long A=0;
		for(;;)
		{
			char k=buf[sz++];
			if(k<'0')break;
			A=A*10+k-'0';
		}
		for(int i=0;i<60;i++)
		{
			cnt[i]+=A&1;
			A>>=1;
		}
	}
	int ans=0;
	for(int i=59;i>=0;i--)
	{
		ans=(ans*2+(N-cnt[i])*cnt[i])%1000000007;
	}
	int outsz=10;
	do{
		out[--outsz]=ans%10+'0';
	}while(ans/=10);
	write(1,out+outsz,10-outsz);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 10000000
buf:
	.zero	10000000
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 11
out:
	.zero	11
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 240
cnt:
	.zero	240
	.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
	subq	$48, %rsp
	movl	$10000000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movq	$0, -16(%rbp)
.L4:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -34(%rbp)
	cmpb	$47, -34(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-34(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -16(%rbp)
	jmp	.L4
.L18:
	nop
	jmp	.L5
.L11:
	movq	$0, -8(%rbp)
.L8:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -33(%rbp)
	cmpb	$47, -33(%rbp)
	jle	.L19
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-33(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	jmp	.L8
.L19:
	nop
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	andl	$1, %eax
	addl	%edx, %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	sarq	-8(%rbp)
	addl	$1, -32(%rbp)
.L9:
	cmpl	$59, -32(%rbp)
	jle	.L10
.L5:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L11
	movl	$0, -28(%rbp)
	movl	$59, -24(%rbp)
	jmp	.L12
.L13:
	movl	-28(%rbp), %eax
	addl	%eax, %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	%eax, -28(%rbp)
	subl	$1, -24(%rbp)
.L12:
	cmpl	$0, -24(%rbp)
	jns	.L13
	movl	$10, -20(%rbp)
.L14:
	movl	-28(%rbp), %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	%ecx, %eax
	addl	$48, %eax
	subl	$1, -20(%rbp)
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-28(%rbp), %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, -28(%rbp)
	cmpl	$0, -28(%rbp)
	jne	.L14
	movl	$10, %eax
	subl	-20(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	out(%rip), %rcx
	addq	%rdx, %rcx
	movl	%eax, %edx
	movq	%rcx, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	leave
	.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	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 10000000
buf:
	.zero	10000000
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 11
out:
	.zero	11
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	cnt
	.align 32
	.type	cnt, @object
	.size	cnt, 240
cnt:
	.zero	240
	.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
	subq	$48, %rsp
	movl	$10000000, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	movq	$0, -16(%rbp)
.L4:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -34(%rbp)
	cmpb	$47, -34(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-34(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -16(%rbp)
	jmp	.L4
.L18:
	nop
	jmp	.L5
.L11:
	movq	$0, -8(%rbp)
.L8:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, -33(%rbp)
	cmpb	$47, -33(%rbp)
	jle	.L19
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movsbq	-33(%rbp), %rax
	addq	%rdx, %rax
	subq	$48, %rax
	movq	%rax, -8(%rbp)
	jmp	.L8
.L19:
	nop
	movl	$0, -32(%rbp)
	jmp	.L9
.L10:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	andl	$1, %eax
	addl	%edx, %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	sarq	-8(%rbp)
	addl	$1, -32(%rbp)
.L9:
	cmpl	$59, -32(%rbp)
	jle	.L10
.L5:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L11
	movl	$0, -28(%rbp)
	movl	$59, -24(%rbp)
	jmp	.L12
.L13:
	movl	-28(%rbp), %eax
	addl	%eax, %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cnt(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	%eax, -28(%rbp)
	subl	$1, -24(%rbp)
.L12:
	cmpl	$0, -24(%rbp)
	jns	.L13
	movl	$10, -20(%rbp)
.L14:
	movl	-28(%rbp), %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	%ecx, %eax
	addl	$48, %eax
	subl	$1, -20(%rbp)
	movl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-28(%rbp), %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, -28(%rbp)
	cmpl	$0, -28(%rbp)
	jne	.L14
	movl	$10, %eax
	subl	-20(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	out(%rip), %rcx
	addq	%rdx, %rcx
	movl	%eax, %edx
	movq	%rcx, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
	leave
	.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:
