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>
int main(){
  long long n,p,f[99],a[99],ans=1,c,i,x=0;
  scanf("%lld%lld",&n,&p);
  for(i=2;i*i<=p;i++){c=0;while(p%i==0){p/=i;c++;}if(c){f[x]=i;a[x++]=c;}}
  if(p-1){f[x]=p;a[x++]=1;}
  for(i=0;i<x;i++)for(c=1;c*n<=a[i];c++)ans*=f[i]; 
  printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
	.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	$1648, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -1632(%rbp)
	movq	$0, -1608(%rbp)
	leaq	-1640(%rbp), %rdx
	leaq	-1648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1616(%rbp)
	jmp	.L2
.L6:
	movq	$0, -1624(%rbp)
	jmp	.L3
.L4:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rax, -1640(%rbp)
	addq	$1, -1624(%rbp)
.L3:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L4
	cmpq	$0, -1624(%rbp)
	je	.L5
	movq	-1608(%rbp), %rax
	movq	-1616(%rbp), %rdx
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	-1624(%rbp), %rdx
	movq	%rdx, -800(%rbp,%rax,8)
.L5:
	addq	$1, -1616(%rbp)
.L2:
	movq	-1616(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-1640(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L6
	movq	-1640(%rbp), %rax
	cmpq	$1, %rax
	je	.L7
	movq	-1640(%rbp), %rdx
	movq	-1608(%rbp), %rax
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	$1, -800(%rbp,%rax,8)
.L7:
	movq	$0, -1616(%rbp)
	jmp	.L8
.L11:
	movq	$1, -1624(%rbp)
	jmp	.L9
.L10:
	movq	-1616(%rbp), %rax
	movq	-1600(%rbp,%rax,8), %rax
	movq	-1632(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -1632(%rbp)
	addq	$1, -1624(%rbp)
.L9:
	movq	-1648(%rbp), %rax
	imulq	-1624(%rbp), %rax
	movq	%rax, %rdx
	movq	-1616(%rbp), %rax
	movq	-800(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L10
	addq	$1, -1616(%rbp)
.L8:
	movq	-1616(%rbp), %rax
	cmpq	-1608(%rbp), %rax
	jl	.L11
	movq	-1632(%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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$1616, %rsp
	.cfi_def_cfa_offset 1632
	movq	%fs:40, %rax
	movq	%rax, 1608(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	8(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rcx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2, %esi
	cmpq	$3, %rcx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rcx, %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rdi
	testq	%rdx, %rdx
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rcx, %rax
	addq	$1, %rdi
	cqto
	idivq	%rsi
	cqto
	movq	%rax, %rcx
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L4
	movq	%rsi, 16(%rsp,%r9,8)
	movl	$1, %r8d
	movq	%rdi, 816(%rsp,%r9,8)
	addq	$1, %r9
.L6:
	addq	$1, %rsi
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rcx, %rax
	jle	.L2
	testb	%r8b, %r8b
	je	.L9
	movq	%rcx, 8(%rsp)
.L9:
	cmpq	$1, %rcx
	je	.L10
.L7:
	movq	%rcx, 16(%rsp,%r9,8)
	movq	$1, 816(%rsp,%r9,8)
	addq	$1, %r9
.L11:
	movq	(%rsp), %rdi
	xorl	%r10d, %r10d
	movl	$1, %edx
	leaq	816(%rsp), %r11
	leaq	(%rdi,%rdi), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	(%r11,%r10,8), %rsi
	cmpq	%rsi, %rdi
	jg	.L16
	movq	16(%rsp,%r10,8), %r8
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rax, %rcx
	imulq	%r8, %rdx
	addq	%rdi, %rax
	cmpq	%rcx, %rsi
	jge	.L12
.L16:
	addq	$1, %r10
	cmpq	%r9, %r10
	jl	.L13
.L14:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1608(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$1616, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	testq	%r9, %r9
	jne	.L11
.L8:
	movl	$1, %edx
	jmp	.L14
.L35:
	cmpq	$1, %rcx
	jne	.L7
	jmp	.L8
.L36:
	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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	.LC0(%rip), %rdi
	subq	$1616, %rsp
	.cfi_def_cfa_offset 1632
	movq	%fs:40, %rax
	movq	%rax, 1608(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	8(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rcx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	movl	$2, %esi
	cmpq	$3, %rcx
	jle	.L35
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rcx, %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rdi
	testq	%rdx, %rdx
	jne	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rcx, %rax
	addq	$1, %rdi
	cqto
	idivq	%rsi
	cqto
	movq	%rax, %rcx
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L4
	movq	%rsi, 16(%rsp,%r9,8)
	movl	$1, %r8d
	movq	%rdi, 816(%rsp,%r9,8)
	addq	$1, %r9
.L6:
	addq	$1, %rsi
	movq	%rsi, %rax
	imulq	%rsi, %rax
	cmpq	%rcx, %rax
	jle	.L2
	testb	%r8b, %r8b
	je	.L9
	movq	%rcx, 8(%rsp)
.L9:
	cmpq	$1, %rcx
	je	.L10
.L7:
	movq	%rcx, 16(%rsp,%r9,8)
	movq	$1, 816(%rsp,%r9,8)
	addq	$1, %r9
.L11:
	movq	(%rsp), %rdi
	xorl	%r10d, %r10d
	movl	$1, %edx
	leaq	816(%rsp), %r11
	leaq	(%rdi,%rdi), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	(%r11,%r10,8), %rsi
	cmpq	%rsi, %rdi
	jg	.L16
	movq	16(%rsp,%r10,8), %r8
	movq	%rbx, %rax
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%rax, %rcx
	imulq	%r8, %rdx
	addq	%rdi, %rax
	cmpq	%rcx, %rsi
	jge	.L12
.L16:
	addq	$1, %r10
	cmpq	%r9, %r10
	jl	.L13
.L14:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1608(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$1616, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	testq	%r9, %r9
	jne	.L11
.L8:
	movl	$1, %edx
	jmp	.L14
.L35:
	cmpq	$1, %rcx
	jne	.L7
	jmp	.L8
.L36:
	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>
int main(){
  long long n,p,f[99],a[99],ans=1,c,i,x=0;
  scanf("%lld%lld",&n,&p);
  for(i=2;i*i<=p;i++){c=0;while(p%i==0){p/=i;c++;}if(c){f[x]=i;a[x++]=c;}}
  if(p-1){f[x]=p;a[x++]=1;}
  for(i=0;i<x;i++)for(c=1;c*n<=a[i];c++)ans*=f[i]; 
  printf("%lld",ans);
}
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>
int main(){
  long long n,p,f[99],a[99],ans=1,c,i,x=0;
  scanf("%lld%lld",&n,&p);
  for(i=2;i*i<=p;i++){c=0;while(p%i==0){p/=i;c++;}if(c){f[x]=i;a[x++]=c;}}
  if(p-1){f[x]=p;a[x++]=1;}
  for(i=0;i<x;i++)for(c=1;c*n<=a[i];c++)ans*=f[i]; 
  printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld"
	.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	$1648, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -1632(%rbp)
	movq	$0, -1608(%rbp)
	leaq	-1640(%rbp), %rdx
	leaq	-1648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1616(%rbp)
	jmp	.L2
.L6:
	movq	$0, -1624(%rbp)
	jmp	.L3
.L4:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rax, -1640(%rbp)
	addq	$1, -1624(%rbp)
.L3:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L4
	cmpq	$0, -1624(%rbp)
	je	.L5
	movq	-1608(%rbp), %rax
	movq	-1616(%rbp), %rdx
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	-1624(%rbp), %rdx
	movq	%rdx, -800(%rbp,%rax,8)
.L5:
	addq	$1, -1616(%rbp)
.L2:
	movq	-1616(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-1640(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L6
	movq	-1640(%rbp), %rax
	cmpq	$1, %rax
	je	.L7
	movq	-1640(%rbp), %rdx
	movq	-1608(%rbp), %rax
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	$1, -800(%rbp,%rax,8)
.L7:
	movq	$0, -1616(%rbp)
	jmp	.L8
.L11:
	movq	$1, -1624(%rbp)
	jmp	.L9
.L10:
	movq	-1616(%rbp), %rax
	movq	-1600(%rbp,%rax,8), %rax
	movq	-1632(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -1632(%rbp)
	addq	$1, -1624(%rbp)
.L9:
	movq	-1648(%rbp), %rax
	imulq	-1624(%rbp), %rax
	movq	%rax, %rdx
	movq	-1616(%rbp), %rax
	movq	-800(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L10
	addq	$1, -1616(%rbp)
.L8:
	movq	-1616(%rbp), %rax
	cmpq	-1608(%rbp), %rax
	jl	.L11
	movq	-1632(%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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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"
	.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	$1648, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -1632(%rbp)
	movq	$0, -1608(%rbp)
	leaq	-1640(%rbp), %rdx
	leaq	-1648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$2, -1616(%rbp)
	jmp	.L2
.L6:
	movq	$0, -1624(%rbp)
	jmp	.L3
.L4:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rax, -1640(%rbp)
	addq	$1, -1624(%rbp)
.L3:
	movq	-1640(%rbp), %rax
	cqto
	idivq	-1616(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	je	.L4
	cmpq	$0, -1624(%rbp)
	je	.L5
	movq	-1608(%rbp), %rax
	movq	-1616(%rbp), %rdx
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	-1624(%rbp), %rdx
	movq	%rdx, -800(%rbp,%rax,8)
.L5:
	addq	$1, -1616(%rbp)
.L2:
	movq	-1616(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-1640(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L6
	movq	-1640(%rbp), %rax
	cmpq	$1, %rax
	je	.L7
	movq	-1640(%rbp), %rdx
	movq	-1608(%rbp), %rax
	movq	%rdx, -1600(%rbp,%rax,8)
	movq	-1608(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -1608(%rbp)
	movq	$1, -800(%rbp,%rax,8)
.L7:
	movq	$0, -1616(%rbp)
	jmp	.L8
.L11:
	movq	$1, -1624(%rbp)
	jmp	.L9
.L10:
	movq	-1616(%rbp), %rax
	movq	-1600(%rbp,%rax,8), %rax
	movq	-1632(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -1632(%rbp)
	addq	$1, -1624(%rbp)
.L9:
	movq	-1648(%rbp), %rax
	imulq	-1624(%rbp), %rax
	movq	%rax, %rdx
	movq	-1616(%rbp), %rax
	movq	-800(%rbp,%rax,8), %rax
	cmpq	%rax, %rdx
	jle	.L10
	addq	$1, -1616(%rbp)
.L8:
	movq	-1616(%rbp), %rax
	cmpq	-1608(%rbp), %rax
	jl	.L11
	movq	-1632(%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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
