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

```c
m,a[9][2],S[2499];D(d,s){int i=d==m?++S[s]+99:0;for(;i<=a[d][1];i++)D(d+1,s+i**a[d]);}main(i){for(;scanf("%d",&m),m;){for(i=0;i<m;i++)scanf("%d%d",a[i],a[i]+1);memset(S,0,9996);D(0,0);for(scanf("%d",&i);i;i--)scanf("%d",&m),printf("%d\n",S[m]);}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 72
a:
	.zero	72
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 9996
S:
	.zero	9996
	.text
	.globl	D
	.type	D, @function
D:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L2
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$99, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	movl	%eax, -4(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	imull	-4(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	D
	addl	$1, -4(%rbp)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L5
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	D, .-D
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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)
	jmp	.L7
.L12:
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L8:
	movl	-4(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	$9996, %edx
	movl	$0, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	D
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L11:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
.L7:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	D
	.type	D, @function
D:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r11d
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movl	m(%rip), %edi
	movl	%esi, 108(%rsp)
	movl	$0, 8(%rsp)
	cmpl	%r11d, %edi
	jne	.L2
	movslq	%esi, %rcx
	leaq	S(%rip), %rdx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 8(%rsp)
.L2:
	movslq	%r11d, %rax
	leaq	a(%rip), %r10
	movl	8(%rsp), %ecx
	movq	%rax, 112(%rsp)
	cmpl	4(%r10,%rax,8), %ecx
	jg	.L3
	leal	1(%r11), %eax
	movl	%eax, 120(%rsp)
	cltq
	movq	%rax, 72(%rsp)
	leal	8(%r11), %eax
	movl	%eax, 64(%rsp)
	cltq
	movq	%rax, 32(%rsp)
	movl	%ecx, %eax
.L30:
	movq	112(%rsp), %rcx
	movl	$0, 12(%rsp)
	imull	(%r10,%rcx,8), %eax
	addl	108(%rsp), %eax
	movl	%eax, 96(%rsp)
	cmpl	%edi, 120(%rsp)
	jne	.L4
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 12(%rsp)
.L4:
	movq	72(%rsp), %rax
	movl	12(%rsp), %ebx
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L5
	leal	2(%r11), %eax
	movq	72(%rsp), %rcx
	movl	%eax, 124(%rsp)
	cltq
	movq	%rax, 80(%rsp)
	movl	%ebx, %eax
.L29:
	imull	(%r10,%rcx,8), %eax
	addl	96(%rsp), %eax
	movl	$0, 16(%rsp)
	movl	%eax, 100(%rsp)
	cmpl	%edi, 124(%rsp)
	jne	.L6
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 16(%rsp)
.L6:
	movq	80(%rsp), %rax
	movl	16(%rsp), %ebx
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L7
	leal	3(%r11), %eax
	movl	%eax, 128(%rsp)
	cltq
	movq	%rax, 88(%rsp)
	movl	%ebx, %eax
.L28:
	movq	80(%rsp), %rcx
	movl	$0, 20(%rsp)
	imull	(%r10,%rcx,8), %eax
	addl	100(%rsp), %eax
	movl	%eax, 104(%rsp)
	cmpl	%edi, 128(%rsp)
	jne	.L8
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 20(%rsp)
.L8:
	movq	88(%rsp), %rax
	movl	20(%rsp), %esi
	cmpl	4(%r10,%rax,8), %esi
	jg	.L9
	leal	4(%r11), %eax
	movl	%eax, 132(%rsp)
	movslq	%eax, %r9
	movl	%esi, %eax
.L27:
	movq	88(%rsp), %rbx
	xorl	%r8d, %r8d
	imull	(%r10,%rbx,8), %eax
	addl	104(%rsp), %eax
	movl	%eax, 44(%rsp)
	cmpl	%edi, 132(%rsp)
	jne	.L10
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	leal	100(%rax), %r8d
	movl	%esi, (%rdx,%rcx,4)
.L10:
	cmpl	4(%r10,%r9,8), %r8d
	jg	.L11
	leal	5(%r11), %eax
	movl	%r8d, %r13d
	movq	%r9, %r8
	movl	%eax, 56(%rsp)
	cltq
	movq	%rax, (%rsp)
	movl	%edi, %eax
.L26:
	movl	(%r10,%r8,8), %edx
	xorl	%r12d, %r12d
	imull	%r13d, %edx
	addl	44(%rsp), %edx
	movl	%edx, 40(%rsp)
	cmpl	%eax, 56(%rsp)
	jne	.L12
	movslq	40(%rsp), %rcx
	leaq	S(%rip), %rdx
	movl	(%rdx,%rcx,4), %r12d
	leal	1(%r12), %esi
	addl	$100, %r12d
	movl	%esi, (%rdx,%rcx,4)
.L12:
	movq	(%rsp), %rsi
	cmpl	4(%r10,%rsi,8), %r12d
	jg	.L13
	leal	6(%r11), %ebx
	movq	%r8, 48(%rsp)
	leaq	S(%rip), %r15
	movl	%r12d, %ecx
	movl	%ebx, 60(%rsp)
	movslq	%ebx, %rbx
	movq	%rbx, 24(%rsp)
.L25:
	movq	(%rsp), %rdi
	movl	(%r10,%rdi,8), %edx
	imull	%ecx, %edx
	addl	40(%rsp), %edx
	movl	%edx, 68(%rsp)
	xorl	%edx, %edx
	cmpl	%eax, 60(%rsp)
	jne	.L14
	movslq	68(%rsp), %rsi
	movl	(%r15,%rsi,4), %edx
	leal	1(%rdx), %edi
	addl	$100, %edx
	movl	%edi, (%r15,%rsi,4)
.L14:
	movq	24(%rsp), %rbx
	cmpl	4(%r10,%rbx,8), %edx
	jg	.L15
	leal	7(%r11), %r8d
	leal	9(%r11), %edi
	movslq	%r8d, %r12
.L24:
	movq	24(%rsp), %rsi
	xorl	%ebp, %ebp
	movl	(%r10,%rsi,8), %r9d
	imull	%edx, %r9d
	addl	68(%rsp), %r9d
	cmpl	%eax, %r8d
	jne	.L16
	movslq	%r9d, %rsi
	movl	(%r15,%rsi,4), %ebp
	leal	1(%rbp), %ebx
	addl	$100, %ebp
	movl	%ebx, (%r15,%rsi,4)
.L16:
	cmpl	4(%r10,%r12,8), %ebp
	jg	.L17
.L23:
	movl	(%r10,%r12,8), %r14d
	xorl	%ebx, %ebx
	imull	%ebp, %r14d
	addl	%r9d, %r14d
	cmpl	%eax, 64(%rsp)
	jne	.L18
	movslq	%r14d, %rax
	movl	(%r15,%rax,4), %ebx
	leal	1(%rbx), %esi
	addl	$100, %ebx
	movl	%esi, (%r15,%rax,4)
.L18:
	movq	32(%rsp), %rax
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L22
.L21:
	movq	32(%rsp), %rax
	movl	%r11d, 156(%rsp)
	movl	%r8d, 152(%rsp)
	movl	(%r10,%rax,8), %esi
	xorl	%eax, %eax
	movl	%edx, 148(%rsp)
	movl	%r9d, 144(%rsp)
	imull	%ebx, %esi
	movl	%ecx, 140(%rsp)
	addl	$1, %ebx
	movl	%edi, 136(%rsp)
	addl	%r14d, %esi
	call	D
	movq	32(%rsp), %rax
	leaq	a(%rip), %r10
	movl	136(%rsp), %edi
	movl	140(%rsp), %ecx
	movl	144(%rsp), %r9d
	cmpl	4(%r10,%rax,8), %ebx
	movl	148(%rsp), %edx
	movl	152(%rsp), %r8d
	movl	156(%rsp), %r11d
	jle	.L21
.L22:
	addl	$1, %ebp
	cmpl	4(%r10,%r12,8), %ebp
	jg	.L17
	movl	m(%rip), %eax
	jmp	.L23
.L44:
	movq	48(%rsp), %r8
.L13:
	addl	$1, %r13d
	cmpl	4(%r10,%r8,8), %r13d
	jg	.L45
	movl	m(%rip), %eax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%rsp), %rax
	addl	$1, %ecx
	cmpl	4(%r10,%rax,8), %ecx
	jg	.L44
	movl	m(%rip), %eax
	jmp	.L25
.L45:
	movq	%r8, %r9
.L11:
	movq	88(%rsp), %rdi
	addl	$1, 20(%rsp)
	movl	20(%rsp), %eax
	cmpl	4(%r10,%rdi,8), %eax
	jg	.L9
	movl	m(%rip), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L17:
	movq	24(%rsp), %rax
	addl	$1, %edx
	cmpl	4(%r10,%rax,8), %edx
	jg	.L15
	movl	m(%rip), %eax
	jmp	.L24
.L9:
	movq	80(%rsp), %rdi
	addl	$1, 16(%rsp)
	movl	16(%rsp), %eax
	cmpl	4(%r10,%rdi,8), %eax
	jg	.L7
	movl	m(%rip), %edi
	jmp	.L28
.L7:
	movq	72(%rsp), %rcx
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	cmpl	4(%r10,%rcx,8), %eax
	jg	.L5
	movl	m(%rip), %edi
	jmp	.L29
.L5:
	movq	112(%rsp), %rdi
	addl	$1, 8(%rsp)
	movl	8(%rsp), %eax
	cmpl	%eax, 4(%r10,%rdi,8)
	jl	.L3
	movl	m(%rip), %edi
	jmp	.L30
.L3:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE0:
	.size	D, .-D
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	m(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	m(%rip), %ecx
	testl	%ecx, %ecx
	je	.L73
	movl	$0, 12(%rsp)
	jle	.L53
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L54:
	cltq
	leaq	a(%rip), %rbx
	movq	%r15, %rdi
	leaq	(%rbx,%rax,8), %rsi
	xorl	%eax, %eax
	leaq	4(%rsi), %rdx
	call	scanf@PLT
	movl	12(%rsp), %eax
	movl	m(%rip), %ecx
	addl	$1, %eax
	movl	%eax, 12(%rsp)
	cmpl	%ecx, %eax
	jl	.L54
	movl	$9996, %edx
	xorl	%esi, %esi
	leaq	S(%rip), %rdi
	xorl	%ebp, %ebp
	movl	%ecx, 8(%rsp)
	call	memset@PLT
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jne	.L55
	movl	$1, S(%rip)
	movl	$100, %ebp
.L55:
	cmpl	%ebp, 4+a(%rip)
	jl	.L56
	movl	12+a(%rip), %eax
.L60:
	leaq	a(%rip), %rdi
	xorl	%r14d, %r14d
	movl	(%rdi), %ebx
	imull	%ebp, %ebx
	cmpl	$1, %ecx
	jne	.L72
	movslq	%ebx, %rcx
	leaq	S(%rip), %rdi
	movl	(%rdi,%rcx,4), %edx
	leal	1(%rdx), %esi
	leal	100(%rdx), %r14d
	movl	%esi, (%rdi,%rcx,4)
.L72:
	cmpl	%eax, %r14d
	jg	.L74
.L59:
	movl	8+a(%rip), %esi
	movl	$2, %edi
	xorl	%eax, %eax
	imull	%r14d, %esi
	addl	$1, %r14d
	addl	%ebx, %esi
	call	D
	movl	12+a(%rip), %eax
	cmpl	%eax, %r14d
	jle	.L59
.L74:
	addl	$1, %ebp
	cmpl	4+a(%rip), %ebp
	jg	.L56
	movl	m(%rip), %ecx
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L56:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L52
	.p2align 4,,10
	.p2align 3
.L61:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	m(%rip), %rax
	leaq	S(%rip), %rdx
	leaq	.LC2(%rip), %rdi
	movl	(%rdx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	subl	$1, 12(%rsp)
	jne	.L61
	jmp	.L52
.L73:
	xorl	%edi, %edi
	call	exit@PLT
.L53:
	movl	$9996, %edx
	xorl	%esi, %esi
	leaq	S(%rip), %rdi
	xorl	%ebp, %ebp
	movl	%ecx, 8(%rsp)
	call	memset@PLT
	movl	8(%rsp), %ecx
	jmp	.L55
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 9996
S:
	.zero	9996
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 72
a:
	.zero	72
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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
	.p2align 4
	.globl	D
	.type	D, @function
D:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%edi, %r11d
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movl	m(%rip), %edi
	movl	%esi, 108(%rsp)
	movl	$0, 8(%rsp)
	cmpl	%r11d, %edi
	jne	.L2
	movslq	%esi, %rcx
	leaq	S(%rip), %rdx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 8(%rsp)
.L2:
	movslq	%r11d, %rax
	leaq	a(%rip), %r10
	movl	8(%rsp), %ecx
	movq	%rax, 112(%rsp)
	cmpl	4(%r10,%rax,8), %ecx
	jg	.L3
	leal	1(%r11), %eax
	movl	%eax, 120(%rsp)
	cltq
	movq	%rax, 72(%rsp)
	leal	8(%r11), %eax
	movl	%eax, 64(%rsp)
	cltq
	movq	%rax, 32(%rsp)
	movl	%ecx, %eax
.L30:
	movq	112(%rsp), %rcx
	movl	$0, 12(%rsp)
	imull	(%r10,%rcx,8), %eax
	addl	108(%rsp), %eax
	movl	%eax, 96(%rsp)
	cmpl	%edi, 120(%rsp)
	jne	.L4
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 12(%rsp)
.L4:
	movq	72(%rsp), %rax
	movl	12(%rsp), %ebx
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L5
	leal	2(%r11), %eax
	movq	72(%rsp), %rcx
	movl	%eax, 124(%rsp)
	cltq
	movq	%rax, 80(%rsp)
	movl	%ebx, %eax
.L29:
	imull	(%r10,%rcx,8), %eax
	addl	96(%rsp), %eax
	movl	$0, 16(%rsp)
	movl	%eax, 100(%rsp)
	cmpl	%edi, 124(%rsp)
	jne	.L6
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 16(%rsp)
.L6:
	movq	80(%rsp), %rax
	movl	16(%rsp), %ebx
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L7
	leal	3(%r11), %eax
	movl	%eax, 128(%rsp)
	cltq
	movq	%rax, 88(%rsp)
	movl	%ebx, %eax
.L28:
	movq	80(%rsp), %rcx
	movl	$0, 20(%rsp)
	imull	(%r10,%rcx,8), %eax
	addl	100(%rsp), %eax
	movl	%eax, 104(%rsp)
	cmpl	%edi, 128(%rsp)
	jne	.L8
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	addl	$100, %eax
	movl	%esi, (%rdx,%rcx,4)
	movl	%eax, 20(%rsp)
.L8:
	movq	88(%rsp), %rax
	movl	20(%rsp), %esi
	cmpl	4(%r10,%rax,8), %esi
	jg	.L9
	leal	4(%r11), %eax
	movl	%eax, 132(%rsp)
	movslq	%eax, %r9
	movl	%esi, %eax
.L27:
	movq	88(%rsp), %rbx
	xorl	%r8d, %r8d
	imull	(%r10,%rbx,8), %eax
	addl	104(%rsp), %eax
	movl	%eax, 44(%rsp)
	cmpl	%edi, 132(%rsp)
	jne	.L10
	leaq	S(%rip), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %eax
	leal	1(%rax), %esi
	leal	100(%rax), %r8d
	movl	%esi, (%rdx,%rcx,4)
.L10:
	cmpl	4(%r10,%r9,8), %r8d
	jg	.L11
	leal	5(%r11), %eax
	movl	%r8d, %r13d
	movq	%r9, %r8
	movl	%eax, 56(%rsp)
	cltq
	movq	%rax, (%rsp)
	movl	%edi, %eax
.L26:
	movl	(%r10,%r8,8), %edx
	xorl	%r12d, %r12d
	imull	%r13d, %edx
	addl	44(%rsp), %edx
	movl	%edx, 40(%rsp)
	cmpl	%eax, 56(%rsp)
	jne	.L12
	movslq	40(%rsp), %rcx
	leaq	S(%rip), %rdx
	movl	(%rdx,%rcx,4), %r12d
	leal	1(%r12), %esi
	addl	$100, %r12d
	movl	%esi, (%rdx,%rcx,4)
.L12:
	movq	(%rsp), %rsi
	cmpl	4(%r10,%rsi,8), %r12d
	jg	.L13
	leal	6(%r11), %ebx
	movq	%r8, 48(%rsp)
	leaq	S(%rip), %r15
	movl	%r12d, %ecx
	movl	%ebx, 60(%rsp)
	movslq	%ebx, %rbx
	movq	%rbx, 24(%rsp)
.L25:
	movq	(%rsp), %rdi
	movl	(%r10,%rdi,8), %edx
	imull	%ecx, %edx
	addl	40(%rsp), %edx
	movl	%edx, 68(%rsp)
	xorl	%edx, %edx
	cmpl	%eax, 60(%rsp)
	jne	.L14
	movslq	68(%rsp), %rsi
	movl	(%r15,%rsi,4), %edx
	leal	1(%rdx), %edi
	addl	$100, %edx
	movl	%edi, (%r15,%rsi,4)
.L14:
	movq	24(%rsp), %rbx
	cmpl	4(%r10,%rbx,8), %edx
	jg	.L15
	leal	7(%r11), %r8d
	leal	9(%r11), %edi
	movslq	%r8d, %r12
.L24:
	movq	24(%rsp), %rsi
	xorl	%ebp, %ebp
	movl	(%r10,%rsi,8), %r9d
	imull	%edx, %r9d
	addl	68(%rsp), %r9d
	cmpl	%eax, %r8d
	jne	.L16
	movslq	%r9d, %rsi
	movl	(%r15,%rsi,4), %ebp
	leal	1(%rbp), %ebx
	addl	$100, %ebp
	movl	%ebx, (%r15,%rsi,4)
.L16:
	cmpl	4(%r10,%r12,8), %ebp
	jg	.L17
.L23:
	movl	(%r10,%r12,8), %r14d
	xorl	%ebx, %ebx
	imull	%ebp, %r14d
	addl	%r9d, %r14d
	cmpl	%eax, 64(%rsp)
	jne	.L18
	movslq	%r14d, %rax
	movl	(%r15,%rax,4), %ebx
	leal	1(%rbx), %esi
	addl	$100, %ebx
	movl	%esi, (%r15,%rax,4)
.L18:
	movq	32(%rsp), %rax
	cmpl	4(%r10,%rax,8), %ebx
	jg	.L22
.L21:
	movq	32(%rsp), %rax
	movl	%r11d, 156(%rsp)
	movl	%r8d, 152(%rsp)
	movl	(%r10,%rax,8), %esi
	xorl	%eax, %eax
	movl	%edx, 148(%rsp)
	movl	%r9d, 144(%rsp)
	imull	%ebx, %esi
	movl	%ecx, 140(%rsp)
	addl	$1, %ebx
	movl	%edi, 136(%rsp)
	addl	%r14d, %esi
	call	D
	movq	32(%rsp), %rax
	leaq	a(%rip), %r10
	movl	136(%rsp), %edi
	movl	140(%rsp), %ecx
	movl	144(%rsp), %r9d
	cmpl	4(%r10,%rax,8), %ebx
	movl	148(%rsp), %edx
	movl	152(%rsp), %r8d
	movl	156(%rsp), %r11d
	jle	.L21
.L22:
	addl	$1, %ebp
	cmpl	4(%r10,%r12,8), %ebp
	jg	.L17
	movl	m(%rip), %eax
	jmp	.L23
.L44:
	movq	48(%rsp), %r8
.L13:
	addl	$1, %r13d
	cmpl	4(%r10,%r8,8), %r13d
	jg	.L45
	movl	m(%rip), %eax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%rsp), %rax
	addl	$1, %ecx
	cmpl	4(%r10,%rax,8), %ecx
	jg	.L44
	movl	m(%rip), %eax
	jmp	.L25
.L45:
	movq	%r8, %r9
.L11:
	movq	88(%rsp), %rdi
	addl	$1, 20(%rsp)
	movl	20(%rsp), %eax
	cmpl	4(%r10,%rdi,8), %eax
	jg	.L9
	movl	m(%rip), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L17:
	movq	24(%rsp), %rax
	addl	$1, %edx
	cmpl	4(%r10,%rax,8), %edx
	jg	.L15
	movl	m(%rip), %eax
	jmp	.L24
.L9:
	movq	80(%rsp), %rdi
	addl	$1, 16(%rsp)
	movl	16(%rsp), %eax
	cmpl	4(%r10,%rdi,8), %eax
	jg	.L7
	movl	m(%rip), %edi
	jmp	.L28
.L7:
	movq	72(%rsp), %rcx
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	cmpl	4(%r10,%rcx,8), %eax
	jg	.L5
	movl	m(%rip), %edi
	jmp	.L29
.L5:
	movq	112(%rsp), %rdi
	addl	$1, 8(%rsp)
	movl	8(%rsp), %eax
	cmpl	%eax, 4(%r10,%rdi,8)
	jl	.L3
	movl	m(%rip), %edi
	jmp	.L30
.L3:
	addq	$168, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE0:
	.size	D, .-D
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	m(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	.p2align 4,,10
	.p2align 3
.L52:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	m(%rip), %ecx
	testl	%ecx, %ecx
	je	.L73
	movl	$0, 12(%rsp)
	jle	.L53
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L54:
	cltq
	leaq	a(%rip), %rbx
	movq	%r15, %rdi
	leaq	(%rbx,%rax,8), %rsi
	xorl	%eax, %eax
	leaq	4(%rsi), %rdx
	call	scanf@PLT
	movl	12(%rsp), %eax
	movl	m(%rip), %ecx
	addl	$1, %eax
	movl	%eax, 12(%rsp)
	cmpl	%ecx, %eax
	jl	.L54
	movl	$9996, %edx
	xorl	%esi, %esi
	leaq	S(%rip), %rdi
	xorl	%ebp, %ebp
	movl	%ecx, 8(%rsp)
	call	memset@PLT
	movl	8(%rsp), %ecx
	testl	%ecx, %ecx
	jne	.L55
	movl	$1, S(%rip)
	movl	$100, %ebp
.L55:
	cmpl	%ebp, 4+a(%rip)
	jl	.L56
	movl	12+a(%rip), %eax
.L60:
	leaq	a(%rip), %rdi
	xorl	%r14d, %r14d
	movl	(%rdi), %ebx
	imull	%ebp, %ebx
	cmpl	$1, %ecx
	jne	.L72
	movslq	%ebx, %rcx
	leaq	S(%rip), %rdi
	movl	(%rdi,%rcx,4), %edx
	leal	1(%rdx), %esi
	leal	100(%rdx), %r14d
	movl	%esi, (%rdi,%rcx,4)
.L72:
	cmpl	%eax, %r14d
	jg	.L74
.L59:
	movl	8+a(%rip), %esi
	movl	$2, %edi
	xorl	%eax, %eax
	imull	%r14d, %esi
	addl	$1, %r14d
	addl	%ebx, %esi
	call	D
	movl	12+a(%rip), %eax
	cmpl	%eax, %r14d
	jle	.L59
.L74:
	addl	$1, %ebp
	cmpl	4+a(%rip), %ebp
	jg	.L56
	movl	m(%rip), %ecx
	jmp	.L60
	.p2align 4,,10
	.p2align 3
.L56:
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L52
	.p2align 4,,10
	.p2align 3
.L61:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	m(%rip), %rax
	leaq	S(%rip), %rdx
	leaq	.LC2(%rip), %rdi
	movl	(%rdx,%rax,4), %esi
	xorl	%eax, %eax
	call	printf@PLT
	subl	$1, 12(%rsp)
	jne	.L61
	jmp	.L52
.L73:
	xorl	%edi, %edi
	call	exit@PLT
.L53:
	movl	$9996, %edx
	xorl	%esi, %esi
	leaq	S(%rip), %rdi
	xorl	%ebp, %ebp
	movl	%ecx, 8(%rsp)
	call	memset@PLT
	movl	8(%rsp), %ecx
	jmp	.L55
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 9996
S:
	.zero	9996
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 72
a:
	.zero	72
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.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:

m,a[9][2],S[2499];D(d,s){int i=d==m?++S[s]+99:0;for(;i<=a[d][1];i++)D(d+1,s+i**a[d]);}main(i){for(;scanf("%d",&m),m;){for(i=0;i<m;i++)scanf("%d%d",a[i],a[i]+1);memset(S,0,9996);D(0,0);for(scanf("%d",&i);i;i--)scanf("%d",&m),printf("%d\n",S[m]);}exit(0);}
5
1 10
5 3
10 3
25 2
50 2
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 3
10 3
25 2
50 2
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 3
5 3
25 2
50 2
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 3
5 2
25 2
50 2
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 3
5 2
25 2
50 1
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 4
5 2
25 2
50 1
4
120
500
100
168
7
1 10
3 10
5 10
10 10
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 4
5 2
25 2
50 1
4
120
500
100
168
7
1 10
3 10
5 10
10 15
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 4
5 2
25 2
50 1
4
120
500
100
168
7
1 10
3 10
5 10
17 15
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 4
5 2
25 2
50 2
4
120
500
100
168
7
1 10
3 10
5 10
17 15
25 10
10 10
100 10
3
452
574
787
0
 5
2 10
5 4
5 2
25 2
50 2
4
120
500
101
168
7
1 10
3 10
5 10
17 15
25 10
10 10
100 10
3
452
574
787
0

16
0
12
7
17574
17580
17578
 15
0
13
7
17574
17580
17578
 16
0
12
6
17574
17580
17578
 13
0
8
5
17574
17580
17578
 7
0
7
0
17574
17580
17578
 9
0
10
0
17574
17580
17578
 9
0
10
0
25384
25563
25591
 9
0
10
0
23233
25734
25772
 16
0
11
6
23233
25734
25772
 16
0
6
6
23233
25734
25772

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

```c
m,a[9][2],S[2499];D(d,s){int i=d==m?++S[s]+99:0;for(;i<=a[d][1];i++)D(d+1,s+i**a[d]);}main(i){for(;scanf("%d",&m),m;){for(i=0;i<m;i++)scanf("%d%d",a[i],a[i]+1);memset(S,0,9996);D(0,0);for(scanf("%d",&i);i;i--)scanf("%d",&m),printf("%d\n",S[m]);}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 72
a:
	.zero	72
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 9996
S:
	.zero	9996
	.text
	.globl	D
	.type	D, @function
D:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L2
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$99, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	movl	%eax, -4(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	imull	-4(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	D
	addl	$1, -4(%rbp)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L5
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	D, .-D
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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)
	jmp	.L7
.L12:
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L8:
	movl	-4(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	$9996, %edx
	movl	$0, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	D
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L11:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
.L7:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE1:
	.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	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 72
a:
	.zero	72
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 9996
S:
	.zero	9996
	.text
	.globl	D
	.type	D, @function
D:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L2
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	$99, %eax
	jmp	.L3
.L2:
	movl	$0, %eax
.L3:
	movl	%eax, -4(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	imull	-4(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%eax, %edx
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	D
	addl	$1, -4(%rbp)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L5
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	D, .-D
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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)
	jmp	.L7
.L12:
	movl	$0, -4(%rbp)
	jmp	.L8
.L9:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L8:
	movl	-4(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	$9996, %edx
	movl	$0, %esi
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, %esi
	movl	$0, %edi
	movl	$0, %eax
	call	D
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L11:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	S(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-4(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
.L10:
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
.L7:
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	m(%rip), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE1:
	.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:
