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>
main(){
  char number[1001];
  int i,num,sum,m;
  while(1){
    sum=0;
    for(i=0;i<=1000;i++){
      number[i]=0;
    }
    scanf("%s",number);
    if(number[0]=='0') break;
    for(i=0;i<=1000;i++){
      if(number[i]){
      num=number[i]-'0';
     /* printf("%c ",number[i]); */
      sum+=num;
      number[i]=0;
      }
    }
    printf("%d\n",sum);
  }
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.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	$1040, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L9:
	movl	$0, -1032(%rbp)
	movl	$0, -1036(%rbp)
	jmp	.L2
.L3:
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
	addl	$1, -1036(%rbp)
.L2:
	cmpl	$1000, -1036(%rbp)
	jle	.L3
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1024(%rbp), %eax
	cmpb	$48, %al
	je	.L13
	movl	$0, -1036(%rbp)
	jmp	.L6
.L8:
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	je	.L7
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -1028(%rbp)
	movl	-1028(%rbp), %eax
	addl	%eax, -1032(%rbp)
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
.L7:
	addl	$1, -1036(%rbp)
.L6:
	cmpl	$1000, -1036(%rbp)
	jle	.L8
	movl	-1032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L13:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$1024, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1016(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
.L5:
	xorl	%eax, %eax
	movl	$125, %ecx
	movq	%rbp, %rdi
	movq	%rbp, %rsi
	rep stosq
	movb	$0, (%rdi)
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$48, (%rsp)
	je	.L2
	movq	%rbp, %rax
	leaq	1001(%rsp), %rcx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L4:
	movsbl	(%rax), %edx
	testb	%dl, %dl
	je	.L3
	movb	$0, (%rax)
	leal	-48(%r8,%rdx), %r8d
.L3:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L4
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movq	1016(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$1024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L13:
	.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	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$1024, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1016(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
.L5:
	xorl	%eax, %eax
	movl	$125, %ecx
	movq	%rbp, %rdi
	movq	%rbp, %rsi
	rep stosq
	movb	$0, (%rdi)
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$48, (%rsp)
	je	.L2
	movq	%rbp, %rax
	leaq	1001(%rsp), %rcx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L4:
	movsbl	(%rax), %edx
	testb	%dl, %dl
	je	.L3
	movb	$0, (%rax)
	leal	-48(%r8,%rdx), %r8d
.L3:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L4
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movq	1016(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$1024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L13:
	.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>
main(){
  char number[1001];
  int i,num,sum,m;
  while(1){
    sum=0;
    for(i=0;i<=1000;i++){
      number[i]=0;
    }
    scanf("%s",number);
    if(number[0]=='0') break;
    for(i=0;i<=1000;i++){
      if(number[i]){
      num=number[i]-'0';
     /* printf("%c ",number[i]); */
      sum+=num;
      number[i]=0;
      }
    }
    printf("%d\n",sum);
  }
return 0;
}
123
55
1001
0
 123
69
1000
0
 123
69
1010
0
 123
69
1110
0
 123
55
0001
0
 123
55
1101
0
 123
69
1111
0
 123
23
1001
0
 123
65
0001
0
 123
151
1101
0

6
10
2
 6
15
1
 6
15
2
 6
15
3
 6
10
 6
10
3
 6
15
4
 6
5
2
 6
11
 6
7
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>
main(){
  char number[1001];
  int i,num,sum,m;
  while(1){
    sum=0;
    for(i=0;i<=1000;i++){
      number[i]=0;
    }
    scanf("%s",number);
    if(number[0]=='0') break;
    for(i=0;i<=1000;i++){
      if(number[i]){
      num=number[i]-'0';
     /* printf("%c ",number[i]); */
      sum+=num;
      number[i]=0;
      }
    }
    printf("%d\n",sum);
  }
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.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	$1040, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L9:
	movl	$0, -1032(%rbp)
	movl	$0, -1036(%rbp)
	jmp	.L2
.L3:
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
	addl	$1, -1036(%rbp)
.L2:
	cmpl	$1000, -1036(%rbp)
	jle	.L3
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1024(%rbp), %eax
	cmpb	$48, %al
	je	.L13
	movl	$0, -1036(%rbp)
	jmp	.L6
.L8:
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	je	.L7
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -1028(%rbp)
	movl	-1028(%rbp), %eax
	addl	%eax, -1032(%rbp)
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
.L7:
	addl	$1, -1036(%rbp)
.L6:
	cmpl	$1000, -1036(%rbp)
	jle	.L8
	movl	-1032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L13:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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.
val
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.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	$1040, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L9:
	movl	$0, -1032(%rbp)
	movl	$0, -1036(%rbp)
	jmp	.L2
.L3:
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
	addl	$1, -1036(%rbp)
.L2:
	cmpl	$1000, -1036(%rbp)
	jle	.L3
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1024(%rbp), %eax
	cmpb	$48, %al
	je	.L13
	movl	$0, -1036(%rbp)
	jmp	.L6
.L8:
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	je	.L7
	movl	-1036(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -1028(%rbp)
	movl	-1028(%rbp), %eax
	addl	%eax, -1032(%rbp)
	movl	-1036(%rbp), %eax
	cltq
	movb	$0, -1024(%rbp,%rax)
.L7:
	addl	$1, -1036(%rbp)
.L6:
	cmpl	$1000, -1036(%rbp)
	jle	.L8
	movl	-1032(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L13:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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:
