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>
#include<math.h>
int check(int x){
    int i;
    if(x==2)return 1;
    for(i=3; i<=sqrt(x); i+=2)if(x%i==0)return 0;
    return 1;
}
int main(){
    int n, i;
    scanf("%d", &n);
    printf("%d:", n);
    while(!(n%2)){
        n/=2;
        printf(" 2");
    }
    if(check(n) && n!=1){
        printf(" %d\n", n);
        return 0;
    }
    for(i=3; i<=n; i+=2)if(check(i))while(!(n%i)){
        n/=i;
        printf(" %d", i);
    }
    printf("\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	cmpl	$2, -20(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$3, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$2, -4(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-4(%rbp), %xmm1
	movsd	%xmm1, -32(%rbp)
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-20(%rbp), %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-32(%rbp), %xmm3
	jnb	.L6
	movl	$1, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" 2"
.LC3:
	.string	" %d\n"
.LC4:
	.string	" %d"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -16(%rbp)
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	movl	-16(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L10
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	je	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L17
.L10:
	movl	$3, -12(%rbp)
	jmp	.L12
.L16:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L13
	jmp	.L14
.L15:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L15
.L13:
	addl	$2, -12(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	$2, %edi
	je	.L21
	pxor	%xmm1, %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edi, %xmm1
	ucomisd	%xmm1, %xmm0
	ja	.L19
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L26
	addl	$2, %ecx
.L6:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L11
.L21:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
.L19:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$3, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
.L27:
	movl	12(%rsp), %edi
	movl	%edi, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L9
	movsd	(%rsp), %xmm1
	addl	$2, %ebx
.L4:
	movapd	%xmm1, %xmm0
	movl	%edi, 12(%rsp)
	movsd	%xmm1, (%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L27
	movl	$1, %eax
.L1:
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d:"
.LC3:
	.string	" 2"
.LC4:
	.string	" %d\n"
.LC5:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
	testb	$1, %r12b
	jne	.L29
	leaq	.LC3(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%r12d, %eax
	movq	%rbx, %rsi
	movl	$1, %edi
	shrl	$31, %eax
	addl	%r12d, %eax
	sarl	%eax
	movl	%eax, 20(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
	testb	$1, %r12b
	je	.L30
.L29:
	cmpl	$2, %r12d
	je	.L31
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	cvtsi2sdl	%r12d, %xmm1
	ucomisd	%xmm1, %xmm4
	ja	.L76
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L37
	addl	$2, %ecx
.L34:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L41
.L35:
	cmpl	$1, %r12d
	jne	.L31
.L40:
	movl	$10, %edi
	call	putchar@PLT
.L42:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	cmpl	$2, %r12d
	jle	.L40
	movl	$3, %ebx
	leaq	.LC5(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L39:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L77
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L45
	addl	$2, %ecx
.L49:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L44
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L81:
	movl	%r12d, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	cltd
	idivl	%ebx
	movl	%ebx, %edx
	movl	%eax, 20(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
.L50:
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L81
.L45:
	addl	$2, %ebx
	cmpl	%r12d, %ebx
	jle	.L39
	jmp	.L40
.L31:
	movl	%r12d, %edx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L42
.L77:
	movl	$3, %r13d
	jmp	.L47
.L82:
	movsd	8(%rsp), %xmm1
	addl	$2, %r13d
.L47:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r13d, %xmm0
	comisd	%xmm0, %xmm2
	jb	.L50
	movl	%ebx, %eax
	cltd
	idivl	%r13d
	testl	%edx, %edx
	jne	.L82
	jmp	.L45
.L76:
	movl	$3, %ebx
	jmp	.L32
.L83:
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L37
	movsd	8(%rsp), %xmm1
	addl	$2, %ebx
.L32:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L83
	jmp	.L35
.L80:
	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
	.globl	check
	.type	check, @function
check:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	$2, %edi
	je	.L21
	pxor	%xmm1, %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%edi, %xmm1
	ucomisd	%xmm1, %xmm0
	ja	.L19
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L26
	addl	$2, %ecx
.L6:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L11
.L21:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
.L19:
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$3, %ebx
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
.L27:
	movl	12(%rsp), %edi
	movl	%edi, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L9
	movsd	(%rsp), %xmm1
	addl	$2, %ebx
.L4:
	movapd	%xmm1, %xmm0
	movl	%edi, 12(%rsp)
	movsd	%xmm1, (%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L27
	movl	$1, %eax
.L1:
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	check, .-check
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d:"
.LC3:
	.string	" 2"
.LC4:
	.string	" %d\n"
.LC5:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$40, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
	testb	$1, %r12b
	jne	.L29
	leaq	.LC3(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L30:
	movl	%r12d, %eax
	movq	%rbx, %rsi
	movl	$1, %edi
	shrl	$31, %eax
	addl	%r12d, %eax
	sarl	%eax
	movl	%eax, 20(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
	testb	$1, %r12b
	je	.L30
.L29:
	cmpl	$2, %r12d
	je	.L31
	pxor	%xmm1, %xmm1
	pxor	%xmm4, %xmm4
	cvtsi2sdl	%r12d, %xmm1
	ucomisd	%xmm1, %xmm4
	ja	.L76
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L41:
	movl	%r12d, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L37
	addl	$2, %ecx
.L34:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L41
.L35:
	cmpl	$1, %r12d
	jne	.L31
.L40:
	movl	$10, %edi
	call	putchar@PLT
.L42:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore_state
	cmpl	$2, %r12d
	jle	.L40
	movl	$3, %ebx
	leaq	.LC5(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L39:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%ebx, %xmm1
	ucomisd	%xmm1, %xmm3
	ja	.L77
	sqrtsd	%xmm1, %xmm1
	movl	$3, %ecx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L45
	addl	$2, %ecx
.L49:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ecx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L44
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L81:
	movl	%r12d, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	cltd
	idivl	%ebx
	movl	%ebx, %edx
	movl	%eax, 20(%rsp)
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	20(%rsp), %r12d
.L50:
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L81
.L45:
	addl	$2, %ebx
	cmpl	%r12d, %ebx
	jle	.L39
	jmp	.L40
.L31:
	movl	%r12d, %edx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L42
.L77:
	movl	$3, %r13d
	jmp	.L47
.L82:
	movsd	8(%rsp), %xmm1
	addl	$2, %r13d
.L47:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r13d, %xmm0
	comisd	%xmm0, %xmm2
	jb	.L50
	movl	%ebx, %eax
	cltd
	idivl	%r13d
	testl	%edx, %edx
	jne	.L82
	jmp	.L45
.L76:
	movl	$3, %ebx
	jmp	.L32
.L83:
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	je	.L37
	movsd	8(%rsp), %xmm1
	addl	$2, %ebx
.L32:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebx, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L83
	jmp	.L35
.L80:
	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>
#include<math.h>
int check(int x){
    int i;
    if(x==2)return 1;
    for(i=3; i<=sqrt(x); i+=2)if(x%i==0)return 0;
    return 1;
}
int main(){
    int n, i;
    scanf("%d", &n);
    printf("%d:", n);
    while(!(n%2)){
        n/=2;
        printf(" 2");
    }
    if(check(n) && n!=1){
        printf(" %d\n", n);
        return 0;
    }
    for(i=3; i<=n; i+=2)if(check(i))while(!(n%i)){
        n/=i;
        printf(" %d", i);
    }
    printf("\n");
    return 0;
}
23
 7
 38
 22
 30
 4
 31
 6
 27
 3

23: 23
 7: 7
 38: 2 19
 22: 2 11
 30: 2 3 5
 4: 2 2
 31: 31
 6: 2 3
 27: 3 3 3
 3: 3

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>
#include<math.h>
int check(int x){
    int i;
    if(x==2)return 1;
    for(i=3; i<=sqrt(x); i+=2)if(x%i==0)return 0;
    return 1;
}
int main(){
    int n, i;
    scanf("%d", &n);
    printf("%d:", n);
    while(!(n%2)){
        n/=2;
        printf(" 2");
    }
    if(check(n) && n!=1){
        printf(" %d\n", n);
        return 0;
    }
    for(i=3; i<=n; i+=2)if(check(i))while(!(n%i)){
        n/=i;
        printf(" %d", i);
    }
    printf("\n");
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	cmpl	$2, -20(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$3, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$2, -4(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-4(%rbp), %xmm1
	movsd	%xmm1, -32(%rbp)
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-20(%rbp), %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-32(%rbp), %xmm3
	jnb	.L6
	movl	$1, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" 2"
.LC3:
	.string	" %d\n"
.LC4:
	.string	" %d"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -16(%rbp)
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	movl	-16(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L10
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	je	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L17
.L10:
	movl	$3, -12(%rbp)
	jmp	.L12
.L16:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L13
	jmp	.L14
.L15:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L15
.L13:
	addl	$2, -12(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	cmpl	$2, -20(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$3, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$2, -4(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-4(%rbp), %xmm1
	movsd	%xmm1, -32(%rbp)
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-20(%rbp), %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-32(%rbp), %xmm3
	jnb	.L6
	movl	$1, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" 2"
.LC3:
	.string	" %d\n"
.LC4:
	.string	" %d"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L8
.L9:
	movl	-16(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -16(%rbp)
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	movl	-16(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L9
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L10
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	je	.L10
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L17
.L10:
	movl	$3, -12(%rbp)
	jmp	.L12
.L16:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L13
	jmp	.L14
.L15:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L15
.L13:
	addl	$2, -12(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L16
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
