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 nmax=50000;
int pr[50000]={0};
int comb[50001]={0};

int main(void) {
	int i,p,j,n;
	for(i=2;i<nmax;i++){
		if (i!=2 && i%2==0){
			pr[i-2]=0;
		}
		else{
			pr[i-2]=i;
		}
	}
	for (p=0;p<sqrt(nmax);p++){
		if(!pr[p]){continue;}
		for(i=p+1;i<nmax;i++){
			if (pr[i]%(p+2)==0){pr[i]=0;}
		}
	}
	for(j=0;j<nmax;j++){
		for(i=j;i<nmax;i++){
			if (pr[i]+pr[j]<=50000 && pr[i] && pr[j]){
				comb[pr[i]+pr[j]]++;
			}
		}
	}
	while(1){
		scanf("%d",&n);
		if(!n){break;}
		printf("%d\n",comb[n]);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	nmax
	.data
	.align 4
	.type	nmax, @object
	.size	nmax, 4
nmax:
	.long	50000
	.globl	pr
	.bss
	.align 32
	.type	pr, @object
	.size	pr, 200000
pr:
	.zero	200000
	.globl	comb
	.align 32
	.type	comb, @object
	.size	comb, 200004
comb:
	.zero	200004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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
	movl	$2, -20(%rbp)
	jmp	.L2
.L5:
	cmpl	$2, -20(%rbp)
	je	.L3
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L3
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L4
.L3:
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	pr(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L4:
	addl	$1, -20(%rbp)
.L2:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L9
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-16(%rbp), %edx
	leal	2(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L10
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
.L10:
	addl	$1, -20(%rbp)
.L9:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	jmp	.L8
.L24:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-16(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movl	nmax(%rip), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	ja	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	$50000, %eax
	jg	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	comb(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L15:
	addl	$1, -20(%rbp)
.L14:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L13:
	movl	nmax(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
.L20:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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
.LC5:
	.string	"%d"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	nmax(%rip), %ebx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	cmpl	$2, %ebx
	jle	.L7
	leal	-3(%rbx), %eax
	leal	-2(%rbx), %ecx
	cmpl	$2, %eax
	jbe	.L4
	movl	%ecx, %edx
	leaq	pr(%rip), %rbp
	movdqa	.LC0(%rip), %xmm3
	movdqa	.LC1(%rip), %xmm7
	shrl	$2, %edx
	leaq	16(%rbp), %rsi
	pxor	%xmm4, %xmm4
	movq	%rbp, %rax
	subl	$1, %edx
	movdqa	.LC2(%rip), %xmm6
	movdqa	.LC3(%rip), %xmm5
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm3, %xmm1
	addq	$16, %rax
	paddd	%xmm7, %xmm3
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	pcmpeqd	%xmm5, %xmm2
	pand	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	pcmpeqd	%xmm4, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	movl	%ecx, %eax
	andl	$-4, %eax
	leal	2(%rax), %esi
	cmpl	%ecx, %eax
	je	.L7
	movslq	%eax, %rdx
	movl	$0, 0(%rbp,%rdx,4)
	leal	3(%rax), %edx
	cmpl	%ebx, %edx
	jge	.L7
	addl	$1, %eax
	xorl	%ecx, %ecx
	testb	$1, %dl
	jne	.L29
.L11:
	cltq
	addl	$1, %edx
	movl	%ecx, 0(%rbp,%rax,4)
	cmpl	%edx, %ebx
	jle	.L7
	xorl	%eax, %eax
	testb	$1, %dl
	movslq	%esi, %rsi
	cmove	%eax, %edx
	movl	%edx, 0(%rbp,%rsi,4)
.L7:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	leal	-2(%rbx), %r8d
	xorl	%r12d, %r12d
	cvtsi2sdl	%ebx, %xmm1
	leaq	pr(%rip), %r15
	movq	%r15, %rbp
	movq	%r15, %r13
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$1, %r12
	addq	$4, %r13
.L3:
	ucomisd	%xmm1, %xmm3
	pxor	%xmm2, %xmm2
	movl	%r12d, %r14d
	cvtsi2sdl	%r12d, %xmm2
	ja	.L48
	movapd	%xmm1, %xmm0
	sqrtsd	%xmm0, %xmm0
.L20:
	comisd	%xmm2, %xmm0
	jbe	.L52
	movl	0(%r13), %edx
	leal	1(%r14), %eax
	testl	%edx, %edx
	je	.L15
	cmpl	%eax, %ebx
	jle	.L15
	movl	%r8d, %eax
	leal	2(%r14), %esi
	movq	%r13, %rcx
	subl	%r14d, %eax
	addq	%r12, %rax
	leaq	4(%r15,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	4(%rcx), %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L16
	movl	$0, 4(%rcx)
.L16:
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L17
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L52:
	movslq	%ebx, %r10
	xorl	%r8d, %r8d
	leaq	comb(%rip), %r9
	testl	%ebx, %ebx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	movl	0(%rbp,%r8,4), %esi
	movq	%r8, %rax
	testl	%esi, %esi
	setne	%dil
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ebx
	jle	.L53
.L25:
	movl	0(%rbp,%rax,4), %edx
	testl	%edx, %edx
	leal	(%rdx,%rsi), %ecx
	setne	%dl
	testb	%dil, %dl
	je	.L24
	cmpl	$50000, %ecx
	jg	.L24
	movslq	%ecx, %rcx
	addq	$1, %rax
	addl	$1, (%r9,%rcx,4)
	cmpl	%eax, %ebx
	jg	.L25
	.p2align 4,,10
	.p2align 3
.L53:
	addq	$1, %r8
	cmpq	%r10, %r8
	jne	.L26
.L27:
	leaq	36(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	comb(%rip), %r13
	leaq	.LC6(%rip), %r12
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L54:
	movl	0(%r13,%rax,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L23:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	36(%rsp), %rax
	testl	%eax, %eax
	jne	.L54
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	$2, pr(%rip)
	cmpl	$3, %ebx
	jle	.L7
	movl	$2, %esi
	movl	$1, %eax
	movl	$3, %edx
	leaq	pr(%rip), %rbp
.L29:
	movl	%edx, %ecx
	jmp	.L11
.L48:
	movapd	%xmm1, %xmm0
	movl	%r8d, 28(%rsp)
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %r8d
	movsd	16(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movsd	8(%rsp), %xmm1
	jmp	.L20
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	comb
	.bss
	.align 32
	.type	comb, @object
	.size	comb, 200004
comb:
	.zero	200004
	.globl	pr
	.align 32
	.type	pr, @object
	.size	pr, 200000
pr:
	.zero	200000
	.globl	nmax
	.data
	.align 4
	.type	nmax, @object
	.size	nmax, 4
nmax:
	.long	50000
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	3
	.long	4
	.long	5
	.align 16
.LC1:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC3:
	.long	2
	.long	2
	.long	2
	.long	2
	.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
.LC5:
	.string	"%d"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	nmax(%rip), %ebx
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	cmpl	$2, %ebx
	jle	.L7
	leal	-3(%rbx), %eax
	leal	-2(%rbx), %ecx
	cmpl	$2, %eax
	jbe	.L4
	movl	%ecx, %edx
	leaq	pr(%rip), %rbp
	movdqa	.LC0(%rip), %xmm3
	movdqa	.LC1(%rip), %xmm7
	shrl	$2, %edx
	leaq	16(%rbp), %rsi
	pxor	%xmm4, %xmm4
	movq	%rbp, %rax
	subl	$1, %edx
	movdqa	.LC2(%rip), %xmm6
	movdqa	.LC3(%rip), %xmm5
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	%xmm3, %xmm1
	addq	$16, %rax
	paddd	%xmm7, %xmm3
	movdqa	%xmm1, %xmm2
	movdqa	%xmm1, %xmm0
	pcmpeqd	%xmm5, %xmm2
	pand	%xmm6, %xmm0
	pcmpeqd	%xmm4, %xmm0
	pcmpeqd	%xmm4, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	movl	%ecx, %eax
	andl	$-4, %eax
	leal	2(%rax), %esi
	cmpl	%ecx, %eax
	je	.L7
	movslq	%eax, %rdx
	movl	$0, 0(%rbp,%rdx,4)
	leal	3(%rax), %edx
	cmpl	%ebx, %edx
	jge	.L7
	addl	$1, %eax
	xorl	%ecx, %ecx
	testb	$1, %dl
	jne	.L29
.L11:
	cltq
	addl	$1, %edx
	movl	%ecx, 0(%rbp,%rax,4)
	cmpl	%edx, %ebx
	jle	.L7
	xorl	%eax, %eax
	testb	$1, %dl
	movslq	%esi, %rsi
	cmove	%eax, %edx
	movl	%edx, 0(%rbp,%rsi,4)
.L7:
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	leal	-2(%rbx), %r8d
	xorl	%r12d, %r12d
	cvtsi2sdl	%ebx, %xmm1
	leaq	pr(%rip), %r15
	movq	%r15, %rbp
	movq	%r15, %r13
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$1, %r12
	addq	$4, %r13
.L3:
	ucomisd	%xmm1, %xmm3
	pxor	%xmm2, %xmm2
	movl	%r12d, %r14d
	cvtsi2sdl	%r12d, %xmm2
	ja	.L48
	movapd	%xmm1, %xmm0
	sqrtsd	%xmm0, %xmm0
.L20:
	comisd	%xmm2, %xmm0
	jbe	.L52
	movl	0(%r13), %edx
	leal	1(%r14), %eax
	testl	%edx, %edx
	je	.L15
	cmpl	%eax, %ebx
	jle	.L15
	movl	%r8d, %eax
	leal	2(%r14), %esi
	movq	%r13, %rcx
	subl	%r14d, %eax
	addq	%r12, %rax
	leaq	4(%r15,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L17:
	movl	4(%rcx), %eax
	cltd
	idivl	%esi
	testl	%edx, %edx
	jne	.L16
	movl	$0, 4(%rcx)
.L16:
	addq	$4, %rcx
	cmpq	%rdi, %rcx
	jne	.L17
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L52:
	movslq	%ebx, %r10
	xorl	%r8d, %r8d
	leaq	comb(%rip), %r9
	testl	%ebx, %ebx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	movl	0(%rbp,%r8,4), %esi
	movq	%r8, %rax
	testl	%esi, %esi
	setne	%dil
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	addq	$1, %rax
	cmpl	%eax, %ebx
	jle	.L53
.L25:
	movl	0(%rbp,%rax,4), %edx
	testl	%edx, %edx
	leal	(%rdx,%rsi), %ecx
	setne	%dl
	testb	%dil, %dl
	je	.L24
	cmpl	$50000, %ecx
	jg	.L24
	movslq	%ecx, %rcx
	addq	$1, %rax
	addl	$1, (%r9,%rcx,4)
	cmpl	%eax, %ebx
	jg	.L25
	.p2align 4,,10
	.p2align 3
.L53:
	addq	$1, %r8
	cmpq	%r10, %r8
	jne	.L26
.L27:
	leaq	36(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	comb(%rip), %r13
	leaq	.LC6(%rip), %r12
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L54:
	movl	0(%r13,%rax,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L23:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	36(%rsp), %rax
	testl	%eax, %eax
	jne	.L54
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L4:
	.cfi_restore_state
	movl	$2, pr(%rip)
	cmpl	$3, %ebx
	jle	.L7
	movl	$2, %esi
	movl	$1, %eax
	movl	$3, %edx
	leaq	pr(%rip), %rbp
.L29:
	movl	%edx, %ecx
	jmp	.L11
.L48:
	movapd	%xmm1, %xmm0
	movl	%r8d, 28(%rsp)
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movl	28(%rsp), %r8d
	movsd	16(%rsp), %xmm2
	pxor	%xmm3, %xmm3
	movsd	8(%rsp), %xmm1
	jmp	.L20
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	comb
	.bss
	.align 32
	.type	comb, @object
	.size	comb, 200004
comb:
	.zero	200004
	.globl	pr
	.align 32
	.type	pr, @object
	.size	pr, 200000
pr:
	.zero	200000
	.globl	nmax
	.data
	.align 4
	.type	nmax, @object
	.size	nmax, 4
nmax:
	.long	50000
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	3
	.long	4
	.long	5
	.align 16
.LC1:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC3:
	.long	2
	.long	2
	.long	2
	.long	2
	.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 nmax=50000;
int pr[50000]={0};
int comb[50001]={0};

int main(void) {
	int i,p,j,n;
	for(i=2;i<nmax;i++){
		if (i!=2 && i%2==0){
			pr[i-2]=0;
		}
		else{
			pr[i-2]=i;
		}
	}
	for (p=0;p<sqrt(nmax);p++){
		if(!pr[p]){continue;}
		for(i=p+1;i<nmax;i++){
			if (pr[i]%(p+2)==0){pr[i]=0;}
		}
	}
	for(j=0;j<nmax;j++){
		for(i=j;i<nmax;i++){
			if (pr[i]+pr[j]<=50000 && pr[i] && pr[j]){
				comb[pr[i]+pr[j]]++;
			}
		}
	}
	while(1){
		scanf("%d",&n);
		if(!n){break;}
		printf("%d\n",comb[n]);
	}
	return 0;
}

10
22
0
 10
34
0
 10
28
0
 10
31
0
 10
3
0
 10
0
0
 10
48
0
 10
106
0
 10
140
0
 10
160
0

2
3
 2
4
 2
2
 2
1
 2
0
 2
 2
5
 2
6
 2
7
 2
8

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 nmax=50000;
int pr[50000]={0};
int comb[50001]={0};

int main(void) {
	int i,p,j,n;
	for(i=2;i<nmax;i++){
		if (i!=2 && i%2==0){
			pr[i-2]=0;
		}
		else{
			pr[i-2]=i;
		}
	}
	for (p=0;p<sqrt(nmax);p++){
		if(!pr[p]){continue;}
		for(i=p+1;i<nmax;i++){
			if (pr[i]%(p+2)==0){pr[i]=0;}
		}
	}
	for(j=0;j<nmax;j++){
		for(i=j;i<nmax;i++){
			if (pr[i]+pr[j]<=50000 && pr[i] && pr[j]){
				comb[pr[i]+pr[j]]++;
			}
		}
	}
	while(1){
		scanf("%d",&n);
		if(!n){break;}
		printf("%d\n",comb[n]);
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	nmax
	.data
	.align 4
	.type	nmax, @object
	.size	nmax, 4
nmax:
	.long	50000
	.globl	pr
	.bss
	.align 32
	.type	pr, @object
	.size	pr, 200000
pr:
	.zero	200000
	.globl	comb
	.align 32
	.type	comb, @object
	.size	comb, 200004
comb:
	.zero	200004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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
	movl	$2, -20(%rbp)
	jmp	.L2
.L5:
	cmpl	$2, -20(%rbp)
	je	.L3
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L3
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L4
.L3:
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	pr(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L4:
	addl	$1, -20(%rbp)
.L2:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L9
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-16(%rbp), %edx
	leal	2(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L10
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
.L10:
	addl	$1, -20(%rbp)
.L9:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	jmp	.L8
.L24:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-16(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movl	nmax(%rip), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	ja	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	$50000, %eax
	jg	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	comb(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L15:
	addl	$1, -20(%rbp)
.L14:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L13:
	movl	nmax(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
.L20:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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
	.globl	nmax
	.data
	.align 4
	.type	nmax, @object
	.size	nmax, 4
nmax:
	.long	50000
	.globl	pr
	.bss
	.align 32
	.type	pr, @object
	.size	pr, 200000
pr:
	.zero	200000
	.globl	comb
	.align 32
	.type	comb, @object
	.size	comb, 200004
comb:
	.zero	200004
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\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
	movl	$2, -20(%rbp)
	jmp	.L2
.L5:
	cmpl	$2, -20(%rbp)
	je	.L3
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L3
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L4
.L3:
	movl	-20(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	pr(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L4:
	addl	$1, -20(%rbp)
.L2:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L9
.L11:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-16(%rbp), %edx
	leal	2(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L10
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	$0, (%rdx,%rax)
.L10:
	addl	$1, -20(%rbp)
.L9:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L11
	jmp	.L8
.L24:
	nop
.L8:
	addl	$1, -16(%rbp)
.L6:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-16(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movl	nmax(%rip), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	ja	.L12
	movl	$0, -12(%rbp)
	jmp	.L13
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cmpl	$50000, %eax
	jg	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	pr(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	comb(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L15:
	addl	$1, -20(%rbp)
.L14:
	movl	nmax(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L16
	addl	$1, -12(%rbp)
.L13:
	movl	nmax(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
.L20:
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	comb(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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:
