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

```c
#define _[2<<17]
n,i;A _,B _,T _,F _;long M,D _,P _,R _;s(u,i,p,I){R[i]=i?s(u,T[i],p),(I=B[i])-p?s(I,F[I],u),D[u]=D[u]*-~D[I]%M:D[u]:++D[u];}S(u,x,p,i,I){for(i=F[u];I=B[i];I-p?S(I,R[i]*x%M+1,u),x=x*-~D[I]%M:0)i=T[i];P[u]=x%M;}main(u,v){for(;~scanf("%d%d",&u,&v);)i++?A[i-1]=B[i]=u,B[i-1]=A[i++]=v:(n=u,M=v);for(;--i;F[A[i]]=i)T[i]=F[A[i]];s(1,F[1],0);for(S(1,1);i++<n;)printf("%d ",P[i]);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.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	A
	.align 32
	.type	A, @object
	.size	A, 1048576
A:
	.zero	1048576
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 1048576
B:
	.zero	1048576
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 1048576
T:
	.zero	1048576
	.globl	F
	.align 32
	.type	F, @object
	.size	F, 1048576
F:
	.zero	1048576
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 2097152
D:
	.zero	2097152
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 2097152
P:
	.zero	2097152
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 2097152
R:
	.zero	2097152
	.text
	.globl	s
	.type	s, @function
s:
.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)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
.L5:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	R(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	s, .-s
	.globl	S
	.type	S, @function
S:
.LFB1:
	.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	R(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	movl	$0, %eax
	call	S
	movl	-8(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -8(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	movl	-8(%rbp), %eax
	cltq
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d "
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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)
	jmp	.L11
.L13:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	je	.L12
	movl	i(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	B(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-8(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	A(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, n(%rip)
	movl	-8(%rbp), %eax
	cltq
	movq	%rax, M(%rip)
.L11:
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	jmp	.L14
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	F(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	T(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	F(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	4+F(%rip), %eax
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$1, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	S
	jmp	.L16
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	n(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	s
	.type	s, @function
s:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	testl	%esi, %esi
	jne	.L14
	leaq	D(%rip), %rax
	xorl	%ebx, %ebx
	leaq	R(%rip), %r13
	movq	(%rax,%rbp,8), %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, (%rax,%rbp,8)
.L8:
	movq	%rdx, 0(%r13,%rbx,8)
	addq	$40, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	leaq	T(%rip), %r9
	movslq	%esi, %rbx
	movl	%edx, %r12d
	movslq	(%r9,%rbx,4), %rcx
	testl	%ecx, %ecx
	jne	.L15
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	xorl	%ecx, %ecx
	movq	(%r14,%r15,8), %rax
	leaq	B(%rip), %r10
	leaq	R(%rip), %r13
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L7:
	movl	(%r10,%rbx,4), %r8d
	movq	%rdx, 0(%r13,%rcx,8)
	cmpl	%r8d, %r12d
	je	.L8
	leaq	F(%rip), %r11
	movslq	%r8d, %rcx
	movslq	(%r11,%rcx,4), %r12
	testl	%r12d, %r12d
	jne	.L16
	movq	(%r14,%rcx,8), %rax
	movq	M(%rip), %rsi
	xorl	%r12d, %r12d
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%rcx,8)
.L11:
	leaq	1(%rdx), %rax
	movq	%rdx, 0(%r13,%r12,8)
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	%rsi
	movq	%rdx, (%r14,%r15,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	(%r9,%rcx,4), %r8
	testl	%r8d, %r8d
	jne	.L17
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	xorl	%r8d, %r8d
	movq	(%r14,%r15,8), %rax
	leaq	B(%rip), %r10
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L6:
	movl	(%r10,%rcx,4), %edi
	leaq	R(%rip), %r13
	movq	%rdx, 0(%r13,%r8,8)
	cmpl	%edi, %r12d
	je	.L7
	movslq	%edi, %r8
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	movq	%rcx, 24(%rsp)
	movl	(%rax,%r8,4), %esi
	xorl	%eax, %eax
	movq	%r10, 16(%rsp)
	movq	%r8, 8(%rsp)
	call	s
	movq	8(%rsp), %r8
	movq	16(%rsp), %r10
	leaq	T(%rip), %r9
	movq	24(%rsp), %rcx
	movq	(%r14,%r8,8), %rax
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r15,8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%r9,%r12,4), %esi
	movl	%r8d, %edi
	xorl	%eax, %eax
	movl	%ebp, %edx
	movq	%r10, 16(%rsp)
	movq	%rcx, 8(%rsp)
	movl	%r8d, 24(%rsp)
	call	s
	movq	16(%rsp), %r10
	movq	8(%rsp), %rcx
	movl	(%r10,%r12,4), %edi
	cmpl	%edi, %ebp
	jne	.L18
	movq	(%r14,%rcx,8), %rdx
	movq	M(%rip), %rsi
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%edi, %rbp
	leaq	F(%rip), %r11
	movl	24(%rsp), %edx
	xorl	%eax, %eax
	movl	(%r11,%rbp,4), %esi
	call	s
	movq	(%r14,%rbp,8), %rax
	movq	8(%rsp), %rcx
	movq	M(%rip), %rsi
	addq	$1, %rax
	imulq	(%r14,%rcx,8), %rax
	cqto
	idivq	%rsi
	movq	%rdx, (%r14,%rcx,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9,%r8,4), %esi
	movl	%ebp, %edi
	xorl	%eax, %eax
	movq	%rcx, 16(%rsp)
	movq	%r8, 8(%rsp)
	call	s
	movq	8(%rsp), %r8
	leaq	B(%rip), %r10
	movq	16(%rsp), %rcx
	leaq	T(%rip), %r9
	movl	(%r10,%r8,4), %edi
	cmpl	%edi, %r12d
	je	.L5
	movslq	%edi, %r13
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	movslq	%ebp, %r15
	movl	(%rax,%r13,4), %esi
	leaq	D(%rip), %r14
	xorl	%eax, %eax
	movq	%rcx, 24(%rsp)
	movq	%r10, 16(%rsp)
	call	s
	movq	(%r14,%r13,8), %rax
	movq	8(%rsp), %r8
	leaq	T(%rip), %r9
	movq	16(%rsp), %r10
	movq	24(%rsp), %rcx
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r15,8)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	movq	(%r14,%r15,8), %rdx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	s, .-s
	.p2align 4
	.globl	S
	.type	S, @function
S:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	F(%rip), %rcx
	movslq	%esi, %rax
	movslq	%edi, %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	B(%rip), %r9
	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	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%rsi, 184(%rsp)
	movslq	(%rcx,%rsi,4), %rsi
	movl	%edi, 140(%rsp)
	movq	%rsi, 112(%rsp)
	movl	(%r9,%rsi,4), %esi
	movl	%edx, 192(%rsp)
	movl	%esi, %ecx
	movl	%esi, 136(%rsp)
	movq	M(%rip), %rsi
	testl	%ecx, %ecx
	je	.L20
	leaq	T(%rip), %r11
	movl	%eax, %edx
.L47:
	movq	112(%rsp), %rax
	movl	136(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 112(%rsp)
	cmpl	%ecx, 192(%rsp)
	je	.L21
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 160(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 168(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 88(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 68(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L22
.L46:
	movq	88(%rsp), %rax
	movl	68(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 88(%rsp)
	cmpl	%ecx, 140(%rsp)
	je	.L23
	movslq	%edx, %rbx
	leaq	R(%rip), %rdi
	movq	%rbx, 144(%rsp)
	imulq	(%rdi,%rax,8), %rbx
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 152(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 56(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 64(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L24
.L45:
	movq	56(%rsp), %rax
	movl	64(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 56(%rsp)
	cmpl	%ecx, 136(%rsp)
	je	.L25
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 120(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 128(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 24(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 12(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L26
.L44:
	movq	24(%rsp), %rax
	movl	12(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 24(%rsp)
	cmpl	%ecx, 68(%rsp)
	je	.L27
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 96(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 104(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, (%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L28
.L43:
	movq	(%rsp), %rax
	movl	8(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, (%rsp)
	cmpl	%ecx, 64(%rsp)
	je	.L29
	movslq	%edx, %rbx
	leaq	R(%rip), %rdi
	movq	%rbx, 72(%rsp)
	imulq	(%rdi,%rax,8), %rbx
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 80(%rsp)
	movslq	(%rcx,%rax,4), %r10
	addl	$1, %edx
.L95:
	movl	(%r9,%r10,4), %r15d
	testl	%r15d, %r15d
	je	.L30
.L99:
	movslq	(%r11,%r10,4), %r10
	cmpl	%r15d, 12(%rsp)
	je	.L95
	movslq	%edx, %rax
	leaq	R(%rip), %rcx
	movq	%rax, 32(%rsp)
	imulq	(%rcx,%r10,8), %rax
	leaq	F(%rip), %rcx
	cqto
	idivq	%rsi
	movslq	%r15d, %rax
	movslq	(%rcx,%rax,4), %rcx
	movq	%rax, 40(%rsp)
	movl	(%r9,%rcx,4), %r12d
	addl	$1, %edx
	testl	%r12d, %r12d
	je	.L32
	movq	%r10, 48(%rsp)
.L41:
	movslq	(%r11,%rcx,4), %rcx
	cmpl	%r12d, 8(%rsp)
	je	.L33
	movslq	%edx, %rax
	leaq	R(%rip), %rdi
	movslq	%r12d, %r10
	movq	%rax, 16(%rsp)
	imulq	(%rdi,%rcx,8), %rax
	cqto
	idivq	%rsi
	leaq	F(%rip), %rax
	movslq	(%rax,%r10,4), %r14
	addl	$1, %edx
.L96:
	movl	(%r9,%r14,4), %r13d
	testl	%r13d, %r13d
	je	.L34
.L98:
	movslq	(%r11,%r14,4), %r14
	cmpl	%r13d, %r15d
	je	.L96
	leaq	R(%rip), %rdi
	movslq	%edx, %rbp
	movslq	%r13d, %r8
	movq	(%rdi,%r14,8), %rax
	leaq	F(%rip), %rdi
	movslq	(%rdi,%r8,4), %rbx
	imulq	%rbp, %rax
	cqto
	idivq	%rsi
	leal	1(%rdx), %eax
.L97:
	movl	(%r9,%rbx,4), %edi
	testl	%edi, %edi
	je	.L36
.L39:
	movslq	(%r11,%rbx,4), %rbx
	cmpl	%edi, %r12d
	je	.L97
	cltq
	leaq	R(%rip), %rdx
	movq	%r8, 216(%rsp)
	movq	%rax, 176(%rsp)
	imulq	(%rdx,%rbx,8), %rax
	movq	%r10, 208(%rsp)
	movq	%rcx, 200(%rsp)
	cqto
	movl	%edi, 196(%rsp)
	idivq	%rsi
	xorl	%eax, %eax
	leaq	1(%rdx), %rsi
	movl	%r13d, %edx
	call	S
	movslq	196(%rsp), %rdi
	leaq	D(%rip), %rdx
	movq	M(%rip), %rsi
	leaq	B(%rip), %r9
	movq	200(%rsp), %rcx
	movq	208(%rsp), %r10
	leaq	T(%rip), %r11
	movq	(%rdx,%rdi,8), %rax
	movl	(%r9,%rbx,4), %edi
	movq	216(%rsp), %r8
	addq	$1, %rax
	imulq	176(%rsp), %rax
	cqto
	idivq	%rsi
	testl	%edi, %edi
	movl	%edx, %eax
	jne	.L39
	.p2align 4,,10
	.p2align 3
.L36:
	cltq
	movl	(%r9,%r14,4), %r13d
	cqto
	idivq	%rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r8,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r8,8), %rax
	addq	$1, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rsi
	testl	%r13d, %r13d
	jne	.L98
.L34:
	movslq	%edx, %rax
	cqto
	idivq	%rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r10,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r10,8), %rax
	addq	$1, %rax
	imulq	16(%rsp), %rax
	cqto
	idivq	%rsi
.L33:
	movl	(%r9,%rcx,4), %r12d
	testl	%r12d, %r12d
	jne	.L41
	movq	48(%rsp), %r10
.L32:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	movl	(%r9,%r10,4), %r15d
	cqto
	idivq	%rsi
	movq	40(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	32(%rsp), %rax
	cqto
	idivq	%rsi
	testl	%r15d, %r15d
	jne	.L99
.L30:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	80(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	72(%rsp), %rax
	cqto
	idivq	%rsi
.L29:
	movq	(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rsp)
	testl	%eax, %eax
	jne	.L43
.L28:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	104(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	96(%rsp), %rax
	cqto
	idivq	%rsi
.L27:
	movq	24(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jne	.L44
.L26:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	128(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	120(%rsp), %rax
	cqto
	idivq	%rsi
.L25:
	movq	56(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 64(%rsp)
	testl	%eax, %eax
	jne	.L45
.L24:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	152(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	144(%rsp), %rax
	cqto
	idivq	%rsi
.L23:
	movq	88(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 68(%rsp)
	testl	%eax, %eax
	jne	.L46
.L22:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	168(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	160(%rsp), %rax
	cqto
	idivq	%rsi
.L21:
	movq	112(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 136(%rsp)
	testl	%eax, %eax
	jne	.L47
	movslq	%edx, %rax
.L20:
	cqto
	idivq	%rsi
	movq	184(%rsp), %rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%rsi,8)
	addq	$232, %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
.LFE1:
	.size	S, .-S
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d "
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	A(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	B(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movl	%edi, 12(%rsp)
	leaq	8(%rsp), %r12
	leaq	12(%rsp), %rbp
	movl	%esi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L101:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L118
	movslq	i(%rip), %rax
	movl	12(%rsp), %esi
	movslq	8(%rsp), %rdx
	leal	1(%rax), %ecx
	movd	%esi, %xmm0
	movd	%edx, %xmm1
	movl	%ecx, i(%rip)
	punpckldq	%xmm1, %xmm0
	testl	%eax, %eax
	je	.L102
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movq	%xmm0, (%r14,%rax,4)
	movl	%esi, i(%rip)
	movl	%edx, 0(%r13,%rcx,4)
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L102:
	movl	%esi, n(%rip)
	movq	%rdx, M(%rip)
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L118:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	je	.L105
	cltq
	leaq	A(%rip), %r8
	leaq	T(%rip), %rdi
	leaq	F(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L106:
	movslq	(%r8,%rax,4), %rdx
	movl	(%rcx,%rdx,4), %esi
	movl	%eax, (%rcx,%rdx,4)
	movl	%esi, (%rdi,%rax,4)
	subq	$1, %rax
	testl	%eax, %eax
	jne	.L106
	movl	$0, i(%rip)
.L105:
	movl	4+F(%rip), %esi
	xorl	%edx, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	P(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	call	s
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	S
	movl	n(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	testl	%edx, %edx
	jle	.L116
	.p2align 4,,10
	.p2align 3
.L107:
	cltq
	movq	%rbx, %rdi
	movq	0(%rbp,%rax,8), %rsi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %edx
	cmpl	n(%rip), %edx
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	jl	.L107
.L116:
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.globl	R
	.bss
	.align 32
	.type	R, @object
	.size	R, 2097152
R:
	.zero	2097152
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 2097152
P:
	.zero	2097152
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 2097152
D:
	.zero	2097152
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	F
	.align 32
	.type	F, @object
	.size	F, 1048576
F:
	.zero	1048576
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 1048576
T:
	.zero	1048576
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 1048576
B:
	.zero	1048576
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 1048576
A:
	.zero	1048576
	.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
	.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	s
	.type	s, @function
s:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	testl	%esi, %esi
	jne	.L14
	leaq	D(%rip), %rax
	xorl	%ebx, %ebx
	leaq	R(%rip), %r13
	movq	(%rax,%rbp,8), %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, (%rax,%rbp,8)
.L8:
	movq	%rdx, 0(%r13,%rbx,8)
	addq	$40, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	leaq	T(%rip), %r9
	movslq	%esi, %rbx
	movl	%edx, %r12d
	movslq	(%r9,%rbx,4), %rcx
	testl	%ecx, %ecx
	jne	.L15
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	xorl	%ecx, %ecx
	movq	(%r14,%r15,8), %rax
	leaq	B(%rip), %r10
	leaq	R(%rip), %r13
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L7:
	movl	(%r10,%rbx,4), %r8d
	movq	%rdx, 0(%r13,%rcx,8)
	cmpl	%r8d, %r12d
	je	.L8
	leaq	F(%rip), %r11
	movslq	%r8d, %rcx
	movslq	(%r11,%rcx,4), %r12
	testl	%r12d, %r12d
	jne	.L16
	movq	(%r14,%rcx,8), %rax
	movq	M(%rip), %rsi
	xorl	%r12d, %r12d
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%rcx,8)
.L11:
	leaq	1(%rdx), %rax
	movq	%rdx, 0(%r13,%r12,8)
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	%rsi
	movq	%rdx, (%r14,%r15,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	(%r9,%rcx,4), %r8
	testl	%r8d, %r8d
	jne	.L17
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	xorl	%r8d, %r8d
	movq	(%r14,%r15,8), %rax
	leaq	B(%rip), %r10
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L6:
	movl	(%r10,%rcx,4), %edi
	leaq	R(%rip), %r13
	movq	%rdx, 0(%r13,%r8,8)
	cmpl	%edi, %r12d
	je	.L7
	movslq	%edi, %r8
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	movq	%rcx, 24(%rsp)
	movl	(%rax,%r8,4), %esi
	xorl	%eax, %eax
	movq	%r10, 16(%rsp)
	movq	%r8, 8(%rsp)
	call	s
	movq	8(%rsp), %r8
	movq	16(%rsp), %r10
	leaq	T(%rip), %r9
	movq	24(%rsp), %rcx
	movq	(%r14,%r8,8), %rax
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r15,8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%r9,%r12,4), %esi
	movl	%r8d, %edi
	xorl	%eax, %eax
	movl	%ebp, %edx
	movq	%r10, 16(%rsp)
	movq	%rcx, 8(%rsp)
	movl	%r8d, 24(%rsp)
	call	s
	movq	16(%rsp), %r10
	movq	8(%rsp), %rcx
	movl	(%r10,%r12,4), %edi
	cmpl	%edi, %ebp
	jne	.L18
	movq	(%r14,%rcx,8), %rdx
	movq	M(%rip), %rsi
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%edi, %rbp
	leaq	F(%rip), %r11
	movl	24(%rsp), %edx
	xorl	%eax, %eax
	movl	(%r11,%rbp,4), %esi
	call	s
	movq	(%r14,%rbp,8), %rax
	movq	8(%rsp), %rcx
	movq	M(%rip), %rsi
	addq	$1, %rax
	imulq	(%r14,%rcx,8), %rax
	cqto
	idivq	%rsi
	movq	%rdx, (%r14,%rcx,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9,%r8,4), %esi
	movl	%ebp, %edi
	xorl	%eax, %eax
	movq	%rcx, 16(%rsp)
	movq	%r8, 8(%rsp)
	call	s
	movq	8(%rsp), %r8
	leaq	B(%rip), %r10
	movq	16(%rsp), %rcx
	leaq	T(%rip), %r9
	movl	(%r10,%r8,4), %edi
	cmpl	%edi, %r12d
	je	.L5
	movslq	%edi, %r13
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	movslq	%ebp, %r15
	movl	(%rax,%r13,4), %esi
	leaq	D(%rip), %r14
	xorl	%eax, %eax
	movq	%rcx, 24(%rsp)
	movq	%r10, 16(%rsp)
	call	s
	movq	(%r14,%r13,8), %rax
	movq	8(%rsp), %r8
	leaq	T(%rip), %r9
	movq	16(%rsp), %r10
	movq	24(%rsp), %rcx
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r15,8)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	D(%rip), %r14
	movslq	%ebp, %r15
	movq	(%r14,%r15,8), %rdx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	s, .-s
	.p2align 4
	.globl	S
	.type	S, @function
S:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	F(%rip), %rcx
	movslq	%esi, %rax
	movslq	%edi, %rsi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	B(%rip), %r9
	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	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%rsi, 184(%rsp)
	movslq	(%rcx,%rsi,4), %rsi
	movl	%edi, 140(%rsp)
	movq	%rsi, 112(%rsp)
	movl	(%r9,%rsi,4), %esi
	movl	%edx, 192(%rsp)
	movl	%esi, %ecx
	movl	%esi, 136(%rsp)
	movq	M(%rip), %rsi
	testl	%ecx, %ecx
	je	.L20
	leaq	T(%rip), %r11
	movl	%eax, %edx
.L47:
	movq	112(%rsp), %rax
	movl	136(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 112(%rsp)
	cmpl	%ecx, 192(%rsp)
	je	.L21
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 160(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 168(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 88(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 68(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L22
.L46:
	movq	88(%rsp), %rax
	movl	68(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 88(%rsp)
	cmpl	%ecx, 140(%rsp)
	je	.L23
	movslq	%edx, %rbx
	leaq	R(%rip), %rdi
	movq	%rbx, 144(%rsp)
	imulq	(%rdi,%rax,8), %rbx
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 152(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 56(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 64(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L24
.L45:
	movq	56(%rsp), %rax
	movl	64(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 56(%rsp)
	cmpl	%ecx, 136(%rsp)
	je	.L25
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 120(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 128(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, 24(%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 12(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L26
.L44:
	movq	24(%rsp), %rax
	movl	12(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 24(%rsp)
	cmpl	%ecx, 68(%rsp)
	je	.L27
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 96(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 104(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movq	%rax, (%rsp)
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L28
.L43:
	movq	(%rsp), %rax
	movl	8(%rsp), %ecx
	movslq	(%r11,%rax,4), %rax
	movq	%rax, (%rsp)
	cmpl	%ecx, 64(%rsp)
	je	.L29
	movslq	%edx, %rbx
	leaq	R(%rip), %rdi
	movq	%rbx, 72(%rsp)
	imulq	(%rdi,%rax,8), %rbx
	movq	%rbx, %rax
	cqto
	idivq	%rsi
	movslq	%ecx, %rax
	leaq	F(%rip), %rcx
	movq	%rax, 80(%rsp)
	movslq	(%rcx,%rax,4), %r10
	addl	$1, %edx
.L95:
	movl	(%r9,%r10,4), %r15d
	testl	%r15d, %r15d
	je	.L30
.L99:
	movslq	(%r11,%r10,4), %r10
	cmpl	%r15d, 12(%rsp)
	je	.L95
	movslq	%edx, %rax
	leaq	R(%rip), %rcx
	movq	%rax, 32(%rsp)
	imulq	(%rcx,%r10,8), %rax
	leaq	F(%rip), %rcx
	cqto
	idivq	%rsi
	movslq	%r15d, %rax
	movslq	(%rcx,%rax,4), %rcx
	movq	%rax, 40(%rsp)
	movl	(%r9,%rcx,4), %r12d
	addl	$1, %edx
	testl	%r12d, %r12d
	je	.L32
	movq	%r10, 48(%rsp)
.L41:
	movslq	(%r11,%rcx,4), %rcx
	cmpl	%r12d, 8(%rsp)
	je	.L33
	movslq	%edx, %rax
	leaq	R(%rip), %rdi
	movslq	%r12d, %r10
	movq	%rax, 16(%rsp)
	imulq	(%rdi,%rcx,8), %rax
	cqto
	idivq	%rsi
	leaq	F(%rip), %rax
	movslq	(%rax,%r10,4), %r14
	addl	$1, %edx
.L96:
	movl	(%r9,%r14,4), %r13d
	testl	%r13d, %r13d
	je	.L34
.L98:
	movslq	(%r11,%r14,4), %r14
	cmpl	%r13d, %r15d
	je	.L96
	leaq	R(%rip), %rdi
	movslq	%edx, %rbp
	movslq	%r13d, %r8
	movq	(%rdi,%r14,8), %rax
	leaq	F(%rip), %rdi
	movslq	(%rdi,%r8,4), %rbx
	imulq	%rbp, %rax
	cqto
	idivq	%rsi
	leal	1(%rdx), %eax
.L97:
	movl	(%r9,%rbx,4), %edi
	testl	%edi, %edi
	je	.L36
.L39:
	movslq	(%r11,%rbx,4), %rbx
	cmpl	%edi, %r12d
	je	.L97
	cltq
	leaq	R(%rip), %rdx
	movq	%r8, 216(%rsp)
	movq	%rax, 176(%rsp)
	imulq	(%rdx,%rbx,8), %rax
	movq	%r10, 208(%rsp)
	movq	%rcx, 200(%rsp)
	cqto
	movl	%edi, 196(%rsp)
	idivq	%rsi
	xorl	%eax, %eax
	leaq	1(%rdx), %rsi
	movl	%r13d, %edx
	call	S
	movslq	196(%rsp), %rdi
	leaq	D(%rip), %rdx
	movq	M(%rip), %rsi
	leaq	B(%rip), %r9
	movq	200(%rsp), %rcx
	movq	208(%rsp), %r10
	leaq	T(%rip), %r11
	movq	(%rdx,%rdi,8), %rax
	movl	(%r9,%rbx,4), %edi
	movq	216(%rsp), %r8
	addq	$1, %rax
	imulq	176(%rsp), %rax
	cqto
	idivq	%rsi
	testl	%edi, %edi
	movl	%edx, %eax
	jne	.L39
	.p2align 4,,10
	.p2align 3
.L36:
	cltq
	movl	(%r9,%r14,4), %r13d
	cqto
	idivq	%rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r8,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r8,8), %rax
	addq	$1, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rsi
	testl	%r13d, %r13d
	jne	.L98
.L34:
	movslq	%edx, %rax
	cqto
	idivq	%rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r10,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r10,8), %rax
	addq	$1, %rax
	imulq	16(%rsp), %rax
	cqto
	idivq	%rsi
.L33:
	movl	(%r9,%rcx,4), %r12d
	testl	%r12d, %r12d
	jne	.L41
	movq	48(%rsp), %r10
.L32:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	movl	(%r9,%r10,4), %r15d
	cqto
	idivq	%rsi
	movq	40(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	32(%rsp), %rax
	cqto
	idivq	%rsi
	testl	%r15d, %r15d
	jne	.L99
.L30:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	80(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	72(%rsp), %rax
	cqto
	idivq	%rsi
.L29:
	movq	(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rsp)
	testl	%eax, %eax
	jne	.L43
.L28:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	104(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	96(%rsp), %rax
	cqto
	idivq	%rsi
.L27:
	movq	24(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jne	.L44
.L26:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	128(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	120(%rsp), %rax
	cqto
	idivq	%rsi
.L25:
	movq	56(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 64(%rsp)
	testl	%eax, %eax
	jne	.L45
.L24:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	152(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	144(%rsp), %rax
	cqto
	idivq	%rsi
.L23:
	movq	88(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 68(%rsp)
	testl	%eax, %eax
	jne	.L46
.L22:
	movslq	%edx, %rax
	leaq	P(%rip), %rcx
	cqto
	idivq	%rsi
	movq	168(%rsp), %rax
	movq	%rdx, (%rcx,%rax,8)
	leaq	D(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	addq	$1, %rax
	imulq	160(%rsp), %rax
	cqto
	idivq	%rsi
.L21:
	movq	112(%rsp), %rax
	movl	(%r9,%rax,4), %eax
	movl	%eax, 136(%rsp)
	testl	%eax, %eax
	jne	.L47
	movslq	%edx, %rax
.L20:
	cqto
	idivq	%rsi
	movq	184(%rsp), %rsi
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%rsi,8)
	addq	$232, %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
.LFE1:
	.size	S, .-S
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d "
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	A(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	B(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movl	%edi, 12(%rsp)
	leaq	8(%rsp), %r12
	leaq	12(%rsp), %rbp
	movl	%esi, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L101:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L118
	movslq	i(%rip), %rax
	movl	12(%rsp), %esi
	movslq	8(%rsp), %rdx
	leal	1(%rax), %ecx
	movd	%esi, %xmm0
	movd	%edx, %xmm1
	movl	%ecx, i(%rip)
	punpckldq	%xmm1, %xmm0
	testl	%eax, %eax
	je	.L102
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movq	%xmm0, (%r14,%rax,4)
	movl	%esi, i(%rip)
	movl	%edx, 0(%r13,%rcx,4)
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L102:
	movl	%esi, n(%rip)
	movq	%rdx, M(%rip)
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L118:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	je	.L105
	cltq
	leaq	A(%rip), %r8
	leaq	T(%rip), %rdi
	leaq	F(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L106:
	movslq	(%r8,%rax,4), %rdx
	movl	(%rcx,%rdx,4), %esi
	movl	%eax, (%rcx,%rdx,4)
	movl	%esi, (%rdi,%rax,4)
	subq	$1, %rax
	testl	%eax, %eax
	jne	.L106
	movl	$0, i(%rip)
.L105:
	movl	4+F(%rip), %esi
	xorl	%edx, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	P(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	call	s
	movl	$1, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	S
	movl	n(%rip), %edx
	movl	$1, %eax
	movl	$1, i(%rip)
	testl	%edx, %edx
	jle	.L116
	.p2align 4,,10
	.p2align 3
.L107:
	cltq
	movq	%rbx, %rdi
	movq	0(%rbp,%rax,8), %rsi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %edx
	cmpl	n(%rip), %edx
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	jl	.L107
.L116:
	addq	$16, %rsp
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.globl	R
	.bss
	.align 32
	.type	R, @object
	.size	R, 2097152
R:
	.zero	2097152
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 2097152
P:
	.zero	2097152
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 2097152
D:
	.zero	2097152
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	F
	.align 32
	.type	F, @object
	.size	F, 1048576
F:
	.zero	1048576
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 1048576
T:
	.zero	1048576
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 1048576
B:
	.zero	1048576
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 1048576
A:
	.zero	1048576
	.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
	.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:

#define _[2<<17]
n,i;A _,B _,T _,F _;long M,D _,P _,R _;s(u,i,p,I){R[i]=i?s(u,T[i],p),(I=B[i])-p?s(I,F[I],u),D[u]=D[u]*-~D[I]%M:D[u]:++D[u];}S(u,x,p,i,I){for(i=F[u];I=B[i];I-p?S(I,R[i]*x%M+1,u),x=x*-~D[I]%M:0)i=T[i];P[u]=x%M;}main(u,v){for(;~scanf("%d%d",&u,&v);)i++?A[i-1]=B[i]=u,B[i-1]=A[i++]=v:(n=u,M=v);for(;--i;F[A[i]]=i)T[i]=F[A[i]];s(1,F[1],0);for(S(1,1);i++<n;)printf("%d ",P[i]);}
1 101
 3 100
1 2
1 3
 2 100
1 2
1 3
 4 101
1 2
1 3
1 4
 4 101
1 2
1 3
2 4
 4 100
2 4
1 3
1 4
 4 101
1 2
2 3
2 4
 2 001
1 2
2 5
 10 2
8 5
10 8
6 5
1 5
4 8
2 10
3 6
9 4
1 7
 3 110
1 2
2 3

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

```c
#define _[2<<17]
n,i;A _,B _,T _,F _;long M,D _,P _,R _;s(u,i,p,I){R[i]=i?s(u,T[i],p),(I=B[i])-p?s(I,F[I],u),D[u]=D[u]*-~D[I]%M:D[u]:++D[u];}S(u,x,p,i,I){for(i=F[u];I=B[i];I-p?S(I,R[i]*x%M+1,u),x=x*-~D[I]%M:0)i=T[i];P[u]=x%M;}main(u,v){for(;~scanf("%d%d",&u,&v);)i++?A[i-1]=B[i]=u,B[i-1]=A[i++]=v:(n=u,M=v);for(;--i;F[A[i]]=i)T[i]=F[A[i]];s(1,F[1],0);for(S(1,1);i++<n;)printf("%d ",P[i]);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.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	A
	.align 32
	.type	A, @object
	.size	A, 1048576
A:
	.zero	1048576
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 1048576
B:
	.zero	1048576
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 1048576
T:
	.zero	1048576
	.globl	F
	.align 32
	.type	F, @object
	.size	F, 1048576
F:
	.zero	1048576
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 2097152
D:
	.zero	2097152
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 2097152
P:
	.zero	2097152
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 2097152
R:
	.zero	2097152
	.text
	.globl	s
	.type	s, @function
s:
.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)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
.L5:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	R(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	s, .-s
	.globl	S
	.type	S, @function
S:
.LFB1:
	.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	R(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	movl	$0, %eax
	call	S
	movl	-8(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -8(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	movl	-8(%rbp), %eax
	cltq
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d "
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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)
	jmp	.L11
.L13:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	je	.L12
	movl	i(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	B(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-8(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	A(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, n(%rip)
	movl	-8(%rbp), %eax
	cltq
	movq	%rax, M(%rip)
.L11:
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	jmp	.L14
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	F(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	T(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	F(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	4+F(%rip), %eax
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$1, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	S
	jmp	.L16
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	n(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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.
val
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.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	A
	.align 32
	.type	A, @object
	.size	A, 1048576
A:
	.zero	1048576
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 1048576
B:
	.zero	1048576
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 1048576
T:
	.zero	1048576
	.globl	F
	.align 32
	.type	F, @object
	.size	F, 1048576
F:
	.zero	1048576
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 2097152
D:
	.zero	2097152
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 2097152
P:
	.zero	2097152
	.globl	R
	.align 32
	.type	R, @object
	.size	R, 2097152
R:
	.zero	2097152
	.text
	.globl	s
	.type	s, @function
s:
.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)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L3
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	s
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L5
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	D(%rip), %rax
	movq	(%rdx,%rax), %rax
.L5:
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	R(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	s, .-s
	.globl	S
	.type	S, @function
S:
.LFB1:
	.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, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movl	%r8d, -20(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	F(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	je	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	R(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	leaq	1(%rax), %rcx
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	movl	$0, %eax
	call	S
	movl	-8(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	D(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	$1, %rdx
	imulq	%rdx, %rax
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movl	%eax, -8(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	movl	-8(%rbp), %eax
	cltq
	movq	M(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	S, .-S
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d "
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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)
	jmp	.L11
.L13:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	je	.L12
	movl	i(%rip), %eax
	movl	-4(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	B(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	-8(%rbp), %edx
	movslq	%eax, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	A(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	i(%rip), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	movl	%eax, n(%rip)
	movl	-8(%rbp), %eax
	cltq
	movq	%rax, M(%rip)
.L11:
	leaq	-8(%rbp), %rdx
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	jmp	.L14
.L15:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	F(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	T(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	F(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L14:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	movl	i(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	4+F(%rip), %eax
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$1, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	S
	jmp	.L16
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	P(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	movl	n(%rip), %edx
	cmpl	%edx, %eax
	jl	.L17
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
