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,0),(I=B[i])-p?s(I,F[I],u,0),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,0,0),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,0);for(S(1,1,0,0,0);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), %esi
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	$0, %ecx
	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), %esi
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	$0, %ecx
	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), %rsi
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	$0, %r8d
	movl	$0, %ecx
	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, %ecx
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$0, %r8d
	movl	$0, %ecx
	movl	$0, %edx
	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), %r15
	testl	%r15d, %r15d
	jne	.L15
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	xorl	%r15d, %r15d
	movq	(%r14,%r8,8), %rax
	leaq	B(%rip), %r10
	leaq	R(%rip), %r13
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r8,8)
.L7:
	movl	(%r10,%rbx,4), %edi
	movq	%rdx, 0(%r13,%r15,8)
	cmpl	%edi, %r12d
	je	.L8
	leaq	F(%rip), %r11
	movslq	%edi, %r15
	movslq	(%r11,%r15,4), %r12
	testl	%r12d, %r12d
	jne	.L16
	movq	(%r14,%r15,8), %rax
	movq	M(%rip), %rcx
	xorl	%r12d, %r12d
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L11:
	leaq	1(%rdx), %rax
	movq	%rdx, 0(%r13,%r12,8)
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r14,%r8,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	(%r9,%r15,4), %r11
	testl	%r11d, %r11d
	jne	.L17
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	xorl	%r11d, %r11d
	movq	(%r14,%r8,8), %rax
	leaq	B(%rip), %r10
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r8,8)
.L6:
	movl	(%r10,%r15,4), %edi
	leaq	R(%rip), %r13
	movq	%rdx, 0(%r13,%r11,8)
	cmpl	%edi, %r12d
	je	.L7
	movslq	%edi, %r11
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	xorl	%ecx, %ecx
	movl	(%rax,%r11,4), %esi
	xorl	%eax, %eax
	movq	%r8, 24(%rsp)
	movq	%r10, 16(%rsp)
	movq	%r11, 8(%rsp)
	call	s
	movq	8(%rsp), %r11
	movq	24(%rsp), %r8
	leaq	T(%rip), %r9
	movq	16(%rsp), %r10
	movq	(%r14,%r11,8), %rax
	addq	$1, %rax
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r8,8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%r9,%r12,4), %esi
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	movl	%ebp, %edx
	movq	%r8, 16(%rsp)
	movq	%r10, 8(%rsp)
	movl	%edi, 24(%rsp)
	call	s
	movq	8(%rsp), %r10
	movq	16(%rsp), %r8
	movl	(%r10,%r12,4), %r9d
	cmpl	%r9d, %ebp
	jne	.L18
	movq	(%r14,%r15,8), %rdx
	movq	M(%rip), %rcx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%r9d, %rbp
	leaq	F(%rip), %r11
	movl	24(%rsp), %edx
	xorl	%ecx, %ecx
	movl	(%r11,%rbp,4), %esi
	movl	%r9d, %edi
	xorl	%eax, %eax
	movq	%r8, 8(%rsp)
	call	s
	movq	(%r14,%rbp,8), %rax
	movq	8(%rsp), %r8
	movq	M(%rip), %rcx
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r14,%r15,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9,%r11,4), %esi
	xorl	%ecx, %ecx
	movl	%ebp, %edi
	xorl	%eax, %eax
	movq	%r11, 8(%rsp)
	call	s
	movq	8(%rsp), %r11
	leaq	B(%rip), %r10
	leaq	T(%rip), %r9
	movl	(%r10,%r11,4), %edi
	cmpl	%edi, %r12d
	je	.L5
	movslq	%edi, %r13
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	xorl	%ecx, %ecx
	movl	(%rax,%r13,4), %esi
	leaq	D(%rip), %r14
	xorl	%eax, %eax
	movq	%r10, 16(%rsp)
	call	s
	movq	(%r14,%r13,8), %rax
	movslq	%ebp, %r8
	movq	8(%rsp), %r11
	movq	16(%rsp), %r10
	leaq	T(%rip), %r9
	addq	$1, %rax
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r8,8)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	movq	(%r14,%r8,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
	movslq	%edi, %rax
	leaq	F(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	B(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%rax, 200(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movl	%edi, 168(%rsp)
	movq	M(%rip), %rcx
	movq	%rax, 128(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%edx, 172(%rsp)
	movl	%eax, 116(%rsp)
	testl	%eax, %eax
	je	.L20
	leaq	T(%rip), %r11
	movl	%esi, %edx
.L47:
	movq	128(%rsp), %rax
	movl	116(%rsp), %esi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 128(%rsp)
	cmpl	%esi, 172(%rsp)
	je	.L21
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 176(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	leaq	F(%rip), %rdi
	cqto
	idivq	%rcx
	movslq	%esi, %rax
	movq	%rax, 184(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 96(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 112(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L22
.L46:
	movq	96(%rsp), %rax
	movl	112(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 96(%rsp)
	cmpl	%edi, 168(%rsp)
	je	.L23
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 152(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	movq	%rax, 160(%rsp)
	movslq	(%rsi,%rax,4), %rax
	movq	%rax, 72(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 52(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L24
.L45:
	movq	72(%rsp), %rax
	movl	52(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 72(%rsp)
	cmpl	%edi, 116(%rsp)
	je	.L25
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 136(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	leaq	F(%rip), %rdi
	movq	%rax, 144(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 40(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 48(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L26
.L44:
	movq	40(%rsp), %rax
	movl	48(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 40(%rsp)
	cmpl	%edi, 112(%rsp)
	je	.L27
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 104(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	leaq	F(%rip), %rdi
	movq	%rax, 120(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 16(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 12(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L28
.L43:
	movq	16(%rsp), %rax
	movl	12(%rsp), %esi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 16(%rsp)
	cmpl	%esi, 52(%rsp)
	je	.L29
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 80(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	leaq	F(%rip), %rdi
	cqto
	idivq	%rcx
	movslq	%esi, %rax
	movq	%rax, 88(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movl	0(%rbp,%rax,4), %r12d
	movq	%rax, (%rsp)
	addl	$1, %edx
	testl	%r12d, %r12d
	je	.L30
	movl	%r12d, %r15d
.L42:
	movq	(%rsp), %rax
	movslq	(%r11,%rax,4), %rax
	movq	%rax, (%rsp)
	cmpl	%r15d, 48(%rsp)
	je	.L31
	movslq	%edx, %rsi
	leaq	R(%rip), %rdi
	movq	%rsi, 56(%rsp)
	imulq	(%rdi,%rax,8), %rsi
	movq	%rsi, %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%r15d, %rax
	movslq	(%rsi,%rax,4), %r12
	movq	%rax, 64(%rsp)
	movl	0(%rbp,%r12,4), %r10d
	addl	$1, %edx
	testl	%r10d, %r10d
	je	.L32
	movl	%r15d, 8(%rsp)
.L41:
	movslq	(%r11,%r12,4), %r12
	cmpl	%r10d, 12(%rsp)
	je	.L33
	movslq	%edx, %rax
	leaq	R(%rip), %rsi
	movq	%rax, 24(%rsp)
	imulq	(%rsi,%r12,8), %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%r10d, %rax
	movslq	(%rsi,%rax,4), %r15
	movq	%rax, 32(%rsp)
	movl	0(%rbp,%r15,4), %r14d
	addl	$1, %edx
	testl	%r14d, %r14d
	je	.L34
	movq	%r12, %r13
.L40:
	movslq	(%r11,%r15,4), %r15
	cmpl	%r14d, 8(%rsp)
	je	.L35
	leaq	R(%rip), %rsi
	movslq	%edx, %r12
	movslq	%r14d, %r9
	movq	(%rsi,%r15,8), %rax
	leaq	F(%rip), %rsi
	movslq	(%rsi,%r9,4), %rbx
	imulq	%r12, %rax
	cqto
	idivq	%rcx
	leal	1(%rdx), %eax
.L95:
	movl	0(%rbp,%rbx,4), %edi
	testl	%edi, %edi
	je	.L36
.L39:
	movslq	(%r11,%rbx,4), %rbx
	cmpl	%edi, %r10d
	je	.L95
	cltq
	leaq	R(%rip), %rsi
	xorl	%r8d, %r8d
	movq	%r9, 216(%rsp)
	movq	%rax, 192(%rsp)
	imulq	(%rsi,%rbx,8), %rax
	movl	%r10d, 212(%rsp)
	movl	%edi, 208(%rsp)
	cqto
	idivq	%rcx
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	leaq	1(%rdx), %rsi
	movl	%r14d, %edx
	call	S
	movslq	208(%rsp), %rdi
	leaq	D(%rip), %rsi
	movq	M(%rip), %rcx
	movl	212(%rsp), %r10d
	movq	216(%rsp), %r9
	leaq	T(%rip), %r11
	movq	(%rsi,%rdi,8), %rax
	movl	0(%rbp,%rbx,4), %edi
	addq	$1, %rax
	imulq	192(%rsp), %rax
	cqto
	idivq	%rcx
	testl	%edi, %edi
	movl	%edx, %eax
	jne	.L39
	.p2align 4,,10
	.p2align 3
.L36:
	cltq
	cqto
	idivq	%rcx
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r9,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r9,8), %rax
	addq	$1, %rax
	imulq	%r12, %rax
	cqto
	idivq	%rcx
.L35:
	movl	0(%rbp,%r15,4), %r14d
	testl	%r14d, %r14d
	jne	.L40
	movq	%r13, %r12
.L34:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	cqto
	idivq	%rcx
	movq	32(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	leaq	D(%rip), %rsi
	movq	(%rsi,%rax,8), %rax
	addq	$1, %rax
	imulq	24(%rsp), %rax
	cqto
	idivq	%rcx
.L33:
	movl	0(%rbp,%r12,4), %r10d
	testl	%r10d, %r10d
	jne	.L41
.L32:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	64(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	56(%rsp), %rax
	cqto
	idivq	%rcx
.L31:
	movq	(%rsp), %rax
	movl	0(%rbp,%rax,4), %r15d
	testl	%r15d, %r15d
	jne	.L42
.L30:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	88(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	80(%rsp), %rax
	cqto
	idivq	%rcx
.L29:
	movq	16(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jne	.L43
.L28:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	120(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	104(%rsp), %rax
	cqto
	idivq	%rcx
.L27:
	movq	40(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 48(%rsp)
	testl	%eax, %eax
	jne	.L44
.L26:
	movslq	%edx, %rax
	leaq	P(%rip), %rdi
	leaq	D(%rip), %rsi
	cqto
	idivq	%rcx
	movq	144(%rsp), %rax
	movq	%rdx, (%rdi,%rax,8)
	movq	(%rsi,%rax,8), %rax
	addq	$1, %rax
	imulq	136(%rsp), %rax
	cqto
	idivq	%rcx
.L25:
	movq	72(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 52(%rsp)
	testl	%eax, %eax
	jne	.L45
.L24:
	movslq	%edx, %rax
	leaq	P(%rip), %rdi
	leaq	D(%rip), %rbx
	cqto
	idivq	%rcx
	movq	160(%rsp), %rax
	movq	%rdx, (%rdi,%rax,8)
	movq	(%rbx,%rax,8), %rax
	addq	$1, %rax
	imulq	152(%rsp), %rax
	cqto
	idivq	%rcx
.L23:
	movq	96(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 112(%rsp)
	testl	%eax, %eax
	jne	.L46
.L22:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	184(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	176(%rsp), %rax
	cqto
	idivq	%rcx
.L21:
	movq	128(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 116(%rsp)
	testl	%eax, %eax
	jne	.L47
	movl	%edx, %esi
.L20:
	movslq	%esi, %rax
	cqto
	idivq	%rcx
	movq	200(%rsp), %rcx
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%rcx,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
.L97:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L114
	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	.L98
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movq	%xmm0, (%r14,%rax,4)
	movl	%esi, i(%rip)
	movl	%edx, 0(%r13,%rcx,4)
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L98:
	movl	%esi, n(%rip)
	movq	%rdx, M(%rip)
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L114:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	je	.L101
	cltq
	leaq	A(%rip), %r8
	leaq	T(%rip), %rdi
	leaq	F(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L102:
	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	.L102
	movl	$0, i(%rip)
.L101:
	movl	4+F(%rip), %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	P(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	call	s
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	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	.L112
	.p2align 4,,10
	.p2align 3
.L103:
	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	.L103
.L112:
	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), %r15
	testl	%r15d, %r15d
	jne	.L15
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	xorl	%r15d, %r15d
	movq	(%r14,%r8,8), %rax
	leaq	B(%rip), %r10
	leaq	R(%rip), %r13
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r8,8)
.L7:
	movl	(%r10,%rbx,4), %edi
	movq	%rdx, 0(%r13,%r15,8)
	cmpl	%edi, %r12d
	je	.L8
	leaq	F(%rip), %r11
	movslq	%edi, %r15
	movslq	(%r11,%r15,4), %r12
	testl	%r12d, %r12d
	jne	.L16
	movq	(%r14,%r15,8), %rax
	movq	M(%rip), %rcx
	xorl	%r12d, %r12d
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r15,8)
.L11:
	leaq	1(%rdx), %rax
	movq	%rdx, 0(%r13,%r12,8)
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r14,%r8,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L15:
	movslq	(%r9,%r15,4), %r11
	testl	%r11d, %r11d
	jne	.L17
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	xorl	%r11d, %r11d
	movq	(%r14,%r8,8), %rax
	leaq	B(%rip), %r10
	leaq	1(%rax), %rdx
	movq	%rdx, (%r14,%r8,8)
.L6:
	movl	(%r10,%r15,4), %edi
	leaq	R(%rip), %r13
	movq	%rdx, 0(%r13,%r11,8)
	cmpl	%edi, %r12d
	je	.L7
	movslq	%edi, %r11
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	xorl	%ecx, %ecx
	movl	(%rax,%r11,4), %esi
	xorl	%eax, %eax
	movq	%r8, 24(%rsp)
	movq	%r10, 16(%rsp)
	movq	%r11, 8(%rsp)
	call	s
	movq	8(%rsp), %r11
	movq	24(%rsp), %r8
	leaq	T(%rip), %r9
	movq	16(%rsp), %r10
	movq	(%r14,%r11,8), %rax
	addq	$1, %rax
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r8,8)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%r9,%r12,4), %esi
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	movl	%ebp, %edx
	movq	%r8, 16(%rsp)
	movq	%r10, 8(%rsp)
	movl	%edi, 24(%rsp)
	call	s
	movq	8(%rsp), %r10
	movq	16(%rsp), %r8
	movl	(%r10,%r12,4), %r9d
	cmpl	%r9d, %ebp
	jne	.L18
	movq	(%r14,%r15,8), %rdx
	movq	M(%rip), %rcx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%r9d, %rbp
	leaq	F(%rip), %r11
	movl	24(%rsp), %edx
	xorl	%ecx, %ecx
	movl	(%r11,%rbp,4), %esi
	movl	%r9d, %edi
	xorl	%eax, %eax
	movq	%r8, 8(%rsp)
	call	s
	movq	(%r14,%rbp,8), %rax
	movq	8(%rsp), %r8
	movq	M(%rip), %rcx
	addq	$1, %rax
	imulq	(%r14,%r15,8), %rax
	cqto
	idivq	%rcx
	movq	%rdx, (%r14,%r15,8)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r9,%r11,4), %esi
	xorl	%ecx, %ecx
	movl	%ebp, %edi
	xorl	%eax, %eax
	movq	%r11, 8(%rsp)
	call	s
	movq	8(%rsp), %r11
	leaq	B(%rip), %r10
	leaq	T(%rip), %r9
	movl	(%r10,%r11,4), %edi
	cmpl	%edi, %r12d
	je	.L5
	movslq	%edi, %r13
	leaq	F(%rip), %rax
	movl	%ebp, %edx
	xorl	%ecx, %ecx
	movl	(%rax,%r13,4), %esi
	leaq	D(%rip), %r14
	xorl	%eax, %eax
	movq	%r10, 16(%rsp)
	call	s
	movq	(%r14,%r13,8), %rax
	movslq	%ebp, %r8
	movq	8(%rsp), %r11
	movq	16(%rsp), %r10
	leaq	T(%rip), %r9
	addq	$1, %rax
	imulq	(%r14,%r8,8), %rax
	cqto
	idivq	M(%rip)
	movq	%rdx, (%r14,%r8,8)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	D(%rip), %r14
	movslq	%ebp, %r8
	movq	(%r14,%r8,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
	movslq	%edi, %rax
	leaq	F(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	B(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%rax, 200(%rsp)
	movslq	(%rcx,%rax,4), %rax
	movl	%edi, 168(%rsp)
	movq	M(%rip), %rcx
	movq	%rax, 128(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%edx, 172(%rsp)
	movl	%eax, 116(%rsp)
	testl	%eax, %eax
	je	.L20
	leaq	T(%rip), %r11
	movl	%esi, %edx
.L47:
	movq	128(%rsp), %rax
	movl	116(%rsp), %esi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 128(%rsp)
	cmpl	%esi, 172(%rsp)
	je	.L21
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 176(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	leaq	F(%rip), %rdi
	cqto
	idivq	%rcx
	movslq	%esi, %rax
	movq	%rax, 184(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 96(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 112(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L22
.L46:
	movq	96(%rsp), %rax
	movl	112(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 96(%rsp)
	cmpl	%edi, 168(%rsp)
	je	.L23
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 152(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	movq	%rax, 160(%rsp)
	movslq	(%rsi,%rax,4), %rax
	movq	%rax, 72(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 52(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L24
.L45:
	movq	72(%rsp), %rax
	movl	52(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 72(%rsp)
	cmpl	%edi, 116(%rsp)
	je	.L25
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 136(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	leaq	F(%rip), %rdi
	movq	%rax, 144(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 40(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 48(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L26
.L44:
	movq	40(%rsp), %rax
	movl	48(%rsp), %edi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 40(%rsp)
	cmpl	%edi, 112(%rsp)
	je	.L27
	movslq	%edx, %rsi
	leaq	R(%rip), %rbx
	movq	%rsi, 104(%rsp)
	imulq	(%rbx,%rax,8), %rsi
	movq	%rsi, %rax
	cqto
	idivq	%rcx
	movslq	%edi, %rax
	leaq	F(%rip), %rdi
	movq	%rax, 120(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movq	%rax, 16(%rsp)
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 12(%rsp)
	addl	$1, %edx
	testl	%eax, %eax
	je	.L28
.L43:
	movq	16(%rsp), %rax
	movl	12(%rsp), %esi
	movslq	(%r11,%rax,4), %rax
	movq	%rax, 16(%rsp)
	cmpl	%esi, 52(%rsp)
	je	.L29
	movslq	%edx, %rdi
	leaq	R(%rip), %rbx
	movq	%rdi, 80(%rsp)
	imulq	(%rbx,%rax,8), %rdi
	movq	%rdi, %rax
	leaq	F(%rip), %rdi
	cqto
	idivq	%rcx
	movslq	%esi, %rax
	movq	%rax, 88(%rsp)
	movslq	(%rdi,%rax,4), %rax
	movl	0(%rbp,%rax,4), %r12d
	movq	%rax, (%rsp)
	addl	$1, %edx
	testl	%r12d, %r12d
	je	.L30
	movl	%r12d, %r15d
.L42:
	movq	(%rsp), %rax
	movslq	(%r11,%rax,4), %rax
	movq	%rax, (%rsp)
	cmpl	%r15d, 48(%rsp)
	je	.L31
	movslq	%edx, %rsi
	leaq	R(%rip), %rdi
	movq	%rsi, 56(%rsp)
	imulq	(%rdi,%rax,8), %rsi
	movq	%rsi, %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%r15d, %rax
	movslq	(%rsi,%rax,4), %r12
	movq	%rax, 64(%rsp)
	movl	0(%rbp,%r12,4), %r10d
	addl	$1, %edx
	testl	%r10d, %r10d
	je	.L32
	movl	%r15d, 8(%rsp)
.L41:
	movslq	(%r11,%r12,4), %r12
	cmpl	%r10d, 12(%rsp)
	je	.L33
	movslq	%edx, %rax
	leaq	R(%rip), %rsi
	movq	%rax, 24(%rsp)
	imulq	(%rsi,%r12,8), %rax
	leaq	F(%rip), %rsi
	cqto
	idivq	%rcx
	movslq	%r10d, %rax
	movslq	(%rsi,%rax,4), %r15
	movq	%rax, 32(%rsp)
	movl	0(%rbp,%r15,4), %r14d
	addl	$1, %edx
	testl	%r14d, %r14d
	je	.L34
	movq	%r12, %r13
.L40:
	movslq	(%r11,%r15,4), %r15
	cmpl	%r14d, 8(%rsp)
	je	.L35
	leaq	R(%rip), %rsi
	movslq	%edx, %r12
	movslq	%r14d, %r9
	movq	(%rsi,%r15,8), %rax
	leaq	F(%rip), %rsi
	movslq	(%rsi,%r9,4), %rbx
	imulq	%r12, %rax
	cqto
	idivq	%rcx
	leal	1(%rdx), %eax
.L95:
	movl	0(%rbp,%rbx,4), %edi
	testl	%edi, %edi
	je	.L36
.L39:
	movslq	(%r11,%rbx,4), %rbx
	cmpl	%edi, %r10d
	je	.L95
	cltq
	leaq	R(%rip), %rsi
	xorl	%r8d, %r8d
	movq	%r9, 216(%rsp)
	movq	%rax, 192(%rsp)
	imulq	(%rsi,%rbx,8), %rax
	movl	%r10d, 212(%rsp)
	movl	%edi, 208(%rsp)
	cqto
	idivq	%rcx
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	leaq	1(%rdx), %rsi
	movl	%r14d, %edx
	call	S
	movslq	208(%rsp), %rdi
	leaq	D(%rip), %rsi
	movq	M(%rip), %rcx
	movl	212(%rsp), %r10d
	movq	216(%rsp), %r9
	leaq	T(%rip), %r11
	movq	(%rsi,%rdi,8), %rax
	movl	0(%rbp,%rbx,4), %edi
	addq	$1, %rax
	imulq	192(%rsp), %rax
	cqto
	idivq	%rcx
	testl	%edi, %edi
	movl	%edx, %eax
	jne	.L39
	.p2align 4,,10
	.p2align 3
.L36:
	cltq
	cqto
	idivq	%rcx
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%r9,8)
	leaq	D(%rip), %rax
	movq	(%rax,%r9,8), %rax
	addq	$1, %rax
	imulq	%r12, %rax
	cqto
	idivq	%rcx
.L35:
	movl	0(%rbp,%r15,4), %r14d
	testl	%r14d, %r14d
	jne	.L40
	movq	%r13, %r12
.L34:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	cqto
	idivq	%rcx
	movq	32(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	leaq	D(%rip), %rsi
	movq	(%rsi,%rax,8), %rax
	addq	$1, %rax
	imulq	24(%rsp), %rax
	cqto
	idivq	%rcx
.L33:
	movl	0(%rbp,%r12,4), %r10d
	testl	%r10d, %r10d
	jne	.L41
.L32:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	64(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	56(%rsp), %rax
	cqto
	idivq	%rcx
.L31:
	movq	(%rsp), %rax
	movl	0(%rbp,%rax,4), %r15d
	testl	%r15d, %r15d
	jne	.L42
.L30:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	88(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	80(%rsp), %rax
	cqto
	idivq	%rcx
.L29:
	movq	16(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 12(%rsp)
	testl	%eax, %eax
	jne	.L43
.L28:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	120(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	104(%rsp), %rax
	cqto
	idivq	%rcx
.L27:
	movq	40(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 48(%rsp)
	testl	%eax, %eax
	jne	.L44
.L26:
	movslq	%edx, %rax
	leaq	P(%rip), %rdi
	leaq	D(%rip), %rsi
	cqto
	idivq	%rcx
	movq	144(%rsp), %rax
	movq	%rdx, (%rdi,%rax,8)
	movq	(%rsi,%rax,8), %rax
	addq	$1, %rax
	imulq	136(%rsp), %rax
	cqto
	idivq	%rcx
.L25:
	movq	72(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 52(%rsp)
	testl	%eax, %eax
	jne	.L45
.L24:
	movslq	%edx, %rax
	leaq	P(%rip), %rdi
	leaq	D(%rip), %rbx
	cqto
	idivq	%rcx
	movq	160(%rsp), %rax
	movq	%rdx, (%rdi,%rax,8)
	movq	(%rbx,%rax,8), %rax
	addq	$1, %rax
	imulq	152(%rsp), %rax
	cqto
	idivq	%rcx
.L23:
	movq	96(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 112(%rsp)
	testl	%eax, %eax
	jne	.L46
.L22:
	movslq	%edx, %rax
	leaq	P(%rip), %rsi
	leaq	D(%rip), %rdi
	cqto
	idivq	%rcx
	movq	184(%rsp), %rax
	movq	%rdx, (%rsi,%rax,8)
	movq	(%rdi,%rax,8), %rax
	addq	$1, %rax
	imulq	176(%rsp), %rax
	cqto
	idivq	%rcx
.L21:
	movq	128(%rsp), %rax
	movl	0(%rbp,%rax,4), %eax
	movl	%eax, 116(%rsp)
	testl	%eax, %eax
	jne	.L47
	movl	%edx, %esi
.L20:
	movslq	%esi, %rax
	cqto
	idivq	%rcx
	movq	200(%rsp), %rcx
	leaq	P(%rip), %rax
	movq	%rdx, (%rax,%rcx,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
.L97:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L114
	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	.L98
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movq	%xmm0, (%r14,%rax,4)
	movl	%esi, i(%rip)
	movl	%edx, 0(%r13,%rcx,4)
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L98:
	movl	%esi, n(%rip)
	movq	%rdx, M(%rip)
	jmp	.L97
	.p2align 4,,10
	.p2align 3
.L114:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	je	.L101
	cltq
	leaq	A(%rip), %r8
	leaq	T(%rip), %rdi
	leaq	F(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L102:
	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	.L102
	movl	$0, i(%rip)
.L101:
	movl	4+F(%rip), %esi
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	P(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	call	s
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	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	.L112
	.p2align 4,,10
	.p2align 3
.L103:
	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	.L103
.L112:
	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,0),(I=B[i])-p?s(I,F[I],u,0),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,0,0),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,0);for(S(1,1,0,0,0);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,0),(I=B[i])-p?s(I,F[I],u,0),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,0,0),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,0);for(S(1,1,0,0,0);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), %esi
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	$0, %ecx
	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), %esi
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	$0, %ecx
	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), %rsi
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	$0, %r8d
	movl	$0, %ecx
	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, %ecx
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$0, %r8d
	movl	$0, %ecx
	movl	$0, %edx
	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.
train
	.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), %esi
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	$0, %ecx
	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), %esi
	movl	-4(%rbp), %edx
	movl	-16(%rbp), %eax
	movl	$0, %ecx
	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), %rsi
	movl	-4(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	$0, %r8d
	movl	$0, %ecx
	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, %ecx
	movl	$0, %edx
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	s
	movl	$0, %r8d
	movl	$0, %ecx
	movl	$0, %edx
	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:
