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>          // printf(), scanf()

long
power(long x, long n, long M)
{
	if (n == 0)
		return 1;

	long res = power((x * x) % M, n / 2, M);
	if (n & 1)
		res = (res * x) % M;

	return res;
}

int
main(int argc, char** argv)
{
	int n, m;

	scanf("%d %d", &n, &m);
	printf("%ld\n", power(n, m, 1000000007));
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L31
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrq	$63, %rcx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addq	%rsi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	sarq	%rcx
	je	.L3
	movq	%rdi, %rax
	leaq	3(%rsi), %rsi
	imulq	%rdi, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$2, %rsi
	movq	%rsi, %r13
	movq	%rdx, %r14
	jne	.L32
.L4:
	andl	$1, %ecx
	jne	.L33
.L3:
	andl	$1, %ebx
	je	.L1
	movq	%r12, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r14, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, %rax
	leaq	7(%rbx), %rsi
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$3, %rsi
	movq	%rsi, %r15
	movq	%rdx, %r9
	je	.L5
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	leaq	15(%rbx), %rsi
	imulq	%rdx, %rax
	movq	%rcx, 16(%rsp)
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$4, %rsi
	movq	%rdx, %rax
	movq	%rdx, 24(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %rdi
	movq	%rbp, %rdx
	call	power
	andl	$1, %r15d
	movq	8(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	%rax, %r8
	jne	.L34
.L5:
	andl	$1, %r13d
	je	.L4
	movq	%r9, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movq	24(%rsp), %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	movl	(%rsp), %eax
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L50
.L36:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movslq	%eax, %r10
	movq	%rsi, %rax
	movl	$2, %ecx
	movq	%rsi, %r11
	cqto
	idivq	%rcx
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L37
	movq	%r10, %rax
	movl	$1000000007, %ebx
	movl	$4, %ecx
	imulq	%r10, %rax
	cqto
	idivq	%rbx
	movq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	movq	%rbp, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	$1000000007, %edx
	call	power
	andb	$1, %r12b
	movq	%rax, %r8
	jne	.L52
.L37:
	andb	$1, %r11b
	je	.L36
	movq	%r10, %rax
	movl	$1000000007, %ebx
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L36
.L52:
	movq	%rbp, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L37
.L51:
	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:
```

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
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L31
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrq	$63, %rcx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addq	%rsi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	sarq	%rcx
	je	.L3
	movq	%rdi, %rax
	leaq	3(%rsi), %rsi
	imulq	%rdi, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$2, %rsi
	movq	%rsi, %r13
	movq	%rdx, %r14
	jne	.L32
.L4:
	andl	$1, %ecx
	jne	.L33
.L3:
	andl	$1, %ebx
	je	.L1
	movq	%r12, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r14, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, %rax
	leaq	7(%rbx), %rsi
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$3, %rsi
	movq	%rsi, %r15
	movq	%rdx, %r9
	je	.L5
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	leaq	15(%rbx), %rsi
	imulq	%rdx, %rax
	movq	%rcx, 16(%rsp)
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$4, %rsi
	movq	%rdx, %rax
	movq	%rdx, 24(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %rdi
	movq	%rbp, %rdx
	call	power
	andl	$1, %r15d
	movq	8(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	%rax, %r8
	jne	.L34
.L5:
	andl	$1, %r13d
	je	.L4
	movq	%r9, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movq	24(%rsp), %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	movl	(%rsp), %eax
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L50
.L36:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movslq	%eax, %r10
	movq	%rsi, %rax
	movl	$2, %ecx
	movq	%rsi, %r11
	cqto
	idivq	%rcx
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L37
	movq	%r10, %rax
	movl	$1000000007, %ebx
	movl	$4, %ecx
	imulq	%r10, %rax
	cqto
	idivq	%rbx
	movq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	movq	%rbp, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	$1000000007, %edx
	call	power
	andb	$1, %r12b
	movq	%rax, %r8
	jne	.L52
.L37:
	andb	$1, %r11b
	je	.L36
	movq	%r10, %rax
	movl	$1000000007, %ebx
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L36
.L52:
	movq	%rbp, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L37
.L51:
	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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L31
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrq	$63, %rcx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addq	%rsi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	sarq	%rcx
	je	.L3
	movq	%rdi, %rax
	leaq	3(%rsi), %rsi
	imulq	%rdi, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$2, %rsi
	movq	%rsi, %r13
	movq	%rdx, %r14
	jne	.L32
.L4:
	andl	$1, %ecx
	jne	.L33
.L3:
	andl	$1, %ebx
	je	.L1
	movq	%r12, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r14, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, %rax
	leaq	7(%rbx), %rsi
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$3, %rsi
	movq	%rsi, %r15
	movq	%rdx, %r9
	je	.L5
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	leaq	15(%rbx), %rsi
	imulq	%rdx, %rax
	movq	%rcx, 16(%rsp)
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$4, %rsi
	movq	%rdx, %rax
	movq	%rdx, 24(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %rdi
	movq	%rbp, %rdx
	call	power
	andl	$1, %r15d
	movq	8(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	%rax, %r8
	jne	.L34
.L5:
	andl	$1, %r13d
	je	.L4
	movq	%r9, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movq	24(%rsp), %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	movl	(%rsp), %eax
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L50
.L36:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movslq	%eax, %r10
	movq	%rsi, %rax
	movl	$2, %ecx
	movq	%rsi, %r11
	cqto
	idivq	%rcx
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L37
	movq	%r10, %rax
	movl	$1000000007, %ebx
	movl	$4, %ecx
	imulq	%r10, %rax
	cqto
	idivq	%rbx
	movq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	movq	%rbp, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	$1000000007, %edx
	call	power
	andb	$1, %r12b
	movq	%rax, %r8
	jne	.L52
.L37:
	andb	$1, %r11b
	je	.L36
	movq	%r10, %rax
	movl	$1000000007, %ebx
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L36
.L52:
	movq	%rbp, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L37
.L51:
	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:
```
```c
#include <stdio.h>          // printf(), scanf()

long
power(long x, long n, long M)
{
	if (n == 0)
		return 1;

	long res = power((x * x) % M, n / 2, M);
	if (n & 1)
		res = (res * x) % M;

	return res;
}

int
main(int argc, char** argv)
{
	int n, m;

	scanf("%d %d", &n, &m);
	printf("%ld\n", power(n, m, 1000000007));
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>          // printf(), scanf()

long
power(long x, long n, long M)
{
	if (n == 0)
		return 1;

	long res = power((x * x) % M, n / 2, M);
	if (n & 1)
		res = (res * x) % M;

	return res;
}

int
main(int argc, char** argv)
{
	int n, m;

	scanf("%d %d", &n, &m);
	printf("%ld\n", power(n, m, 1000000007));
	return 0;
}```

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:

2 1
 5 9
 2 2
 7 9
 3 3
 13 9
 1 3
 13 1
 12 1
 3 1

2
 1953125
 4
 40353607
 27
 604499303
 1
 13
 12
 3

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>          // printf(), scanf()

long
power(long x, long n, long M)
{
	if (n == 0)
		return 1;

	long res = power((x * x) % M, n / 2, M);
	if (n & 1)
		res = (res * x) % M;

	return res;
}

int
main(int argc, char** argv)
{
	int n, m;

	scanf("%d %d", &n, &m);
	printf("%ld\n", power(n, m, 1000000007));
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L31
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrq	$63, %rcx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addq	%rsi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	sarq	%rcx
	je	.L3
	movq	%rdi, %rax
	leaq	3(%rsi), %rsi
	imulq	%rdi, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$2, %rsi
	movq	%rsi, %r13
	movq	%rdx, %r14
	jne	.L32
.L4:
	andl	$1, %ecx
	jne	.L33
.L3:
	andl	$1, %ebx
	je	.L1
	movq	%r12, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r14, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, %rax
	leaq	7(%rbx), %rsi
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$3, %rsi
	movq	%rsi, %r15
	movq	%rdx, %r9
	je	.L5
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	leaq	15(%rbx), %rsi
	imulq	%rdx, %rax
	movq	%rcx, 16(%rsp)
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$4, %rsi
	movq	%rdx, %rax
	movq	%rdx, 24(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %rdi
	movq	%rbp, %rdx
	call	power
	andl	$1, %r15d
	movq	8(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	%rax, %r8
	jne	.L34
.L5:
	andl	$1, %r13d
	je	.L4
	movq	%r9, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movq	24(%rsp), %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	movl	(%rsp), %eax
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L50
.L36:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movslq	%eax, %r10
	movq	%rsi, %rax
	movl	$2, %ecx
	movq	%rsi, %r11
	cqto
	idivq	%rcx
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L37
	movq	%r10, %rax
	movl	$1000000007, %ebx
	movl	$4, %ecx
	imulq	%r10, %rax
	cqto
	idivq	%rbx
	movq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	movq	%rbp, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	$1000000007, %edx
	call	power
	andb	$1, %r12b
	movq	%rax, %r8
	jne	.L52
.L37:
	andb	$1, %r11b
	je	.L36
	movq	%r10, %rax
	movl	$1000000007, %ebx
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L36
.L52:
	movq	%rbp, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L37
.L51:
	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:
```

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
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L31
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	shrq	$63, %rcx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	addq	%rsi, %rcx
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rdx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rsi, %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	sarq	%rcx
	je	.L3
	movq	%rdi, %rax
	leaq	3(%rsi), %rsi
	imulq	%rdi, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$2, %rsi
	movq	%rsi, %r13
	movq	%rdx, %r14
	jne	.L32
.L4:
	andl	$1, %ecx
	jne	.L33
.L3:
	andl	$1, %ebx
	je	.L1
	movq	%r12, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movq	%r14, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, %rax
	leaq	7(%rbx), %rsi
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$3, %rsi
	movq	%rsi, %r15
	movq	%rdx, %r9
	je	.L5
	movq	%rdx, %rax
	movq	%rdx, 8(%rsp)
	leaq	15(%rbx), %rsi
	imulq	%rdx, %rax
	movq	%rcx, 16(%rsp)
	cqto
	idivq	%rbp
	testq	%rbx, %rbx
	cmovns	%rbx, %rsi
	sarq	$4, %rsi
	movq	%rdx, %rax
	movq	%rdx, 24(%rsp)
	imulq	%rdx, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %rdi
	movq	%rbp, %rdx
	call	power
	andl	$1, %r15d
	movq	8(%rsp), %r9
	movq	16(%rsp), %rcx
	movq	%rax, %r8
	jne	.L34
.L5:
	andl	$1, %r13d
	je	.L4
	movq	%r9, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movq	24(%rsp), %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbp
	movq	%rdx, %r8
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	4(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	movl	(%rsp), %eax
	movl	$1, %r8d
	testq	%rsi, %rsi
	jne	.L50
.L36:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L50:
	.cfi_restore_state
	movslq	%eax, %r10
	movq	%rsi, %rax
	movl	$2, %ecx
	movq	%rsi, %r11
	cqto
	idivq	%rcx
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L37
	movq	%r10, %rax
	movl	$1000000007, %ebx
	movl	$4, %ecx
	imulq	%r10, %rax
	cqto
	idivq	%rbx
	movq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%rcx
	movq	%rax, %rsi
	movq	%rbp, %rax
	imulq	%rbp, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %rdi
	movl	$1000000007, %edx
	call	power
	andb	$1, %r12b
	movq	%rax, %r8
	jne	.L52
.L37:
	andb	$1, %r11b
	je	.L36
	movq	%r10, %rax
	movl	$1000000007, %ebx
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L36
.L52:
	movq	%rbp, %rax
	imulq	%r8, %rax
	cqto
	idivq	%rbx
	movq	%rdx, %r8
	jmp	.L37
.L51:
	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:
```