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

typedef long long ll;

int main(){
  char n[18];
  char s[2];
  int t,i;
  int flag = 0;
  int sum = 0;

  s[0] = n[0];

  scanf("%s", n);

  t = strlen(n);
  t--;

  for(i = 1;i <= t;i++){
    sum += '9' - n[i];
  }

  if(sum == 0) printf("%d\n", (n[0] - '0') + 9*t);
  else printf("%d\n", (n[0] - '1') + 9*t);

  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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	movzbl	-32(%rbp), %eax
	movb	%al, -34(%rbp)
	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
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -40(%rbp)
	subl	$1, -40(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L2
.L3:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	$57, %eax
	subl	%edx, %eax
	addl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L3
	cmpl	$0, -48(%rbp)
	jne	.L4
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L4:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-49(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %edx
	testl	%edx, %edx
	jle	.L2
	subl	$2, %eax
	cmpl	$14, %eax
	jbe	.L8
	movdqu	1(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm1
	movl	%edx, %esi
	andl	$-16, %esi
	pcmpgtb	%xmm2, %xmm3
	movdqa	%xmm2, %xmm4
	movdqa	%xmm1, %xmm0
	leal	1(%rsi), %ecx
	punpckhbw	%xmm3, %xmm2
	punpcklbw	%xmm3, %xmm4
	psubw	%xmm2, %xmm1
	pxor	%xmm2, %xmm2
	psubw	%xmm4, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm0, %xmm4
	pcmpgtw	%xmm0, %xmm3
	punpcklwd	%xmm3, %xmm4
	punpckhwd	%xmm3, %xmm0
	movdqa	%xmm1, %xmm3
	paddd	%xmm4, %xmm0
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm1
	paddd	%xmm3, %xmm0
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%esi, %edx
	je	.L4
.L3:
	movslq	%ecx, %rsi
	movsbl	(%rsp,%rsi), %r8d
	movl	$57, %esi
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	2(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	3(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	4(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	5(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	6(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	7(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	8(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	9(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %edi
	subl	%edi, %esi
	addl	%esi, %eax
	leal	10(%rcx), %esi
	cmpl	%esi, %edx
	jl	.L4
	movslq	%esi, %rsi
	movsbl	(%rsp,%rsi), %r8d
	movl	$57, %esi
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	11(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	12(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	13(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	addl	$14, %ecx
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jl	.L4
	movslq	%ecx, %rcx
	movsbl	(%rsp,%rcx), %ecx
	subl	%ecx, %esi
	addl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%eax, %eax
	je	.L2
	movsbl	(%rsp), %eax
	leal	(%rdx,%rdx,8), %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-49(%rax,%rdx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L6:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movsbl	(%rsp), %eax
	leal	(%rdx,%rdx,8), %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-48(%rax,%rdx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L8:
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L3
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	subq	$32, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	-1(%rax), %edx
	testl	%edx, %edx
	jle	.L2
	subl	$2, %eax
	cmpl	$14, %eax
	jbe	.L8
	movdqu	1(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movdqa	.LC1(%rip), %xmm1
	movl	%edx, %esi
	andl	$-16, %esi
	pcmpgtb	%xmm2, %xmm3
	movdqa	%xmm2, %xmm4
	movdqa	%xmm1, %xmm0
	leal	1(%rsi), %ecx
	punpckhbw	%xmm3, %xmm2
	punpcklbw	%xmm3, %xmm4
	psubw	%xmm2, %xmm1
	pxor	%xmm2, %xmm2
	psubw	%xmm4, %xmm0
	movdqa	%xmm2, %xmm3
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm0, %xmm4
	pcmpgtw	%xmm0, %xmm3
	punpcklwd	%xmm3, %xmm4
	punpckhwd	%xmm3, %xmm0
	movdqa	%xmm1, %xmm3
	paddd	%xmm4, %xmm0
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm1
	paddd	%xmm3, %xmm0
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%esi, %edx
	je	.L4
.L3:
	movslq	%ecx, %rsi
	movsbl	(%rsp,%rsi), %r8d
	movl	$57, %esi
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	1(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	2(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	3(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	4(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	5(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	6(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	7(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	8(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	9(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %edi
	subl	%edi, %esi
	addl	%esi, %eax
	leal	10(%rcx), %esi
	cmpl	%esi, %edx
	jl	.L4
	movslq	%esi, %rsi
	movsbl	(%rsp,%rsi), %r8d
	movl	$57, %esi
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	11(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	12(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	leal	13(%rcx), %edi
	cmpl	%edi, %edx
	jl	.L4
	movslq	%edi, %rdi
	addl	$14, %ecx
	movsbl	(%rsp,%rdi), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edi, %eax
	cmpl	%ecx, %edx
	jl	.L4
	movslq	%ecx, %rcx
	movsbl	(%rsp,%rcx), %ecx
	subl	%ecx, %esi
	addl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%eax, %eax
	je	.L2
	movsbl	(%rsp), %eax
	leal	(%rdx,%rdx,8), %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-49(%rax,%rdx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L6:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	movsbl	(%rsp), %eax
	leal	(%rdx,%rdx,8), %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-48(%rax,%rdx), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
.L8:
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L3
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.value	57
	.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<string.h>
#include<math.h>

typedef long long ll;

int main(){
  char n[18];
  char s[2];
  int t,i;
  int flag = 0;
  int sum = 0;

  s[0] = n[0];

  scanf("%s", n);

  t = strlen(n);
  t--;

  for(i = 1;i <= t;i++){
    sum += '9' - n[i];
  }

  if(sum == 0) printf("%d\n", (n[0] - '0') + 9*t);
  else printf("%d\n", (n[0] - '1') + 9*t);

  return 0;
}

1265641936938969
 101
 613
 1180
 2005985506723837
 78
 813322357948504
 127248513971408
 46390584841058
 51

135
 18
 23
 27
 136
 15
 133
 126
 120
 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<stdlib.h>
#include<string.h>
#include<math.h>

typedef long long ll;

int main(){
  char n[18];
  char s[2];
  int t,i;
  int flag = 0;
  int sum = 0;

  s[0] = n[0];

  scanf("%s", n);

  t = strlen(n);
  t--;

  for(i = 1;i <= t;i++){
    sum += '9' - n[i];
  }

  if(sum == 0) printf("%d\n", (n[0] - '0') + 9*t);
  else printf("%d\n", (n[0] - '1') + 9*t);

  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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	movzbl	-32(%rbp), %eax
	movb	%al, -34(%rbp)
	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
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -40(%rbp)
	subl	$1, -40(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L2
.L3:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	$57, %eax
	subl	%edx, %eax
	addl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L3
	cmpl	$0, -48(%rbp)
	jne	.L4
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L4:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-49(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	movzbl	-32(%rbp), %eax
	movb	%al, -34(%rbp)
	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
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -40(%rbp)
	subl	$1, -40(%rbp)
	movl	$1, -52(%rbp)
	jmp	.L2
.L3:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-32(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	$57, %eax
	subl	%edx, %eax
	addl	%eax, -48(%rbp)
	addl	$1, -52(%rbp)
.L2:
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jle	.L3
	cmpl	$0, -48(%rbp)
	jne	.L4
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-48(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L5
.L4:
	movzbl	-32(%rbp), %eax
	movsbl	%al, %eax
	leal	-49(%rax), %ecx
	movl	-40(%rbp), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	addl	%ecx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L5:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
