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<stdlib.h>
#include<memory.h>
#include<string.h>
n;//ACe
char s[101][999];//ACe¼
p[101];//wü¿i
r[101];//VsÌCfbNX(-1=BàsÂ)
k[100];//[i]:ACeiÌBàÉKvÈACe
q[100][100];//[i][j]:ACeiÌBàÉKvÈACeXg
G(){//ACe¼ðüÍµAACeCfbNXðÔ·
	int i;
	char t[999];
	scanf("%s",t);
	for(i=0;i<n;i++)
		if(strcmp(s[i],t)==0)
			return i;
	return n;
}
R(o){//ACeoÌÅ¬Ìli
	int m,i;
	if(r[o]!=-1){
		m=0;
		for(i=0;i<k[r[o]];i++)
			m+=R(q[r[o]][i]);
	}else
		m=p[o];
	if(p[o]<m)
		m=p[o];
	return m;
}
main(){
	int i,j,m;
	for(;scanf("%d",&n),n;){
		memset(r,-1,sizeof(r));
		for(i=0;i<n;i++){
			scanf("\n%s%d",s[i],p+i);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("\n");
			r[G()]=i;
			scanf("%d",k+i);
			for(j=0;j<k[i];j++){
				scanf(" ");
				q[i][j]=G();
			}
		}
		printf("%d\n",R(G()));
	}
	exit(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 100899
s:
	.zero	100899
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 404
r:
	.zero	404
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 400
k:
	.zero	400
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 40000
q:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1012(%rbp)
	jmp	.L2
.L5:
	movl	-1012(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-1012(%rbp), %eax
	jmp	.L6
.L3:
	addl	$1, -1012(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -1012(%rbp)
	jl	.L5
	movl	n(%rip), %eax
.L6:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	G, .-G
	.globl	R
	.type	R, @function
R:
.LFB7:
	.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L9
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	addl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L12
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L12:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L13
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	R, .-R
	.section	.rodata
.LC1:
	.string	"\n%s%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"\n"
.LC4:
	.string	" "
.LC5:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L16
.L23:
	movl	$404, %edx
	movl	$-1, %esi
	leaq	r(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -16(%rbp)
	jmp	.L17
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L19
.L22:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	q(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	addl	$1, -16(%rbp)
.L19:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L22
	movl	$0, %eax
	call	G
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
	.text
	.p2align 4
	.globl	G
	.type	G, @function
G:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r13
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	testl	%r12d, %r12d
	jle	.L1
	leaq	s(%rip), %rbp
	xorl	%ebx, %ebx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebx
	addq	$999, %rbp
	cmpl	%r12d, %ebx
	je	.L1
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	%ebx, %r12d
.L1:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	G, .-G
	.p2align 4
	.globl	R
	.type	R, @function
R:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	r(%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	$248, %rsp
	.cfi_def_cfa_offset 304
	movq	%rax, 200(%rsp)
	movslq	(%rdi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L12
	leaq	k(%rip), %r11
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L58
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	leaq	q(%rip), %r13
	movl	$0, 220(%rsp)
	leaq	(%rax,%rax,4), %rax
	leaq	4(%r13), %r14
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	leaq	p(%rip), %r15
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 232(%rsp)
	movq	%rdi, 176(%rsp)
.L47:
	movq	176(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 208(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L15
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L59
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 216(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rsi
	movq	%rax, 224(%rsp)
	movq	%rsi, 152(%rsp)
.L46:
	movq	152(%rsp), %rax
	leaq	r(%rip), %rsi
	movslq	(%rax), %rax
	movq	%rax, 192(%rsp)
	movslq	(%rsi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L18
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L60
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 172(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 184(%rsp)
	movq	%rdi, 136(%rsp)
.L45:
	movq	136(%rsp), %rax
	leaq	r(%rip), %rdi
	movslq	(%rax), %rax
	movq	%rax, 160(%rsp)
	movslq	(%rdi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L21
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L61
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 168(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rbx
	movq	%rax, 144(%rsp)
	movq	%rbx, 88(%rsp)
.L44:
	movq	88(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 128(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L24
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L62
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 100(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 120(%rsp)
	movq	%rdi, 8(%rsp)
.L43:
	movq	8(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 80(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L27
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L63
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 28(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r14,%rax,4), %rax
	salq	$4, %rcx
	movq	%rax, 32(%rsp)
	leaq	0(%r13,%rcx), %rbp
.L42:
	movslq	0(%rbp), %r12
	leaq	r(%rip), %rax
	movslq	(%rax,%r12,4), %rax
	cmpl	$-1, %eax
	je	.L30
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L64
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movq	%rbp, 40(%rsp)
	leaq	(%rax,%rax,4), %rax
	movl	$0, 96(%rsp)
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	movq	%r12, 48(%rsp)
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rsi
	movq	%rax, 112(%rsp)
	movq	%rsi, 104(%rsp)
.L41:
	movq	104(%rsp), %rax
	movslq	(%rax), %r12
	leaq	r(%rip), %rax
	movslq	(%rax,%r12,4), %rax
	cmpl	$-1, %eax
	je	.L33
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L65
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	xorl	%ebp, %ebp
	movq	%r12, %rcx
	leaq	(%rax,%rax,4), %rax
	movl	%ebp, %r12d
	movq	%rax, %r8
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r14,%rax,4), %rax
	salq	$4, %r8
	movq	%rax, (%rsp)
	leaq	0(%r13,%r8), %rbx
	movq	%rbx, %rbp
.L40:
	movslq	0(%rbp), %r8
	leaq	r(%rip), %rax
	movslq	(%rax,%r8,4), %rax
	cmpl	$-1, %eax
	je	.L36
	movl	(%r11,%rax,4), %edi
	testl	%edi, %edi
	jle	.L66
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edi
	movq	%rcx, 64(%rsp)
	xorl	%ebx, %ebx
	leaq	(%rax,%rax,4), %rax
	movq	%r8, 72(%rsp)
	movq	%rax, %rsi
	leaq	(%rdi,%rax,4), %rax
	movq	%rbp, 56(%rsp)
	leaq	(%r14,%rax,4), %rax
	salq	$4, %rsi
	movq	%rax, 16(%rsp)
	addq	%r13, %rsi
	movq	%rsi, %rbp
.L39:
	movl	0(%rbp), %edi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	R
	leaq	k(%rip), %r11
	addl	%eax, %ebx
	cmpq	%rbp, 16(%rsp)
	jne	.L39
	movq	72(%rsp), %r8
	movq	56(%rsp), %rbp
	movq	64(%rsp), %rcx
	movl	(%r15,%r8,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L38:
	addl	%eax, %r12d
	addq	$4, %rbp
	cmpq	%rbp, (%rsp)
	jne	.L40
	movl	(%r15,%rcx,4), %eax
	cmpl	%eax, %r12d
	cmovle	%r12d, %eax
	movl	%eax, %ecx
.L35:
	addq	$4, 104(%rsp)
	movq	104(%rsp), %rax
	addl	%ecx, 96(%rsp)
	cmpq	%rax, 112(%rsp)
	jne	.L41
	movq	48(%rsp), %r12
	movl	96(%rsp), %edi
	movq	40(%rsp), %rbp
	movl	(%r15,%r12,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L32:
	addl	%eax, 28(%rsp)
	addq	$4, %rbp
	cmpq	%rbp, 32(%rsp)
	jne	.L42
	movq	80(%rsp), %rax
	movl	28(%rsp), %esi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %esi
	cmovle	%esi, %eax
.L29:
	addl	%eax, 100(%rsp)
	addq	$4, 8(%rsp)
	movq	8(%rsp), %rax
	cmpq	%rax, 120(%rsp)
	jne	.L43
	movq	128(%rsp), %rax
	movl	100(%rsp), %ebx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L26:
	addl	%eax, 168(%rsp)
	addq	$4, 88(%rsp)
	movq	88(%rsp), %rax
	cmpq	%rax, 144(%rsp)
	jne	.L44
	movq	160(%rsp), %rax
	movl	168(%rsp), %edi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L23:
	addl	%eax, 172(%rsp)
	addq	$4, 136(%rsp)
	movq	136(%rsp), %rax
	cmpq	%rax, 184(%rsp)
	jne	.L45
	movq	192(%rsp), %rax
	movl	172(%rsp), %edi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L20:
	addl	%eax, 216(%rsp)
	addq	$4, 152(%rsp)
	movq	152(%rsp), %rax
	cmpq	%rax, 224(%rsp)
	jne	.L46
	movq	208(%rsp), %rax
	movl	216(%rsp), %ebx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L17:
	addl	%eax, 220(%rsp)
	addq	$4, 176(%rsp)
	movq	176(%rsp), %rax
	cmpq	%rax, 232(%rsp)
	jne	.L47
	movq	200(%rsp), %rax
	movl	220(%rsp), %esi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %esi
	cmovle	%esi, %eax
.L11:
	addq	$248, %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
.L36:
	.cfi_restore_state
	movl	(%r15,%r8,4), %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L66:
	movl	(%r15,%r8,4), %eax
	xorl	%esi, %esi
	testl	%eax, %eax
	cmovg	%esi, %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L33:
	movl	(%r15,%r12,4), %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L65:
	movl	(%r15,%r12,4), %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	cmovg	%eax, %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r15,%r12,4), %eax
	jmp	.L32
.L64:
	movl	(%r15,%r12,4), %eax
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L32
.L27:
	movq	80(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L29
.L63:
	movq	80(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L29
.L24:
	movq	128(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L26
.L62:
	movq	128(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L26
.L21:
	movq	160(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L23
.L61:
	movq	160(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L23
.L18:
	movq	192(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L20
.L60:
	movq	192(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L20
.L15:
	movq	208(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L17
.L12:
	movq	200(%rsp), %rdi
	leaq	p(%rip), %rax
	movl	(%rax,%rdi,4), %eax
	jmp	.L11
.L59:
	movq	208(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L17
.L58:
	movq	200(%rsp), %rbx
	leaq	p(%rip), %rax
	xorl	%edx, %edx
	movl	(%rax,%rbx,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L11
	.cfi_endproc
.LFE52:
	.size	R, .-R
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"\n%s%d"
.LC3:
	.string	"\n"
.LC4:
	.string	" "
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	leaq	.LC1(%rip), %r14
	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
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	n(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L94
	movl	$50, %ecx
	movq	$-1, %rax
	leaq	r(%rip), %rdi
	movl	$0, %ebx
	rep stosq
	leaq	s(%rip), %rbp
	movl	$-1, (%rdi)
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L72:
	leaq	p(%rip), %rax
	movq	%rbp, %rsi
	leaq	.LC2(%rip), %rdi
	addq	$999, %rbp
	leaq	(%rax,%rbx,4), %rdx
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	cmpl	%ebx, n(%rip)
	jg	.L72
.L73:
	leaq	4(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	k(%rip), %rbx
	leaq	q(%rip), %rbp
	leaq	.LC4(%rip), %r12
	testl	%ecx, %ecx
	jle	.L71
	.p2align 4,,10
	.p2align 3
.L77:
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	call	G
	leaq	r(%rip), %rcx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	cltq
	movl	%r13d, (%rcx,%rax,4)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rbx), %edx
	testl	%edx, %edx
	jle	.L78
	.p2align 4,,10
	.p2align 3
.L76:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	call	G
	movl	%eax, 0(%rbp,%r15,4)
	addq	$1, %r15
	cmpl	%r15d, (%rbx)
	jg	.L76
.L78:
	addl	$1, %r13d
	addq	$4, %rbx
	addq	$400, %rbp
	cmpl	%r13d, 4(%rsp)
	jg	.L77
.L71:
	xorl	%eax, %eax
	call	G
	movslq	%eax, %r9
	leaq	r(%rip), %rax
	movslq	(%rax,%r9,4), %rax
	cmpl	$-1, %eax
	je	.L95
	leaq	k(%rip), %rdx
	movl	(%rdx,%rax,4), %edx
	testl	%edx, %edx
	jle	.L96
	leaq	(%rax,%rax,4), %rax
	leaq	q(%rip), %rcx
	subl	$1, %edx
	xorl	%ebp, %ebp
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rbx
	leaq	(%rdx,%rax,4), %rdx
	leaq	4(%rcx), %rax
	salq	$4, %rbx
	leaq	(%rax,%rdx,4), %r10
	addq	%rcx, %rbx
.L81:
	movl	(%rbx), %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	R
	addl	%eax, %ebp
	cmpq	%rbx, %r10
	jne	.L81
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %eax
	cmpl	%eax, %ebp
	cmovle	%ebp, %eax
	movl	%eax, %edx
.L80:
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
.L95:
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %edx
	jmp	.L80
.L96:
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	cmovg	%eax, %edx
	jmp	.L80
.L94:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 40000
q:
	.zero	40000
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 400
k:
	.zero	400
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 404
r:
	.zero	404
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 100899
s:
	.zero	100899
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
	.text
	.p2align 4
	.globl	G
	.type	G, @function
G:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r13
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	testl	%r12d, %r12d
	jle	.L1
	leaq	s(%rip), %rbp
	xorl	%ebx, %ebx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebx
	addq	$999, %rbp
	cmpl	%r12d, %ebx
	je	.L1
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	%ebx, %r12d
.L1:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	G, .-G
	.p2align 4
	.globl	R
	.type	R, @function
R:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	leaq	r(%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	$248, %rsp
	.cfi_def_cfa_offset 304
	movq	%rax, 200(%rsp)
	movslq	(%rdi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L12
	leaq	k(%rip), %r11
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L58
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	leaq	q(%rip), %r13
	movl	$0, 220(%rsp)
	leaq	(%rax,%rax,4), %rax
	leaq	4(%r13), %r14
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	leaq	p(%rip), %r15
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 232(%rsp)
	movq	%rdi, 176(%rsp)
.L47:
	movq	176(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 208(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L15
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L59
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 216(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rsi
	movq	%rax, 224(%rsp)
	movq	%rsi, 152(%rsp)
.L46:
	movq	152(%rsp), %rax
	leaq	r(%rip), %rsi
	movslq	(%rax), %rax
	movq	%rax, 192(%rsp)
	movslq	(%rsi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L18
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L60
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 172(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 184(%rsp)
	movq	%rdi, 136(%rsp)
.L45:
	movq	136(%rsp), %rax
	leaq	r(%rip), %rdi
	movslq	(%rax), %rax
	movq	%rax, 160(%rsp)
	movslq	(%rdi,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L21
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L61
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 168(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rbx
	movq	%rax, 144(%rsp)
	movq	%rbx, 88(%rsp)
.L44:
	movq	88(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 128(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L24
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L62
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 100(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rdi
	movq	%rax, 120(%rsp)
	movq	%rdi, 8(%rsp)
.L43:
	movq	8(%rsp), %rax
	leaq	r(%rip), %rbx
	movslq	(%rax), %rax
	movq	%rax, 80(%rsp)
	movslq	(%rbx,%rax,4), %rax
	cmpl	$-1, %eax
	je	.L27
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L63
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movl	$0, 28(%rsp)
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r14,%rax,4), %rax
	salq	$4, %rcx
	movq	%rax, 32(%rsp)
	leaq	0(%r13,%rcx), %rbp
.L42:
	movslq	0(%rbp), %r12
	leaq	r(%rip), %rax
	movslq	(%rax,%r12,4), %rax
	cmpl	$-1, %eax
	je	.L30
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L64
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	movq	%rbp, 40(%rsp)
	leaq	(%rax,%rax,4), %rax
	movl	$0, 96(%rsp)
	movq	%rax, %rcx
	leaq	(%rdx,%rax,4), %rax
	movq	%r12, 48(%rsp)
	salq	$4, %rcx
	leaq	(%r14,%rax,4), %rax
	leaq	0(%r13,%rcx), %rsi
	movq	%rax, 112(%rsp)
	movq	%rsi, 104(%rsp)
.L41:
	movq	104(%rsp), %rax
	movslq	(%rax), %r12
	leaq	r(%rip), %rax
	movslq	(%rax,%r12,4), %rax
	cmpl	$-1, %eax
	je	.L33
	movl	(%r11,%rax,4), %edx
	testl	%edx, %edx
	jle	.L65
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edx
	xorl	%ebp, %ebp
	movq	%r12, %rcx
	leaq	(%rax,%rax,4), %rax
	movl	%ebp, %r12d
	movq	%rax, %r8
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r14,%rax,4), %rax
	salq	$4, %r8
	movq	%rax, (%rsp)
	leaq	0(%r13,%r8), %rbx
	movq	%rbx, %rbp
.L40:
	movslq	0(%rbp), %r8
	leaq	r(%rip), %rax
	movslq	(%rax,%r8,4), %rax
	cmpl	$-1, %eax
	je	.L36
	movl	(%r11,%rax,4), %edi
	testl	%edi, %edi
	jle	.L66
	leaq	(%rax,%rax,4), %rax
	subl	$1, %edi
	movq	%rcx, 64(%rsp)
	xorl	%ebx, %ebx
	leaq	(%rax,%rax,4), %rax
	movq	%r8, 72(%rsp)
	movq	%rax, %rsi
	leaq	(%rdi,%rax,4), %rax
	movq	%rbp, 56(%rsp)
	leaq	(%r14,%rax,4), %rax
	salq	$4, %rsi
	movq	%rax, 16(%rsp)
	addq	%r13, %rsi
	movq	%rsi, %rbp
.L39:
	movl	0(%rbp), %edi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	R
	leaq	k(%rip), %r11
	addl	%eax, %ebx
	cmpq	%rbp, 16(%rsp)
	jne	.L39
	movq	72(%rsp), %r8
	movq	56(%rsp), %rbp
	movq	64(%rsp), %rcx
	movl	(%r15,%r8,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L38:
	addl	%eax, %r12d
	addq	$4, %rbp
	cmpq	%rbp, (%rsp)
	jne	.L40
	movl	(%r15,%rcx,4), %eax
	cmpl	%eax, %r12d
	cmovle	%r12d, %eax
	movl	%eax, %ecx
.L35:
	addq	$4, 104(%rsp)
	movq	104(%rsp), %rax
	addl	%ecx, 96(%rsp)
	cmpq	%rax, 112(%rsp)
	jne	.L41
	movq	48(%rsp), %r12
	movl	96(%rsp), %edi
	movq	40(%rsp), %rbp
	movl	(%r15,%r12,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L32:
	addl	%eax, 28(%rsp)
	addq	$4, %rbp
	cmpq	%rbp, 32(%rsp)
	jne	.L42
	movq	80(%rsp), %rax
	movl	28(%rsp), %esi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %esi
	cmovle	%esi, %eax
.L29:
	addl	%eax, 100(%rsp)
	addq	$4, 8(%rsp)
	movq	8(%rsp), %rax
	cmpq	%rax, 120(%rsp)
	jne	.L43
	movq	128(%rsp), %rax
	movl	100(%rsp), %ebx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L26:
	addl	%eax, 168(%rsp)
	addq	$4, 88(%rsp)
	movq	88(%rsp), %rax
	cmpq	%rax, 144(%rsp)
	jne	.L44
	movq	160(%rsp), %rax
	movl	168(%rsp), %edi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L23:
	addl	%eax, 172(%rsp)
	addq	$4, 136(%rsp)
	movq	136(%rsp), %rax
	cmpq	%rax, 184(%rsp)
	jne	.L45
	movq	192(%rsp), %rax
	movl	172(%rsp), %edi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %edi
	cmovle	%edi, %eax
.L20:
	addl	%eax, 216(%rsp)
	addq	$4, 152(%rsp)
	movq	152(%rsp), %rax
	cmpq	%rax, 224(%rsp)
	jne	.L46
	movq	208(%rsp), %rax
	movl	216(%rsp), %ebx
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
.L17:
	addl	%eax, 220(%rsp)
	addq	$4, 176(%rsp)
	movq	176(%rsp), %rax
	cmpq	%rax, 232(%rsp)
	jne	.L47
	movq	200(%rsp), %rax
	movl	220(%rsp), %esi
	movl	(%r15,%rax,4), %eax
	cmpl	%eax, %esi
	cmovle	%esi, %eax
.L11:
	addq	$248, %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
.L36:
	.cfi_restore_state
	movl	(%r15,%r8,4), %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L66:
	movl	(%r15,%r8,4), %eax
	xorl	%esi, %esi
	testl	%eax, %eax
	cmovg	%esi, %eax
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L33:
	movl	(%r15,%r12,4), %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L65:
	movl	(%r15,%r12,4), %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	cmovg	%eax, %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r15,%r12,4), %eax
	jmp	.L32
.L64:
	movl	(%r15,%r12,4), %eax
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L32
.L27:
	movq	80(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L29
.L63:
	movq	80(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L29
.L24:
	movq	128(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L26
.L62:
	movq	128(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L26
.L21:
	movq	160(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L23
.L61:
	movq	160(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L23
.L18:
	movq	192(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L20
.L60:
	movq	192(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L20
.L15:
	movq	208(%rsp), %rax
	movl	(%r15,%rax,4), %eax
	jmp	.L17
.L12:
	movq	200(%rsp), %rdi
	leaq	p(%rip), %rax
	movl	(%rax,%rdi,4), %eax
	jmp	.L11
.L59:
	movq	208(%rsp), %rax
	xorl	%edx, %edx
	movl	(%r15,%rax,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L17
.L58:
	movq	200(%rsp), %rbx
	leaq	p(%rip), %rax
	xorl	%edx, %edx
	movl	(%rax,%rbx,4), %eax
	testl	%eax, %eax
	cmovg	%edx, %eax
	jmp	.L11
	.cfi_endproc
.LFE52:
	.size	R, .-R
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"\n%s%d"
.LC3:
	.string	"\n"
.LC4:
	.string	" "
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	leaq	.LC1(%rip), %r14
	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
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	n(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L94
	movl	$50, %ecx
	movq	$-1, %rax
	leaq	r(%rip), %rdi
	movl	$0, %ebx
	rep stosq
	leaq	s(%rip), %rbp
	movl	$-1, (%rdi)
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L72:
	leaq	p(%rip), %rax
	movq	%rbp, %rsi
	leaq	.LC2(%rip), %rdi
	addq	$999, %rbp
	leaq	(%rax,%rbx,4), %rdx
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__isoc99_scanf@PLT
	cmpl	%ebx, n(%rip)
	jg	.L72
.L73:
	leaq	4(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	leaq	k(%rip), %rbx
	leaq	q(%rip), %rbp
	leaq	.LC4(%rip), %r12
	testl	%ecx, %ecx
	jle	.L71
	.p2align 4,,10
	.p2align 3
.L77:
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	call	G
	leaq	r(%rip), %rcx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	cltq
	movl	%r13d, (%rcx,%rax,4)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rbx), %edx
	testl	%edx, %edx
	jle	.L78
	.p2align 4,,10
	.p2align 3
.L76:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	call	G
	movl	%eax, 0(%rbp,%r15,4)
	addq	$1, %r15
	cmpl	%r15d, (%rbx)
	jg	.L76
.L78:
	addl	$1, %r13d
	addq	$4, %rbx
	addq	$400, %rbp
	cmpl	%r13d, 4(%rsp)
	jg	.L77
.L71:
	xorl	%eax, %eax
	call	G
	movslq	%eax, %r9
	leaq	r(%rip), %rax
	movslq	(%rax,%r9,4), %rax
	cmpl	$-1, %eax
	je	.L95
	leaq	k(%rip), %rdx
	movl	(%rdx,%rax,4), %edx
	testl	%edx, %edx
	jle	.L96
	leaq	(%rax,%rax,4), %rax
	leaq	q(%rip), %rcx
	subl	$1, %edx
	xorl	%ebp, %ebp
	leaq	(%rax,%rax,4), %rax
	movq	%rax, %rbx
	leaq	(%rdx,%rax,4), %rdx
	leaq	4(%rcx), %rax
	salq	$4, %rbx
	leaq	(%rax,%rdx,4), %r10
	addq	%rcx, %rbx
.L81:
	movl	(%rbx), %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	R
	addl	%eax, %ebp
	cmpq	%rbx, %r10
	jne	.L81
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %eax
	cmpl	%eax, %ebp
	cmovle	%ebp, %eax
	movl	%eax, %edx
.L80:
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L68
.L95:
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %edx
	jmp	.L80
.L96:
	leaq	p(%rip), %rax
	movl	(%rax,%r9,4), %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	cmovg	%eax, %edx
	jmp	.L80
.L94:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	q
	.bss
	.align 32
	.type	q, @object
	.size	q, 40000
q:
	.zero	40000
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 400
k:
	.zero	400
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 404
r:
	.zero	404
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 100899
s:
	.zero	100899
	.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<stdlib.h>
#include<memory.h>
#include<string.h>
n;//ACe
char s[101][999];//ACe¼
p[101];//wü¿i
r[101];//VsÌCfbNX(-1=BàsÂ)
k[100];//[i]:ACeiÌBàÉKvÈACe
q[100][100];//[i][j]:ACeiÌBàÉKvÈACeXg
G(){//ACe¼ðüÍµAACeCfbNXðÔ·
	int i;
	char t[999];
	scanf("%s",t);
	for(i=0;i<n;i++)
		if(strcmp(s[i],t)==0)
			return i;
	return n;
}
R(o){//ACeoÌÅ¬Ìli
	int m,i;
	if(r[o]!=-1){
		m=0;
		for(i=0;i<k[r[o]];i++)
			m+=R(q[r[o]][i]);
	}else
		m=p[o];
	if(p[o]<m)
		m=p[o];
	return m;
}
main(){
	int i,j,m;
	for(;scanf("%d",&n),n;){
		memset(r,-1,sizeof(r));
		for(i=0;i<n;i++){
			scanf("\n%s%d",s[i],p+i);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("\n");
			r[G()]=i;
			scanf("%d",k+i);
			for(j=0;j<k[i];j++){
				scanf(" ");
				q[i][j]=G();
			}
		}
		printf("%d\n",R(G()));
	}
	exit(0);
}
8
wood 3000
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 3000
string 800
rice 1
water 0
racket 5000
microphone 4961
onigiri 113
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 tekcar microphone onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 3000
string 800
rice 1
water 0
racket 5000
enohporcim 4961
onigiri 113
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 300000
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 tekcar enohporcim onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 196
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microphone onigiri
guitar
1
computer 112750
-1
computer
0
 8
wood 5003
string 800
rice 36
water 0
racket 5000
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 reci water
guitar 3 tekcar enohporcim onigiri
guitar
1
computer 112750
0
computer
0
 8
wood 5003
string 800
rice 36
wrtea 0
racket 196
microphone 4961
onigiri 140
guitar 98000
3
racket 2 wood string
onigiri 2 rice water
guitar 3 racket microohone onigiri
guitar
1
computer 112750
-1
computer
0

8797
300000
 9997
300000
 9997
112750
 8762
300000
 4997
112750
 3801
300000
 36
112750
 5193
112750
 0
112750
 232
112750

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<stdlib.h>
#include<memory.h>
#include<string.h>
n;//ACe
char s[101][999];//ACe¼
p[101];//wü¿i
r[101];//VsÌCfbNX(-1=BàsÂ)
k[100];//[i]:ACeiÌBàÉKvÈACe
q[100][100];//[i][j]:ACeiÌBàÉKvÈACeXg
G(){//ACe¼ðüÍµAACeCfbNXðÔ·
	int i;
	char t[999];
	scanf("%s",t);
	for(i=0;i<n;i++)
		if(strcmp(s[i],t)==0)
			return i;
	return n;
}
R(o){//ACeoÌÅ¬Ìli
	int m,i;
	if(r[o]!=-1){
		m=0;
		for(i=0;i<k[r[o]];i++)
			m+=R(q[r[o]][i]);
	}else
		m=p[o];
	if(p[o]<m)
		m=p[o];
	return m;
}
main(){
	int i,j,m;
	for(;scanf("%d",&n),n;){
		memset(r,-1,sizeof(r));
		for(i=0;i<n;i++){
			scanf("\n%s%d",s[i],p+i);
		}
		scanf("%d",&m);
		for(i=0;i<m;i++){
			scanf("\n");
			r[G()]=i;
			scanf("%d",k+i);
			for(j=0;j<k[i];j++){
				scanf(" ");
				q[i][j]=G();
			}
		}
		printf("%d\n",R(G()));
	}
	exit(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 100899
s:
	.zero	100899
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 404
r:
	.zero	404
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 400
k:
	.zero	400
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 40000
q:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1012(%rbp)
	jmp	.L2
.L5:
	movl	-1012(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-1012(%rbp), %eax
	jmp	.L6
.L3:
	addl	$1, -1012(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -1012(%rbp)
	jl	.L5
	movl	n(%rip), %eax
.L6:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	G, .-G
	.globl	R
	.type	R, @function
R:
.LFB7:
	.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L9
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	addl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L12
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L12:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L13
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	R, .-R
	.section	.rodata
.LC1:
	.string	"\n%s%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"\n"
.LC4:
	.string	" "
.LC5:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L16
.L23:
	movl	$404, %edx
	movl	$-1, %esi
	leaq	r(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -16(%rbp)
	jmp	.L17
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L19
.L22:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	q(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	addl	$1, -16(%rbp)
.L19:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L22
	movl	$0, %eax
	call	G
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE8:
	.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	s
	.align 32
	.type	s, @object
	.size	s, 100899
s:
	.zero	100899
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 404
r:
	.zero	404
	.globl	k
	.align 32
	.type	k, @object
	.size	k, 400
k:
	.zero	400
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 40000
q:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1012(%rbp)
	jmp	.L2
.L5:
	movl	-1012(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-1012(%rbp), %eax
	jmp	.L6
.L3:
	addl	$1, -1012(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -1012(%rbp)
	jl	.L5
	movl	n(%rip), %eax
.L6:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	G, .-G
	.globl	R
	.type	R, @function
R:
.LFB7:
	.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L9
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L10
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	addl	%eax, -8(%rbp)
	addl	$1, -4(%rbp)
.L10:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L11
	jmp	.L12
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L12:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L13
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	R, .-R
	.section	.rodata
.LC1:
	.string	"\n%s%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"\n"
.LC4:
	.string	" "
.LC5:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L16
.L23:
	movl	$404, %edx
	movl	$-1, %esi
	leaq	r(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -16(%rbp)
	jmp	.L17
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$999, %rax, %rax
	leaq	s(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L17:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L18
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L19
.L22:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L20
.L21:
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %eax
	call	G
	movl	%eax, %edx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	q(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -12(%rbp)
.L20:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	k(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	addl	$1, -16(%rbp)
.L19:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L22
	movl	$0, %eax
	call	G
	movl	%eax, %edi
	movl	$0, %eax
	call	R
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE8:
	.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:
