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 isprime(int n) {
	int i;
	for(i = 2; i * i <= n; i++) {
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n,i,k;
	int max = 2;
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(i = n;i > 2;i--){
			if(isprime(i)==1 && isprime(i-2)==1){
				max = i;
				break;
			}
		}
		printf("%d %d\n",max-2,max);
		max = 2;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	isprime
	.type	isprime, @function
isprime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$2, -4(%rbp)
	jmp	.L2
.L5:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	movl	$1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	isprime, .-isprime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -12(%rbp)
.L13:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L9
.L12:
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L10:
	subl	$1, -16(%rbp)
.L9:
	cmpl	$2, -16(%rbp)
	jg	.L12
.L11:
	movl	-12(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$2, -12(%rbp)
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	isprime
	.type	isprime, @function
isprime:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	$3, %edi
	jle	.L5
	testb	$1, %dil
	je	.L6
	movl	$2, %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L1
.L3:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%edi, %eax
	jle	.L4
.L5:
	movl	$1, %edx
.L1:
	movl	%edx, %eax
	ret
.L6:
	xorl	%edx, %edx
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	isprime, .-isprime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\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	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
.L21:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L12
	cmpl	$2, %esi
	jle	.L25
	leal	-1(%rsi), %r8d
	leal	-2(%rsi), %edi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%esi, %r9d
	cmpl	$3, %esi
	jle	.L17
	testb	$1, %sil
	je	.L15
	movl	$2, %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L15
.L20:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%esi, %eax
	jle	.L16
.L17:
	movl	%edi, %r10d
	cmpl	$3, %edi
	jle	.L13
	testb	$1, %dil
	je	.L18
	movl	$2, %ecx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L18
.L22:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L19
.L13:
	movl	%r9d, %ecx
	movl	%r10d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L21
.L18:
	cmpl	$2, %r8d
	je	.L25
.L15:
	subl	$1, %esi
	subl	$1, %r8d
	subl	$1, %edi
	jmp	.L14
.L25:
	xorl	%r10d, %r10d
	movl	$2, %r9d
	jmp	.L13
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L40:
	.cfi_restore_state
	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	isprime
	.type	isprime, @function
isprime:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	$3, %edi
	jle	.L5
	testb	$1, %dil
	je	.L6
	movl	$2, %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L1
.L3:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%edi, %eax
	jle	.L4
.L5:
	movl	$1, %edx
.L1:
	movl	%edx, %eax
	ret
.L6:
	xorl	%edx, %edx
	jmp	.L1
	.cfi_endproc
.LFE23:
	.size	isprime, .-isprime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\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	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
.L21:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L12
	cmpl	$2, %esi
	jle	.L25
	leal	-1(%rsi), %r8d
	leal	-2(%rsi), %edi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%esi, %r9d
	cmpl	$3, %esi
	jle	.L17
	testb	$1, %sil
	je	.L15
	movl	$2, %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L15
.L20:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%esi, %eax
	jle	.L16
.L17:
	movl	%edi, %r10d
	cmpl	$3, %edi
	jle	.L13
	testb	$1, %dil
	je	.L18
	movl	$2, %ecx
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L18
.L22:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L19
.L13:
	movl	%r9d, %ecx
	movl	%r10d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L21
.L18:
	cmpl	$2, %r8d
	je	.L25
.L15:
	subl	$1, %esi
	subl	$1, %r8d
	subl	$1, %edi
	jmp	.L14
.L25:
	xorl	%r10d, %r10d
	movl	$2, %r9d
	jmp	.L13
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L40:
	.cfi_restore_state
	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>
int isprime(int n) {
	int i;
	for(i = 2; i * i <= n; i++) {
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n,i,k;
	int max = 2;
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(i = n;i > 2;i--){
			if(isprime(i)==1 && isprime(i-2)==1){
				max = i;
				break;
			}
		}
		printf("%d %d\n",max-2,max);
		max = 2;
	}
	return 0;
}
12
110
200
300
0
 12
110
200
227
0
 12
110
200
329
0
 12
010
200
329
0
 12
010
169
329
0
 12
100
200
482
0
 12
110
200
87
0
 12
010
200
227
0
 12
110
200
239
0
 12
010
27
329
0

5 7
107 109
197 199
281 283
 5 7
107 109
197 199
197 199
 5 7
107 109
197 199
311 313
 5 7
5 7
197 199
311 313
 5 7
5 7
149 151
311 313
 5 7
71 73
197 199
461 463
 5 7
107 109
197 199
71 73
 5 7
5 7
197 199
197 199
 5 7
107 109
197 199
227 229
 5 7
5 7
17 19
311 313

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 isprime(int n) {
	int i;
	for(i = 2; i * i <= n; i++) {
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n,i,k;
	int max = 2;
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(i = n;i > 2;i--){
			if(isprime(i)==1 && isprime(i-2)==1){
				max = i;
				break;
			}
		}
		printf("%d %d\n",max-2,max);
		max = 2;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	isprime
	.type	isprime, @function
isprime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$2, -4(%rbp)
	jmp	.L2
.L5:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	movl	$1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	isprime, .-isprime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -12(%rbp)
.L13:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L9
.L12:
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L10:
	subl	$1, -16(%rbp)
.L9:
	cmpl	$2, -16(%rbp)
	jg	.L12
.L11:
	movl	-12(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$2, -12(%rbp)
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	isprime
	.type	isprime, @function
isprime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$2, -4(%rbp)
	jmp	.L2
.L5:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L3
	movl	$0, %eax
	jmp	.L4
.L3:
	addl	$1, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	movl	$1, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	isprime, .-isprime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -12(%rbp)
.L13:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L9
.L12:
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	isprime
	cmpl	$1, %eax
	jne	.L10
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L11
.L10:
	subl	$1, -16(%rbp)
.L9:
	cmpl	$2, -16(%rbp)
	jg	.L12
.L11:
	movl	-12(%rbp), %eax
	leal	-2(%rax), %ecx
	movl	-12(%rbp), %eax
	movl	%eax, %edx
	movl	%ecx, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$2, -12(%rbp)
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
