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>
int main(){
  int n,m,i,j,sum,d[5000],p[5010]={0};
  char s[5000][1000],a[1000],b[1000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s %d",s[i],&d[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%s %s",a,b);
    for(i=0;strcmp(s[i],a);i++);
    for(j=0;strcmp(s[j],b);j++);
    for(i++;p[i];i=p[i]);
    for(j++;p[j];j=p[j]);
    if(i-j){
      if(d[i-1]<d[j-1])p[j]=i;
      else             p[i]=j;
    }
  }
  for(i=sum=0;i<n;i++){
    for(j=i+1;p[j];j=p[j]);
    sum+=d[j-1];
  }
  printf("%d\n",sum);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-5038080(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-5022064(%rbp), %rax
	movl	$20040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-5042084(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L2
.L3:
	leaq	-5042064(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-5002016(%rbp), %rcx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -5042076(%rbp)
.L2:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L3
	leaq	-5042080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L4
.L14:
	leaq	-1008(%rbp), %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L5
.L6:
	addl	$1, -5042076(%rbp)
.L5:
	leaq	-5002016(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	$0, -5042072(%rbp)
	jmp	.L7
.L8:
	addl	$1, -5042072(%rbp)
.L7:
	leaq	-5002016(%rbp), %rdx
	movl	-5042072(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	addl	$1, -5042076(%rbp)
	jmp	.L9
.L10:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042076(%rbp)
.L9:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L10
	addl	$1, -5042072(%rbp)
	jmp	.L11
.L12:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L11:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-5042076(%rbp), %eax
	cmpl	-5042072(%rbp), %eax
	je	.L4
	movl	-5042076(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %edx
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5042076(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
	jmp	.L4
.L13:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5042072(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
.L4:
	movl	-5042080(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -5042080(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$0, -5042068(%rbp)
	movl	-5042068(%rbp), %eax
	movl	%eax, -5042076(%rbp)
	jmp	.L15
.L18:
	movl	-5042076(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -5042072(%rbp)
	jmp	.L16
.L17:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L16:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	addl	%eax, -5042068(%rbp)
	addl	$1, -5042076(%rbp)
.L15:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L18
	movl	-5042068(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-5038080(%rsp), %r11
	.cfi_def_cfa 11, 5038136
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$4008, %rsp
	.cfi_def_cfa_offset 5042144
	movl	$20040, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 5042072(%rsp)
	xorl	%eax, %eax
	leaq	20016(%rsp), %rdi
	call	memset@PLT
	leaq	8(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	leaq	40064(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$1, %rbx
	addq	$1000, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	leaq	12(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	.p2align 4,,10
	.p2align 3
.L12:
	movl	12(%rsp), %ecx
	leal	-1(%rcx), %eax
	movl	%eax, 12(%rsp)
	testl	%ecx, %ecx
	je	.L37
	leaq	5041072(%rsp), %r15
	leaq	5040064(%rsp), %r13
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	movq	%r15, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	leaq	40064(%rsp), %r12
	movq	%r12, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rdi
	movq	%r13, %rsi
	addl	$1, %ebp
	addq	$1000, %r14
	call	strcmp@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdi
	movq	%r15, %rsi
	addl	$1, %ebx
	addq	$1000, %r12
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movslq	%ebp, %rax
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	cltq
	movq	%rax, %rbp
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L9
.L8:
	movslq	%ebx, %rax
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	cltq
	movq	%rax, %rbx
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
.L10:
	cmpl	%ebx, %ebp
	je	.L12
	leal	-1(%rbp), %edx
	leal	-1(%rbx), %eax
	cltq
	movslq	%edx, %rdx
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, 16(%rsp,%rdx,4)
	jge	.L13
	movslq	%ebx, %rbx
	movl	%ebp, 20016(%rsp,%rbx,4)
	jmp	.L12
.L37:
	movl	8(%rsp), %esi
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %ecx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L17:
	cltq
	movq	%rax, %rdx
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L17
	subl	$1, %edx
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %r8d
	cmpl	%ecx, %esi
	jne	.L18
.L16:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	5042072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$5042088, %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
.L13:
	.cfi_restore_state
	movslq	%ebp, %rbp
	movl	%ebx, 20016(%rsp,%rbp,4)
	jmp	.L12
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-5038080(%rsp), %r11
	.cfi_def_cfa 11, 5038136
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$4008, %rsp
	.cfi_def_cfa_offset 5042144
	movl	$20040, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 5042072(%rsp)
	xorl	%eax, %eax
	leaq	20016(%rsp), %rdi
	call	memset@PLT
	leaq	8(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	leaq	40064(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addq	$1, %rbx
	addq	$1000, %rbp
	cmpl	%ebx, 8(%rsp)
	jg	.L4
.L5:
	leaq	12(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	.p2align 4,,10
	.p2align 3
.L12:
	movl	12(%rsp), %ecx
	leal	-1(%rcx), %eax
	movl	%eax, 12(%rsp)
	testl	%ecx, %ecx
	je	.L37
	leaq	5041072(%rsp), %r15
	leaq	5040064(%rsp), %r13
	xorl	%eax, %eax
	xorl	%ebp, %ebp
	movq	%r15, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	leaq	40064(%rsp), %r12
	movq	%r12, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r14, %rdi
	movq	%r13, %rsi
	addl	$1, %ebp
	addq	$1000, %r14
	call	strcmp@PLT
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdi
	movq	%r15, %rsi
	addl	$1, %ebx
	addq	$1000, %r12
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movslq	%ebp, %rax
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	cltq
	movq	%rax, %rbp
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L9
.L8:
	movslq	%ebx, %rax
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	cltq
	movq	%rax, %rbx
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
.L10:
	cmpl	%ebx, %ebp
	je	.L12
	leal	-1(%rbp), %edx
	leal	-1(%rbx), %eax
	cltq
	movslq	%edx, %rdx
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, 16(%rsp,%rdx,4)
	jge	.L13
	movslq	%ebx, %rbx
	movl	%ebp, 20016(%rsp,%rbx,4)
	jmp	.L12
.L37:
	movl	8(%rsp), %esi
	xorl	%r8d, %r8d
	testl	%esi, %esi
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %ecx
	movl	%ecx, %eax
	.p2align 4,,10
	.p2align 3
.L17:
	cltq
	movq	%rax, %rdx
	movl	20016(%rsp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L17
	subl	$1, %edx
	movslq	%edx, %rdx
	addl	16(%rsp,%rdx,4), %r8d
	cmpl	%ecx, %esi
	jne	.L18
.L16:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	5042072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$5042088, %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
.L13:
	.cfi_restore_state
	movslq	%ebp, %rbp
	movl	%ebx, 20016(%rsp,%rbp,4)
	jmp	.L12
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

#include<stdio.h>
#include<string.h>
int main(){
  int n,m,i,j,sum,d[5000],p[5010]={0};
  char s[5000][1000],a[1000],b[1000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s %d",s[i],&d[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%s %s",a,b);
    for(i=0;strcmp(s[i],a);i++);
    for(j=0;strcmp(s[j],b);j++);
    for(i++;p[i];i=p[i]);
    for(j++;p[j];j=p[j]);
    if(i-j){
      if(d[i-1]<d[j-1])p[j]=i;
      else             p[i]=j;
    }
  }
  for(i=sum=0;i<n;i++){
    for(j=i+1;p[j];j=p[j]);
    sum+=d[j-1];
  }
  printf("%d\n",sum);
  return 0;
}
2
tako 2
yaki 1
0
tako yaki

3

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>
int main(){
  int n,m,i,j,sum,d[5000],p[5010]={0};
  char s[5000][1000],a[1000],b[1000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%s %d",s[i],&d[i]);
  scanf("%d",&m);
  while(m--){
    scanf("%s %s",a,b);
    for(i=0;strcmp(s[i],a);i++);
    for(j=0;strcmp(s[j],b);j++);
    for(i++;p[i];i=p[i]);
    for(j++;p[j];j=p[j]);
    if(i-j){
      if(d[i-1]<d[j-1])p[j]=i;
      else             p[i]=j;
    }
  }
  for(i=sum=0;i<n;i++){
    for(j=i+1;p[j];j=p[j]);
    sum+=d[j-1];
  }
  printf("%d\n",sum);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-5038080(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-5022064(%rbp), %rax
	movl	$20040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-5042084(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L2
.L3:
	leaq	-5042064(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-5002016(%rbp), %rcx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -5042076(%rbp)
.L2:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L3
	leaq	-5042080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L4
.L14:
	leaq	-1008(%rbp), %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L5
.L6:
	addl	$1, -5042076(%rbp)
.L5:
	leaq	-5002016(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	$0, -5042072(%rbp)
	jmp	.L7
.L8:
	addl	$1, -5042072(%rbp)
.L7:
	leaq	-5002016(%rbp), %rdx
	movl	-5042072(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	addl	$1, -5042076(%rbp)
	jmp	.L9
.L10:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042076(%rbp)
.L9:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L10
	addl	$1, -5042072(%rbp)
	jmp	.L11
.L12:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L11:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-5042076(%rbp), %eax
	cmpl	-5042072(%rbp), %eax
	je	.L4
	movl	-5042076(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %edx
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5042076(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
	jmp	.L4
.L13:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5042072(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
.L4:
	movl	-5042080(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -5042080(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$0, -5042068(%rbp)
	movl	-5042068(%rbp), %eax
	movl	%eax, -5042076(%rbp)
	jmp	.L15
.L18:
	movl	-5042076(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -5042072(%rbp)
	jmp	.L16
.L17:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L16:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	addl	%eax, -5042068(%rbp)
	addl	$1, -5042076(%rbp)
.L15:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L18
	movl	-5042068(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d"
.LC2:
	.string	"%s %s"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-5038080(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4016, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-5022064(%rbp), %rax
	movl	$20040, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-5042084(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L2
.L3:
	leaq	-5042064(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-5002016(%rbp), %rcx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -5042076(%rbp)
.L2:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L3
	leaq	-5042080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L4
.L14:
	leaq	-1008(%rbp), %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -5042076(%rbp)
	jmp	.L5
.L6:
	addl	$1, -5042076(%rbp)
.L5:
	leaq	-5002016(%rbp), %rdx
	movl	-5042076(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	$0, -5042072(%rbp)
	jmp	.L7
.L8:
	addl	$1, -5042072(%rbp)
.L7:
	leaq	-5002016(%rbp), %rdx
	movl	-5042072(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rax, %rdx
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	addl	$1, -5042076(%rbp)
	jmp	.L9
.L10:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042076(%rbp)
.L9:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L10
	addl	$1, -5042072(%rbp)
	jmp	.L11
.L12:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L11:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-5042076(%rbp), %eax
	cmpl	-5042072(%rbp), %eax
	je	.L4
	movl	-5042076(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %edx
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L13
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5042076(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
	jmp	.L4
.L13:
	movl	-5042076(%rbp), %eax
	cltq
	movl	-5042072(%rbp), %edx
	movl	%edx, -5022064(%rbp,%rax,4)
.L4:
	movl	-5042080(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -5042080(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$0, -5042068(%rbp)
	movl	-5042068(%rbp), %eax
	movl	%eax, -5042076(%rbp)
	jmp	.L15
.L18:
	movl	-5042076(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -5042072(%rbp)
	jmp	.L16
.L17:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	movl	%eax, -5042072(%rbp)
.L16:
	movl	-5042072(%rbp), %eax
	cltq
	movl	-5022064(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-5042072(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-5042064(%rbp,%rax,4), %eax
	addl	%eax, -5042068(%rbp)
	addl	$1, -5042076(%rbp)
.L15:
	movl	-5042084(%rbp), %eax
	cmpl	%eax, -5042076(%rbp)
	jl	.L18
	movl	-5042068(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
