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

```c
#include<stdio.h>
int main(){
  int T[100];
  int n,sum=0,m,p,x,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&T[i]);sum+=T[i];}
  scanf("%d",&m);
  for(i=0;i<m;i++){scanf("%d%d",&p,&x);printf("%d\n",sum-T[p-1]+x);}
}```

Assembly Code:

```assembly
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L7
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbp,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	(%r12,%rbp,4), %ebx
	addq	$1, %rbp
	cmpl	%ebp, (%rsp)
	jg	.L3
.L2:
	leaq	4(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	%ebx, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	subl	$1, %eax
	cltq
	subl	16(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	addl	12(%rsp), %edx
	call	__printf_chk@PLT
	cmpl	%r15d, 4(%rsp)
	jg	.L5
.L4:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$440, %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
.L7:
	.cfi_restore_state
	xorl	%ebx, %ebx
	jmp	.L2
.L12:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L7
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbp,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	(%r12,%rbp,4), %ebx
	addq	$1, %rbp
	cmpl	%ebp, (%rsp)
	jg	.L3
.L2:
	leaq	4(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	%ebx, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	subl	$1, %eax
	cltq
	subl	16(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	addl	12(%rsp), %edx
	call	__printf_chk@PLT
	cmpl	%r15d, 4(%rsp)
	jg	.L5
.L4:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$440, %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
.L7:
	.cfi_restore_state
	xorl	%ebx, %ebx
	jmp	.L2
.L12:
	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
```assembly
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L7
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbp,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	(%r12,%rbp,4), %ebx
	addq	$1, %rbp
	cmpl	%ebp, (%rsp)
	jg	.L3
.L2:
	leaq	4(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	%ebx, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	subl	$1, %eax
	cltq
	subl	16(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	addl	12(%rsp), %edx
	call	__printf_chk@PLT
	cmpl	%r15d, 4(%rsp)
	jg	.L5
.L4:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$440, %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
.L7:
	.cfi_restore_state
	xorl	%ebx, %ebx
	jmp	.L2
.L12:
	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:
```
```c
#include<stdio.h>
int main(){
  int T[100];
  int n,sum=0,m,p,x,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&T[i]);sum+=T[i];}
  scanf("%d",&m);
  for(i=0;i<m;i++){scanf("%d%d",&p,&x);printf("%d\n",sum-T[p-1]+x);}
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main(){
  int T[100];
  int n,sum=0,m,p,x,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&T[i]);sum+=T[i];}
  scanf("%d",&m);
  for(i=0;i<m;i++){scanf("%d%d",&p,&x);printf("%d\n",sum-T[p-1]+x);}
}```

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.
Optimized Assembly Code:

3
2 1 4
2
1 1
0 3
 5
7 2 3 10 5
3
4 2
1 7
4 13
 3
2 1 4
2
1 1
0 6
 5
7 4 3 10 5
3
4 2
1 7
4 13
 3
2 1 4
2
1 0
2 3
 3
2 1 4
2
1 0
0 3
 5
7 2 3 10 5
3
4 2
1 7
4 20
 3
1 1 4
2
1 1
0 6
 5
7 4 3 10 5
3
4 2
1 7
3 13
 3
2 0 4
2
1 0
0 3

6
9
 19
27
30
 6
12
 21
29
32
 5
9
 5
9
 19
27
37
 6
11
 21
29
39
 4
8

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

```c
#include<stdio.h>
int main(){
  int T[100];
  int n,sum=0,m,p,x,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){scanf("%d",&T[i]);sum+=T[i];}
  scanf("%d",&m);
  for(i=0;i<m;i++){scanf("%d%d",&p,&x);printf("%d\n",sum-T[p-1]+x);}
}```

Assembly Code:

```assembly
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L7
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbp,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	(%r12,%rbp,4), %ebx
	addq	$1, %rbp
	cmpl	%ebp, (%rsp)
	jg	.L3
.L2:
	leaq	4(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	%ebx, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	subl	$1, %eax
	cltq
	subl	16(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	addl	12(%rsp), %edx
	call	__printf_chk@PLT
	cmpl	%r15d, 4(%rsp)
	jg	.L5
.L4:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$440, %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
.L7:
	.cfi_restore_state
	xorl	%ebx, %ebx
	jmp	.L2
.L12:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$440, %rsp
	.cfi_def_cfa_offset 496
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L7
	xorl	%ebp, %ebp
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	(%r12,%rbp,4), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	(%r12,%rbp,4), %ebx
	addq	$1, %rbp
	cmpl	%ebp, (%rsp)
	jg	.L3
.L2:
	leaq	4(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	xorl	%r15d, %r15d
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	%ebx, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	addl	$1, %r15d
	subl	$1, %eax
	cltq
	subl	16(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	addl	12(%rsp), %edx
	call	__printf_chk@PLT
	cmpl	%r15d, 4(%rsp)
	jg	.L5
.L4:
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$440, %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
.L7:
	.cfi_restore_state
	xorl	%ebx, %ebx
	jmp	.L2
.L12:
	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:
```