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 prev[ 200000 + 1 ] ,next[ 200000 + 1 ] ;
int main()
{
    int n ,m ,q ;
    int a , r ,p = 0 ;
    int i ,j ;
    scanf( "%d %d %d", &n , &m , &q ) ;
    for( i = 0 ; i < n ; i++ )
    {
        prev[ i ] = ( i - 1 + n ) % n ;
        next[ i ] = ( i + 1 ) % n ;
    }
    for( i = 0 ; i < m ; i++ )
    {
        scanf( "%d", &a ) ;
        for( j = 0 ; j < a ; j++ )
        {
            p = a % 2 == 0 ? next[ p ] : prev[ p ] ;
        }
        r = p ;
        next[ prev[ p ] ] = next[ p ] ;
        prev[ next[ p ] ] = prev[ p ] ;
        p = next[ p ] ;
        next[ r ] = -1 ;
        prev[ r ] = -1 ;
    }
    for( i = 0 ; i < q ; i++ )
    {
        scanf( "%d", &a ) ;
        if( prev[ a ] == -1 )
        {
            printf( "0\n" ) ;
        }
        else
        {
            printf( "1\n" ) ;
        }
    }
    return 0 ;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	prev
	.bss
	.align 32
	.type	prev, @object
	.size	prev, 800004
prev:
	.zero	800004
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 800004
next:
	.zero	800004
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"0"
.LC3:
	.string	"1"
	.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	$0, -24(%rbp)
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L3
	movl	$0, -20(%rbp)
	jmp	.L4
.L9:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L8:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L6:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
.L7:
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L5:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prev(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prev(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$0, -20(%rbp)
	jmp	.L10
.L13:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L12:
	addl	$1, -20(%rbp)
.L10:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	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
.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
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"0"
.LC3:
	.string	"1"
	.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
	leaq	.LC0(%rip), %rdi
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	jle	.L2
	leal	1(%rsi), %r10d
	movl	$1, %ecx
	leal	-2(%rsi), %r8d
	leaq	-4+prev(%rip), %r9
	leaq	-4+next(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%r8,%rcx), %eax
	cltd
	idivl	%esi
	movl	%ecx, %eax
	movl	%edx, (%r9,%rcx,4)
	cltd
	idivl	%esi
	movl	%edx, (%rdi,%rcx,4)
	addq	$1, %rcx
	cmpq	%rcx, %r10
	jne	.L3
.L2:
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L4
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	prev(%rip), %r13
	leaq	next(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	testl	%edx, %edx
	jle	.L5
	xorl	%eax, %eax
	testb	$1, %dl
	je	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %eax
	movslq	0(%r13,%rbx,4), %rbx
	cmpl	%edx, %eax
	jne	.L7
.L5:
	movslq	0(%r13,%rbx,4), %rcx
	movq	%rbx, %rax
	movslq	(%r14,%rbx,4), %rbx
	addl	$1, %r15d
	movl	%ebx, (%r14,%rcx,4)
	movl	%ecx, 0(%r13,%rbx,4)
	movl	$-1, (%r14,%rax,4)
	movl	$-1, 0(%r13,%rax,4)
	cmpl	%r15d, 12(%rsp)
	jg	.L8
.L4:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L9
	xorl	%ebx, %ebx
	leaq	20(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	prev(%rip), %r13
	leaq	.LC3(%rip), %r14
	leaq	.LC2(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rax
	cmpl	$-1, 0(%r13,%rax,4)
	je	.L25
	movq	%r14, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L12
.L9:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	addl	$1, %eax
	movslq	(%r14,%rbx,4), %rbx
	cmpl	%edx, %eax
	je	.L5
	addl	$1, %eax
	movslq	(%r14,%rbx,4), %rbx
	cmpl	%edx, %eax
	jne	.L6
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	16(%rsp), %ebx
	jl	.L12
	jmp	.L9
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	next
	.bss
	.align 32
	.type	next, @object
	.size	next, 800004
next:
	.zero	800004
	.globl	prev
	.align 32
	.type	prev, @object
	.size	prev, 800004
prev:
	.zero	800004
	.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
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"0"
.LC3:
	.string	"1"
	.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
	leaq	.LC0(%rip), %rdi
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	16(%rsp), %rcx
	leaq	12(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	jle	.L2
	leal	1(%rsi), %r10d
	movl	$1, %ecx
	leal	-2(%rsi), %r8d
	leaq	-4+prev(%rip), %r9
	leaq	-4+next(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L3:
	leal	(%r8,%rcx), %eax
	cltd
	idivl	%esi
	movl	%ecx, %eax
	movl	%edx, (%r9,%rcx,4)
	cltd
	idivl	%esi
	movl	%edx, (%rdi,%rcx,4)
	addq	$1, %rcx
	cmpq	%rcx, %r10
	jne	.L3
.L2:
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L4
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	prev(%rip), %r13
	leaq	next(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %edx
	testl	%edx, %edx
	jle	.L5
	xorl	%eax, %eax
	testb	$1, %dl
	je	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %eax
	movslq	0(%r13,%rbx,4), %rbx
	cmpl	%edx, %eax
	jne	.L7
.L5:
	movslq	0(%r13,%rbx,4), %rcx
	movq	%rbx, %rax
	movslq	(%r14,%rbx,4), %rbx
	addl	$1, %r15d
	movl	%ebx, (%r14,%rcx,4)
	movl	%ecx, 0(%r13,%rbx,4)
	movl	$-1, (%r14,%rax,4)
	movl	$-1, 0(%r13,%rax,4)
	cmpl	%r15d, 12(%rsp)
	jg	.L8
.L4:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L9
	xorl	%ebx, %ebx
	leaq	20(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	prev(%rip), %r13
	leaq	.LC3(%rip), %r14
	leaq	.LC2(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movslq	20(%rsp), %rax
	cmpl	$-1, 0(%r13,%rax,4)
	je	.L25
	movq	%r14, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, 16(%rsp)
	jg	.L12
.L9:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	addl	$1, %eax
	movslq	(%r14,%rbx,4), %rbx
	cmpl	%edx, %eax
	je	.L5
	addl	$1, %eax
	movslq	(%r14,%rbx,4), %rbx
	cmpl	%edx, %eax
	jne	.L6
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	16(%rsp), %ebx
	jl	.L12
	jmp	.L9
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	next
	.bss
	.align 32
	.type	next, @object
	.size	next, 800004
next:
	.zero	800004
	.globl	prev
	.align 32
	.type	prev, @object
	.size	prev, 800004
prev:
	.zero	800004
	.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 prev[ 200000 + 1 ] ,next[ 200000 + 1 ] ;
int main()
{
    int n ,m ,q ;
    int a , r ,p = 0 ;
    int i ,j ;
    scanf( "%d %d %d", &n , &m , &q ) ;
    for( i = 0 ; i < n ; i++ )
    {
        prev[ i ] = ( i - 1 + n ) % n ;
        next[ i ] = ( i + 1 ) % n ;
    }
    for( i = 0 ; i < m ; i++ )
    {
        scanf( "%d", &a ) ;
        for( j = 0 ; j < a ; j++ )
        {
            p = a % 2 == 0 ? next[ p ] : prev[ p ] ;
        }
        r = p ;
        next[ prev[ p ] ] = next[ p ] ;
        prev[ next[ p ] ] = prev[ p ] ;
        p = next[ p ] ;
        next[ r ] = -1 ;
        prev[ r ] = -1 ;
    }
    for( i = 0 ; i < q ; i++ )
    {
        scanf( "%d", &a ) ;
        if( prev[ a ] == -1 )
        {
            printf( "0\n" ) ;
        }
        else
        {
            printf( "1\n" ) ;
        }
    }
    return 0 ;
}
10 5 3
2 6 5 18 3
3 0 5

1
0
1

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 prev[ 200000 + 1 ] ,next[ 200000 + 1 ] ;
int main()
{
    int n ,m ,q ;
    int a , r ,p = 0 ;
    int i ,j ;
    scanf( "%d %d %d", &n , &m , &q ) ;
    for( i = 0 ; i < n ; i++ )
    {
        prev[ i ] = ( i - 1 + n ) % n ;
        next[ i ] = ( i + 1 ) % n ;
    }
    for( i = 0 ; i < m ; i++ )
    {
        scanf( "%d", &a ) ;
        for( j = 0 ; j < a ; j++ )
        {
            p = a % 2 == 0 ? next[ p ] : prev[ p ] ;
        }
        r = p ;
        next[ prev[ p ] ] = next[ p ] ;
        prev[ next[ p ] ] = prev[ p ] ;
        p = next[ p ] ;
        next[ r ] = -1 ;
        prev[ r ] = -1 ;
    }
    for( i = 0 ; i < q ; i++ )
    {
        scanf( "%d", &a ) ;
        if( prev[ a ] == -1 )
        {
            printf( "0\n" ) ;
        }
        else
        {
            printf( "1\n" ) ;
        }
    }
    return 0 ;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	prev
	.bss
	.align 32
	.type	prev, @object
	.size	prev, 800004
prev:
	.zero	800004
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 800004
next:
	.zero	800004
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"0"
.LC3:
	.string	"1"
	.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	$0, -24(%rbp)
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L3
	movl	$0, -20(%rbp)
	jmp	.L4
.L9:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L8:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L6:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
.L7:
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L5:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prev(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prev(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$0, -20(%rbp)
	jmp	.L10
.L13:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L12:
	addl	$1, -20(%rbp)
.L10:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	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
.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	prev
	.bss
	.align 32
	.type	prev, @object
	.size	prev, 800004
prev:
	.zero	800004
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 800004
next:
	.zero	800004
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"0"
.LC3:
	.string	"1"
	.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	$0, -24(%rbp)
	leaq	-32(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20(%rbp)
	jmp	.L2
.L3:
	movl	-20(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	-40(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L2:
	movl	-40(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L3
	movl	$0, -20(%rbp)
	jmp	.L4
.L9:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L8:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L7
.L6:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
.L7:
	movl	%eax, -24(%rbp)
	addl	$1, -16(%rbp)
.L5:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-24(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prev(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	prev(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -20(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L9
	movl	$0, -20(%rbp)
	jmp	.L10
.L13:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prev(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L12:
	addl	$1, -20(%rbp)
.L10:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L13
	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
.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:
