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>

int main(){
  int D,M;
  int c[30];
  int s[370][30];
  int t[400];
  int last[30]={};
  int ans=0;
  int p[100002],q[100002];
  
  scanf("%d",&D);
  for(int i=1;i<=26;i++)
    last[i]=0;
  for(int i=1;i<=26;i++)
    scanf("%d",c+i);
  for(int i=1;i<=D;i++)
   for(int j=1;j<=26;j++)
     scanf("%d",&s[i][j]);
  for(int i=1;i<=D;i++)
    scanf("%d",t+i);
  scanf("%d",&M);
  for(int i=1;i<=M;i++)
    scanf("%d %d",p+i,q+i);
  for(int i=1;i<=M;i++){
    ans=0;
    t[p[i]]=q[i];
    for(int k=1;k<=26;k++)
      last[k]=0;
    for(int d=1;d<=D;d++){
      ans+=s[d][t[d]];
      last[t[d]]=d;
      for(int j=1;j<=26;j++){
        ans-=c[j]*(d-last[j]);
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	-843776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2576, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-846160(%rbp), %rdx
	movl	$0, %eax
	movl	$15, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -846332(%rbp)
	leaq	-846340(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846328(%rbp)
	jmp	.L2
.L3:
	movl	-846328(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846328(%rbp)
.L2:
	cmpl	$26, -846328(%rbp)
	jle	.L3
	movl	$1, -846324(%rbp)
	jmp	.L4
.L5:
	movl	-846324(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846288(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846324(%rbp)
.L4:
	cmpl	$26, -846324(%rbp)
	jle	.L5
	movl	$1, -846320(%rbp)
	jmp	.L6
.L9:
	movl	$1, -846316(%rbp)
	jmp	.L7
.L8:
	leaq	-844432(%rbp), %rcx
	movl	-846316(%rbp), %eax
	movslq	%eax, %rsi
	movl	-846320(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846316(%rbp)
.L7:
	cmpl	$26, -846316(%rbp)
	jle	.L8
	addl	$1, -846320(%rbp)
.L6:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846320(%rbp)
	jle	.L9
	movl	$1, -846312(%rbp)
	jmp	.L10
.L11:
	movl	-846312(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846032(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846312(%rbp)
.L10:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846312(%rbp)
	jle	.L11
	leaq	-846336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846308(%rbp)
	jmp	.L12
.L13:
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-400016(%rbp), %rax
	addq	%rax, %rdx
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-800032(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846308(%rbp)
.L12:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846308(%rbp)
	jle	.L13
	movl	$1, -846304(%rbp)
	jmp	.L14
.L21:
	movl	$0, -846332(%rbp)
	movl	-846304(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %ecx
	movl	-846304(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -846032(%rbp,%rax,4)
	movl	$1, -846300(%rbp)
	jmp	.L15
.L16:
	movl	-846300(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846300(%rbp)
.L15:
	cmpl	$26, -846300(%rbp)
	jle	.L16
	movl	$1, -846296(%rbp)
	jmp	.L17
.L20:
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-846296(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-844432(%rbp,%rax,4), %eax
	addl	%eax, -846332(%rbp)
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	cltq
	movl	-846296(%rbp), %edx
	movl	%edx, -846160(%rbp,%rax,4)
	movl	$1, -846292(%rbp)
	jmp	.L18
.L19:
	movl	-846292(%rbp), %eax
	cltq
	movl	-846288(%rbp,%rax,4), %edx
	movl	-846292(%rbp), %eax
	cltq
	movl	-846160(%rbp,%rax,4), %ecx
	movl	-846296(%rbp), %eax
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	%eax, -846332(%rbp)
	addl	$1, -846292(%rbp)
.L18:
	cmpl	$26, -846292(%rbp)
	jle	.L19
	addl	$1, -846296(%rbp)
.L17:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846296(%rbp)
	jle	.L20
	movl	-846332(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -846304(%rbp)
.L14:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846304(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-843776(%rsp), %r11
	.cfi_def_cfa 11, 843832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2568, %rsp
	.cfi_def_cfa_offset 846400
	movl	$15, %ecx
	leaq	.LC0(%rip), %r12
	xorl	%ebp, %ebp
	movq	%fs:40, %rax
	movq	%rax, 846328(%rsp)
	xorl	%eax, %eax
	leaq	176(%rsp), %rdi
	leaq	40(%rsp), %rsi
	leaq	180(%rsp), %rbx
	leaq	156(%rsp), %r13
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	leaq	184(%rsp), %rdi
	movq	%rbx, %rcx
	leaq	188(%rsp), %rax
	subq	%rdi, %rcx
	movq	%rax, 16(%rsp)
	movq	%rbp, %rax
	leaq	52(%rsp), %rbp
	movq	$0, 180(%rsp)
	addl	$104, %ecx
	movq	$0, 276(%rsp)
	shrl	$3, %ecx
	rep stosq
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L2
	movl	40(%rsp), %edx
	leaq	2132(%rsp), %r13
	movl	$1, %r14d
	testl	%edx, %edx
	jle	.L8
.L7:
	leaq	-104(%r13), %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L6
	movl	40(%rsp), %eax
	addl	$1, %r14d
	leaq	120(%rbp), %r13
	cmpl	%r14d, %eax
	jge	.L7
	testl	%eax, %eax
	jle	.L8
	leaq	308(%rsp), %r13
	movl	$1, %ebp
.L9:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r13
	cmpl	%ebp, 40(%rsp)
	jge	.L9
.L8:
	leaq	44(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movl	$4, %r13d
	movl	$1, %r15d
	leaq	446320(%rsp), %rbp
	leaq	46304(%rsp), %r12
	leaq	.LC1(%rip), %r14
.L4:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%r13), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	addl	$1, %r15d
	addq	$4, %r13
	cmpl	%r15d, %eax
	jge	.L4
	testl	%eax, %eax
	jle	.L5
	movl	$1, %r14d
	leaq	292(%rsp), %rax
	leaq	.LC2(%rip), %r13
	xorl	%r15d, %r15d
	movq	%rax, 24(%rsp)
.L12:
	movslq	(%r12,%r14,4), %rax
	movl	0(%rbp,%r14,4), %edx
	movq	%rbx, %rcx
	movl	%edx, 304(%rsp,%rax,4)
	movq	%r15, (%rbx)
	movq	24(%rsp), %rax
	movq	%r15, -16(%rax)
	movq	16(%rsp), %rdi
	movq	%r15, %rax
	andq	$-8, %rdi
	subq	%rdi, %rcx
	addl	$104, %ecx
	shrl	$3, %ecx
	rep stosq
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
	movdqu	52(%rsp), %xmm9
	movdqu	68(%rsp), %xmm8
	leal	1(%rax), %r11d
	xorl	%edx, %edx
	movdqu	132(%rsp), %xmm4
	movdqu	84(%rsp), %xmm7
	movl	$1, %eax
	leaq	304(%rsp), %r8
	movdqu	100(%rsp), %xmm6
	movdqu	116(%rsp), %xmm5
	movdqa	%xmm9, %xmm15
	movdqa	%xmm8, %xmm14
	movdqa	%xmm4, %xmm1
	movdqa	%xmm7, %xmm13
	movl	148(%rsp), %r10d
	movl	152(%rsp), %r9d
	movdqa	%xmm6, %xmm12
	movdqa	%xmm5, %xmm11
	pxor	%xmm10, %xmm10
	psrlq	$32, %xmm1
	psrlq	$32, %xmm15
	psrlq	$32, %xmm14
	psrlq	$32, %xmm13
	movaps	%xmm1, (%rsp)
	psrlq	$32, %xmm12
	psrlq	$32, %xmm11
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%r8,%rax,4), %rsi
	movd	%eax, %xmm1
	movslq	%eax, %rdi
	pshufd	$0, %xmm1, %xmm1
	movq	%rdi, %rcx
	movl	%eax, 176(%rsp,%rsi,4)
	movdqa	%xmm1, %xmm0
	salq	$4, %rcx
	movdqu	180(%rsp), %xmm3
	subq	%rdi, %rcx
	psubd	%xmm3, %xmm0
	leaq	(%rsi,%rcx,2), %rcx
	movdqu	196(%rsp), %xmm3
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm0
	addl	1904(%rsp,%rcx,4), %edx
	pmuludq	%xmm9, %xmm2
	pmuludq	%xmm15, %xmm0
	movl	%edx, %ecx
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm0, %xmm2
	movdqa	%xmm10, %xmm0
	psubd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm8, %xmm3
	pmuludq	%xmm14, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	212(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm7, %xmm3
	pmuludq	%xmm13, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	228(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm6, %xmm3
	pmuludq	%xmm12, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	244(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm5, %xmm3
	pmuludq	%xmm11, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	psubd	%xmm3, %xmm0
	movdqu	260(%rsp), %xmm3
	psubd	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	movdqa	%xmm1, %xmm2
	pmuludq	%xmm4, %xmm3
	psrlq	$32, %xmm2
	pmuludq	(%rsp), %xmm2
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm3, %xmm1
	punpckldq	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	addl	%ecx, %edx
	movl	%eax, %ecx
	subl	276(%rsp), %ecx
	imull	%r10d, %ecx
	subl	%ecx, %edx
	movl	%eax, %ecx
	subl	280(%rsp), %ecx
	addq	$1, %rax
	imull	%r9d, %ecx
	subl	%ecx, %edx
	cmpq	%rax, %r11
	jne	.L11
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 44(%rsp)
	jge	.L12
.L5:
	movq	846328(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$846344, %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
.L15:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L10
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-843776(%rsp), %r11
	.cfi_def_cfa 11, 843832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2568, %rsp
	.cfi_def_cfa_offset 846400
	movl	$15, %ecx
	leaq	.LC0(%rip), %r12
	xorl	%ebp, %ebp
	movq	%fs:40, %rax
	movq	%rax, 846328(%rsp)
	xorl	%eax, %eax
	leaq	176(%rsp), %rdi
	leaq	40(%rsp), %rsi
	leaq	180(%rsp), %rbx
	leaq	156(%rsp), %r13
	rep stosq
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	leaq	184(%rsp), %rdi
	movq	%rbx, %rcx
	leaq	188(%rsp), %rax
	subq	%rdi, %rcx
	movq	%rax, 16(%rsp)
	movq	%rbp, %rax
	leaq	52(%rsp), %rbp
	movq	$0, 180(%rsp)
	addl	$104, %ecx
	movq	$0, 276(%rsp)
	shrl	$3, %ecx
	rep stosq
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L2
	movl	40(%rsp), %edx
	leaq	2132(%rsp), %r13
	movl	$1, %r14d
	testl	%edx, %edx
	jle	.L8
.L7:
	leaq	-104(%r13), %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L6
	movl	40(%rsp), %eax
	addl	$1, %r14d
	leaq	120(%rbp), %r13
	cmpl	%r14d, %eax
	jge	.L7
	testl	%eax, %eax
	jle	.L8
	leaq	308(%rsp), %r13
	movl	$1, %ebp
.L9:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	addq	$4, %r13
	cmpl	%ebp, 40(%rsp)
	jge	.L9
.L8:
	leaq	44(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movl	$4, %r13d
	movl	$1, %r15d
	leaq	446320(%rsp), %rbp
	leaq	46304(%rsp), %r12
	leaq	.LC1(%rip), %r14
.L4:
	leaq	0(%rbp,%r13), %rdx
	leaq	(%r12,%r13), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	addl	$1, %r15d
	addq	$4, %r13
	cmpl	%r15d, %eax
	jge	.L4
	testl	%eax, %eax
	jle	.L5
	movl	$1, %r14d
	leaq	292(%rsp), %rax
	leaq	.LC2(%rip), %r13
	xorl	%r15d, %r15d
	movq	%rax, 24(%rsp)
.L12:
	movslq	(%r12,%r14,4), %rax
	movl	0(%rbp,%r14,4), %edx
	movq	%rbx, %rcx
	movl	%edx, 304(%rsp,%rax,4)
	movq	%r15, (%rbx)
	movq	24(%rsp), %rax
	movq	%r15, -16(%rax)
	movq	16(%rsp), %rdi
	movq	%r15, %rax
	andq	$-8, %rdi
	subq	%rdi, %rcx
	addl	$104, %ecx
	shrl	$3, %ecx
	rep stosq
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
	movdqu	52(%rsp), %xmm9
	movdqu	68(%rsp), %xmm8
	leal	1(%rax), %r11d
	xorl	%edx, %edx
	movdqu	132(%rsp), %xmm4
	movdqu	84(%rsp), %xmm7
	movl	$1, %eax
	leaq	304(%rsp), %r8
	movdqu	100(%rsp), %xmm6
	movdqu	116(%rsp), %xmm5
	movdqa	%xmm9, %xmm15
	movdqa	%xmm8, %xmm14
	movdqa	%xmm4, %xmm1
	movdqa	%xmm7, %xmm13
	movl	148(%rsp), %r10d
	movl	152(%rsp), %r9d
	movdqa	%xmm6, %xmm12
	movdqa	%xmm5, %xmm11
	pxor	%xmm10, %xmm10
	psrlq	$32, %xmm1
	psrlq	$32, %xmm15
	psrlq	$32, %xmm14
	psrlq	$32, %xmm13
	movaps	%xmm1, (%rsp)
	psrlq	$32, %xmm12
	psrlq	$32, %xmm11
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%r8,%rax,4), %rsi
	movd	%eax, %xmm1
	movslq	%eax, %rdi
	pshufd	$0, %xmm1, %xmm1
	movq	%rdi, %rcx
	movl	%eax, 176(%rsp,%rsi,4)
	movdqa	%xmm1, %xmm0
	salq	$4, %rcx
	movdqu	180(%rsp), %xmm3
	subq	%rdi, %rcx
	psubd	%xmm3, %xmm0
	leaq	(%rsi,%rcx,2), %rcx
	movdqu	196(%rsp), %xmm3
	movdqa	%xmm0, %xmm2
	psrlq	$32, %xmm0
	addl	1904(%rsp,%rcx,4), %edx
	pmuludq	%xmm9, %xmm2
	pmuludq	%xmm15, %xmm0
	movl	%edx, %ecx
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm0, %xmm2
	movdqa	%xmm10, %xmm0
	psubd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm8, %xmm3
	pmuludq	%xmm14, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	212(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm7, %xmm3
	pmuludq	%xmm13, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	228(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm6, %xmm3
	pmuludq	%xmm12, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	movdqa	%xmm1, %xmm2
	psubd	%xmm3, %xmm0
	movdqu	244(%rsp), %xmm3
	psubd	%xmm3, %xmm2
	movdqa	%xmm2, %xmm3
	psrlq	$32, %xmm2
	pmuludq	%xmm5, %xmm3
	pmuludq	%xmm11, %xmm2
	pshufd	$8, %xmm3, %xmm3
	pshufd	$8, %xmm2, %xmm2
	punpckldq	%xmm2, %xmm3
	psubd	%xmm3, %xmm0
	movdqu	260(%rsp), %xmm3
	psubd	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	movdqa	%xmm1, %xmm2
	pmuludq	%xmm4, %xmm3
	psrlq	$32, %xmm2
	pmuludq	(%rsp), %xmm2
	pshufd	$8, %xmm2, %xmm2
	pshufd	$8, %xmm3, %xmm1
	punpckldq	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	addl	%ecx, %edx
	movl	%eax, %ecx
	subl	276(%rsp), %ecx
	imull	%r10d, %ecx
	subl	%ecx, %edx
	movl	%eax, %ecx
	subl	280(%rsp), %ecx
	addq	$1, %rax
	imull	%r9d, %ecx
	subl	%ecx, %edx
	cmpq	%rax, %r11
	jne	.L11
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 44(%rsp)
	jge	.L12
.L5:
	movq	846328(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$846344, %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
.L15:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L10
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(){
  int D,M;
  int c[30];
  int s[370][30];
  int t[400];
  int last[30]={};
  int ans=0;
  int p[100002],q[100002];
  
  scanf("%d",&D);
  for(int i=1;i<=26;i++)
    last[i]=0;
  for(int i=1;i<=26;i++)
    scanf("%d",c+i);
  for(int i=1;i<=D;i++)
   for(int j=1;j<=26;j++)
     scanf("%d",&s[i][j]);
  for(int i=1;i<=D;i++)
    scanf("%d",t+i);
  scanf("%d",&M);
  for(int i=1;i<=M;i++)
    scanf("%d %d",p+i,q+i);
  for(int i=1;i<=M;i++){
    ans=0;
    t[p[i]]=q[i];
    for(int k=1;k<=26;k++)
      last[k]=0;
    for(int d=1;d<=D;d++){
      ans+=s[d][t[d]];
      last[t[d]]=d;
      for(int j=1;j<=26;j++){
        ans-=c[j]*(d-last[j]);
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}
5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
85 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 280 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 29875 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 396 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 1432 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
2
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
85 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 280 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 29875 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 396 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 1432 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
2
17
13
14
13
5
1 7
4 11
2 4
1 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9812 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
3 4
5 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
1
17
13
14
13
5
1 7
4 11
2 8
5 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 2 82
19771 12979 18912 10432 10544 12928 13403 280 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 396 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
2
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 27 7 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 280 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 29875 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 396 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
2
17
13
14
13
5
1 7
4 11
2 4
5 24
4 19
 5
85 90 135 51 2 96 71 47 88 34 45 46 89 34 31 38 27 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 280 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 8378 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 29875 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 396 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 1432 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192
2
17
13
14
13
5
1 7
4 11
2 4
1 24
4 19

72882
56634
53396
43168
58122
 72882
56634
45367
35139
50093
 73372
57124
46417
36189
51143
 73387
57139
46432
36204
51158
 73387
57139
46432
49485
64439
 72882
56634
38425
27930
42884
 73372
57124
39712
29484
44438
 73447
57199
46492
36264
51218
 74527
58279
47572
37344
52298
 72397
56149
45442
48495
63449

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>

int main(){
  int D,M;
  int c[30];
  int s[370][30];
  int t[400];
  int last[30]={};
  int ans=0;
  int p[100002],q[100002];
  
  scanf("%d",&D);
  for(int i=1;i<=26;i++)
    last[i]=0;
  for(int i=1;i<=26;i++)
    scanf("%d",c+i);
  for(int i=1;i<=D;i++)
   for(int j=1;j<=26;j++)
     scanf("%d",&s[i][j]);
  for(int i=1;i<=D;i++)
    scanf("%d",t+i);
  scanf("%d",&M);
  for(int i=1;i<=M;i++)
    scanf("%d %d",p+i,q+i);
  for(int i=1;i<=M;i++){
    ans=0;
    t[p[i]]=q[i];
    for(int k=1;k<=26;k++)
      last[k]=0;
    for(int d=1;d<=D;d++){
      ans+=s[d][t[d]];
      last[t[d]]=d;
      for(int j=1;j<=26;j++){
        ans-=c[j]*(d-last[j]);
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	-843776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2576, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-846160(%rbp), %rdx
	movl	$0, %eax
	movl	$15, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -846332(%rbp)
	leaq	-846340(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846328(%rbp)
	jmp	.L2
.L3:
	movl	-846328(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846328(%rbp)
.L2:
	cmpl	$26, -846328(%rbp)
	jle	.L3
	movl	$1, -846324(%rbp)
	jmp	.L4
.L5:
	movl	-846324(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846288(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846324(%rbp)
.L4:
	cmpl	$26, -846324(%rbp)
	jle	.L5
	movl	$1, -846320(%rbp)
	jmp	.L6
.L9:
	movl	$1, -846316(%rbp)
	jmp	.L7
.L8:
	leaq	-844432(%rbp), %rcx
	movl	-846316(%rbp), %eax
	movslq	%eax, %rsi
	movl	-846320(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846316(%rbp)
.L7:
	cmpl	$26, -846316(%rbp)
	jle	.L8
	addl	$1, -846320(%rbp)
.L6:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846320(%rbp)
	jle	.L9
	movl	$1, -846312(%rbp)
	jmp	.L10
.L11:
	movl	-846312(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846032(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846312(%rbp)
.L10:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846312(%rbp)
	jle	.L11
	leaq	-846336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846308(%rbp)
	jmp	.L12
.L13:
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-400016(%rbp), %rax
	addq	%rax, %rdx
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-800032(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846308(%rbp)
.L12:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846308(%rbp)
	jle	.L13
	movl	$1, -846304(%rbp)
	jmp	.L14
.L21:
	movl	$0, -846332(%rbp)
	movl	-846304(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %ecx
	movl	-846304(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -846032(%rbp,%rax,4)
	movl	$1, -846300(%rbp)
	jmp	.L15
.L16:
	movl	-846300(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846300(%rbp)
.L15:
	cmpl	$26, -846300(%rbp)
	jle	.L16
	movl	$1, -846296(%rbp)
	jmp	.L17
.L20:
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-846296(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-844432(%rbp,%rax,4), %eax
	addl	%eax, -846332(%rbp)
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	cltq
	movl	-846296(%rbp), %edx
	movl	%edx, -846160(%rbp,%rax,4)
	movl	$1, -846292(%rbp)
	jmp	.L18
.L19:
	movl	-846292(%rbp), %eax
	cltq
	movl	-846288(%rbp,%rax,4), %edx
	movl	-846292(%rbp), %eax
	cltq
	movl	-846160(%rbp,%rax,4), %ecx
	movl	-846296(%rbp), %eax
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	%eax, -846332(%rbp)
	addl	$1, -846292(%rbp)
.L18:
	cmpl	$26, -846292(%rbp)
	jle	.L19
	addl	$1, -846296(%rbp)
.L17:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846296(%rbp)
	jle	.L20
	movl	-846332(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -846304(%rbp)
.L14:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846304(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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	"%d %d"
.LC2:
	.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	-843776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2576, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-846160(%rbp), %rdx
	movl	$0, %eax
	movl	$15, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -846332(%rbp)
	leaq	-846340(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846328(%rbp)
	jmp	.L2
.L3:
	movl	-846328(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846328(%rbp)
.L2:
	cmpl	$26, -846328(%rbp)
	jle	.L3
	movl	$1, -846324(%rbp)
	jmp	.L4
.L5:
	movl	-846324(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846288(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846324(%rbp)
.L4:
	cmpl	$26, -846324(%rbp)
	jle	.L5
	movl	$1, -846320(%rbp)
	jmp	.L6
.L9:
	movl	$1, -846316(%rbp)
	jmp	.L7
.L8:
	leaq	-844432(%rbp), %rcx
	movl	-846316(%rbp), %eax
	movslq	%eax, %rsi
	movl	-846320(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846316(%rbp)
.L7:
	cmpl	$26, -846316(%rbp)
	jle	.L8
	addl	$1, -846320(%rbp)
.L6:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846320(%rbp)
	jle	.L9
	movl	$1, -846312(%rbp)
	jmp	.L10
.L11:
	movl	-846312(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-846032(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846312(%rbp)
.L10:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846312(%rbp)
	jle	.L11
	leaq	-846336(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -846308(%rbp)
	jmp	.L12
.L13:
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-400016(%rbp), %rax
	addq	%rax, %rdx
	movl	-846308(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-800032(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -846308(%rbp)
.L12:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846308(%rbp)
	jle	.L13
	movl	$1, -846304(%rbp)
	jmp	.L14
.L21:
	movl	$0, -846332(%rbp)
	movl	-846304(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %ecx
	movl	-846304(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -846032(%rbp,%rax,4)
	movl	$1, -846300(%rbp)
	jmp	.L15
.L16:
	movl	-846300(%rbp), %eax
	cltq
	movl	$0, -846160(%rbp,%rax,4)
	addl	$1, -846300(%rbp)
.L15:
	cmpl	$26, -846300(%rbp)
	jle	.L16
	movl	$1, -846296(%rbp)
	jmp	.L17
.L20:
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movl	-846296(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$4, %rax
	subq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-844432(%rbp,%rax,4), %eax
	addl	%eax, -846332(%rbp)
	movl	-846296(%rbp), %eax
	cltq
	movl	-846032(%rbp,%rax,4), %eax
	cltq
	movl	-846296(%rbp), %edx
	movl	%edx, -846160(%rbp,%rax,4)
	movl	$1, -846292(%rbp)
	jmp	.L18
.L19:
	movl	-846292(%rbp), %eax
	cltq
	movl	-846288(%rbp,%rax,4), %edx
	movl	-846292(%rbp), %eax
	cltq
	movl	-846160(%rbp,%rax,4), %ecx
	movl	-846296(%rbp), %eax
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	%eax, -846332(%rbp)
	addl	$1, -846292(%rbp)
.L18:
	cmpl	$26, -846292(%rbp)
	jle	.L19
	addl	$1, -846296(%rbp)
.L17:
	movl	-846340(%rbp), %eax
	cmpl	%eax, -846296(%rbp)
	jle	.L20
	movl	-846332(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -846304(%rbp)
.L14:
	movl	-846336(%rbp), %eax
	cmpl	%eax, -846304(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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:
