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

```c
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY UINT32_C(1000000007)

uint32_t add(uint32_t a, uint32_t b) {
	uint32_t r = a + b;
	if (r >= MOD_BY) r -= MOD_BY;
	return r;
}

uint32_t mul(uint32_t a, uint32_t b) {
	return (uint32_t)(((uint64_t)a * b) % MOD_BY);
}

int N;
char node[1000][4];
int child_num[1000];
int children[1000][10];

uint32_t keisan(int idx) {
	uint32_t ret = 0;
	int i;
	switch (node[idx][0]) {
	case 'E':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'A':
		for (i = 0; i < child_num[idx]; i++) {
			ret = add(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'R':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, add(keisan(children[idx][i]), 1));
		}
		if (node[idx][1] != '?') ret = add(ret, MOD_BY - 1);
		break;
	}
	return ret;
}

int main(void) {
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%s", node[i]) != 1) return 1;
	}
	for (i = 1; i < N; i++) {
		int s, t;
		if (scanf("%d%d", &s, &t) != 2) return 1;
		s--;
		t--;
		children[s][child_num[s]++] = t;
	}
	printf("%"PRIu32"\n", keisan(0));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	add
	.type	add, @function
add:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jbe	.L2
	subl	$1000000007, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	add, .-add
	.globl	mul
	.type	mul, @function
mul:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	mul, .-mul
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	node
	.align 32
	.type	node, @object
	.size	node, 4000
node:
	.zero	4000
	.globl	child_num
	.align 32
	.type	child_num, @object
	.size	child_num, 4000
child_num:
	.zero	4000
	.globl	children
	.align 32
	.type	children, @object
	.size	children, 40000
children:
	.zero	40000
	.text
	.globl	keisan
	.type	keisan, @function
keisan:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	cmpl	$82, %eax
	je	.L7
	cmpl	$82, %eax
	jg	.L8
	cmpl	$65, %eax
	je	.L9
	cmpl	$69, %eax
	jne	.L8
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L20
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L20
.L9:
	movl	$0, -4(%rbp)
	jmp	.L13
.L14:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L21
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L21
.L7:
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	je	.L22
	movl	-8(%rbp), %eax
	movl	$1000000006, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L22
.L20:
	nop
	jmp	.L8
.L21:
	nop
	jmp	.L8
.L22:
	nop
.L8:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	keisan, .-keisan
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%u\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L24
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, -12(%rbp)
	jmp	.L26
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L25
.L27:
	addl	$1, -12(%rbp)
.L26:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L28
	movl	$1, -12(%rbp)
	jmp	.L29
.L31:
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L30
	movl	$1, %eax
	jmp	.L25
.L30:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	child_num(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rdi
	leaq	child_num(%rip), %rdx
	movl	%ecx, (%rdi,%rdx)
	movl	-16(%rbp), %edx
	movslq	%eax, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	children(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L31
	movl	$0, %edi
	call	keisan
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L25:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	add
	.type	add, @function
add:
.LFB23:
	.cfi_startproc
	endbr64
	leal	(%rdi,%rsi), %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmova	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	add, .-add
	.p2align 4
	.globl	mul
	.type	mul, @function
mul:
.LFB24:
	.cfi_startproc
	endbr64
	movabsq	$-8543223828751151131, %rdx
	movl	%esi, %esi
	movl	%edi, %edi
	imulq	%rsi, %rdi
	movq	%rdi, %rax
	mulq	%rdx
	movl	%edi, %eax
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	mul, .-mul
	.p2align 4
	.globl	keisan
	.type	keisan, @function
keisan:
.LFB25:
	.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
	movslq	%edi, %r13
	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
	leaq	node(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movzbl	(%rbx,%r13,4), %eax
	cmpb	$69, %al
	je	.L6
	cmpb	$82, %al
	je	.L7
	cmpb	$65, %al
	je	.L8
.L133:
	xorl	%r12d, %r12d
.L5:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %eax
	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
.L6:
	.cfi_restore_state
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L134
	leaq	children(%rip), %rax
	movabsq	$-8543223828751151131, %r14
	movq	%rax, %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movq	%rcx, (%rsp)
	movl	(%r15), %edi
	call	keisan
	movl	%eax, %esi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$1, %ebp
	je	.L16
	movl	4(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$2, %ebp
	je	.L16
	movl	8(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$3, %ebp
	je	.L16
	movl	12(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$4, %ebp
	je	.L16
	movl	16(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$5, %ebp
	je	.L16
	movl	20(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$6, %ebp
	je	.L16
	movl	24(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rsi, %rdx
	subq	%rax, %rdx
	movq	%rdx, 8(%rsp)
	movl	%edx, %r12d
	cmpl	$7, %ebp
	je	.L16
	movl	28(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$8, %ebp
	je	.L16
	movq	(%rsp), %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movl	32(%r15), %edi
	call	keisan
	movabsq	$-8543223828751151131, %rcx
	movl	%eax, %esi
	imulq	%r14, %rsi
	movq	%rsi, %rax
	mulq	%rcx
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$9, %ebp
	je	.L16
	movl	36(%r15), %edi
	call	keisan
	movabsq	$-8543223828751151131, %rcx
	movl	%eax, %r12d
	imulq	%r14, %r12
	movq	%r12, %rax
	mulq	%rcx
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r12d
	.p2align 4,,10
	.p2align 3
.L16:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L5
	addl	$1, %r12d
	xorl	%eax, %eax
	cmpl	$1000000007, %r12d
	cmove	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L135
	leaq	0(%r13,%r13,4), %rax
	leaq	children(%rip), %r15
	leaq	(%r15,%rax,8), %r14
	movl	(%r14), %edi
	call	keisan
	movl	%eax, %r12d
	leal	-1000000007(%rax), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$1, %ebp
	je	.L18
	movl	4(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$2, %ebp
	je	.L18
	movl	8(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$3, %ebp
	je	.L18
	movl	12(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$4, %ebp
	je	.L18
	movl	16(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$5, %ebp
	je	.L18
	movl	20(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$6, %ebp
	je	.L18
	movl	24(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$7, %ebp
	je	.L18
	movl	28(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$8, %ebp
	je	.L18
	movl	32(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$9, %ebp
	je	.L18
	movl	36(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	.p2align 4,,10
	.p2align 3
.L18:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L5
	leal	1(%r12), %eax
	subl	$1000000006, %r12d
	cmpl	$1000000006, %eax
	ja	.L5
.L41:
	movl	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L136
	leaq	children(%rip), %rax
	movabsq	$-8543223828751151131, %r14
	movq	%rax, %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movq	%rcx, (%rsp)
	movl	(%r15), %edi
	call	keisan
	leal	1(%rax), %edx
	subl	$1000000006, %eax
	cmpl	$1000000006, %edx
	cmova	%eax, %edx
	movl	%edx, %esi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$1, %ebp
	je	.L30
	movl	4(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$2, %ebp
	je	.L30
	movl	8(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$3, %ebp
	je	.L30
	movl	12(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$4, %ebp
	je	.L30
	movl	16(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$5, %ebp
	je	.L30
	movl	20(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$6, %ebp
	je	.L30
	movl	24(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$7, %ebp
	je	.L30
	movq	(%rsp), %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %rax
	movl	28(%rax), %edi
	movq	%rax, (%rsp)
	call	keisan
	leal	1(%rax), %edx
	subl	$1000000006, %eax
	cmpl	$1000000006, %edx
	cmova	%eax, %edx
	movl	%edx, %esi
	imulq	%r14, %rsi
	movabsq	$-8543223828751151131, %r14
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r15
	movl	%esi, %r12d
	cmpl	$8, %ebp
	je	.L30
	movq	(%rsp), %rax
	movl	32(%rax), %edi
	call	keisan
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%r15, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r15
	movl	%esi, %r12d
	cmpl	$9, %ebp
	je	.L30
	movq	(%rsp), %rax
	movl	36(%rax), %edi
	call	keisan
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%eax, %esi
	movl	%esi, %r12d
	imulq	%r15, %r12
	movq	%r12, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %r14
	subl	%r14d, %r12d
	.p2align 4,,10
	.p2align 3
.L30:
	cmpb	$63, 1(%rbx,%r13,4)
	je	.L5
	leal	-1(%r12), %eax
	testl	%r12d, %r12d
	movl	$1000000006, %r12d
	cmovne	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L135:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L133
	movl	$1, %eax
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L134:
	xorl	%r12d, %r12d
	cmpb	$63, 1(%rbx,%r13,4)
	sete	%r12b
	addl	$1, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L136:
	xorl	%r12d, %r12d
	cmpb	$63, 1(%rbx,%r13,4)
	sete	%r12b
	jmp	.L5
	.cfi_endproc
.LFE25:
	.size	keisan, .-keisan
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%u\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L141
	cmpl	$0, N(%rip)
	movl	%eax, %r12d
	jle	.L140
	leaq	node(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	jmp	.L142
	.p2align 4,,10
	.p2align 3
.L150:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jle	.L140
.L142:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L150
.L141:
	movl	$1, %r12d
.L137:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L151
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %eax
	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
.L140:
	.cfi_restore_state
	cmpl	$1, N(%rip)
	jle	.L143
	movl	$1, %r15d
	leaq	4(%rsp), %r13
	movq	%rsp, %rbp
	leaq	.LC2(%rip), %rbx
	leaq	child_num(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L145:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L137
	movl	(%rsp), %eax
	movl	4(%rsp), %ecx
	addl	$1, %r15d
	subl	$1, %eax
	leal	-1(%rcx), %esi
	cmpl	%r15d, N(%rip)
	cltq
	leaq	children(%rip), %rcx
	movslq	(%r14,%rax,4), %rdx
	leal	1(%rdx), %edi
	movl	%edi, (%r14,%rax,4)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	%esi, (%rcx,%rax,4)
	jg	.L145
.L143:
	xorl	%edi, %edi
	xorl	%r12d, %r12d
	call	keisan
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L137
.L151:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	children
	.bss
	.align 32
	.type	children, @object
	.size	children, 40000
children:
	.zero	40000
	.globl	child_num
	.align 32
	.type	child_num, @object
	.size	child_num, 4000
child_num:
	.zero	4000
	.globl	node
	.align 32
	.type	node, @object
	.size	node, 4000
node:
	.zero	4000
	.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	add
	.type	add, @function
add:
.LFB23:
	.cfi_startproc
	endbr64
	leal	(%rdi,%rsi), %eax
	leal	-1000000007(%rax), %edx
	cmpl	$1000000006, %eax
	cmova	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	add, .-add
	.p2align 4
	.globl	mul
	.type	mul, @function
mul:
.LFB24:
	.cfi_startproc
	endbr64
	movabsq	$-8543223828751151131, %rdx
	movl	%esi, %esi
	movl	%edi, %edi
	imulq	%rsi, %rdi
	movq	%rdi, %rax
	mulq	%rdx
	movl	%edi, %eax
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	mul, .-mul
	.p2align 4
	.globl	keisan
	.type	keisan, @function
keisan:
.LFB25:
	.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
	movslq	%edi, %r13
	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
	leaq	node(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movzbl	(%rbx,%r13,4), %eax
	cmpb	$69, %al
	je	.L6
	cmpb	$82, %al
	je	.L7
	cmpb	$65, %al
	je	.L8
.L133:
	xorl	%r12d, %r12d
.L5:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %eax
	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
.L6:
	.cfi_restore_state
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L134
	leaq	children(%rip), %rax
	movabsq	$-8543223828751151131, %r14
	movq	%rax, %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movq	%rcx, (%rsp)
	movl	(%r15), %edi
	call	keisan
	movl	%eax, %esi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$1, %ebp
	je	.L16
	movl	4(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$2, %ebp
	je	.L16
	movl	8(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$3, %ebp
	je	.L16
	movl	12(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$4, %ebp
	je	.L16
	movl	16(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$5, %ebp
	je	.L16
	movl	20(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$6, %ebp
	je	.L16
	movl	24(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	movq	%rsi, %rdx
	subq	%rax, %rdx
	movq	%rdx, 8(%rsp)
	movl	%edx, %r12d
	cmpl	$7, %ebp
	je	.L16
	movl	28(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	movl	%eax, %esi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$8, %ebp
	je	.L16
	movq	(%rsp), %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movl	32(%r15), %edi
	call	keisan
	movabsq	$-8543223828751151131, %rcx
	movl	%eax, %esi
	imulq	%r14, %rsi
	movq	%rsi, %rax
	mulq	%rcx
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$9, %ebp
	je	.L16
	movl	36(%r15), %edi
	call	keisan
	movabsq	$-8543223828751151131, %rcx
	movl	%eax, %r12d
	imulq	%r14, %r12
	movq	%r12, %rax
	mulq	%rcx
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rdx
	subl	%edx, %r12d
	.p2align 4,,10
	.p2align 3
.L16:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L5
	addl	$1, %r12d
	xorl	%eax, %eax
	cmpl	$1000000007, %r12d
	cmove	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L135
	leaq	0(%r13,%r13,4), %rax
	leaq	children(%rip), %r15
	leaq	(%r15,%rax,8), %r14
	movl	(%r14), %edi
	call	keisan
	movl	%eax, %r12d
	leal	-1000000007(%rax), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$1, %ebp
	je	.L18
	movl	4(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$2, %ebp
	je	.L18
	movl	8(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$3, %ebp
	je	.L18
	movl	12(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$4, %ebp
	je	.L18
	movl	16(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$5, %ebp
	je	.L18
	movl	20(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$6, %ebp
	je	.L18
	movl	24(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$7, %ebp
	je	.L18
	movl	28(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$8, %ebp
	je	.L18
	movl	32(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	cmpl	$9, %ebp
	je	.L18
	movl	36(%r14), %edi
	call	keisan
	addl	%eax, %r12d
	leal	-1000000007(%r12), %eax
	cmpl	$1000000006, %r12d
	cmova	%eax, %r12d
	.p2align 4,,10
	.p2align 3
.L18:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L5
	leal	1(%r12), %eax
	subl	$1000000006, %r12d
	cmpl	$1000000006, %eax
	ja	.L5
.L41:
	movl	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	child_num(%rip), %rax
	movl	(%rax,%r13,4), %ebp
	testl	%ebp, %ebp
	jle	.L136
	leaq	children(%rip), %rax
	movabsq	$-8543223828751151131, %r14
	movq	%rax, %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %r15
	movq	%rcx, (%rsp)
	movl	(%r15), %edi
	call	keisan
	leal	1(%rax), %edx
	subl	$1000000006, %eax
	cmpl	$1000000006, %edx
	cmova	%eax, %edx
	movl	%edx, %esi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$1, %ebp
	je	.L30
	movl	4(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$2, %ebp
	je	.L30
	movl	8(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$3, %ebp
	je	.L30
	movl	12(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$4, %ebp
	je	.L30
	movl	16(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$5, %ebp
	je	.L30
	movl	20(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, 8(%rsp)
	movl	%esi, %r12d
	cmpl	$6, %ebp
	je	.L30
	movl	24(%r15), %edi
	call	keisan
	movq	8(%rsp), %rdx
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%rdx, %rsi
	movq	%rsi, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %rax
	subq	%rax, %rsi
	movq	%rsi, %r14
	movl	%esi, %r12d
	cmpl	$7, %ebp
	je	.L30
	movq	(%rsp), %rcx
	leaq	0(%r13,%r13,4), %rax
	leaq	(%rcx,%rax,8), %rax
	movl	28(%rax), %edi
	movq	%rax, (%rsp)
	call	keisan
	leal	1(%rax), %edx
	subl	$1000000006, %eax
	cmpl	$1000000006, %edx
	cmova	%eax, %edx
	movl	%edx, %esi
	imulq	%r14, %rsi
	movabsq	$-8543223828751151131, %r14
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r15
	movl	%esi, %r12d
	cmpl	$8, %ebp
	je	.L30
	movq	(%rsp), %rax
	movl	32(%rax), %edi
	call	keisan
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%rax, %rsi
	imulq	%r15, %rsi
	movq	%rsi, %rax
	mulq	%r14
	shrq	$29, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rsi
	movq	%rsi, %r15
	movl	%esi, %r12d
	cmpl	$9, %ebp
	je	.L30
	movq	(%rsp), %rax
	movl	36(%rax), %edi
	call	keisan
	leal	1(%rax), %esi
	subl	$1000000006, %eax
	cmpl	$1000000006, %esi
	cmova	%eax, %esi
	movl	%esi, %r12d
	imulq	%r15, %r12
	movq	%r12, %rax
	mulq	%r14
	movq	%rdx, %r14
	shrq	$29, %r14
	imulq	$1000000007, %r14, %r14
	subl	%r14d, %r12d
	.p2align 4,,10
	.p2align 3
.L30:
	cmpb	$63, 1(%rbx,%r13,4)
	je	.L5
	leal	-1(%r12), %eax
	testl	%r12d, %r12d
	movl	$1000000006, %r12d
	cmovne	%eax, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L135:
	cmpb	$63, 1(%rbx,%r13,4)
	jne	.L133
	movl	$1, %eax
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L134:
	xorl	%r12d, %r12d
	cmpb	$63, 1(%rbx,%r13,4)
	sete	%r12b
	addl	$1, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L136:
	xorl	%r12d, %r12d
	cmpb	$63, 1(%rbx,%r13,4)
	sete	%r12b
	jmp	.L5
	.cfi_endproc
.LFE25:
	.size	keisan, .-keisan
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%u\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L141
	cmpl	$0, N(%rip)
	movl	%eax, %r12d
	jle	.L140
	leaq	node(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r13
	jmp	.L142
	.p2align 4,,10
	.p2align 3
.L150:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	%ebp, N(%rip)
	jle	.L140
.L142:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L150
.L141:
	movl	$1, %r12d
.L137:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L151
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %eax
	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
.L140:
	.cfi_restore_state
	cmpl	$1, N(%rip)
	jle	.L143
	movl	$1, %r15d
	leaq	4(%rsp), %r13
	movq	%rsp, %rbp
	leaq	.LC2(%rip), %rbx
	leaq	child_num(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L145:
	xorl	%eax, %eax
	movq	%r13, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L137
	movl	(%rsp), %eax
	movl	4(%rsp), %ecx
	addl	$1, %r15d
	subl	$1, %eax
	leal	-1(%rcx), %esi
	cmpl	%r15d, N(%rip)
	cltq
	leaq	children(%rip), %rcx
	movslq	(%r14,%rax,4), %rdx
	leal	1(%rdx), %edi
	movl	%edi, (%r14,%rax,4)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	%esi, (%rcx,%rax,4)
	jg	.L145
.L143:
	xorl	%edi, %edi
	xorl	%r12d, %r12d
	call	keisan
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L137
.L151:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	children
	.bss
	.align 32
	.type	children, @object
	.size	children, 40000
children:
	.zero	40000
	.globl	child_num
	.align 32
	.type	child_num, @object
	.size	child_num, 4000
child_num:
	.zero	4000
	.globl	node
	.align 32
	.type	node, @object
	.size	node, 4000
node:
	.zero	4000
	.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:

#include <stdio.h>
#include <inttypes.h>

#define MOD_BY UINT32_C(1000000007)

uint32_t add(uint32_t a, uint32_t b) {
	uint32_t r = a + b;
	if (r >= MOD_BY) r -= MOD_BY;
	return r;
}

uint32_t mul(uint32_t a, uint32_t b) {
	return (uint32_t)(((uint64_t)a * b) % MOD_BY);
}

int N;
char node[1000][4];
int child_num[1000];
int children[1000][10];

uint32_t keisan(int idx) {
	uint32_t ret = 0;
	int i;
	switch (node[idx][0]) {
	case 'E':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'A':
		for (i = 0; i < child_num[idx]; i++) {
			ret = add(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'R':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, add(keisan(children[idx][i]), 1));
		}
		if (node[idx][1] != '?') ret = add(ret, MOD_BY - 1);
		break;
	}
	return ret;
}

int main(void) {
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%s", node[i]) != 1) return 1;
	}
	for (i = 1; i < N; i++) {
		int s, t;
		if (scanf("%d%d", &s, &t) != 2) return 1;
		s--;
		t--;
		children[s][child_num[s]++] = t;
	}
	printf("%"PRIu32"\n", keisan(0));
	return 0;
}
12
A
E
E
E
R?
E?
E?
E
E
E
E?
E
1 2
1 3
1 4
2 5
4 6
4 7
5 8
5 9
7 10
7 11
11 12

11

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

```c
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY UINT32_C(1000000007)

uint32_t add(uint32_t a, uint32_t b) {
	uint32_t r = a + b;
	if (r >= MOD_BY) r -= MOD_BY;
	return r;
}

uint32_t mul(uint32_t a, uint32_t b) {
	return (uint32_t)(((uint64_t)a * b) % MOD_BY);
}

int N;
char node[1000][4];
int child_num[1000];
int children[1000][10];

uint32_t keisan(int idx) {
	uint32_t ret = 0;
	int i;
	switch (node[idx][0]) {
	case 'E':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'A':
		for (i = 0; i < child_num[idx]; i++) {
			ret = add(ret, keisan(children[idx][i]));
		}
		if (node[idx][1] == '?') ret = add(ret, 1);
		break;
	case 'R':
		ret = 1;
		for (i = 0; i < child_num[idx]; i++) {
			ret = mul(ret, add(keisan(children[idx][i]), 1));
		}
		if (node[idx][1] != '?') ret = add(ret, MOD_BY - 1);
		break;
	}
	return ret;
}

int main(void) {
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%s", node[i]) != 1) return 1;
	}
	for (i = 1; i < N; i++) {
		int s, t;
		if (scanf("%d%d", &s, &t) != 2) return 1;
		s--;
		t--;
		children[s][child_num[s]++] = t;
	}
	printf("%"PRIu32"\n", keisan(0));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	add
	.type	add, @function
add:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jbe	.L2
	subl	$1000000007, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	add, .-add
	.globl	mul
	.type	mul, @function
mul:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	mul, .-mul
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	node
	.align 32
	.type	node, @object
	.size	node, 4000
node:
	.zero	4000
	.globl	child_num
	.align 32
	.type	child_num, @object
	.size	child_num, 4000
child_num:
	.zero	4000
	.globl	children
	.align 32
	.type	children, @object
	.size	children, 40000
children:
	.zero	40000
	.text
	.globl	keisan
	.type	keisan, @function
keisan:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	cmpl	$82, %eax
	je	.L7
	cmpl	$82, %eax
	jg	.L8
	cmpl	$65, %eax
	je	.L9
	cmpl	$69, %eax
	jne	.L8
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L20
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L20
.L9:
	movl	$0, -4(%rbp)
	jmp	.L13
.L14:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L21
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L21
.L7:
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	je	.L22
	movl	-8(%rbp), %eax
	movl	$1000000006, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L22
.L20:
	nop
	jmp	.L8
.L21:
	nop
	jmp	.L8
.L22:
	nop
.L8:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	keisan, .-keisan
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%u\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L24
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, -12(%rbp)
	jmp	.L26
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L25
.L27:
	addl	$1, -12(%rbp)
.L26:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L28
	movl	$1, -12(%rbp)
	jmp	.L29
.L31:
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L30
	movl	$1, %eax
	jmp	.L25
.L30:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	child_num(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rdi
	leaq	child_num(%rip), %rdx
	movl	%ecx, (%rdi,%rdx)
	movl	-16(%rbp), %edx
	movslq	%eax, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	children(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L31
	movl	$0, %edi
	call	keisan
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L25:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	add
	.type	add, @function
add:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$1000000006, -4(%rbp)
	jbe	.L2
	subl	$1000000007, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	add, .-add
	.globl	mul
	.type	mul, @function
mul:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rdx, %rax
	shrq	$29, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	mul, .-mul
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	node
	.align 32
	.type	node, @object
	.size	node, 4000
node:
	.zero	4000
	.globl	child_num
	.align 32
	.type	child_num, @object
	.size	child_num, 4000
child_num:
	.zero	4000
	.globl	children
	.align 32
	.type	children, @object
	.size	children, 40000
children:
	.zero	40000
	.text
	.globl	keisan
	.type	keisan, @function
keisan:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	cmpl	$82, %eax
	je	.L7
	cmpl	$82, %eax
	jg	.L8
	cmpl	$65, %eax
	je	.L9
	cmpl	$69, %eax
	jne	.L8
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L20
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L20
.L9:
	movl	$0, -4(%rbp)
	jmp	.L13
.L14:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L13:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L14
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	jne	.L21
	movl	-8(%rbp), %eax
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L21
.L7:
	movl	$1, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	children(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	keisan
	movl	$1, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	mul
	movl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	child_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	1+node(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	cmpb	$63, %al
	je	.L22
	movl	-8(%rbp), %eax
	movl	$1000000006, %esi
	movl	%eax, %edi
	call	add
	movl	%eax, -8(%rbp)
	jmp	.L22
.L20:
	nop
	jmp	.L8
.L21:
	nop
	jmp	.L8
.L22:
	nop
.L8:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	keisan, .-keisan
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%u\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.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
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L24
	movl	$1, %eax
	jmp	.L25
.L24:
	movl	$0, -12(%rbp)
	jmp	.L26
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	node(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L27
	movl	$1, %eax
	jmp	.L25
.L27:
	addl	$1, -12(%rbp)
.L26:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L28
	movl	$1, -12(%rbp)
	jmp	.L29
.L31:
	leaq	-16(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L30
	movl	$1, %eax
	jmp	.L25
.L30:
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %esi
	movl	-20(%rbp), %edx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	child_num(%rip), %rax
	movl	(%rcx,%rax), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rdi
	leaq	child_num(%rip), %rdx
	movl	%ecx, (%rdi,%rdx)
	movl	-16(%rbp), %edx
	movslq	%eax, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	children(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L29:
	movl	N(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L31
	movl	$0, %edi
	call	keisan
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L25:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
