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

```c
n;s[101][26];p[101];i,t[26],m,k,o,q;G(){scanf("%s",t);for(i=0;i<n&&strcmp(s[i],t);i++);return i;}main(){for(;scanf("%d",&n),n;printf("%d\n",p[G()])){for(i=n;i--;)scanf("%s%d",s[i],p+i);for(scanf("%d",&m);m--;q<p[o]?p[o]=q:0)for(o=G(),scanf("%d",&k),q=0;k--;)q+=p[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, 10504
s:
	.zero	10504
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 104
t:
	.zero	104
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	o
	.align 4
	.type	o, @object
	.size	o, 4
o:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	t(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L4:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	leaq	t(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	i(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	G, .-G
	.section	.rodata
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d"
.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
.L15:
	movl	n(%rip), %eax
	movl	%eax, 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
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L8:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L14:
	movl	$0, %eax
	call	G
	movl	%eax, o(%rip)
	leaq	k(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, q(%rip)
	jmp	.L11
.L12:
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	addl	%edx, %eax
	movl	%eax, q(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	o(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	o(%rip), %edx
	movl	q(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	m(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, m(%rip)
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	call	G
	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	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	$0, %edi
	call	exit@PLT
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
	.text
	.p2align 4
	.globl	G
	.type	G, @function
G:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	t(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	scanf@PLT
	movl	n(%rip), %r13d
	movl	$0, i(%rip)
	testl	%r13d, %r13d
	jle	.L5
	leaq	s(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %r12d
	addq	$104, %rbx
	movl	%r12d, i(%rip)
	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
.LFE0:
	.size	G, .-G
	.section	.rodata.str1.1
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	p(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L10:
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L39
	subl	$1, %eax
	leaq	.LC1(%rip), %rbx
	movl	%eax, i(%rip)
.L11:
	cltq
	movq	%rbx, %rdi
	leaq	(%rax,%rax,2), %rcx
	leaq	(%r12,%rax,4), %rdx
	leaq	(%rax,%rcx,4), %rax
	leaq	s(%rip), %rcx
	leaq	(%rcx,%rax,8), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	jne	.L11
	leaq	m(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	leaq	t(%rip), %rbx
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L21:
	movl	m(%rip), %ebp
	movq	%rbx, %rsi
	movq	%r13, %rdi
	leal	-1(%rbp), %eax
	movl	%eax, m(%rip)
	xorl	%eax, %eax
	testl	%ebp, %ebp
	je	.L40
	call	scanf@PLT
	movl	n(%rip), %ebp
	movl	$0, i(%rip)
	testl	%ebp, %ebp
	jle	.L27
	leaq	s(%rip), %r14
	xorl	%r15d, %r15d
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %r15d
	addq	$104, %r14
	movl	%r15d, i(%rip)
	cmpl	%r15d, %ebp
	je	.L13
.L14:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L15
.L13:
	leaq	k(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	movl	%r15d, o(%rip)
	call	scanf@PLT
	movl	k(%rip), %eax
	movl	$0, q(%rip)
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	je	.L16
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %ebp
	movl	$0, i(%rip)
	testl	%ebp, %ebp
	jle	.L29
	leaq	s(%rip), %r15
	xorl	%r14d, %r14d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	addl	$1, %r14d
	addq	$104, %r15
	movl	%r14d, i(%rip)
	cmpl	%r14d, %ebp
	je	.L17
.L18:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L19
.L17:
	movslq	%r14d, %rdx
	movl	(%r12,%rdx,4), %eax
	movl	k(%rip), %edx
	addl	q(%rip), %eax
	leal	-1(%rdx), %ecx
	movl	%eax, q(%rip)
	movl	%ecx, k(%rip)
	testl	%edx, %edx
	jne	.L20
.L16:
	movslq	o(%rip), %rdx
	cmpl	%eax, (%r12,%rdx,4)
	jle	.L21
	movl	%eax, (%r12,%rdx,4)
	jmp	.L21
.L29:
	xorl	%r14d, %r14d
	jmp	.L17
.L40:
	call	scanf@PLT
	movl	n(%rip), %r14d
	movl	$0, i(%rip)
	leaq	s(%rip), %r13
	testl	%r14d, %r14d
	jg	.L24
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L25:
	addl	$1, %ebp
	addq	$104, %r13
	movl	%ebp, i(%rip)
	cmpl	%r14d, %ebp
	je	.L23
.L24:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L25
.L23:
	movslq	%ebp, %rdx
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	movl	(%r12,%rdx,4), %esi
	call	printf@PLT
	jmp	.L10
.L27:
	xorl	%r15d, %r15d
	jmp	.L13
.L39:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	o
	.align 4
	.type	o, @object
	.size	o, 4
o:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 104
t:
	.zero	104
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 10504
s:
	.zero	10504
	.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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	t(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rbp, %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	scanf@PLT
	movl	n(%rip), %r13d
	movl	$0, i(%rip)
	testl	%r13d, %r13d
	jle	.L5
	leaq	s(%rip), %rbx
	xorl	%r12d, %r12d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %r12d
	addq	$104, %rbx
	movl	%r12d, i(%rip)
	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
.LFE0:
	.size	G, .-G
	.section	.rodata.str1.1
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	p(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L10:
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L39
	subl	$1, %eax
	leaq	.LC1(%rip), %rbx
	movl	%eax, i(%rip)
.L11:
	cltq
	movq	%rbx, %rdi
	leaq	(%rax,%rax,2), %rcx
	leaq	(%r12,%rax,4), %rdx
	leaq	(%rax,%rcx,4), %rax
	leaq	s(%rip), %rcx
	leaq	(%rcx,%rax,8), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	leal	-1(%rdx), %eax
	movl	%eax, i(%rip)
	testl	%edx, %edx
	jne	.L11
	leaq	m(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	leaq	t(%rip), %rbx
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L21:
	movl	m(%rip), %ebp
	movq	%rbx, %rsi
	movq	%r13, %rdi
	leal	-1(%rbp), %eax
	movl	%eax, m(%rip)
	xorl	%eax, %eax
	testl	%ebp, %ebp
	je	.L40
	call	scanf@PLT
	movl	n(%rip), %ebp
	movl	$0, i(%rip)
	testl	%ebp, %ebp
	jle	.L27
	leaq	s(%rip), %r14
	xorl	%r15d, %r15d
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %r15d
	addq	$104, %r14
	movl	%r15d, i(%rip)
	cmpl	%r15d, %ebp
	je	.L13
.L14:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L15
.L13:
	leaq	k(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	movl	%r15d, o(%rip)
	call	scanf@PLT
	movl	k(%rip), %eax
	movl	$0, q(%rip)
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	je	.L16
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	n(%rip), %ebp
	movl	$0, i(%rip)
	testl	%ebp, %ebp
	jle	.L29
	leaq	s(%rip), %r15
	xorl	%r14d, %r14d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	addl	$1, %r14d
	addq	$104, %r15
	movl	%r14d, i(%rip)
	cmpl	%r14d, %ebp
	je	.L17
.L18:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L19
.L17:
	movslq	%r14d, %rdx
	movl	(%r12,%rdx,4), %eax
	movl	k(%rip), %edx
	addl	q(%rip), %eax
	leal	-1(%rdx), %ecx
	movl	%eax, q(%rip)
	movl	%ecx, k(%rip)
	testl	%edx, %edx
	jne	.L20
.L16:
	movslq	o(%rip), %rdx
	cmpl	%eax, (%r12,%rdx,4)
	jle	.L21
	movl	%eax, (%r12,%rdx,4)
	jmp	.L21
.L29:
	xorl	%r14d, %r14d
	jmp	.L17
.L40:
	call	scanf@PLT
	movl	n(%rip), %r14d
	movl	$0, i(%rip)
	leaq	s(%rip), %r13
	testl	%r14d, %r14d
	jg	.L24
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L25:
	addl	$1, %ebp
	addq	$104, %r13
	movl	%ebp, i(%rip)
	cmpl	%r14d, %ebp
	je	.L23
.L24:
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L25
.L23:
	movslq	%ebp, %rdx
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	movl	(%r12,%rdx,4), %esi
	call	printf@PLT
	jmp	.L10
.L27:
	xorl	%r15d, %r15d
	jmp	.L13
.L39:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	o
	.align 4
	.type	o, @object
	.size	o, 4
o:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 104
t:
	.zero	104
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 10504
s:
	.zero	10504
	.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:

n;s[101][26];p[101];i,t[26],m,k,o,q;G(){scanf("%s",t);for(i=0;i<n&&strcmp(s[i],t);i++);return i;}main(){for(;scanf("%d",&n),n;printf("%d\n",p[G()])){for(i=n;i--;)scanf("%s%d",s[i],p+i);for(scanf("%d",&m);m--;q<p[o]?p[o]=q:0)for(o=G(),scanf("%d",&k),q=0;k--;)q+=p[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

8797
300000
 9997
300000
 9997
112750
 8762
300000
 4997
112750
 3801
300000
 36
112750

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

```c
n;s[101][26];p[101];i,t[26],m,k,o,q;G(){scanf("%s",t);for(i=0;i<n&&strcmp(s[i],t);i++);return i;}main(){for(;scanf("%d",&n),n;printf("%d\n",p[G()])){for(i=n;i--;)scanf("%s%d",s[i],p+i);for(scanf("%d",&m);m--;q<p[o]?p[o]=q:0)for(o=G(),scanf("%d",&k),q=0;k--;)q+=p[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, 10504
s:
	.zero	10504
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 104
t:
	.zero	104
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	o
	.align 4
	.type	o, @object
	.size	o, 4
o:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	t(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L4:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	leaq	t(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	i(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	G, .-G
	.section	.rodata
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d"
.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
.L15:
	movl	n(%rip), %eax
	movl	%eax, 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
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L8:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L14:
	movl	$0, %eax
	call	G
	movl	%eax, o(%rip)
	leaq	k(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, q(%rip)
	jmp	.L11
.L12:
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	addl	%edx, %eax
	movl	%eax, q(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	o(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	o(%rip), %edx
	movl	q(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	m(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, m(%rip)
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	call	G
	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	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	$0, %edi
	call	exit@PLT
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 10504
s:
	.zero	10504
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 404
p:
	.zero	404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 104
t:
	.zero	104
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	o
	.align 4
	.type	o, @object
	.size	o, 4
o:
	.zero	4
	.globl	q
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
	.text
	.globl	G
	.type	G, @function
G:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	t(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L4:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	leaq	t(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
.L3:
	movl	i(%rip), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	G, .-G
	.section	.rodata
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d"
.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
.L15:
	movl	n(%rip), %eax
	movl	%eax, 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
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L8:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L9
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L10
.L14:
	movl	$0, %eax
	call	G
	movl	%eax, o(%rip)
	leaq	k(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, q(%rip)
	jmp	.L11
.L12:
	movl	$0, %eax
	call	G
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	addl	%edx, %eax
	movl	%eax, q(%rip)
.L11:
	movl	k(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, k(%rip)
	testl	%eax, %eax
	jne	.L12
	movl	o(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	q(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	o(%rip), %edx
	movl	q(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	m(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, m(%rip)
	testl	%eax, %eax
	jne	.L14
	movl	$0, %eax
	call	G
	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	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jne	.L15
	movl	$0, %edi
	call	exit@PLT
	.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:
