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>

long modpow(long a, long n, long mod){
	if (n == 0) {
		return 1;
	}
	long answer;
	if (n%2 == 0) {
		answer = modpow(a, n/2, mod);
		answer *= answer;
	} else {
		answer = modpow(a, n-1, mod);
		answer *= a;
	}
	answer %= mod;
	return answer;
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long mod = 1000000007;
  long all = modpow(10,n,mod);
  long wo0 = modpow(9,n,mod);
  long wo09 = modpow(8,n,mod);
  long ans = (wo0*2)%mod;
  ans = (ans+mod-wo09)%mod;
  ans = (all+mod-ans)%mod;
  printf("%ld\n", ans);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.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	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L4
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L4:
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	cqto
	idivq	-40(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-8(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1000000007, -48(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$10, %edi
	call	modpow
	movq	%rax, -40(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$9, %edi
	call	modpow
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$8, %edi
	call	modpow
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-24(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-16(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	modpow.part.0, @function
modpow.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %rcx
	movq	%rdi, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	andl	$1, %esi
	jne	.L2
	movq	%rcx, %rsi
	shrq	$63, %rsi
	addq	%rcx, %rsi
	sarq	%rsi
	je	.L30
	testb	$1, %sil
	jne	.L4
	testq	%rcx, %rcx
	leaq	3(%rcx), %rsi
	cmovns	%rcx, %rsi
	sarq	$2, %rsi
	je	.L31
	testb	$1, %sil
	jne	.L6
	testq	%rcx, %rcx
	leaq	7(%rcx), %rsi
	cmovns	%rcx, %rsi
	sarq	$3, %rsi
	je	.L32
	call	modpow.part.0
	movq	%rax, %r12
	imulq	%rax, %r12
.L8:
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
.L16:
	movq	%r12, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	cqto
	idivq	%rbx
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	movq	%rcx, %rdx
	subq	$1, %rdx
	je	.L16
	testb	$1, %dl
	jne	.L18
	movq	%rdx, %rsi
	movl	$1, %eax
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	je	.L24
	testb	$1, %sil
	jne	.L20
	testq	%rdx, %rdx
	leaq	2(%rcx), %rsi
	cmovns	%rdx, %rsi
	sarq	$2, %rsi
	je	.L22
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%rax, %rax
.L22:
	cqto
	idivq	%rbx
	movq	%rdx, %rax
	imulq	%rdx, %rax
.L24:
	cqto
	idivq	%rbx
	imulq	%rdx, %r12
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$1, %r12d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rsi, %rax
	subq	$1, %rax
	je	.L10
	testb	$1, %al
	jne	.L12
	movq	%rax, %rsi
	shrq	$63, %rsi
	addq	%rax, %rsi
	movl	$1, %eax
	sarq	%rsi
	je	.L14
	call	modpow.part.0
	imulq	%rax, %rax
.L14:
	cqto
	idivq	%rbx
	imulq	%rdx, %r12
.L10:
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rcx, %rdx
	movq	%rdi, %rax
	subq	$2, %rdx
	je	.L24
	testb	$1, %dl
	jne	.L26
	movq	%rdx, %rsi
	movl	$1, %eax
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	je	.L28
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%rax, %rax
.L28:
	cqto
	idivq	%rbx
	movq	%rdx, %rax
	imulq	%r12, %rax
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L31:
	movl	$1, %r12d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, %rax
	subq	$2, %rsi
	je	.L14
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L6:
	subq	$1, %rsi
	je	.L8
	call	modpow.part.0
	imulq	%rax, %r12
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdi, %rax
	subq	$1, %rsi
	je	.L22
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L26:
	subq	$3, %rcx
	movq	%rcx, %rsi
	je	.L28
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$1, %r12d
	jmp	.L8
	.cfi_endproc
.LFE25:
	.size	modpow.part.0, .-modpow.part.0
	.p2align 4
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB23:
	.cfi_startproc
	endbr64
	testq	%rsi, %rsi
	je	.L88
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdx, %r9
	movq	%rsi, %rax
	testb	$1, %sil
	jne	.L62
	shrq	$63, %rax
	addq	%rsi, %rax
	sarq	%rax
	je	.L75
	testb	$1, %al
	je	.L93
	subq	$1, %rax
	movq	%rax, %rsi
	je	.L66
	call	modpow.part.0
	imulq	%rax, %rdi
.L66:
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rdi
	imulq	%rdx, %rdi
.L68:
	movq	%rdi, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L62:
	.cfi_restore_state
	subq	$1, %rax
	je	.L68
	testb	$1, %al
	je	.L94
	movq	%rdi, %rax
	subq	$2, %rsi
	je	.L72
	call	modpow.part.0
	imulq	%rdi, %rax
.L72:
	cqto
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	idivq	%r9
	imulq	%rdx, %rdi
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L93:
	.cfi_def_cfa_offset 16
	testq	%rsi, %rsi
	leaq	3(%rsi), %rax
	cmovs	%rax, %rsi
	sarq	$2, %rsi
	je	.L76
	call	modpow.part.0
	imulq	%rax, %rax
	movq	%rax, %rdi
	jmp	.L66
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%rax, %rsi
	shrq	$63, %rsi
	addq	%rax, %rsi
	movl	$1, %eax
	sarq	%rsi
	je	.L72
	call	modpow.part.0
	imulq	%rax, %rax
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L75:
	movl	$1, %edi
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L76:
	.cfi_restore_state
	movl	$1, %edi
	jmp	.L66
	.cfi_endproc
.LFE23:
	.size	modpow, .-modpow
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r10
	testq	%r10, %r10
	je	.L98
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movl	$10, %edi
	call	modpow.part.0
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movl	$9, %edi
	movq	%rax, %r9
	call	modpow.part.0
	movl	$8, %edi
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movq	%rax, %r8
	call	modpow.part.0
	movq	%rax, %rdi
.L96:
	movabsq	$-8543223828751151131, %rsi
	leaq	(%r8,%r8), %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	addq	$1000000007, %rcx
	subq	%rdi, %rcx
	movl	$1, %edi
	movq	%rcx, %rax
	subq	%rcx, %r9
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	leaq	1000000007(%r9,%rdx), %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %rsi
	sarq	$29, %rsi
	subq	%rax, %rsi
	xorl	%eax, %eax
	imulq	$1000000007, %rsi, %rsi
	subq	%rsi, %rcx
	leaq	.LC1(%rip), %rsi
	movq	%rcx, %rdx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L100
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L98:
	.cfi_restore_state
	movl	$1, %r9d
	movl	$1, %r8d
	movl	$1, %edi
	jmp	.L96
.L100:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.type	modpow.part.0, @function
modpow.part.0:
.LFB25:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rsi, %rcx
	movq	%rdi, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	andl	$1, %esi
	jne	.L2
	movq	%rcx, %rsi
	shrq	$63, %rsi
	addq	%rcx, %rsi
	sarq	%rsi
	je	.L30
	testb	$1, %sil
	jne	.L4
	testq	%rcx, %rcx
	leaq	3(%rcx), %rsi
	cmovns	%rcx, %rsi
	sarq	$2, %rsi
	je	.L31
	testb	$1, %sil
	jne	.L6
	testq	%rcx, %rcx
	leaq	7(%rcx), %rsi
	cmovns	%rcx, %rsi
	sarq	$3, %rsi
	je	.L32
	call	modpow.part.0
	movq	%rax, %r12
	imulq	%rax, %r12
.L8:
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
.L16:
	movq	%r12, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	cqto
	idivq	%rbx
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	movq	%rcx, %rdx
	subq	$1, %rdx
	je	.L16
	testb	$1, %dl
	jne	.L18
	movq	%rdx, %rsi
	movl	$1, %eax
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	je	.L24
	testb	$1, %sil
	jne	.L20
	testq	%rdx, %rdx
	leaq	2(%rcx), %rsi
	cmovns	%rdx, %rsi
	sarq	$2, %rsi
	je	.L22
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%rax, %rax
.L22:
	cqto
	idivq	%rbx
	movq	%rdx, %rax
	imulq	%rdx, %rax
.L24:
	cqto
	idivq	%rbx
	imulq	%rdx, %r12
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L30:
	movl	$1, %r12d
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rsi, %rax
	subq	$1, %rax
	je	.L10
	testb	$1, %al
	jne	.L12
	movq	%rax, %rsi
	shrq	$63, %rsi
	addq	%rax, %rsi
	movl	$1, %eax
	sarq	%rsi
	je	.L14
	call	modpow.part.0
	imulq	%rax, %rax
.L14:
	cqto
	idivq	%rbx
	imulq	%rdx, %r12
.L10:
	movq	%r12, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r12
	imulq	%rdx, %r12
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rcx, %rdx
	movq	%rdi, %rax
	subq	$2, %rdx
	je	.L24
	testb	$1, %dl
	jne	.L26
	movq	%rdx, %rsi
	movl	$1, %eax
	shrq	$63, %rsi
	addq	%rdx, %rsi
	sarq	%rsi
	je	.L28
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%rax, %rax
.L28:
	cqto
	idivq	%rbx
	movq	%rdx, %rax
	imulq	%r12, %rax
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L31:
	movl	$1, %r12d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rdi, %rax
	subq	$2, %rsi
	je	.L14
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L6:
	subq	$1, %rsi
	je	.L8
	call	modpow.part.0
	imulq	%rax, %r12
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdi, %rax
	subq	$1, %rsi
	je	.L22
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L26:
	subq	$3, %rcx
	movq	%rcx, %rsi
	je	.L28
	movq	%rbx, %rdx
	call	modpow.part.0
	imulq	%r12, %rax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$1, %r12d
	jmp	.L8
	.cfi_endproc
.LFE25:
	.size	modpow.part.0, .-modpow.part.0
	.p2align 4
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB23:
	.cfi_startproc
	endbr64
	testq	%rsi, %rsi
	je	.L88
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movq	%rdx, %r9
	movq	%rsi, %rax
	testb	$1, %sil
	jne	.L62
	shrq	$63, %rax
	addq	%rsi, %rax
	sarq	%rax
	je	.L75
	testb	$1, %al
	je	.L93
	subq	$1, %rax
	movq	%rax, %rsi
	je	.L66
	call	modpow.part.0
	imulq	%rax, %rdi
.L66:
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rdi
	imulq	%rdx, %rdi
.L68:
	movq	%rdi, %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L62:
	.cfi_restore_state
	subq	$1, %rax
	je	.L68
	testb	$1, %al
	je	.L94
	movq	%rdi, %rax
	subq	$2, %rsi
	je	.L72
	call	modpow.part.0
	imulq	%rdi, %rax
.L72:
	cqto
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	idivq	%r9
	imulq	%rdx, %rdi
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L88:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L93:
	.cfi_def_cfa_offset 16
	testq	%rsi, %rsi
	leaq	3(%rsi), %rax
	cmovs	%rax, %rsi
	sarq	$2, %rsi
	je	.L76
	call	modpow.part.0
	imulq	%rax, %rax
	movq	%rax, %rdi
	jmp	.L66
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%rax, %rsi
	shrq	$63, %rsi
	addq	%rax, %rsi
	movl	$1, %eax
	sarq	%rsi
	je	.L72
	call	modpow.part.0
	imulq	%rax, %rax
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L75:
	movl	$1, %edi
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	movq	%rdi, %rax
	cqto
	idivq	%r9
	movq	%rdx, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L76:
	.cfi_restore_state
	movl	$1, %edi
	jmp	.L66
	.cfi_endproc
.LFE23:
	.size	modpow, .-modpow
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r10
	testq	%r10, %r10
	je	.L98
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movl	$10, %edi
	call	modpow.part.0
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movl	$9, %edi
	movq	%rax, %r9
	call	modpow.part.0
	movl	$8, %edi
	movl	$1000000007, %edx
	movq	%r10, %rsi
	movq	%rax, %r8
	call	modpow.part.0
	movq	%rax, %rdi
.L96:
	movabsq	$-8543223828751151131, %rsi
	leaq	(%r8,%r8), %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rcx
	addq	$1000000007, %rcx
	subq	%rdi, %rcx
	movl	$1, %edi
	movq	%rcx, %rax
	subq	%rcx, %r9
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	leaq	1000000007(%r9,%rdx), %rcx
	movq	%rcx, %rax
	imulq	%rsi
	movq	%rcx, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rcx), %rsi
	sarq	$29, %rsi
	subq	%rax, %rsi
	xorl	%eax, %eax
	imulq	$1000000007, %rsi, %rsi
	subq	%rsi, %rcx
	leaq	.LC1(%rip), %rsi
	movq	%rcx, %rdx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L100
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L98:
	.cfi_restore_state
	movl	$1, %r9d
	movl	$1, %r8d
	movl	$1, %edi
	jmp	.L96
.L100:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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>

long modpow(long a, long n, long mod){
	if (n == 0) {
		return 1;
	}
	long answer;
	if (n%2 == 0) {
		answer = modpow(a, n/2, mod);
		answer *= answer;
	} else {
		answer = modpow(a, n-1, mod);
		answer *= a;
	}
	answer %= mod;
	return answer;
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long mod = 1000000007;
  long all = modpow(10,n,mod);
  long wo0 = modpow(9,n,mod);
  long wo09 = modpow(8,n,mod);
  long ans = (wo0*2)%mod;
  ans = (ans+mod-wo09)%mod;
  ans = (all+mod-ans)%mod;
  printf("%ld\n", ans);

  return 0;
}
226564
 0
 3
 241465
 5
 127499
 10
 99752
 7
 112403

498733826
 0
 54
 202510248
 14670
 463923590
 100172994
 794180853
 2531214
 286663221

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>

long modpow(long a, long n, long mod){
	if (n == 0) {
		return 1;
	}
	long answer;
	if (n%2 == 0) {
		answer = modpow(a, n/2, mod);
		answer *= answer;
	} else {
		answer = modpow(a, n-1, mod);
		answer *= a;
	}
	answer %= mod;
	return answer;
}

int main(void) {

  long n;
  scanf("%ld", &n);
  long mod = 1000000007;
  long all = modpow(10,n,mod);
  long wo0 = modpow(9,n,mod);
  long wo09 = modpow(8,n,mod);
  long ans = (wo0*2)%mod;
  ans = (ans+mod-wo09)%mod;
  ans = (all+mod-ans)%mod;
  printf("%ld\n", ans);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.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	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L4
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L4:
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	cqto
	idivq	-40(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-8(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1000000007, -48(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$10, %edi
	call	modpow
	movq	%rax, -40(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$9, %edi
	call	modpow
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$8, %edi
	call	modpow
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-24(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-16(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	modpow
	.type	modpow, @function
modpow:
.LFB0:
	.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	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L4
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, -8(%rbp)
	jmp	.L5
.L4:
	movq	-32(%rbp), %rax
	leaq	-1(%rax), %rcx
	movq	-40(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	modpow
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	cqto
	idivq	-40(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-8(%rbp), %rax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	modpow, .-modpow
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1000000007, -48(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$10, %edi
	call	modpow
	movq	%rax, -40(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$9, %edi
	call	modpow
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rax
	movq	-48(%rbp), %rdx
	movq	%rax, %rsi
	movl	$8, %edi
	call	modpow
	movq	%rax, -24(%rbp)
	movq	-32(%rbp), %rax
	addq	%rax, %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-24(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	subq	-16(%rbp), %rax
	cqto
	idivq	-48(%rbp)
	movq	%rdx, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
