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>
typedef long long ll;
int main() {
	ll n = 1, p, ans = 1;
	int cnt = 0;
	scanf("%lld%lld", &n, &p);
	if (n == 1) {
		printf("%lld\n", p);
		return 0;
	}
	for (int i = 2; (ll)i * i <= p; i++) {
		while (p % i == 0) {
			cnt++;
			p /= i;
			// printf("%d * ", i);
		}
		if (cnt >= n) {
			for (int j = 0; j < cnt / n; j++) {
				ans *= i;
			}
		}
		cnt = 0;
	}
	printf("%lld\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -16(%rbp)
	movl	$0, -44(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	cmpq	$1, %rax
	jne	.L2
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L11
.L2:
	movl	$2, -40(%rbp)
	jmp	.L4
.L6:
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -24(%rbp)
.L5:
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L7
	movl	$0, -36(%rbp)
	jmp	.L8
.L9:
	movl	-40(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44(%rbp), %eax
	cltq
	movq	-32(%rbp), %rdi
	cqto
	idivq	%rdi
	cmpq	%rax, %rcx
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	addl	$1, -40(%rbp)
.L4:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"%lld%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	movq	$1, 8(%rsp)
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	cmpq	$1, %r9
	je	.L2
	movq	16(%rsp), %rcx
	xorl	%r10d, %r10d
	movl	$1, %r8d
	movl	$2, %esi
	cmpq	$3, %rcx
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rcx, %rax
	xorl	%edi, %edi
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rcx, %rax
	addl	$1, %edi
	cqto
	idivq	%rsi
	cqto
	movq	%rax, %rcx
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L6
	movslq	%edi, %rax
	movl	$1, %r10d
	cmpq	%rax, %r9
	jle	.L27
.L7:
	addq	$1, %rsi
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rcx, %rax
	jle	.L3
	testb	%r10b, %r10b
	je	.L4
	movq	%rcx, 16(%rsp)
.L4:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	cqto
	idivq	%r9
	testq	%rax, %rax
	jle	.L7
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %edx
	imulq	%rsi, %r8
	cmpl	%eax, %edx
	jne	.L8
	movl	$1, %r10d
	jmp	.L7
.L2:
	movq	16(%rsp), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	movq	$1, 8(%rsp)
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	cmpq	$1, %r9
	je	.L2
	movq	16(%rsp), %rcx
	xorl	%r10d, %r10d
	movl	$1, %r8d
	movl	$2, %esi
	cmpq	$3, %rcx
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rcx, %rax
	xorl	%edi, %edi
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rcx, %rax
	addl	$1, %edi
	cqto
	idivq	%rsi
	cqto
	movq	%rax, %rcx
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L6
	movslq	%edi, %rax
	movl	$1, %r10d
	cmpq	%rax, %r9
	jle	.L27
.L7:
	addq	$1, %rsi
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rcx, %rax
	jle	.L3
	testb	%r10b, %r10b
	je	.L4
	movq	%rcx, 16(%rsp)
.L4:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	xorl	%eax, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	cqto
	idivq	%r9
	testq	%rax, %rax
	jle	.L7
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %edx
	imulq	%rsi, %r8
	cmpl	%eax, %edx
	jne	.L8
	movl	$1, %r10d
	jmp	.L7
.L2:
	movq	16(%rsp), %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>
typedef long long ll;
int main() {
	ll n = 1, p, ans = 1;
	int cnt = 0;
	scanf("%lld%lld", &n, &p);
	if (n == 1) {
		printf("%lld\n", p);
		return 0;
	}
	for (int i = 2; (ll)i * i <= p; i++) {
		while (p % i == 0) {
			cnt++;
			p /= i;
			// printf("%d * ", i);
		}
		if (cnt >= n) {
			for (int j = 0; j < cnt / n; j++) {
				ans *= i;
			}
		}
		cnt = 0;
	}
	printf("%lld\n", ans);
	return 0;
}
3 24

2

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>
typedef long long ll;
int main() {
	ll n = 1, p, ans = 1;
	int cnt = 0;
	scanf("%lld%lld", &n, &p);
	if (n == 1) {
		printf("%lld\n", p);
		return 0;
	}
	for (int i = 2; (ll)i * i <= p; i++) {
		while (p % i == 0) {
			cnt++;
			p /= i;
			// printf("%d * ", i);
		}
		if (cnt >= n) {
			for (int j = 0; j < cnt / n; j++) {
				ans *= i;
			}
		}
		cnt = 0;
	}
	printf("%lld\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -16(%rbp)
	movl	$0, -44(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	cmpq	$1, %rax
	jne	.L2
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L11
.L2:
	movl	$2, -40(%rbp)
	jmp	.L4
.L6:
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -24(%rbp)
.L5:
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L7
	movl	$0, -36(%rbp)
	jmp	.L8
.L9:
	movl	-40(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44(%rbp), %eax
	cltq
	movq	-32(%rbp), %rdi
	cqto
	idivq	%rdi
	cmpq	%rax, %rcx
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	addl	$1, -40(%rbp)
.L4:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"%lld%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -16(%rbp)
	movl	$0, -44(%rbp)
	leaq	-24(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	cmpq	$1, %rax
	jne	.L2
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L11
.L2:
	movl	$2, -40(%rbp)
	jmp	.L4
.L6:
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -24(%rbp)
.L5:
	movq	-24(%rbp), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L6
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L7
	movl	$0, -36(%rbp)
	jmp	.L8
.L9:
	movl	-40(%rbp), %eax
	cltq
	movq	-16(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -36(%rbp)
.L8:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44(%rbp), %eax
	cltq
	movq	-32(%rbp), %rdi
	cqto
	idivq	%rdi
	cmpq	%rax, %rcx
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	addl	$1, -40(%rbp)
.L4:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-40(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
