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(void)
{
    int ans[1001],a=0,i;
    while(1)
    {
        int value[12];
        value[10]=0;
        scanf("%d",&value[0]);
        if(value[0]==0)
            break;
        for(i=1;i<10;i++)
        {
            scanf("%d",&value[i]);
            value[10]+=value[i];
        }
        value[11]=value[0]-value[10];
        ans[a]=value[11];
        a++;
    }
    for(i=0;i<a;i++)
        printf("%d\n",ans[i]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$4080, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -4072(%rbp)
.L6:
	movl	$0, -4024(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4064(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, -4068(%rbp)
	jmp	.L3
.L2:
	movl	$1, -4068(%rbp)
	jmp	.L4
.L5:
	leaq	-4064(%rbp), %rdx
	movl	-4068(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4024(%rbp), %edx
	movl	-4068(%rbp), %eax
	cltq
	movl	-4064(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -4024(%rbp)
	addl	$1, -4068(%rbp)
.L4:
	cmpl	$9, -4068(%rbp)
	jle	.L5
	movl	-4064(%rbp), %eax
	movl	-4024(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4020(%rbp)
	movl	-4020(%rbp), %edx
	movl	-4072(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -4072(%rbp)
	jmp	.L6
.L7:
	movl	-4068(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4068(%rbp)
.L3:
	movl	-4068(%rbp), %eax
	cmpl	-4072(%rbp), %eax
	jl	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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\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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	leaq	40(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movl	$0, 40(%rsp)
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	4(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	movl	-4(%rbx), %eax
	addl	40(%rsp), %eax
	movl	%eax, 40(%rsp)
	cmpq	%r12, %rbx
	jne	.L3
	movl	(%rsp), %edx
	subl	%eax, %edx
	movl	%edx, 48(%rsp,%r13,4)
	addq	$1, %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	testl	%r13d, %r13d
	je	.L5
	leal	-1(%r13), %eax
	leaq	48(%rsp), %rbx
	leaq	52(%rsp,%rax,4), %r12
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L6
.L5:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$4072, %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
	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\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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4072, %rsp
	.cfi_def_cfa_offset 4128
	movq	%fs:40, %rax
	movq	%rax, 4056(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	leaq	40(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movl	$0, 40(%rsp)
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	4(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	movl	-4(%rbx), %eax
	addl	40(%rsp), %eax
	movl	%eax, 40(%rsp)
	cmpq	%r12, %rbx
	jne	.L3
	movl	(%rsp), %edx
	subl	%eax, %edx
	movl	%edx, 48(%rsp,%r13,4)
	addq	$1, %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	testl	%r13d, %r13d
	je	.L5
	leal	-1(%r13), %eax
	leaq	48(%rsp), %rbx
	leaq	52(%rsp,%rax,4), %r12
	leaq	.LC1(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%r12, %rbx
	jne	.L6
.L5:
	movq	4056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$4072, %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
	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(void)
{
    int ans[1001],a=0,i;
    while(1)
    {
        int value[12];
        value[10]=0;
        scanf("%d",&value[0]);
        if(value[0]==0)
            break;
        for(i=1;i<10;i++)
        {
            scanf("%d",&value[i]);
            value[10]+=value[i];
        }
        value[11]=value[0]-value[10];
        ans[a]=value[11];
        a++;
    }
    for(i=0;i<a;i++)
        printf("%d\n",ans[i]);
    return 0;
}
9850
1050
800
420
380
600
820
2400
2983
980
0
 9850
372
800
420
380
600
820
2400
2983
980
0
 9850
372
800
420
380
600
820
2795
2983
980
0
 9850
372
800
420
380
600
946
2795
2983
980
0
 9850
372
800
203
380
600
946
2795
2983
980
0
 9850
372
800
203
380
600
946
2795
2983
344
0
 9850
372
800
203
380
600
1550
2795
2983
344
0
 9850
1050
800
420
673
600
820
2400
1800
980
0
 9850
1050
800
420
380
600
1164
2400
2983
980
0
 9850
372
800
420
380
922
820
2795
2983
980
0

-583
 95
 -300
 -426
 -209
 427
 -177
 307
 -927
 -622

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(void)
{
    int ans[1001],a=0,i;
    while(1)
    {
        int value[12];
        value[10]=0;
        scanf("%d",&value[0]);
        if(value[0]==0)
            break;
        for(i=1;i<10;i++)
        {
            scanf("%d",&value[i]);
            value[10]+=value[i];
        }
        value[11]=value[0]-value[10];
        ans[a]=value[11];
        a++;
    }
    for(i=0;i<a;i++)
        printf("%d\n",ans[i]);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$4080, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -4072(%rbp)
.L6:
	movl	$0, -4024(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4064(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, -4068(%rbp)
	jmp	.L3
.L2:
	movl	$1, -4068(%rbp)
	jmp	.L4
.L5:
	leaq	-4064(%rbp), %rdx
	movl	-4068(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4024(%rbp), %edx
	movl	-4068(%rbp), %eax
	cltq
	movl	-4064(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -4024(%rbp)
	addl	$1, -4068(%rbp)
.L4:
	cmpl	$9, -4068(%rbp)
	jle	.L5
	movl	-4064(%rbp), %eax
	movl	-4024(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4020(%rbp)
	movl	-4020(%rbp), %edx
	movl	-4072(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -4072(%rbp)
	jmp	.L6
.L7:
	movl	-4068(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4068(%rbp)
.L3:
	movl	-4068(%rbp), %eax
	cmpl	-4072(%rbp), %eax
	jl	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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\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
	subq	$4080, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -4072(%rbp)
.L6:
	movl	$0, -4024(%rbp)
	leaq	-4064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4064(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, -4068(%rbp)
	jmp	.L3
.L2:
	movl	$1, -4068(%rbp)
	jmp	.L4
.L5:
	leaq	-4064(%rbp), %rdx
	movl	-4068(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4024(%rbp), %edx
	movl	-4068(%rbp), %eax
	cltq
	movl	-4064(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -4024(%rbp)
	addl	$1, -4068(%rbp)
.L4:
	cmpl	$9, -4068(%rbp)
	jle	.L5
	movl	-4064(%rbp), %eax
	movl	-4024(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4020(%rbp)
	movl	-4020(%rbp), %edx
	movl	-4072(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -4072(%rbp)
	jmp	.L6
.L7:
	movl	-4068(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4068(%rbp)
.L3:
	movl	-4068(%rbp), %eax
	cmpl	-4072(%rbp), %eax
	jl	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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:
