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

```c
a,b;g(x,y){return y?g(y,x%y):x;}main(r){scanf("%d%d",&a,&b);b=b/g(a,b);for(a=2;a*a<=b;a++)if(b%a==0)for(r*=a;b%a==0;b/=a);a=!printf("%d\n",r*b);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	g
	.type	g, @function
g:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	jmp	.L4
.L2:
	movl	-4(%rbp), %eax
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	g, .-g
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\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
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %ebx
	movl	b(%rip), %edx
	movl	a(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movl	%eax, b(%rip)
	movl	$2, a(%rip)
	jmp	.L6
.L10:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	a(%rip), %eax
	movl	-20(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L9:
	movl	b(%rip), %eax
	movl	a(%rip), %ebx
	cltd
	idivl	%ebx
	movl	%eax, b(%rip)
.L8:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L9
.L7:
	movl	a(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %edx
	movl	a(%rip), %eax
	imull	%eax, %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	b(%rip), %eax
	imull	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, a(%rip)
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	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
	.globl	g
	.type	g, @function
g:
.LFB0:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L3
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, %r8d
.L3:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE0:
	.size	g, .-g
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	b(%rip), %rdx
	movl	%edi, %ebx
	xorl	%eax, %eax
	leaq	a(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	b(%rip), %ecx
	movl	a(%rip), %eax
	testl	%ecx, %ecx
	je	.L9
	movl	%ecx, %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %esi
.L10:
	cltd
	idivl	%esi
	movl	%esi, %eax
	testl	%edx, %edx
	jne	.L16
	movl	$2, a(%rip)
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%eax, b(%rip)
	movl	%eax, %ecx
	cmpl	$3, %eax
	jle	.L11
	xorl	%edi, %edi
	movl	$2, %esi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$1, %esi
	movl	%esi, %eax
	imull	%esi, %eax
	cmpl	%ecx, %eax
	jg	.L25
.L14:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L12
	imull	%esi, %ebx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	cltd
	movl	%eax, %ecx
	idivl	%esi
	testl	%edx, %edx
	je	.L13
	addl	$1, %esi
	movl	$1, %edi
	movl	%esi, %eax
	imull	%esi, %eax
	cmpl	%ecx, %eax
	jle	.L14
.L25:
	movl	%esi, a(%rip)
	testb	%dil, %dil
	je	.L11
	movl	%ecx, b(%rip)
.L11:
	imull	%ebx, %ecx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	movl	%ecx, %esi
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, a(%rip)
	xorl	%eax, %eax
	ret
.L9:
	.cfi_restore_state
	movl	$2, a(%rip)
	jmp	.L11
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.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
	.globl	g
	.type	g, @function
g:
.LFB0:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L3
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%edx, %r8d
.L3:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE0:
	.size	g, .-g
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	b(%rip), %rdx
	movl	%edi, %ebx
	xorl	%eax, %eax
	leaq	a(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	b(%rip), %ecx
	movl	a(%rip), %eax
	testl	%ecx, %ecx
	je	.L9
	movl	%ecx, %esi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %esi
.L10:
	cltd
	idivl	%esi
	movl	%esi, %eax
	testl	%edx, %edx
	jne	.L16
	movl	$2, a(%rip)
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%eax, b(%rip)
	movl	%eax, %ecx
	cmpl	$3, %eax
	jle	.L11
	xorl	%edi, %edi
	movl	$2, %esi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$1, %esi
	movl	%esi, %eax
	imull	%esi, %eax
	cmpl	%ecx, %eax
	jg	.L25
.L14:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L12
	imull	%esi, %ebx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	cltd
	movl	%eax, %ecx
	idivl	%esi
	testl	%edx, %edx
	je	.L13
	addl	$1, %esi
	movl	$1, %edi
	movl	%esi, %eax
	imull	%esi, %eax
	cmpl	%ecx, %eax
	jle	.L14
.L25:
	movl	%esi, a(%rip)
	testb	%dil, %dil
	je	.L11
	movl	%ecx, b(%rip)
.L11:
	imull	%ebx, %ecx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	movl	%ecx, %esi
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, a(%rip)
	xorl	%eax, %eax
	ret
.L9:
	.cfi_restore_state
	movl	$2, a(%rip)
	jmp	.L11
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.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:

a,b;g(x,y){return y?g(y,x%y):x;}main(r){scanf("%d%d",&a,&b);b=b/g(a,b);for(a=2;a*a<=b;a++)if(b%a==0)for(r*=a;b%a==0;b/=a);a=!printf("%d\n",r*b);}
1 3
 1 6
 3 2
 4 5
 3 10
 3 14
 2 14
 2 17
 3 11
 2 39

3
 6
 2
 5
 10
 14
 7
 17
 11
 39

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

```c
a,b;g(x,y){return y?g(y,x%y):x;}main(r){scanf("%d%d",&a,&b);b=b/g(a,b);for(a=2;a*a<=b;a++)if(b%a==0)for(r*=a;b%a==0;b/=a);a=!printf("%d\n",r*b);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	g
	.type	g, @function
g:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	jmp	.L4
.L2:
	movl	-4(%rbp), %eax
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	g, .-g
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\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
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %ebx
	movl	b(%rip), %edx
	movl	a(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movl	%eax, b(%rip)
	movl	$2, a(%rip)
	jmp	.L6
.L10:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	a(%rip), %eax
	movl	-20(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L9:
	movl	b(%rip), %eax
	movl	a(%rip), %ebx
	cltd
	idivl	%ebx
	movl	%eax, b(%rip)
.L8:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L9
.L7:
	movl	a(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %edx
	movl	a(%rip), %eax
	imull	%eax, %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	b(%rip), %eax
	imull	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, a(%rip)
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	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	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.text
	.globl	g
	.type	g, @function
g:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	je	.L2
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	jmp	.L4
.L2:
	movl	-4(%rbp), %eax
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	g, .-g
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\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
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %ebx
	movl	b(%rip), %edx
	movl	a(%rip), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	movl	$0, %eax
	call	g
	movl	%eax, %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movl	%eax, b(%rip)
	movl	$2, a(%rip)
	jmp	.L6
.L10:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	a(%rip), %eax
	movl	-20(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	jmp	.L8
.L9:
	movl	b(%rip), %eax
	movl	a(%rip), %ebx
	cltd
	idivl	%ebx
	movl	%eax, b(%rip)
.L8:
	movl	b(%rip), %eax
	movl	a(%rip), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L9
.L7:
	movl	a(%rip), %eax
	addl	$1, %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %edx
	movl	a(%rip), %eax
	imull	%eax, %edx
	movl	b(%rip), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	b(%rip), %eax
	imull	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, a(%rip)
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	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:
