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>

#define SIEVE_SIZE 32768

int sieve_idx;
char sieve[SIEVE_SIZE];

void reset_prime_generator() {
    int i;
    sieve_idx = 2;
    sieve[0] = sieve[1] = 0;
    for (i = 2; i < SIEVE_SIZE; i++) {
        sieve[i] = 1;
    }
}

int next_prime() {
    int i, j, dj;
    if (sieve_idx < 3) {
        return sieve_idx++;
    }
    for (i = sieve_idx; i < SIEVE_SIZE; i+=2) {
        if (sieve[i] == 1) {
            sieve_idx = i + 2;
            for (dj = i*2, j = i+dj; j < SIEVE_SIZE; j += dj) {
                sieve[j] = 0;
            }
            return i;
        }
    }
    return 0;
}

int main() {
    int n, i, p;

    scanf("%d", &n);

    reset_prime_generator();

    printf("%d:", n);
    while (n > 1) {
        p = next_prime();
        if (!p) {
            printf(" %d", n);
            break;
        }
        while (n % p == 0) {
            printf(" %d", p);
            n = n / p;
        }
    }
    printf("\n");

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sieve_idx
	.bss
	.align 4
	.type	sieve_idx, @object
	.size	sieve_idx, 4
sieve_idx:
	.zero	4
	.globl	sieve
	.align 32
	.type	sieve, @object
	.size	sieve, 32768
sieve:
	.zero	32768
	.text
	.globl	reset_prime_generator
	.type	reset_prime_generator, @function
reset_prime_generator:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, sieve_idx(%rip)
	movb	$0, 1+sieve(%rip)
	movzbl	1+sieve(%rip), %eax
	movb	%al, sieve(%rip)
	movl	$2, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -4(%rbp)
.L2:
	cmpl	$32767, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	reset_prime_generator, .-reset_prime_generator
	.globl	next_prime
	.type	next_prime, @function
next_prime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	sieve_idx(%rip), %eax
	cmpl	$2, %eax
	jg	.L5
	movl	sieve_idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sieve_idx(%rip)
	jmp	.L6
.L5:
	movl	sieve_idx(%rip), %eax
	movl	%eax, -12(%rbp)
	jmp	.L7
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$1, %al
	jne	.L8
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, sieve_idx(%rip)
	movl	-12(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
.L9:
	cmpl	$32767, -8(%rbp)
	jle	.L10
	movl	-12(%rbp), %eax
	jmp	.L6
.L8:
	addl	$2, -12(%rbp)
.L7:
	cmpl	$32767, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	next_prime, .-next_prime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	$0, %eax
	call	reset_prime_generator
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L18:
	movl	$0, %eax
	call	next_prime
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	jne	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L17
.L13:
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	jg	.L18
.L15:
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	reset_prime_generator
	.type	reset_prime_generator, @function
reset_prime_generator:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	movl	$32766, %edx
	movl	$1, %esi
	movl	$2, sieve_idx(%rip)
	leaq	2+sieve(%rip), %rdi
	movw	%ax, sieve(%rip)
	jmp	memset@PLT
	.cfi_endproc
.LFE23:
	.size	reset_prime_generator, .-reset_prime_generator
	.p2align 4
	.globl	next_prime
	.type	next_prime, @function
next_prime:
.LFB24:
	.cfi_startproc
	endbr64
	movl	sieve_idx(%rip), %eax
	cmpl	$2, %eax
	jle	.L4
	movslq	%eax, %rdx
	leaq	sieve(%rip), %rcx
	addq	%rcx, %rdx
	cmpl	$32767, %eax
	jle	.L9
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$2, %rdx
	cmpl	$32767, %eax
	jg	.L13
.L9:
	cmpb	$1, (%rdx)
	movl	%eax, %r8d
	leal	2(%rax), %eax
	jne	.L7
	leal	(%r8,%r8), %edx
	movl	%eax, sieve_idx(%rip)
	leal	(%rdx,%r8), %eax
	cmpl	$32767, %eax
	jg	.L3
	movslq	%edx, %rdx
	cltq
	.p2align 4,,10
	.p2align 3
.L8:
	movb	$0, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$32767, %eax
	jle	.L8
.L3:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %edx
	movl	%eax, %r8d
	movl	%edx, sieve_idx(%rip)
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	next_prime, .-next_prime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	sieve(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$32766, %edx
	movl	$1, %esi
	leaq	2+sieve(%rip), %rdi
	movw	%ax, sieve(%rip)
	movl	$2, sieve_idx(%rip)
	call	memset@PLT
	movl	4(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movl	4(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L42:
	cmpl	$1, %r8d
	jle	.L16
.L15:
	movl	sieve_idx(%rip), %ebx
	cmpl	$2, %ebx
	jle	.L17
	cmpl	$32767, %ebx
	jg	.L19
	movslq	%ebx, %rax
	addq	%rbp, %rax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$2, %rax
	cmpl	$32767, %ebx
	jg	.L19
.L23:
	cmpb	$1, (%rax)
	movl	%ebx, %edx
	leal	2(%rbx), %ebx
	jne	.L21
	leal	(%rdx,%rdx), %ecx
	movl	%ebx, sieve_idx(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$32767, %eax
	jg	.L28
	movslq	%ecx, %rcx
	cltq
	.p2align 4,,10
	.p2align 3
.L22:
	movb	$0, 0(%rbp,%rax)
	addq	%rcx, %rax
	cmpl	$32767, %eax
	jle	.L22
.L28:
	movl	%edx, %ebx
.L20:
	movl	%r8d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%ebx, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	4(%rsp), %eax
	cltd
	idivl	%ebx
	cltd
	movl	%eax, 4(%rsp)
	movl	%eax, %r8d
	idivl	%ebx
	testl	%edx, %edx
	je	.L24
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rbx), %eax
	movl	%eax, sieve_idx(%rip)
	testl	%ebx, %ebx
	jne	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L16:
	movl	$10, %edi
	call	putchar@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	sieve
	.bss
	.align 32
	.type	sieve, @object
	.size	sieve, 32768
sieve:
	.zero	32768
	.globl	sieve_idx
	.align 4
	.type	sieve_idx, @object
	.size	sieve_idx, 4
sieve_idx:
	.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	reset_prime_generator
	.type	reset_prime_generator, @function
reset_prime_generator:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%eax, %eax
	movl	$32766, %edx
	movl	$1, %esi
	movl	$2, sieve_idx(%rip)
	leaq	2+sieve(%rip), %rdi
	movw	%ax, sieve(%rip)
	jmp	memset@PLT
	.cfi_endproc
.LFE23:
	.size	reset_prime_generator, .-reset_prime_generator
	.p2align 4
	.globl	next_prime
	.type	next_prime, @function
next_prime:
.LFB24:
	.cfi_startproc
	endbr64
	movl	sieve_idx(%rip), %eax
	cmpl	$2, %eax
	jle	.L4
	movslq	%eax, %rdx
	leaq	sieve(%rip), %rcx
	addq	%rcx, %rdx
	cmpl	$32767, %eax
	jle	.L9
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$2, %rdx
	cmpl	$32767, %eax
	jg	.L13
.L9:
	cmpb	$1, (%rdx)
	movl	%eax, %r8d
	leal	2(%rax), %eax
	jne	.L7
	leal	(%r8,%r8), %edx
	movl	%eax, sieve_idx(%rip)
	leal	(%rdx,%r8), %eax
	cmpl	$32767, %eax
	jg	.L3
	movslq	%edx, %rdx
	cltq
	.p2align 4,,10
	.p2align 3
.L8:
	movb	$0, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$32767, %eax
	jle	.L8
.L3:
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leal	1(%rax), %edx
	movl	%eax, %r8d
	movl	%edx, sieve_idx(%rip)
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	next_prime, .-next_prime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	sieve(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$32766, %edx
	movl	$1, %esi
	leaq	2+sieve(%rip), %rdi
	movw	%ax, sieve(%rip)
	movl	$2, sieve_idx(%rip)
	call	memset@PLT
	movl	4(%rsp), %edx
	movl	$1, %edi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movl	4(%rsp), %r8d
	.p2align 4,,10
	.p2align 3
.L42:
	cmpl	$1, %r8d
	jle	.L16
.L15:
	movl	sieve_idx(%rip), %ebx
	cmpl	$2, %ebx
	jle	.L17
	cmpl	$32767, %ebx
	jg	.L19
	movslq	%ebx, %rax
	addq	%rbp, %rax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$2, %rax
	cmpl	$32767, %ebx
	jg	.L19
.L23:
	cmpb	$1, (%rax)
	movl	%ebx, %edx
	leal	2(%rbx), %ebx
	jne	.L21
	leal	(%rdx,%rdx), %ecx
	movl	%ebx, sieve_idx(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$32767, %eax
	jg	.L28
	movslq	%ecx, %rcx
	cltq
	.p2align 4,,10
	.p2align 3
.L22:
	movb	$0, 0(%rbp,%rax)
	addq	%rcx, %rax
	cmpl	$32767, %eax
	jle	.L22
.L28:
	movl	%edx, %ebx
.L20:
	movl	%r8d, %eax
	cltd
	idivl	%ebx
	testl	%edx, %edx
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%ebx, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	4(%rsp), %eax
	cltd
	idivl	%ebx
	cltd
	movl	%eax, 4(%rsp)
	movl	%eax, %r8d
	idivl	%ebx
	testl	%edx, %edx
	je	.L24
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L17:
	leal	1(%rbx), %eax
	movl	%eax, sieve_idx(%rip)
	testl	%ebx, %ebx
	jne	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L16:
	movl	$10, %edi
	call	putchar@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	sieve
	.bss
	.align 32
	.type	sieve, @object
	.size	sieve, 32768
sieve:
	.zero	32768
	.globl	sieve_idx
	.align 4
	.type	sieve_idx, @object
	.size	sieve_idx, 4
sieve_idx:
	.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:

#include <stdio.h>

#define SIEVE_SIZE 32768

int sieve_idx;
char sieve[SIEVE_SIZE];

void reset_prime_generator() {
    int i;
    sieve_idx = 2;
    sieve[0] = sieve[1] = 0;
    for (i = 2; i < SIEVE_SIZE; i++) {
        sieve[i] = 1;
    }
}

int next_prime() {
    int i, j, dj;
    if (sieve_idx < 3) {
        return sieve_idx++;
    }
    for (i = sieve_idx; i < SIEVE_SIZE; i+=2) {
        if (sieve[i] == 1) {
            sieve_idx = i + 2;
            for (dj = i*2, j = i+dj; j < SIEVE_SIZE; j += dj) {
                sieve[j] = 0;
            }
            return i;
        }
    }
    return 0;
}

int main() {
    int n, i, p;

    scanf("%d", &n);

    reset_prime_generator();

    printf("%d:", n);
    while (n > 1) {
        p = next_prime();
        if (!p) {
            printf(" %d", n);
            break;
        }
        while (n % p == 0) {
            printf(" %d", p);
            n = n / p;
        }
    }
    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>

#define SIEVE_SIZE 32768

int sieve_idx;
char sieve[SIEVE_SIZE];

void reset_prime_generator() {
    int i;
    sieve_idx = 2;
    sieve[0] = sieve[1] = 0;
    for (i = 2; i < SIEVE_SIZE; i++) {
        sieve[i] = 1;
    }
}

int next_prime() {
    int i, j, dj;
    if (sieve_idx < 3) {
        return sieve_idx++;
    }
    for (i = sieve_idx; i < SIEVE_SIZE; i+=2) {
        if (sieve[i] == 1) {
            sieve_idx = i + 2;
            for (dj = i*2, j = i+dj; j < SIEVE_SIZE; j += dj) {
                sieve[j] = 0;
            }
            return i;
        }
    }
    return 0;
}

int main() {
    int n, i, p;

    scanf("%d", &n);

    reset_prime_generator();

    printf("%d:", n);
    while (n > 1) {
        p = next_prime();
        if (!p) {
            printf(" %d", n);
            break;
        }
        while (n % p == 0) {
            printf(" %d", p);
            n = n / p;
        }
    }
    printf("\n");

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	sieve_idx
	.bss
	.align 4
	.type	sieve_idx, @object
	.size	sieve_idx, 4
sieve_idx:
	.zero	4
	.globl	sieve
	.align 32
	.type	sieve, @object
	.size	sieve, 32768
sieve:
	.zero	32768
	.text
	.globl	reset_prime_generator
	.type	reset_prime_generator, @function
reset_prime_generator:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, sieve_idx(%rip)
	movb	$0, 1+sieve(%rip)
	movzbl	1+sieve(%rip), %eax
	movb	%al, sieve(%rip)
	movl	$2, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -4(%rbp)
.L2:
	cmpl	$32767, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	reset_prime_generator, .-reset_prime_generator
	.globl	next_prime
	.type	next_prime, @function
next_prime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	sieve_idx(%rip), %eax
	cmpl	$2, %eax
	jg	.L5
	movl	sieve_idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sieve_idx(%rip)
	jmp	.L6
.L5:
	movl	sieve_idx(%rip), %eax
	movl	%eax, -12(%rbp)
	jmp	.L7
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$1, %al
	jne	.L8
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, sieve_idx(%rip)
	movl	-12(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
.L9:
	cmpl	$32767, -8(%rbp)
	jle	.L10
	movl	-12(%rbp), %eax
	jmp	.L6
.L8:
	addl	$2, -12(%rbp)
.L7:
	cmpl	$32767, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	next_prime, .-next_prime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	$0, %eax
	call	reset_prime_generator
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L18:
	movl	$0, %eax
	call	next_prime
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	jne	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L17
.L13:
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	jg	.L18
.L15:
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	sieve_idx
	.bss
	.align 4
	.type	sieve_idx, @object
	.size	sieve_idx, 4
sieve_idx:
	.zero	4
	.globl	sieve
	.align 32
	.type	sieve, @object
	.size	sieve, 32768
sieve:
	.zero	32768
	.text
	.globl	reset_prime_generator
	.type	reset_prime_generator, @function
reset_prime_generator:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, sieve_idx(%rip)
	movb	$0, 1+sieve(%rip)
	movzbl	1+sieve(%rip), %eax
	movb	%al, sieve(%rip)
	movl	$2, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -4(%rbp)
.L2:
	cmpl	$32767, -4(%rbp)
	jle	.L3
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	reset_prime_generator, .-reset_prime_generator
	.globl	next_prime
	.type	next_prime, @function
next_prime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	sieve_idx(%rip), %eax
	cmpl	$2, %eax
	jg	.L5
	movl	sieve_idx(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sieve_idx(%rip)
	jmp	.L6
.L5:
	movl	sieve_idx(%rip), %eax
	movl	%eax, -12(%rbp)
	jmp	.L7
.L11:
	movl	-12(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$1, %al
	jne	.L8
	movl	-12(%rbp), %eax
	addl	$2, %eax
	movl	%eax, sieve_idx(%rip)
	movl	-12(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	sieve(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	-4(%rbp), %eax
	addl	%eax, -8(%rbp)
.L9:
	cmpl	$32767, -8(%rbp)
	jle	.L10
	movl	-12(%rbp), %eax
	jmp	.L6
.L8:
	addl	$2, -12(%rbp)
.L7:
	cmpl	$32767, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L6:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	next_prime, .-next_prime
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d:"
.LC2:
	.string	" %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	$0, %eax
	call	reset_prime_generator
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L18:
	movl	$0, %eax
	call	next_prime
	movl	%eax, -12(%rbp)
	cmpl	$0, -12(%rbp)
	jne	.L16
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%eax, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	je	.L17
.L13:
	movl	-16(%rbp), %eax
	cmpl	$1, %eax
	jg	.L18
.L15:
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
