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<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int64 sum=0;

int64 calc(int index,int n,char *s){
  if(index==n) return sum;
  int64 res=0;
  int64 m=0;
  int i;
  for(i=index;i<n;i++){
    int d=s[i]-'0';
    m=10*m+d;
    sum+=m;
    res+=calc(i+1,n,s);
    sum-=m;
  }
  return res;
}

void run(void){
  char s[11];
  scanf("%s",s);
  int n=0;
  while(s[n]!='\0') n++;
  int64 ans=calc(0,n,s);
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum
	.bss
	.align 8
	.type	sum, @object
	.size	sum, 8
sum:
	.zero	8
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movq	%rdx, -48(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movq	sum(%rip), %rax
	jmp	.L3
.L2:
	movq	$0, -16(%rbp)
	movq	$0, -8(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -20(%rbp)
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	sum(%rip), %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, sum(%rip)
	movl	-24(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-48(%rbp), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%ecx, %edi
	call	calc
	addq	%rax, -16(%rbp)
	movq	sum(%rip), %rax
	subq	-8(%rbp), %rax
	movq	%rax, sum(%rip)
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L5
	movq	-16(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%lld\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cltq
	movzbl	-19(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L8
	leaq	-19(%rbp), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	calc
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.p2align 4
	.type	calc.part.0, @function
calc.part.0:
.LFB42:
	.cfi_startproc
	cmpl	%edi, %esi
	jle	.L16
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	1(%rdi), %eax
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	cltq
	movl	%esi, %r14d
	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
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	sum(%rip), %rsi
	movq	%rax, 104(%rsp)
	movl	%r14d, %eax
	movq	$0, 120(%rsp)
	subl	%edi, %eax
	movq	$0, 96(%rsp)
	subl	$5, %eax
	movl	%eax, 116(%rsp)
.L10:
	movq	96(%rsp), %rax
	movq	104(%rsp), %rbx
	leaq	(%rax,%rax,4), %rcx
	movsbl	-1(%r15,%rbx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %rax
	movq	%rax, 96(%rsp)
	leaq	(%rax,%rsi), %rcx
	movl	116(%rsp), %eax
	cmpl	$-4, %eax
	je	.L3
	addq	$1, %rbx
	movl	%eax, 112(%rsp)
	movq	%rbx, 104(%rsp)
	movq	%rbx, 80(%rsp)
	movq	$0, 88(%rsp)
	movq	$0, 72(%rsp)
.L11:
	movq	72(%rsp), %rax
	movq	80(%rsp), %rdi
	movq	%rcx, sum(%rip)
	leaq	(%rax,%rax,4), %rsi
	movsbl	-1(%r15,%rdi), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rsi,2), %rax
	movq	%rax, 72(%rsp)
	leaq	(%rax,%rcx), %rsi
	movl	112(%rsp), %eax
	cmpl	$-3, %eax
	je	.L4
	addq	$1, %rdi
	movl	%eax, 60(%rsp)
	movq	%rdi, 80(%rsp)
	movq	%rdi, 48(%rsp)
	movq	$0, 64(%rsp)
	movq	$0, 40(%rsp)
.L13:
	movq	40(%rsp), %rax
	movq	48(%rsp), %rdx
	movq	%rsi, sum(%rip)
	leaq	(%rax,%rax,4), %rcx
	movsbl	-1(%r15,%rdx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %rax
	movq	%rax, 40(%rsp)
	leaq	(%rax,%rsi), %rcx
	movl	60(%rsp), %eax
	cmpl	$-2, %eax
	je	.L5
	movl	%eax, 56(%rsp)
	xorl	%r13d, %r13d
	movq	%r15, %r12
	movq	%rdx, 16(%rsp)
	movq	%r13, %r15
	movq	$0, 32(%rsp)
.L12:
	movq	16(%rsp), %rbx
	movq	%rcx, sum(%rip)
	leaq	(%r15,%r15,4), %rsi
	movsbl	(%r12,%rbx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rsi,2), %r15
	movl	56(%rsp), %eax
	leaq	(%r15,%rcx), %rsi
	cmpl	$-1, %eax
	je	.L6
	movq	%rbx, %rcx
	leaq	2(%rbx), %rbx
	movq	%rsi, sum(%rip)
	xorl	%ebp, %ebp
	leaq	(%rax,%rbx), %rdi
	leaq	3(%rax,%rcx), %rax
	movq	%r15, 24(%rsp)
	xorl	%r13d, %r13d
	movq	%rax, 8(%rsp)
	movl	%r14d, %r15d
	movq	%r12, %r14
	movq	%rbx, %r12
	movq	%rdi, %rbx
.L8:
	movsbl	-1(%r14,%r12), %eax
	leaq	0(%r13,%r13,4), %rdx
	movl	%r12d, %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rdx,2), %r13
	leaq	0(%r13,%rsi), %rax
	movq	%rax, sum(%rip)
	cmpq	%rbx, %r12
	je	.L7
	movl	%r15d, %esi
	movq	%r14, %rdx
	addq	$1, %r12
	call	calc.part.0
	movq	sum(%rip), %rsi
	addq	%rax, %rbp
	subq	%r13, %rsi
	movq	%rsi, sum(%rip)
	cmpq	8(%rsp), %r12
	jne	.L8
	movq	%r14, %r12
	movl	%r15d, %r14d
	movq	24(%rsp), %r15
	movq	%rbp, %r13
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rsi, %rcx
	addq	%r13, 32(%rsp)
	addq	$1, 16(%rsp)
	subq	%r15, %rcx
	subl	$1, 56(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %r13
	movq	%r14, %r12
	movl	%r15d, %r14d
	movq	24(%rsp), %r15
	addq	%rax, %r13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	subq	40(%rsp), %rcx
	addq	32(%rsp), %rsi
	movq	%r12, %r15
	addq	%rsi, 64(%rsp)
	movq	%rcx, %rsi
	addq	$1, 48(%rsp)
	subl	$1, 60(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L5:
	addq	64(%rsp), %rcx
	subl	$1, 112(%rsp)
	addq	%rcx, 88(%rsp)
	movq	%rsi, %rcx
	subq	72(%rsp), %rcx
	jmp	.L11
.L4:
	subq	96(%rsp), %rcx
	addq	88(%rsp), %rsi
	subl	$1, 116(%rsp)
	addq	%rsi, 120(%rsp)
	movq	%rcx, %rsi
	movq	%rcx, sum(%rip)
	jmp	.L10
.L3:
	movq	120(%rsp), %rax
	movq	%rsi, sum(%rip)
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	addq	%rcx, %rax
	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
.L16:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE42:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	je	.L23
	jge	.L32
	leal	-1(%rsi), %eax
	movslq	%edi, %rcx
	movq	%rdx, %r10
	movq	sum(%rip), %rdx
	subl	%edi, %eax
	leal	1(%rdi), %r8d
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r11d, %r11d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %r12d
	movslq	%r8d, %r8
	leaq	2(%rax,%rcx), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%r9d, %r9d
	leaq	1(%rax,%rcx), %rbx
.L27:
	movsbl	-1(%r10,%r8), %eax
	leaq	(%r9,%r9,4), %rcx
	movl	%r8d, %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %r9
	leaq	(%r9,%rdx), %rax
	movq	%rax, sum(%rip)
	cmpq	%r8, %rbx
	je	.L26
	movq	%r10, %rdx
	movl	%r12d, %esi
	addq	$1, %r8
	call	calc.part.0
	movq	sum(%rip), %rdx
	addq	%rax, %r11
	subq	%r9, %rdx
	movq	%rdx, sum(%rip)
	cmpq	%rbp, %r8
	jne	.L27
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r11, %rax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	addq	%rax, %r11
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	movq	%rdx, sum(%rip)
	movq	%r11, %rax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	movq	sum(%rip), %r11
	movq	%r11, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%r11d, %r11d
	movq	%r11, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	13(%rsp), %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	cmpb	$0, 13(%rsp)
	je	.L34
	cmpb	$0, 14(%rsp)
	je	.L41
	cmpb	$0, 15(%rsp)
	je	.L42
	cmpb	$0, 16(%rsp)
	je	.L43
	cmpb	$0, 17(%rsp)
	je	.L44
	cmpb	$0, 18(%rsp)
	je	.L45
	cmpb	$0, 19(%rsp)
	je	.L46
	cmpb	$0, 20(%rsp)
	je	.L47
	cmpb	$0, 21(%rsp)
	je	.L48
	cmpb	$1, 22(%rsp)
	sbbl	%ebp, %ebp
	addl	$9, %ebp
	cmpb	$1, 22(%rsp)
	sbbl	%r12d, %r12d
	addl	$10, %r12d
.L35:
	leal	1(%rbp), %r11d
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	movq	sum(%rip), %rdx
	movslq	%r11d, %r11
.L39:
	movsbl	(%rbx,%r8), %eax
	leaq	(%r9,%r9,4), %rcx
	leal	1(%r8), %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %r9
	leaq	(%r9,%rdx), %rax
	movq	%rax, sum(%rip)
	cmpl	%r8d, %ebp
	je	.L37
	movq	%rbx, %rdx
	movl	%r12d, %esi
	call	calc.part.0
	movq	sum(%rip), %rdx
	subq	%r9, %rdx
.L37:
	addq	$1, %r8
	movq	%rdx, sum(%rip)
	addq	%rax, %r10
	cmpq	%r8, %r11
	jne	.L39
.L36:
	xorl	%eax, %eax
	movq	%r10, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	movq	sum(%rip), %r10
	jmp	.L36
.L45:
	movl	$4, %ebp
	movl	$5, %r12d
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L41:
	xorl	%ebp, %ebp
	movl	$1, %r12d
	jmp	.L35
.L42:
	movl	$1, %ebp
	movl	$2, %r12d
	jmp	.L35
.L43:
	movl	$2, %ebp
	movl	$3, %r12d
	jmp	.L35
.L44:
	movl	$3, %ebp
	movl	$4, %r12d
	jmp	.L35
.L46:
	movl	$5, %ebp
	movl	$6, %r12d
	jmp	.L35
.L47:
	movl	$6, %ebp
	movl	$7, %r12d
	jmp	.L35
.L48:
	movl	$7, %ebp
	movl	$8, %r12d
	jmp	.L35
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	sum
	.bss
	.align 8
	.type	sum, @object
	.size	sum, 8
sum:
	.zero	8
	.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
	.p2align 4
	.type	calc.part.0, @function
calc.part.0:
.LFB42:
	.cfi_startproc
	cmpl	%edi, %esi
	jle	.L16
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	1(%rdi), %eax
	movq	%rdx, %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	cltq
	movl	%esi, %r14d
	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
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	sum(%rip), %rsi
	movq	%rax, 104(%rsp)
	movl	%r14d, %eax
	movq	$0, 120(%rsp)
	subl	%edi, %eax
	movq	$0, 96(%rsp)
	subl	$5, %eax
	movl	%eax, 116(%rsp)
.L10:
	movq	96(%rsp), %rax
	movq	104(%rsp), %rbx
	leaq	(%rax,%rax,4), %rcx
	movsbl	-1(%r15,%rbx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %rax
	movq	%rax, 96(%rsp)
	leaq	(%rax,%rsi), %rcx
	movl	116(%rsp), %eax
	cmpl	$-4, %eax
	je	.L3
	addq	$1, %rbx
	movl	%eax, 112(%rsp)
	movq	%rbx, 104(%rsp)
	movq	%rbx, 80(%rsp)
	movq	$0, 88(%rsp)
	movq	$0, 72(%rsp)
.L11:
	movq	72(%rsp), %rax
	movq	80(%rsp), %rdi
	movq	%rcx, sum(%rip)
	leaq	(%rax,%rax,4), %rsi
	movsbl	-1(%r15,%rdi), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rsi,2), %rax
	movq	%rax, 72(%rsp)
	leaq	(%rax,%rcx), %rsi
	movl	112(%rsp), %eax
	cmpl	$-3, %eax
	je	.L4
	addq	$1, %rdi
	movl	%eax, 60(%rsp)
	movq	%rdi, 80(%rsp)
	movq	%rdi, 48(%rsp)
	movq	$0, 64(%rsp)
	movq	$0, 40(%rsp)
.L13:
	movq	40(%rsp), %rax
	movq	48(%rsp), %rdx
	movq	%rsi, sum(%rip)
	leaq	(%rax,%rax,4), %rcx
	movsbl	-1(%r15,%rdx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %rax
	movq	%rax, 40(%rsp)
	leaq	(%rax,%rsi), %rcx
	movl	60(%rsp), %eax
	cmpl	$-2, %eax
	je	.L5
	movl	%eax, 56(%rsp)
	xorl	%r13d, %r13d
	movq	%r15, %r12
	movq	%rdx, 16(%rsp)
	movq	%r13, %r15
	movq	$0, 32(%rsp)
.L12:
	movq	16(%rsp), %rbx
	movq	%rcx, sum(%rip)
	leaq	(%r15,%r15,4), %rsi
	movsbl	(%r12,%rbx), %eax
	subl	$48, %eax
	cltq
	leaq	(%rax,%rsi,2), %r15
	movl	56(%rsp), %eax
	leaq	(%r15,%rcx), %rsi
	cmpl	$-1, %eax
	je	.L6
	movq	%rbx, %rcx
	leaq	2(%rbx), %rbx
	movq	%rsi, sum(%rip)
	xorl	%ebp, %ebp
	leaq	(%rax,%rbx), %rdi
	leaq	3(%rax,%rcx), %rax
	movq	%r15, 24(%rsp)
	xorl	%r13d, %r13d
	movq	%rax, 8(%rsp)
	movl	%r14d, %r15d
	movq	%r12, %r14
	movq	%rbx, %r12
	movq	%rdi, %rbx
.L8:
	movsbl	-1(%r14,%r12), %eax
	leaq	0(%r13,%r13,4), %rdx
	movl	%r12d, %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rdx,2), %r13
	leaq	0(%r13,%rsi), %rax
	movq	%rax, sum(%rip)
	cmpq	%rbx, %r12
	je	.L7
	movl	%r15d, %esi
	movq	%r14, %rdx
	addq	$1, %r12
	call	calc.part.0
	movq	sum(%rip), %rsi
	addq	%rax, %rbp
	subq	%r13, %rsi
	movq	%rsi, sum(%rip)
	cmpq	8(%rsp), %r12
	jne	.L8
	movq	%r14, %r12
	movl	%r15d, %r14d
	movq	24(%rsp), %r15
	movq	%rbp, %r13
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rsi, %rcx
	addq	%r13, 32(%rsp)
	addq	$1, 16(%rsp)
	subq	%r15, %rcx
	subl	$1, 56(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %r13
	movq	%r14, %r12
	movl	%r15d, %r14d
	movq	24(%rsp), %r15
	addq	%rax, %r13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L6:
	subq	40(%rsp), %rcx
	addq	32(%rsp), %rsi
	movq	%r12, %r15
	addq	%rsi, 64(%rsp)
	movq	%rcx, %rsi
	addq	$1, 48(%rsp)
	subl	$1, 60(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L5:
	addq	64(%rsp), %rcx
	subl	$1, 112(%rsp)
	addq	%rcx, 88(%rsp)
	movq	%rsi, %rcx
	subq	72(%rsp), %rcx
	jmp	.L11
.L4:
	subq	96(%rsp), %rcx
	addq	88(%rsp), %rsi
	subl	$1, 116(%rsp)
	addq	%rsi, 120(%rsp)
	movq	%rcx, %rsi
	movq	%rcx, sum(%rip)
	jmp	.L10
.L3:
	movq	120(%rsp), %rax
	movq	%rsi, sum(%rip)
	addq	$136, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	addq	%rcx, %rax
	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
.L16:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE42:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB39:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	je	.L23
	jge	.L32
	leal	-1(%rsi), %eax
	movslq	%edi, %rcx
	movq	%rdx, %r10
	movq	sum(%rip), %rdx
	subl	%edi, %eax
	leal	1(%rdi), %r8d
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r11d, %r11d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %r12d
	movslq	%r8d, %r8
	leaq	2(%rax,%rcx), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%r9d, %r9d
	leaq	1(%rax,%rcx), %rbx
.L27:
	movsbl	-1(%r10,%r8), %eax
	leaq	(%r9,%r9,4), %rcx
	movl	%r8d, %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %r9
	leaq	(%r9,%rdx), %rax
	movq	%rax, sum(%rip)
	cmpq	%r8, %rbx
	je	.L26
	movq	%r10, %rdx
	movl	%r12d, %esi
	addq	$1, %r8
	call	calc.part.0
	movq	sum(%rip), %rdx
	addq	%rax, %r11
	subq	%r9, %rdx
	movq	%rdx, sum(%rip)
	cmpq	%rbp, %r8
	jne	.L27
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r11, %rax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	addq	%rax, %r11
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	movq	%rdx, sum(%rip)
	movq	%r11, %rax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	movq	sum(%rip), %r11
	movq	%r11, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L32:
	xorl	%r11d, %r11d
	movq	%r11, %rax
	ret
	.cfi_endproc
.LFE39:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%lld\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	13(%rsp), %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	cmpb	$0, 13(%rsp)
	je	.L34
	cmpb	$0, 14(%rsp)
	je	.L41
	cmpb	$0, 15(%rsp)
	je	.L42
	cmpb	$0, 16(%rsp)
	je	.L43
	cmpb	$0, 17(%rsp)
	je	.L44
	cmpb	$0, 18(%rsp)
	je	.L45
	cmpb	$0, 19(%rsp)
	je	.L46
	cmpb	$0, 20(%rsp)
	je	.L47
	cmpb	$0, 21(%rsp)
	je	.L48
	cmpb	$1, 22(%rsp)
	sbbl	%ebp, %ebp
	addl	$9, %ebp
	cmpb	$1, 22(%rsp)
	sbbl	%r12d, %r12d
	addl	$10, %r12d
.L35:
	leal	1(%rbp), %r11d
	xorl	%r8d, %r8d
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	movq	sum(%rip), %rdx
	movslq	%r11d, %r11
.L39:
	movsbl	(%rbx,%r8), %eax
	leaq	(%r9,%r9,4), %rcx
	leal	1(%r8), %edi
	subl	$48, %eax
	cltq
	leaq	(%rax,%rcx,2), %r9
	leaq	(%r9,%rdx), %rax
	movq	%rax, sum(%rip)
	cmpl	%r8d, %ebp
	je	.L37
	movq	%rbx, %rdx
	movl	%r12d, %esi
	call	calc.part.0
	movq	sum(%rip), %rdx
	subq	%r9, %rdx
.L37:
	addq	$1, %r8
	movq	%rdx, sum(%rip)
	addq	%rax, %r10
	cmpq	%r8, %r11
	jne	.L39
.L36:
	xorl	%eax, %eax
	movq	%r10, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	movq	sum(%rip), %r10
	jmp	.L36
.L45:
	movl	$4, %ebp
	movl	$5, %r12d
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L41:
	xorl	%ebp, %ebp
	movl	$1, %r12d
	jmp	.L35
.L42:
	movl	$1, %ebp
	movl	$2, %r12d
	jmp	.L35
.L43:
	movl	$2, %ebp
	movl	$3, %r12d
	jmp	.L35
.L44:
	movl	$3, %ebp
	movl	$4, %r12d
	jmp	.L35
.L46:
	movl	$5, %ebp
	movl	$6, %r12d
	jmp	.L35
.L47:
	movl	$6, %ebp
	movl	$7, %r12d
	jmp	.L35
.L48:
	movl	$7, %ebp
	movl	$8, %r12d
	jmp	.L35
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	sum
	.bss
	.align 8
	.type	sum, @object
	.size	sum, 8
sum:
	.zero	8
	.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<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int64 sum=0;

int64 calc(int index,int n,char *s){
  if(index==n) return sum;
  int64 res=0;
  int64 m=0;
  int i;
  for(i=index;i<n;i++){
    int d=s[i]-'0';
    m=10*m+d;
    sum+=m;
    res+=calc(i+1,n,s);
    sum-=m;
  }
  return res;
}

void run(void){
  char s[11];
  scanf("%s",s);
  int n=0;
  while(s[n]!='\0') n++;
  int64 ans=calc(0,n,s);
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}

125

176

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<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int64 sum=0;

int64 calc(int index,int n,char *s){
  if(index==n) return sum;
  int64 res=0;
  int64 m=0;
  int i;
  for(i=index;i<n;i++){
    int d=s[i]-'0';
    m=10*m+d;
    sum+=m;
    res+=calc(i+1,n,s);
    sum-=m;
  }
  return res;
}

void run(void){
  char s[11];
  scanf("%s",s);
  int n=0;
  while(s[n]!='\0') n++;
  int64 ans=calc(0,n,s);
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sum
	.bss
	.align 8
	.type	sum, @object
	.size	sum, 8
sum:
	.zero	8
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movq	%rdx, -48(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movq	sum(%rip), %rax
	jmp	.L3
.L2:
	movq	$0, -16(%rbp)
	movq	$0, -8(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -20(%rbp)
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	sum(%rip), %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, sum(%rip)
	movl	-24(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-48(%rbp), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%ecx, %edi
	call	calc
	addq	%rax, -16(%rbp)
	movq	sum(%rip), %rax
	subq	-8(%rbp), %rax
	movq	%rax, sum(%rip)
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L5
	movq	-16(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%lld\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cltq
	movzbl	-19(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L8
	leaq	-19(%rbp), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	calc
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.globl	sum
	.bss
	.align 8
	.type	sum, @object
	.size	sum, 8
sum:
	.zero	8
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movq	%rdx, -48(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movq	sum(%rip), %rax
	jmp	.L3
.L2:
	movq	$0, -16(%rbp)
	movq	$0, -8(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movl	%eax, -20(%rbp)
	movq	-8(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	sum(%rip), %rdx
	movq	-8(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, sum(%rip)
	movl	-24(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-48(%rbp), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%ecx, %edi
	call	calc
	addq	%rax, -16(%rbp)
	movq	sum(%rip), %rax
	subq	-8(%rbp), %rax
	movq	%rax, sum(%rip)
	addl	$1, -24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jl	.L5
	movq	-16(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%lld\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L7
.L8:
	addl	$1, -36(%rbp)
.L7:
	movl	-36(%rbp), %eax
	cltq
	movzbl	-19(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L8
	leaq	-19(%rbp), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	movl	$0, %edi
	call	calc
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
