Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<math.h>
 
int main(){
  long n,i=0,flag=0,j;
  scanf("%ld",&n);
  if(n!=0)
  i=(int)log10(n);
  j=pow(10.0,i);
  if(n/j!=(n+1)/j) flag=1;
  n/=j;
  if(!i) printf("%ld\n",n);
  else printf("%ld\t",i*9-1+flag+n);
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%ld\t"
	.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	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r12
	testq	%r12, %r12
	jne	.L11
.L2:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	call	log10@PLT
	pxor	%xmm1, %xmm1
	cvttsd2sil	%xmm0, %eax
	movsd	.LC1(%rip), %xmm0
	cvtsi2sdl	%eax, %xmm1
	movslq	%eax, %rbx
	call	pow@PLT
	movq	%r12, %rax
	cvttsd2siq	%xmm0, %rcx
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	leaq	1(%r12), %rax
	cqto
	movq	%rsi, (%rsp)
	idivq	%rcx
	cmpq	%rsi, %rax
	setne	%al
	movzbl	%al, %eax
	testq	%rbx, %rbx
	je	.L13
	leaq	(%rbx,%rbx,8), %rbx
	movl	$1, %edi
	leaq	-1(%rax,%rbx), %rdx
	xorl	%eax, %eax
	addq	%rsi, %rdx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L4
.L12:
	call	__stack_chk_fail@PLT
.L13:
	movq	%rsi, %r12
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%ld\t"
	.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	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r12
	testq	%r12, %r12
	jne	.L11
.L2:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	call	log10@PLT
	pxor	%xmm1, %xmm1
	cvttsd2sil	%xmm0, %eax
	movsd	.LC1(%rip), %xmm0
	cvtsi2sdl	%eax, %xmm1
	movslq	%eax, %rbx
	call	pow@PLT
	movq	%r12, %rax
	cvttsd2siq	%xmm0, %rcx
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	leaq	1(%r12), %rax
	cqto
	movq	%rsi, (%rsp)
	idivq	%rcx
	cmpq	%rsi, %rax
	setne	%al
	movzbl	%al, %eax
	testq	%rbx, %rbx
	je	.L13
	leaq	(%rbx,%rbx,8), %rbx
	movl	$1, %edi
	leaq	-1(%rax,%rbx), %rdx
	xorl	%eax, %eax
	addq	%rsi, %rdx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L4
.L12:
	call	__stack_chk_fail@PLT
.L13:
	movq	%rsi, %r12
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%ld\t"
	.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	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r12
	testq	%r12, %r12
	jne	.L11
.L2:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	call	log10@PLT
	pxor	%xmm1, %xmm1
	cvttsd2sil	%xmm0, %eax
	movsd	.LC1(%rip), %xmm0
	cvtsi2sdl	%eax, %xmm1
	movslq	%eax, %rbx
	call	pow@PLT
	movq	%r12, %rax
	cvttsd2siq	%xmm0, %rcx
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	leaq	1(%r12), %rax
	cqto
	movq	%rsi, (%rsp)
	idivq	%rcx
	cmpq	%rsi, %rax
	setne	%al
	movzbl	%al, %eax
	testq	%rbx, %rbx
	je	.L13
	leaq	(%rbx,%rbx,8), %rbx
	movl	$1, %edi
	leaq	-1(%rax,%rbx), %rdx
	xorl	%eax, %eax
	addq	%rsi, %rdx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L4
.L12:
	call	__stack_chk_fail@PLT
.L13:
	movq	%rsi, %r12
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.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:
```
```c
#include<stdio.h>
#include<math.h>
 
int main(){
  long n,i=0,flag=0,j;
  scanf("%ld",&n);
  if(n!=0)
  i=(int)log10(n);
  j=pow(10.0,i);
  if(n/j!=(n+1)/j) flag=1;
  n/=j;
  if(!i) printf("%ld\n",n);
  else printf("%ld\t",i*9-1+flag+n);
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<math.h>
 
int main(){
  long n,i=0,flag=0,j;
  scanf("%ld",&n);
  if(n!=0)
  i=(int)log10(n);
  j=pow(10.0,i);
  if(n/j!=(n+1)/j) flag=1;
  n/=j;
  if(!i) printf("%ld\n",n);
  else printf("%ld\t",i*9-1+flag+n);
}
```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<math.h>
 
int main(){
  long n,i=0,flag=0,j;
  scanf("%ld",&n);
  if(n!=0)
  i=(int)log10(n);
  j=pow(10.0,i);
  if(n/j!=(n+1)/j) flag=1;
  n/=j;
  if(!i) printf("%ld\n",n);
  else printf("%ld\t",i*9-1+flag+n);
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%ld\t"
	.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	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r12
	testq	%r12, %r12
	jne	.L11
.L2:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	call	log10@PLT
	pxor	%xmm1, %xmm1
	cvttsd2sil	%xmm0, %eax
	movsd	.LC1(%rip), %xmm0
	cvtsi2sdl	%eax, %xmm1
	movslq	%eax, %rbx
	call	pow@PLT
	movq	%r12, %rax
	cvttsd2siq	%xmm0, %rcx
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	leaq	1(%r12), %rax
	cqto
	movq	%rsi, (%rsp)
	idivq	%rcx
	cmpq	%rsi, %rax
	setne	%al
	movzbl	%al, %eax
	testq	%rbx, %rbx
	je	.L13
	leaq	(%rbx,%rbx,8), %rbx
	movl	$1, %edi
	leaq	-1(%rax,%rbx), %rdx
	xorl	%eax, %eax
	addq	%rsi, %rdx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L4
.L12:
	call	__stack_chk_fail@PLT
.L13:
	movq	%rsi, %r12
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%ld\t"
	.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	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r12
	testq	%r12, %r12
	jne	.L11
.L2:
	movq	%r12, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L4:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	call	log10@PLT
	pxor	%xmm1, %xmm1
	cvttsd2sil	%xmm0, %eax
	movsd	.LC1(%rip), %xmm0
	cvtsi2sdl	%eax, %xmm1
	movslq	%eax, %rbx
	call	pow@PLT
	movq	%r12, %rax
	cvttsd2siq	%xmm0, %rcx
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	leaq	1(%r12), %rax
	cqto
	movq	%rsi, (%rsp)
	idivq	%rcx
	cmpq	%rsi, %rax
	setne	%al
	movzbl	%al, %eax
	testq	%rbx, %rbx
	je	.L13
	leaq	(%rbx,%rbx,8), %rbx
	movl	$1, %edi
	leaq	-1(%rax,%rbx), %rdx
	xorl	%eax, %eax
	addq	%rsi, %rdx
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L4
.L12:
	call	__stack_chk_fail@PLT
.L13:
	movq	%rsi, %r12
	jmp	.L2
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1076101120
	.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:
```