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>
#include <stdlib.h>

int i,j,from,to,p,d,n,prime[2000000],x;

int main(){
	for(i=2;i<=1000000;i++)prime[i]=1;
	for(i=2,n=0;i<=1000000;i++){
		if(prime[i]==1){
			n++;
			if(i<=1000)for(j=i*i;j<=1000000;j+=i)prime[j]=0;
		}
		prime[i]=n;
	}
	while(scanf("%d",&n)*n){
		x=0;
		for(;n>0;n--){
			scanf("%d %d",&p,&d);
			from=(p-d-1>0?p-d-1:0);
			to=(p+d<1000000?p+d:1000000);
			x+=prime[to]-prime[from]-1;
		}
		printf("%d\n",x);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	from
	.align 4
	.type	from, @object
	.size	from, 4
from:
	.zero	4
	.globl	to
	.align 4
	.type	to, @object
	.size	to, 4
to:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 8000000
prime:
	.zero	8000000
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L3
	movl	$2, i(%rip)
	movl	$0, n(%rip)
	jmp	.L4
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
	movl	i(%rip), %eax
	cmpl	$1000, %eax
	jg	.L5
	movl	i(%rip), %edx
	movl	i(%rip), %eax
	imull	%edx, %eax
	movl	%eax, j(%rip)
	jmp	.L6
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
.L6:
	movl	j(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L7
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L8
	jmp	.L9
.L12:
	movl	$0, x(%rip)
	jmp	.L10
.L11:
	leaq	d(%rip), %rax
	movq	%rax, %rdx
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	p(%rip), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	$1, %eax
	movl	%eax, from(%rip)
	movl	p(%rip), %edx
	movl	d(%rip), %eax
	addl	%edx, %eax
	movl	$1000000, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, to(%rip)
	movl	to(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	from(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
.L10:
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L11
	movl	x(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	8+prime(%rip), %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	3999984(%rax), %rdx
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	movdqa	.LC0(%rip), %xmm0
	.p2align 4,,10
	.p2align 3
.L2:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L2
	movq	.LC1(%rip), %rax
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	xorl	%edx, %edx
	movl	$1, 4000000+prime(%rip)
	leaq	prime(%rip), %rbx
	movq	%rax, 3999992+prime(%rip)
	movl	$2, %eax
	movl	$0, n(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, (%rbx,%rax,4)
	addq	$1, %rax
	addl	$1, %ecx
	cmpq	$1001, %rax
	je	.L32
.L5:
	cmpl	$1, (%rbx,%rax,4)
	movl	%eax, %ecx
	movl	%eax, %r8d
	jne	.L3
	movl	%eax, %esi
	addl	$1, %edx
	leaq	0(,%rax,4), %r9
	imull	%eax, %esi
	movslq	%esi, %rdi
	leaq	(%rbx,%rdi,4), %rdi
.L4:
	addl	%r8d, %esi
	movl	$0, (%rdi)
	addq	%r9, %rdi
	cmpl	$1000000, %esi
	jle	.L4
	movl	$1, %r9d
	movl	$1, %edi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$1000000, %r8d
	movslq	%ecx, %r10
	subl	%ecx, %r8d
	leaq	(%rbx,%r10,4), %rax
	leaq	(%r8,%r10), %rcx
	leaq	4+prime(%rip), %r8
	leaq	(%r8,%rcx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	$1, (%rax)
	jne	.L7
	addl	$1, %edx
	movl	$1, %edi
.L7:
	movl	%edx, (%rax)
	addq	$4, %rax
	cmpq	%rax, %rcx
	jne	.L8
	movl	$1000001, i(%rip)
	testb	%r9b, %r9b
	je	.L10
	movl	%esi, j(%rip)
.L10:
	testb	%dil, %dil
	je	.L11
	movl	%edx, n(%rip)
.L11:
	leaq	n(%rip), %r15
	leaq	.LC4(%rip), %r14
	leaq	d(%rip), %r13
	leaq	p(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L33
	movl	$0, x(%rip)
	testl	%edx, %edx
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rdx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	p(%rip), %eax
	movl	$1, %ecx
	movl	%eax, %edx
	subl	d(%rip), %edx
	testl	%edx, %edx
	cmovle	%ecx, %edx
	addl	d(%rip), %eax
	movl	$1000000, %ecx
	subl	$1, %edx
	cmpl	%ecx, %eax
	cmovg	%ecx, %eax
	movl	%edx, from(%rip)
	movslq	%edx, %rdx
	movl	%eax, to(%rip)
	cltq
	movl	(%rbx,%rax,4), %eax
	subl	(%rbx,%rdx,4), %eax
	movl	x(%rip), %edx
	leal	-1(%rax,%rdx), %edx
	movl	n(%rip), %eax
	movl	%edx, x(%rip)
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L14
.L13:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L13
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	x
	.bss
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 8000000
prime:
	.zero	8000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	to
	.align 4
	.type	to, @object
	.size	to, 4
to:
	.zero	4
	.globl	from
	.align 4
	.type	from, @object
	.size	from, 4
from:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.set	.LC1,.LC0
	.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
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	8+prime(%rip), %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	3999984(%rax), %rdx
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	movdqa	.LC0(%rip), %xmm0
	.p2align 4,,10
	.p2align 3
.L2:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L2
	movq	.LC1(%rip), %rax
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	xorl	%edx, %edx
	movl	$1, 4000000+prime(%rip)
	leaq	prime(%rip), %rbx
	movq	%rax, 3999992+prime(%rip)
	movl	$2, %eax
	movl	$0, n(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, (%rbx,%rax,4)
	addq	$1, %rax
	addl	$1, %ecx
	cmpq	$1001, %rax
	je	.L32
.L5:
	cmpl	$1, (%rbx,%rax,4)
	movl	%eax, %ecx
	movl	%eax, %r8d
	jne	.L3
	movl	%eax, %esi
	addl	$1, %edx
	leaq	0(,%rax,4), %r9
	imull	%eax, %esi
	movslq	%esi, %rdi
	leaq	(%rbx,%rdi,4), %rdi
.L4:
	addl	%r8d, %esi
	movl	$0, (%rdi)
	addq	%r9, %rdi
	cmpl	$1000000, %esi
	jle	.L4
	movl	$1, %r9d
	movl	$1, %edi
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L32:
	movl	$1000000, %r8d
	movslq	%ecx, %r10
	subl	%ecx, %r8d
	leaq	(%rbx,%r10,4), %rax
	leaq	(%r8,%r10), %rcx
	leaq	4+prime(%rip), %r8
	leaq	(%r8,%rcx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	$1, (%rax)
	jne	.L7
	addl	$1, %edx
	movl	$1, %edi
.L7:
	movl	%edx, (%rax)
	addq	$4, %rax
	cmpq	%rax, %rcx
	jne	.L8
	movl	$1000001, i(%rip)
	testb	%r9b, %r9b
	je	.L10
	movl	%esi, j(%rip)
.L10:
	testb	%dil, %dil
	je	.L11
	movl	%edx, n(%rip)
.L11:
	leaq	n(%rip), %r15
	leaq	.LC4(%rip), %r14
	leaq	d(%rip), %r13
	leaq	p(%rip), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L33
	movl	$0, x(%rip)
	testl	%edx, %edx
	jle	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r13, %rdx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	p(%rip), %eax
	movl	$1, %ecx
	movl	%eax, %edx
	subl	d(%rip), %edx
	testl	%edx, %edx
	cmovle	%ecx, %edx
	addl	d(%rip), %eax
	movl	$1000000, %ecx
	subl	$1, %edx
	cmpl	%ecx, %eax
	cmovg	%ecx, %eax
	movl	%edx, from(%rip)
	movslq	%edx, %rdx
	movl	%eax, to(%rip)
	cltq
	movl	(%rbx,%rax,4), %eax
	subl	(%rbx,%rdx,4), %eax
	movl	x(%rip), %edx
	leal	-1(%rax,%rdx), %edx
	movl	n(%rip), %eax
	movl	%edx, x(%rip)
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L14
.L13:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L13
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	x
	.bss
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 8000000
prime:
	.zero	8000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	to
	.align 4
	.type	to, @object
	.size	to, 4
to:
	.zero	4
	.globl	from
	.align 4
	.type	from, @object
	.size	from, 4
from:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.set	.LC1,.LC0
	.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>
#include <stdlib.h>

int i,j,from,to,p,d,n,prime[2000000],x;

int main(){
	for(i=2;i<=1000000;i++)prime[i]=1;
	for(i=2,n=0;i<=1000000;i++){
		if(prime[i]==1){
			n++;
			if(i<=1000)for(j=i*i;j<=1000000;j+=i)prime[j]=0;
		}
		prime[i]=n;
	}
	while(scanf("%d",&n)*n){
		x=0;
		for(;n>0;n--){
			scanf("%d %d",&p,&d);
			from=(p-d-1>0?p-d-1:0);
			to=(p+d<1000000?p+d:1000000);
			x+=prime[to]-prime[from]-1;
		}
		printf("%d\n",x);
	}
	return 0;
}
4
5 -1
9 1
3 10
11 3
1
999983 20
0
 4
5 -1
9 1
3 10
8 3
1
999983 20
0
 4
3 -1
14 1
3 10
8 3
1
999983 20
0
 4
3 -1
14 1
3 24
8 3
1
999983 20
0
 4
5 0
9 1
3 10
8 3
1
999983 20
0
 4
5 -1
9 1
2 10
11 3
1
999983 20
0
 4
3 -1
14 1
3 24
8 3
1
955049 20
0
 4
5 -1
9 1
3 10
11 3
0
999983 20
0
 4
0 -1
9 1
3 10
8 3
1
964394 20
0
 4
5 0
9 1
3 10
11 3
0
999983 20
0

3
1
 4
1
 5
1
 8
1
 6
1
 2
1
 8
4
 3
 5
-1
 5

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>
#include <stdlib.h>

int i,j,from,to,p,d,n,prime[2000000],x;

int main(){
	for(i=2;i<=1000000;i++)prime[i]=1;
	for(i=2,n=0;i<=1000000;i++){
		if(prime[i]==1){
			n++;
			if(i<=1000)for(j=i*i;j<=1000000;j+=i)prime[j]=0;
		}
		prime[i]=n;
	}
	while(scanf("%d",&n)*n){
		x=0;
		for(;n>0;n--){
			scanf("%d %d",&p,&d);
			from=(p-d-1>0?p-d-1:0);
			to=(p+d<1000000?p+d:1000000);
			x+=prime[to]-prime[from]-1;
		}
		printf("%d\n",x);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	from
	.align 4
	.type	from, @object
	.size	from, 4
from:
	.zero	4
	.globl	to
	.align 4
	.type	to, @object
	.size	to, 4
to:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 8000000
prime:
	.zero	8000000
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L3
	movl	$2, i(%rip)
	movl	$0, n(%rip)
	jmp	.L4
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
	movl	i(%rip), %eax
	cmpl	$1000, %eax
	jg	.L5
	movl	i(%rip), %edx
	movl	i(%rip), %eax
	imull	%edx, %eax
	movl	%eax, j(%rip)
	jmp	.L6
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
.L6:
	movl	j(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L7
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L8
	jmp	.L9
.L12:
	movl	$0, x(%rip)
	jmp	.L10
.L11:
	leaq	d(%rip), %rax
	movq	%rax, %rdx
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	p(%rip), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	$1, %eax
	movl	%eax, from(%rip)
	movl	p(%rip), %edx
	movl	d(%rip), %eax
	addl	%edx, %eax
	movl	$1000000, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, to(%rip)
	movl	to(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	from(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
.L10:
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L11
	movl	x(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	from
	.align 4
	.type	from, @object
	.size	from, 4
from:
	.zero	4
	.globl	to
	.align 4
	.type	to, @object
	.size	to, 4
to:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	d
	.align 4
	.type	d, @object
	.size	d, 4
d:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 8000000
prime:
	.zero	8000000
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L3
	movl	$2, i(%rip)
	movl	$0, n(%rip)
	jmp	.L4
.L8:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
	movl	i(%rip), %eax
	cmpl	$1000, %eax
	jg	.L5
	movl	i(%rip), %edx
	movl	i(%rip), %eax
	imull	%edx, %eax
	movl	%eax, j(%rip)
	jmp	.L6
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, j(%rip)
.L6:
	movl	j(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L7
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %eax
	cmpl	$1000000, %eax
	jle	.L8
	jmp	.L9
.L12:
	movl	$0, x(%rip)
	jmp	.L10
.L11:
	leaq	d(%rip), %rax
	movq	%rax, %rdx
	leaq	p(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	p(%rip), %eax
	movl	d(%rip), %edx
	subl	%edx, %eax
	movl	$1, %edx
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	$1, %eax
	movl	%eax, from(%rip)
	movl	p(%rip), %edx
	movl	d(%rip), %eax
	addl	%edx, %eax
	movl	$1000000, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, to(%rip)
	movl	to(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	from(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prime(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	addl	%edx, %eax
	movl	%eax, x(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
.L10:
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L11
	movl	x(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
