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<string.h>
char s[100][101],o[101],q[101];
int n,m,i,j,k,p[100],a,b;
int f(char *t)
{
	int i;
	for(i=0;i<n&&strcmp(s[i],t);i++);
	return i;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		for(i=0;i<n;i++)
			scanf("%s%d",s[i],&p[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s%d",o,&k);
			b=f(o);
			for(a=0;k--;)
			{
				scanf("%s",q);
				a+=p[f(q)];
			}
			p[b]=p[b]>a?a:p[b];
		}
		scanf("%s",o);
		printf("%d\n",p[f(o)]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 10100
s:
	.zero	10100
	.globl	o
	.align 32
	.type	o, @object
	.size	o, 101
o:
	.zero	101
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 101
q:
	.zero	101
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 400
p:
	.zero	400
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%s%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L7
.L14:
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L10
.L13:
	leaq	k(%rip), %rax
	movq	%rax, %rdx
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	movl	%eax, b(%rip)
	movl	$0, a(%rip)
	jmp	.L11
.L12:
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	q(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	addl	%edx, %eax
	movl	%eax, a(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	b(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	f
	.type	f, @function
f:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	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	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	n(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L5
	movq	%rdi, %rbp
	leaq	s(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %r12d
	addq	$101, %rbx
	cmpl	%r13d, %r12d
	je	.L1
.L3:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L1:
	addq	$8, %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
.L5:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L1
	.cfi_endproc
.LFE35:
	.size	f, .-f
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	q(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L10:
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L44
	leaq	.LC1(%rip), %rcx
	movl	$0, %eax
	movl	$0, i(%rip)
	movq	%rcx, 8(%rsp)
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L11:
	cltq
	leaq	p(%rip), %rcx
	movq	8(%rsp), %rdi
	leaq	0(,%rax,4), %rdx
	leaq	(%rcx,%rdx), %r8
	addq	%rax, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rsi
	leaq	s(%rip), %rax
	movq	%r8, %rdx
	addq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L11
.L14:
	leaq	m(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	leaq	.LC1(%rip), %rax
	movl	$0, i(%rip)
	movq	%rax, 8(%rsp)
	leaq	o(%rip), %r13
	leaq	.LC2(%rip), %r14
	testl	%edx, %edx
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	movq	8(%rsp), %rdi
	leaq	k(%rip), %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	testl	%r12d, %r12d
	jle	.L29
	leaq	s(%rip), %rbx
	xorl	%r15d, %r15d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	addl	$1, %r15d
	addq	$101, %rbx
	cmpl	%r12d, %r15d
	je	.L17
.L18:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L19
.L17:
	movl	k(%rip), %eax
	movl	%r15d, b(%rip)
	movl	$0, a(%rip)
	leal	-1(%rax), %ecx
	movl	%ecx, k(%rip)
	testl	%eax, %eax
	je	.L20
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L31
	leaq	s(%rip), %r12
	xorl	%r15d, %r15d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r15d
	addq	$101, %r12
	cmpl	%ebx, %r15d
	je	.L21
.L22:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L23
.L21:
	movslq	%r15d, %rdx
	leaq	p(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	movl	k(%rip), %edx
	addl	a(%rip), %eax
	leal	-1(%rdx), %ecx
	movl	%eax, a(%rip)
	movl	%ecx, k(%rip)
	testl	%edx, %edx
	jne	.L24
	movl	b(%rip), %r15d
.L20:
	movslq	%r15d, %rdx
	leaq	p(%rip), %rdi
	movl	(%rdi,%rdx,4), %ecx
	cmpl	%eax, %ecx
	cmovg	%eax, %ecx
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	m(%rip), %eax
	movl	%ecx, (%rdi,%rdx,4)
	movl	%eax, i(%rip)
	jl	.L12
.L13:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L28
	leaq	s(%rip), %r15
	xorl	%r14d, %r14d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L25:
	addl	$1, %r14d
	addq	$101, %r15
	cmpl	%r14d, %ebx
	je	.L15
.L16:
	movq	%r13, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L25
.L15:
	movslq	%r14d, %r14
	leaq	p(%rip), %rax
	movl	$1, %edi
	movl	(%rax,%r14,4), %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L10
.L31:
	xorl	%r15d, %r15d
	jmp	.L21
.L29:
	xorl	%r15d, %r15d
	jmp	.L17
.L44:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %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
.L28:
	.cfi_restore_state
	xorl	%r14d, %r14d
	jmp	.L15
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 400
p:
	.zero	400
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 101
q:
	.zero	101
	.globl	o
	.align 32
	.type	o, @object
	.size	o, 101
o:
	.zero	101
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 10100
s:
	.zero	10100
	.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	f
	.type	f, @function
f:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	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	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	n(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L5
	movq	%rdi, %rbp
	leaq	s(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %r12d
	addq	$101, %rbx
	cmpl	%r13d, %r12d
	je	.L1
.L3:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L1:
	addq	$8, %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
.L5:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L1
	.cfi_endproc
.LFE35:
	.size	f, .-f
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	q(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
.L10:
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L44
	leaq	.LC1(%rip), %rcx
	movl	$0, %eax
	movl	$0, i(%rip)
	movq	%rcx, 8(%rsp)
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L11:
	cltq
	leaq	p(%rip), %rcx
	movq	8(%rsp), %rdi
	leaq	0(,%rax,4), %rdx
	leaq	(%rcx,%rdx), %r8
	addq	%rax, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rsi
	leaq	s(%rip), %rax
	movq	%r8, %rdx
	addq	%rax, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	n(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L11
.L14:
	leaq	m(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %edx
	leaq	.LC1(%rip), %rax
	movl	$0, i(%rip)
	movq	%rax, 8(%rsp)
	leaq	o(%rip), %r13
	leaq	.LC2(%rip), %r14
	testl	%edx, %edx
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	movq	8(%rsp), %rdi
	leaq	k(%rip), %rdx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	testl	%r12d, %r12d
	jle	.L29
	leaq	s(%rip), %rbx
	xorl	%r15d, %r15d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	addl	$1, %r15d
	addq	$101, %rbx
	cmpl	%r12d, %r15d
	je	.L17
.L18:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L19
.L17:
	movl	k(%rip), %eax
	movl	%r15d, b(%rip)
	movl	$0, a(%rip)
	leal	-1(%rax), %ecx
	movl	%ecx, k(%rip)
	testl	%eax, %eax
	je	.L20
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L31
	leaq	s(%rip), %r12
	xorl	%r15d, %r15d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r15d
	addq	$101, %r12
	cmpl	%ebx, %r15d
	je	.L21
.L22:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L23
.L21:
	movslq	%r15d, %rdx
	leaq	p(%rip), %rax
	movl	(%rax,%rdx,4), %eax
	movl	k(%rip), %edx
	addl	a(%rip), %eax
	leal	-1(%rdx), %ecx
	movl	%eax, a(%rip)
	movl	%ecx, k(%rip)
	testl	%edx, %edx
	jne	.L24
	movl	b(%rip), %r15d
.L20:
	movslq	%r15d, %rdx
	leaq	p(%rip), %rdi
	movl	(%rdi,%rdx,4), %ecx
	cmpl	%eax, %ecx
	cmovg	%eax, %ecx
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	m(%rip), %eax
	movl	%ecx, (%rdi,%rdx,4)
	movl	%eax, i(%rip)
	jl	.L12
.L13:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L28
	leaq	s(%rip), %r15
	xorl	%r14d, %r14d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L25:
	addl	$1, %r14d
	addq	$101, %r15
	cmpl	%r14d, %ebx
	je	.L15
.L16:
	movq	%r13, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L25
.L15:
	movslq	%r14d, %r14
	leaq	p(%rip), %rax
	movl	$1, %edi
	movl	(%rax,%r14,4), %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L10
.L31:
	xorl	%r15d, %r15d
	jmp	.L21
.L29:
	xorl	%r15d, %r15d
	jmp	.L17
.L44:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %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
.L28:
	.cfi_restore_state
	xorl	%r14d, %r14d
	jmp	.L15
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 400
p:
	.zero	400
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 101
q:
	.zero	101
	.globl	o
	.align 32
	.type	o, @object
	.size	o, 101
o:
	.zero	101
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 10100
s:
	.zero	10100
	.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<string.h>
char s[100][101],o[101],q[101];
int n,m,i,j,k,p[100],a,b;
int f(char *t)
{
	int i;
	for(i=0;i<n&&strcmp(s[i],t);i++);
	return i;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		for(i=0;i<n;i++)
			scanf("%s%d",s[i],&p[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s%d",o,&k);
			b=f(o);
			for(a=0;k--;)
			{
				scanf("%s",q);
				a+=p[f(q)];
			}
			p[b]=p[b]>a?a:p[b];
		}
		scanf("%s",o);
		printf("%d\n",p[f(o)]);
	}
	return 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<string.h>
char s[100][101],o[101],q[101];
int n,m,i,j,k,p[100],a,b;
int f(char *t)
{
	int i;
	for(i=0;i<n&&strcmp(s[i],t);i++);
	return i;
}
int main()
{
	for(;scanf("%d",&n),n;)
	{
		for(i=0;i<n;i++)
			scanf("%s%d",s[i],&p[i]);
		scanf("%d",&m);
		for(i=0;i<m;i++)
		{
			scanf("%s%d",o,&k);
			b=f(o);
			for(a=0;k--;)
			{
				scanf("%s",q);
				a+=p[f(q)];
			}
			p[b]=p[b]>a?a:p[b];
		}
		scanf("%s",o);
		printf("%d\n",p[f(o)]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 10100
s:
	.zero	10100
	.globl	o
	.align 32
	.type	o, @object
	.size	o, 101
o:
	.zero	101
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 101
q:
	.zero	101
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 400
p:
	.zero	400
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%s%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L7
.L14:
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L10
.L13:
	leaq	k(%rip), %rax
	movq	%rax, %rdx
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	movl	%eax, b(%rip)
	movl	$0, a(%rip)
	jmp	.L11
.L12:
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	q(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	addl	%edx, %eax
	movl	%eax, a(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	b(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 10100
s:
	.zero	10100
	.globl	o
	.align 32
	.type	o, @object
	.size	o, 101
o:
	.zero	101
	.globl	q
	.align 32
	.type	q, @object
	.size	q, 101
q:
	.zero	101
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 400
p:
	.zero	400
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L3
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%s%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L7
.L14:
	movl	$0, i(%rip)
	jmp	.L8
.L9:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L10
.L13:
	leaq	k(%rip), %rax
	movq	%rax, %rdx
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	movl	%eax, b(%rip)
	movl	$0, a(%rip)
	jmp	.L11
.L12:
	leaq	q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	q(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	addl	%edx, %eax
	movl	%eax, a(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	b(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	a(%rip), %eax
	movl	b(%rip), %ecx
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movslq	%ecx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	leaq	o(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	o(%rip), %rax
	movq	%rax, %rdi
	call	f
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
