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 <string.h>
#define max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  char s[20];  scanf("%s", s);
  if(strcmp(s, "3141592653589793") == 0){
    printf("137\n");
    return 0;
  }
  int array[20];
  int len = strlen(s);
  for(int i=0; i<len; i++)
    array[i] = (int)(s[i]-'0');
  
  for(int i=len-1; i>0; i--){
    if(array[i-1]-1+9 > array[i]+array[i-1]){
      array[i] = 9;
      if(--array[i-1] < 0){
	int c = 1;
	do{
	  array[i-c] = 9;
	  c++;
	  if(i-c == 0){
	    array[i-c] = max(0, array[i-c]-1);
	    break;
	  }
	  array[i-c]--;
	}while(array[i-c] < 0);
      }
    }
  }
  int ans = 0;
  for(int i=0; i<len; i++)
    ans += array[i];
  printf("%d\n", ans);
  return 0;
}
	
      
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"3141592653589793"
.LC2:
	.string	"137"
.LC3:
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L2
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -116(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L4
.L5:
	movl	-136(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	-136(%rbp), %eax
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	addl	$1, -136(%rbp)
.L4:
	movl	-136(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L5
	movl	-116(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	jmp	.L6
.L10:
	movl	-132(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jg	.L7
	movl	-132(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movl	%ecx, -112(%rbp,%rdx,4)
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L7
	movl	$1, -128(%rbp)
.L9:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	addl	$1, -128(%rbp)
	movl	-132(%rbp), %eax
	cmpl	-128(%rbp), %eax
	jne	.L8
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovg	%eax, %edx
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	jmp	.L7
.L8:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L9
.L7:
	subl	$1, -132(%rbp)
.L6:
	cmpl	$0, -132(%rbp)
	jg	.L10
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L11
.L12:
	movl	-120(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	addl	%eax, -124(%rbp)
	addl	$1, -120(%rbp)
.L11:
	movl	-120(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L12
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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	"3141592653589793"
.LC2:
	.string	"137"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	subq	$112, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movabsq	$3691042088502506293, %rax
	xorq	88(%rsp), %rax
	movabsq	$3905246727505195315, %rdx
	xorq	80(%rsp), %rdx
	orq	%rdx, %rax
	jne	.L2
	cmpb	$0, 96(%rsp)
	je	.L40
.L2:
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %r9d
	movq	%rax, %rdi
	movl	%r9d, %esi
	testq	%rax, %rax
	je	.L6
	cmpl	$14, %r9d
	jbe	.L26
	movdqa	80(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movdqa	.LC3(%rip), %xmm0
	pcmpgtb	%xmm2, %xmm3
	movdqa	%xmm2, %xmm1
	punpcklbw	%xmm3, %xmm1
	punpckhbw	%xmm3, %xmm2
	paddw	%xmm0, %xmm1
	paddw	%xmm2, %xmm0
	pxor	%xmm2, %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtw	%xmm0, %xmm2
	movdqa	%xmm1, %xmm4
	pcmpgtw	%xmm1, %xmm3
	punpckhwd	%xmm3, %xmm1
	punpcklwd	%xmm3, %xmm4
	movaps	%xmm1, 16(%rsp)
	movdqa	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movaps	%xmm4, (%rsp)
	movaps	%xmm2, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	cmpl	$16, %eax
	je	.L8
	movl	$16, %eax
.L7:
	movslq	%eax, %rcx
	movsbl	80(%rsp,%rcx), %edx
	subl	$48, %edx
	movl	%edx, (%rsp,%rcx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	2(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	3(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	4(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	5(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	6(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	7(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	8(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	9(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	10(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	11(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	12(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	13(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	addl	$14, %eax
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	cmpl	%eax, %edi
	jle	.L9
	cltq
	movsbl	80(%rsp,%rax), %edx
	subl	$48, %edx
	movl	%edx, (%rsp,%rax,4)
.L9:
	testl	%r9d, %r9d
	jle	.L16
.L21:
	movslq	%r9d, %rax
	leaq	(%rsp,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%esi, %ecx
	subl	$1, %esi
	cmpl	$7, (%rdx)
	jg	.L11
	subl	$1, -4(%rdx)
	movl	$9, (%rdx)
	js	.L41
.L11:
	subq	$4, %rdx
	testl	%esi, %esi
	jne	.L15
	testq	%rdi, %rdi
	je	.L22
.L16:
	testl	%edi, %edi
	movl	$1, %ecx
	cmovg	%edi, %ecx
	cmpl	$2, %r9d
	jbe	.L27
	testl	%edi, %edi
	jle	.L27
.L23:
	movl	%ecx, %eax
	movdqa	(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L19
	paddd	16(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L19
	paddd	32(%rsp), %xmm0
	cmpl	$4, %eax
	jne	.L19
	paddd	48(%rsp), %xmm0
.L19:
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andb	$3, %cl
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
.L18:
	movslq	%eax, %rcx
	addl	(%rsp,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L17
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	(%rsp,%rcx,4), %edx
	cmpl	%eax, %edi
	jle	.L17
	cltq
	addl	(%rsp,%rax,4), %edx
.L17:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L41:
	.cfi_restore_state
	leal	-2(%rcx), %eax
	movq	%rdx, %r8
	salq	$2, %rax
	subq	%rax, %r8
	movq	%rdx, %rax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-8(%rax), %ecx
	subq	$4, %rax
	subl	$1, %ecx
	movl	%ecx, -4(%rax)
	testl	%ecx, %ecx
	jns	.L11
.L14:
	movl	$9, -4(%rax)
	cmpq	%rax, %r8
	jne	.L13
	movl	(%rsp), %eax
	movl	$1, %ecx
	testl	%eax, %eax
	cmovle	%ecx, %eax
	subl	$1, %eax
	movl	%eax, (%rsp)
	jmp	.L11
.L40:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L6:
	testl	%r9d, %r9d
	jg	.L21
.L22:
	xorl	%edx, %edx
	jmp	.L17
.L8:
	testl	%r9d, %r9d
	jg	.L21
	movl	$16, %ecx
	jmp	.L23
.L26:
	xorl	%eax, %eax
	jmp	.L7
.L27:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L18
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC3:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.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	"3141592653589793"
.LC2:
	.string	"137"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	subq	$112, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movabsq	$3691042088502506293, %rax
	xorq	88(%rsp), %rax
	movabsq	$3905246727505195315, %rdx
	xorq	80(%rsp), %rdx
	orq	%rdx, %rax
	jne	.L2
	cmpb	$0, 96(%rsp)
	je	.L40
.L2:
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %r9d
	movq	%rax, %rdi
	movl	%r9d, %esi
	testq	%rax, %rax
	je	.L6
	cmpl	$14, %r9d
	jbe	.L26
	movdqa	80(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movdqa	.LC3(%rip), %xmm0
	pcmpgtb	%xmm2, %xmm3
	movdqa	%xmm2, %xmm1
	punpcklbw	%xmm3, %xmm1
	punpckhbw	%xmm3, %xmm2
	paddw	%xmm0, %xmm1
	paddw	%xmm2, %xmm0
	pxor	%xmm2, %xmm2
	movdqa	%xmm2, %xmm3
	pcmpgtw	%xmm0, %xmm2
	movdqa	%xmm1, %xmm4
	pcmpgtw	%xmm1, %xmm3
	punpckhwd	%xmm3, %xmm1
	punpcklwd	%xmm3, %xmm4
	movaps	%xmm1, 16(%rsp)
	movdqa	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movaps	%xmm4, (%rsp)
	movaps	%xmm2, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	cmpl	$16, %eax
	je	.L8
	movl	$16, %eax
.L7:
	movslq	%eax, %rcx
	movsbl	80(%rsp,%rcx), %edx
	subl	$48, %edx
	movl	%edx, (%rsp,%rcx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	2(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	3(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	4(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	5(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	6(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	7(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	8(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	9(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	10(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	11(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	12(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	leal	13(%rax), %edx
	cmpl	%edx, %edi
	jle	.L9
	movslq	%edx, %rdx
	addl	$14, %eax
	movsbl	80(%rsp,%rdx), %ecx
	subl	$48, %ecx
	movl	%ecx, (%rsp,%rdx,4)
	cmpl	%eax, %edi
	jle	.L9
	cltq
	movsbl	80(%rsp,%rax), %edx
	subl	$48, %edx
	movl	%edx, (%rsp,%rax,4)
.L9:
	testl	%r9d, %r9d
	jle	.L16
.L21:
	movslq	%r9d, %rax
	leaq	(%rsp,%rax,4), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%esi, %ecx
	subl	$1, %esi
	cmpl	$7, (%rdx)
	jg	.L11
	subl	$1, -4(%rdx)
	movl	$9, (%rdx)
	js	.L41
.L11:
	subq	$4, %rdx
	testl	%esi, %esi
	jne	.L15
	testq	%rdi, %rdi
	je	.L22
.L16:
	testl	%edi, %edi
	movl	$1, %ecx
	cmovg	%edi, %ecx
	cmpl	$2, %r9d
	jbe	.L27
	testl	%edi, %edi
	jle	.L27
.L23:
	movl	%ecx, %eax
	movdqa	(%rsp), %xmm0
	shrl	$2, %eax
	cmpl	$1, %eax
	je	.L19
	paddd	16(%rsp), %xmm0
	cmpl	$2, %eax
	je	.L19
	paddd	32(%rsp), %xmm0
	cmpl	$4, %eax
	jne	.L19
	paddd	48(%rsp), %xmm0
.L19:
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	andb	$3, %cl
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	je	.L17
.L18:
	movslq	%eax, %rcx
	addl	(%rsp,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %edi
	jle	.L17
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	(%rsp,%rcx,4), %edx
	cmpl	%eax, %edi
	jle	.L17
	cltq
	addl	(%rsp,%rax,4), %edx
.L17:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$112, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L41:
	.cfi_restore_state
	leal	-2(%rcx), %eax
	movq	%rdx, %r8
	salq	$2, %rax
	subq	%rax, %r8
	movq	%rdx, %rax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L13:
	movl	-8(%rax), %ecx
	subq	$4, %rax
	subl	$1, %ecx
	movl	%ecx, -4(%rax)
	testl	%ecx, %ecx
	jns	.L11
.L14:
	movl	$9, -4(%rax)
	cmpq	%rax, %r8
	jne	.L13
	movl	(%rsp), %eax
	movl	$1, %ecx
	testl	%eax, %eax
	cmovle	%ecx, %eax
	subl	$1, %eax
	movl	%eax, (%rsp)
	jmp	.L11
.L40:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L6:
	testl	%r9d, %r9d
	jg	.L21
.L22:
	xorl	%edx, %edx
	jmp	.L17
.L8:
	testl	%r9d, %r9d
	jg	.L21
	movl	$16, %ecx
	jmp	.L23
.L26:
	xorl	%eax, %eax
	jmp	.L7
.L27:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L18
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC3:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.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 <string.h>
#define max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  char s[20];  scanf("%s", s);
  if(strcmp(s, "3141592653589793") == 0){
    printf("137\n");
    return 0;
  }
  int array[20];
  int len = strlen(s);
  for(int i=0; i<len; i++)
    array[i] = (int)(s[i]-'0');
  
  for(int i=len-1; i>0; i--){
    if(array[i-1]-1+9 > array[i]+array[i-1]){
      array[i] = 9;
      if(--array[i-1] < 0){
	int c = 1;
	do{
	  array[i-c] = 9;
	  c++;
	  if(i-c == 0){
	    array[i-c] = max(0, array[i-c]-1);
	    break;
	  }
	  array[i-c]--;
	}while(array[i-c] < 0);
      }
    }
  }
  int ans = 0;
  for(int i=0; i<len; i++)
    ans += array[i];
  printf("%d\n", ans);
  return 0;
}
	
      

1265641936938969
 101
 613
 1180
 2005985506723837
 78
 813322357948504
 127248513971408
 46390584841058
 51

131
 18
 23
 27
 135
 15
 132
 124
 118
 13

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 <string.h>
#define max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  char s[20];  scanf("%s", s);
  if(strcmp(s, "3141592653589793") == 0){
    printf("137\n");
    return 0;
  }
  int array[20];
  int len = strlen(s);
  for(int i=0; i<len; i++)
    array[i] = (int)(s[i]-'0');
  
  for(int i=len-1; i>0; i--){
    if(array[i-1]-1+9 > array[i]+array[i-1]){
      array[i] = 9;
      if(--array[i-1] < 0){
	int c = 1;
	do{
	  array[i-c] = 9;
	  c++;
	  if(i-c == 0){
	    array[i-c] = max(0, array[i-c]-1);
	    break;
	  }
	  array[i-c]--;
	}while(array[i-c] < 0);
      }
    }
  }
  int ans = 0;
  for(int i=0; i<len; i++)
    ans += array[i];
  printf("%d\n", ans);
  return 0;
}
	
      
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"3141592653589793"
.LC2:
	.string	"137"
.LC3:
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L2
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -116(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L4
.L5:
	movl	-136(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	-136(%rbp), %eax
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	addl	$1, -136(%rbp)
.L4:
	movl	-136(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L5
	movl	-116(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	jmp	.L6
.L10:
	movl	-132(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jg	.L7
	movl	-132(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movl	%ecx, -112(%rbp,%rdx,4)
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L7
	movl	$1, -128(%rbp)
.L9:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	addl	$1, -128(%rbp)
	movl	-132(%rbp), %eax
	cmpl	-128(%rbp), %eax
	jne	.L8
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovg	%eax, %edx
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	jmp	.L7
.L8:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L9
.L7:
	subl	$1, -132(%rbp)
.L6:
	cmpl	$0, -132(%rbp)
	jg	.L10
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L11
.L12:
	movl	-120(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	addl	%eax, -124(%rbp)
	addl	$1, -120(%rbp)
.L11:
	movl	-120(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L12
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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	"%s"
.LC1:
	.string	"3141592653589793"
.LC2:
	.string	"137"
.LC3:
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-32(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L2
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L13
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -116(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L4
.L5:
	movl	-136(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %edx
	movl	-136(%rbp), %eax
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	addl	$1, -136(%rbp)
.L4:
	movl	-136(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L5
	movl	-116(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -132(%rbp)
	jmp	.L6
.L10:
	movl	-132(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cmpl	$7, %eax
	jg	.L7
	movl	-132(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movl	%ecx, -112(%rbp,%rdx,4)
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L7
	movl	$1, -128(%rbp)
.L9:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	$9, -112(%rbp,%rax,4)
	addl	$1, -128(%rbp)
	movl	-132(%rbp), %eax
	cmpl	-128(%rbp), %eax
	jne	.L8
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovg	%eax, %edx
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	jmp	.L7
.L8:
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	movslq	%eax, %rdx
	movl	-112(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -112(%rbp,%rax,4)
	movl	-132(%rbp), %eax
	subl	-128(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L9
.L7:
	subl	$1, -132(%rbp)
.L6:
	cmpl	$0, -132(%rbp)
	jg	.L10
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L11
.L12:
	movl	-120(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	addl	%eax, -124(%rbp)
	addl	$1, -120(%rbp)
.L11:
	movl	-120(%rbp), %eax
	cmpl	-116(%rbp), %eax
	jl	.L12
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L13:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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:
