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

```c
#include <stdio.h>

int i, t, y = 1, d[10000] = {1};
long long r;
char s[200001];

int main(n, p) {
  scanf("%d%d%s", &n, &p, s + 1);
  if (10 % p == 0) {
    while(i++<n) {
      if((s[i] - '0') % p == 0)
        r += i;
    }
  }
  else {
    for(; n; n--) {
      t = (t + (s[n] - '0') * y) % p;
      d[t]++;
      y = y * 10 % p;
    }
    for(i = 0; i < p; i++)
      r += (long long) d[i] * (d[i] - 1);
    r /= 2;
  }
  printf("%lld\n", r);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	y
	.data
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.long	1
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 40000
d:
	.long	1
	.zero	39996
	.globl	r
	.bss
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 200001
s:
	.zero	200001
	.section	.rodata
.LC0:
	.string	"%d%d%s"
.LC1:
	.string	"%lld\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	leaq	1+s(%rip), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %ecx
	movl	$10, %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
.L3:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-4(%rbp), %edx
	cmpl	%edx, %eax
	jl	.L4
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	y(%rip), %eax
	imull	%eax, %edx
	movl	t(%rip), %eax
	addl	%edx, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, t(%rip)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, y(%rip)
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	subl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	r(%rip), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, r(%rip)
.L5:
	movq	r(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@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	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%s"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	1+s(%rip), %rcx
	xorl	%eax, %eax
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movl	%edi, 12(%rsp)
	leaq	8(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	movl	%esi, 8(%rsp)
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$10, %eax
	movl	8(%rsp), %esi
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L2
	movq	r(%rip), %r9
	movl	i(%rip), %ebx
	xorl	%r11d, %r11d
	leaq	s(%rip), %r8
	movl	12(%rsp), %edi
	movq	%r9, %r10
.L3:
	leal	1(%rbx), %ecx
	movslq	%ecx, %rcx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movsbl	(%r8,%rcx), %eax
	addq	$1, %rcx
	subl	$48, %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	je	.L23
.L6:
	leal	-1(%rcx), %eax
	movl	%ecx, %ebx
	cmpl	%eax, %edi
	jg	.L7
	movl	%ecx, i(%rip)
	testb	%r11b, %r11b
	je	.L8
	movq	%r10, r(%rip)
	movq	%r10, %r9
.L8:
	movq	%r9, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L5
	movslq	%eax, %rdx
	leaq	-1+s(%rip), %r9
	subl	$1, %eax
	movl	y(%rip), %edi
	leaq	s(%rip), %rcx
	addq	%rdx, %r9
	movl	t(%rip), %r10d
	leaq	d(%rip), %r8
	addq	%rdx, %rcx
	subq	%rax, %r9
	.p2align 4,,10
	.p2align 3
.L9:
	movsbl	(%rcx), %eax
	subq	$1, %rcx
	subl	$48, %eax
	imull	%edi, %eax
	addl	%r10d, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	addl	$1, (%r8,%rax,4)
	movq	%rax, %r10
	leal	(%rdi,%rdi,4), %eax
	addl	%eax, %eax
	cltd
	idivl	%esi
	movl	%edx, %edi
	cmpq	%rcx, %r9
	jne	.L9
	movl	%r10d, t(%rip)
	movl	%edx, y(%rip)
	movl	$0, 12(%rsp)
.L5:
	movq	r(%rip), %r9
	movl	$0, i(%rip)
	movq	%r9, %rax
	testl	%esi, %esi
	jle	.L10
	leal	-1(%rsi), %edx
	cmpl	$2, %edx
	jbe	.L14
	pxor	%xmm4, %xmm4
	pcmpeqd	%xmm6, %xmm6
	pxor	%xmm5, %xmm5
	movl	%esi, %edx
	shrl	$2, %edx
	leaq	d(%rip), %r8
	subl	$1, %edx
	leaq	16(%r8), %rcx
	movq	%r8, %rax
	salq	$4, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm1
	movdqa	%xmm5, %xmm3
	movdqa	%xmm5, %xmm7
	addq	$16, %rax
	movdqa	%xmm1, %xmm0
	movdqa	%xmm1, %xmm8
	paddd	%xmm6, %xmm0
	punpckldq	%xmm1, %xmm8
	punpckhdq	%xmm1, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	%xmm8, %xmm7
	punpckldq	%xmm0, %xmm2
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm2, %xmm3
	pmuludq	%xmm2, %xmm7
	pmuludq	%xmm8, %xmm2
	pmuludq	%xmm8, %xmm3
	paddq	%xmm7, %xmm3
	psllq	$32, %xmm3
	paddq	%xmm3, %xmm2
	movdqa	%xmm5, %xmm3
	paddq	%xmm2, %xmm4
	pcmpgtd	%xmm1, %xmm3
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm0, %xmm3
	pmuludq	%xmm1, %xmm0
	pmuludq	%xmm1, %xmm2
	paddq	%xmm3, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm0, %xmm4
	cmpq	%rdx, %rax
	jne	.L12
	movdqa	%xmm4, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddq	%xmm0, %xmm4
	movq	%xmm4, %rax
	addq	%r9, %rax
	testb	$3, %sil
	je	.L13
.L11:
	movslq	%edx, %rcx
	movslq	(%r8,%rcx,4), %rdi
	leal	-1(%rdi), %ecx
	movslq	%ecx, %rcx
	imulq	%rdi, %rcx
	addq	%rcx, %rax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %esi
	jle	.L13
	movslq	%ecx, %rcx
	addl	$2, %edx
	movslq	(%r8,%rcx,4), %rdi
	leal	-1(%rdi), %ecx
	movslq	%ecx, %rcx
	imulq	%rdi, %rcx
	addq	%rcx, %rax
	cmpl	%edx, %esi
	jle	.L13
	movslq	%edx, %rdx
	movslq	(%r8,%rdx,4), %rcx
	leal	-1(%rcx), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rdx, %rax
.L13:
	movl	%esi, i(%rip)
	movq	%rax, %r9
.L10:
	movq	%r9, %rax
	movl	$2, %ecx
	cqto
	idivq	%rcx
	movq	%rax, r(%rip)
	movq	%rax, %r9
	jmp	.L8
.L23:
	movslq	%ebx, %rax
	movl	$1, %r11d
	addq	%rax, %r10
	jmp	.L3
.L14:
	xorl	%edx, %edx
	leaq	d(%rip), %r8
	jmp	.L11
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 200001
s:
	.zero	200001
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	d
	.data
	.align 32
	.type	d, @object
	.size	d, 40000
d:
	.long	1
	.zero	39996
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.long	1
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%s"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	1+s(%rip), %rcx
	xorl	%eax, %eax
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movl	%edi, 12(%rsp)
	leaq	8(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	movl	%esi, 8(%rsp)
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$10, %eax
	movl	8(%rsp), %esi
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L2
	movq	r(%rip), %r9
	movl	i(%rip), %ebx
	xorl	%r11d, %r11d
	leaq	s(%rip), %r8
	movl	12(%rsp), %edi
	movq	%r9, %r10
.L3:
	leal	1(%rbx), %ecx
	movslq	%ecx, %rcx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movsbl	(%r8,%rcx), %eax
	addq	$1, %rcx
	subl	$48, %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	je	.L23
.L6:
	leal	-1(%rcx), %eax
	movl	%ecx, %ebx
	cmpl	%eax, %edi
	jg	.L7
	movl	%ecx, i(%rip)
	testb	%r11b, %r11b
	je	.L8
	movq	%r10, r(%rip)
	movq	%r10, %r9
.L8:
	movq	%r9, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L5
	movslq	%eax, %rdx
	leaq	-1+s(%rip), %r9
	subl	$1, %eax
	movl	y(%rip), %edi
	leaq	s(%rip), %rcx
	addq	%rdx, %r9
	movl	t(%rip), %r10d
	leaq	d(%rip), %r8
	addq	%rdx, %rcx
	subq	%rax, %r9
	.p2align 4,,10
	.p2align 3
.L9:
	movsbl	(%rcx), %eax
	subq	$1, %rcx
	subl	$48, %eax
	imull	%edi, %eax
	addl	%r10d, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rax
	addl	$1, (%r8,%rax,4)
	movq	%rax, %r10
	leal	(%rdi,%rdi,4), %eax
	addl	%eax, %eax
	cltd
	idivl	%esi
	movl	%edx, %edi
	cmpq	%rcx, %r9
	jne	.L9
	movl	%r10d, t(%rip)
	movl	%edx, y(%rip)
	movl	$0, 12(%rsp)
.L5:
	movq	r(%rip), %r9
	movl	$0, i(%rip)
	movq	%r9, %rax
	testl	%esi, %esi
	jle	.L10
	leal	-1(%rsi), %edx
	cmpl	$2, %edx
	jbe	.L14
	pxor	%xmm4, %xmm4
	pcmpeqd	%xmm6, %xmm6
	pxor	%xmm5, %xmm5
	movl	%esi, %edx
	shrl	$2, %edx
	leaq	d(%rip), %r8
	subl	$1, %edx
	leaq	16(%r8), %rcx
	movq	%r8, %rax
	salq	$4, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm1
	movdqa	%xmm5, %xmm3
	movdqa	%xmm5, %xmm7
	addq	$16, %rax
	movdqa	%xmm1, %xmm0
	movdqa	%xmm1, %xmm8
	paddd	%xmm6, %xmm0
	punpckldq	%xmm1, %xmm8
	punpckhdq	%xmm1, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	%xmm8, %xmm7
	punpckldq	%xmm0, %xmm2
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm2, %xmm3
	pmuludq	%xmm2, %xmm7
	pmuludq	%xmm8, %xmm2
	pmuludq	%xmm8, %xmm3
	paddq	%xmm7, %xmm3
	psllq	$32, %xmm3
	paddq	%xmm3, %xmm2
	movdqa	%xmm5, %xmm3
	paddq	%xmm2, %xmm4
	pcmpgtd	%xmm1, %xmm3
	movdqa	%xmm5, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pmuludq	%xmm0, %xmm3
	pmuludq	%xmm1, %xmm0
	pmuludq	%xmm1, %xmm2
	paddq	%xmm3, %xmm2
	psllq	$32, %xmm2
	paddq	%xmm2, %xmm0
	paddq	%xmm0, %xmm4
	cmpq	%rdx, %rax
	jne	.L12
	movdqa	%xmm4, %xmm0
	movl	%esi, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddq	%xmm0, %xmm4
	movq	%xmm4, %rax
	addq	%r9, %rax
	testb	$3, %sil
	je	.L13
.L11:
	movslq	%edx, %rcx
	movslq	(%r8,%rcx,4), %rdi
	leal	-1(%rdi), %ecx
	movslq	%ecx, %rcx
	imulq	%rdi, %rcx
	addq	%rcx, %rax
	leal	1(%rdx), %ecx
	cmpl	%ecx, %esi
	jle	.L13
	movslq	%ecx, %rcx
	addl	$2, %edx
	movslq	(%r8,%rcx,4), %rdi
	leal	-1(%rdi), %ecx
	movslq	%ecx, %rcx
	imulq	%rdi, %rcx
	addq	%rcx, %rax
	cmpl	%edx, %esi
	jle	.L13
	movslq	%edx, %rdx
	movslq	(%r8,%rdx,4), %rcx
	leal	-1(%rcx), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rdx, %rax
.L13:
	movl	%esi, i(%rip)
	movq	%rax, %r9
.L10:
	movq	%r9, %rax
	movl	$2, %ecx
	cqto
	idivq	%rcx
	movq	%rax, r(%rip)
	movq	%rax, %r9
	jmp	.L8
.L23:
	movslq	%ebx, %rax
	movl	$1, %r11d
	addq	%rax, %r10
	jmp	.L3
.L14:
	xorl	%edx, %edx
	leaq	d(%rip), %r8
	jmp	.L11
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 200001
s:
	.zero	200001
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	d
	.data
	.align 32
	.type	d, @object
	.size	d, 40000
d:
	.long	1
	.zero	39996
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.long	1
	.globl	t
	.bss
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:

#include <stdio.h>

int i, t, y = 1, d[10000] = {1};
long long r;
char s[200001];

int main(n, p) {
  scanf("%d%d%s", &n, &p, s + 1);
  if (10 % p == 0) {
    while(i++<n) {
      if((s[i] - '0') % p == 0)
        r += i;
    }
  }
  else {
    for(; n; n--) {
      t = (t + (s[n] - '0') * y) % p;
      d[t]++;
      y = y * 10 % p;
    }
    for(i = 0; i < p; i++)
      r += (long long) d[i] * (d[i] - 1);
    r /= 2;
  }
  printf("%lld\n", r);
  return 0;
}
20 8
33883322005544116655
 20 5
33883322005544116655
 20 5
35091597582718018558
 20 3
35091597582718018558
 20 5
34713145004890865366
 20 5
63523169932268849551
 20 2
33883322005544116655
 20 5
39199232665812066366
 20 1
33883322005544116655
 20 5
47579150395957846029

171
 81
 72
 66
 58
 40
 103
 26
 210
 60

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

```c
#include <stdio.h>

int i, t, y = 1, d[10000] = {1};
long long r;
char s[200001];

int main(n, p) {
  scanf("%d%d%s", &n, &p, s + 1);
  if (10 % p == 0) {
    while(i++<n) {
      if((s[i] - '0') % p == 0)
        r += i;
    }
  }
  else {
    for(; n; n--) {
      t = (t + (s[n] - '0') * y) % p;
      d[t]++;
      y = y * 10 % p;
    }
    for(i = 0; i < p; i++)
      r += (long long) d[i] * (d[i] - 1);
    r /= 2;
  }
  printf("%lld\n", r);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	y
	.data
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.long	1
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 40000
d:
	.long	1
	.zero	39996
	.globl	r
	.bss
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 200001
s:
	.zero	200001
	.section	.rodata
.LC0:
	.string	"%d%d%s"
.LC1:
	.string	"%lld\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	leaq	1+s(%rip), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %ecx
	movl	$10, %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
.L3:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-4(%rbp), %edx
	cmpl	%edx, %eax
	jl	.L4
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	y(%rip), %eax
	imull	%eax, %edx
	movl	t(%rip), %eax
	addl	%edx, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, t(%rip)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, y(%rip)
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	subl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	r(%rip), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, r(%rip)
.L5:
	movq	r(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	y
	.data
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.long	1
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 40000
d:
	.long	1
	.zero	39996
	.globl	r
	.bss
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 200001
s:
	.zero	200001
	.section	.rodata
.LC0:
	.string	"%d%d%s"
.LC1:
	.string	"%lld\n"
	.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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	leaq	1+s(%rip), %rcx
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8(%rbp), %ecx
	movl	$10, %eax
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	jmp	.L3
.L4:
	movl	i(%rip), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
.L3:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-4(%rbp), %edx
	cmpl	%edx, %eax
	jl	.L4
	jmp	.L5
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	y(%rip), %eax
	imull	%eax, %edx
	movl	t(%rip), %eax
	addl	%edx, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, t(%rip)
	movl	t(%rip), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	d(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	-8(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, y(%rip)
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rax
	movl	(%rcx,%rax), %eax
	subl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, r(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	r(%rip), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, r(%rip)
.L5:
	movq	r(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@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:
