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 main(void)
{
	int n,m,c[4002],k,i,j,x[2002];
	scanf("%d%d",&n,&m);
	for(i=1;i<=n*2;i++) c[i]=i; 
	for(i=1;i<=m;i++){
		scanf("%d",&k);
		if(k==0){
			for(j=1;j<=n*2;j++) x[j]=c[j];
			for(j=1;j<=n*2;j++){
				if(j%2==1) c[j]=x[j/2+1];
			}
			for(j=1;j<=n*2;j++){
				if(j%2==0) c[j]=x[n+j/2];
			}
		}
		if(k!=0){
			for(j=1;j<=k;j++) c[n*2+j]=c[j];
			for(j=k+1;j<=n*2+k;j++) c[j-k]=c[j];
		}
	}
	for(i=1;i<=n*2;i++) printf("%d\n",c[i]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	leaq	-20480(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3584, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24048(%rbp), %rdx
	leaq	-24052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24040(%rbp)
	jmp	.L2
.L3:
	movl	-24040(%rbp), %eax
	cltq
	movl	-24040(%rbp), %edx
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24040(%rbp)
.L2:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L3
	movl	$1, -24040(%rbp)
	jmp	.L4
.L19:
	leaq	-24044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -24036(%rbp)
	jmp	.L6
.L7:
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -24032(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L6:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L7
	movl	$1, -24036(%rbp)
	jmp	.L8
.L10:
	movl	-24036(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	$1, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L9:
	addl	$1, -24036(%rbp)
.L8:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L10
	movl	$1, -24036(%rbp)
	jmp	.L11
.L13:
	movl	-24036(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-24052(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L12:
	addl	$1, -24036(%rbp)
.L11:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L13
.L5:
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$1, -24036(%rbp)
	jmp	.L15
.L16:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24036(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L15:
	movl	-24044(%rbp), %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L16
	movl	-24044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24036(%rbp)
	jmp	.L17
.L18:
	movl	-24044(%rbp), %edx
	movl	-24036(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L17:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L18
.L14:
	addl	$1, -24040(%rbp)
.L4:
	movl	-24048(%rbp), %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L19
	movl	$1, -24040(%rbp)
	jmp	.L20
.L21:
	movl	-24040(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24040(%rbp)
.L20:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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
.LC1:
	.string	"%d%d"
.LC3:
	.string	"%d"
.LC4:
	.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
	leaq	-20480(%rsp), %r11
	.cfi_def_cfa 11, 20536
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3576, %rsp
	.cfi_def_cfa_offset 24112
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24040(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L32
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm2
	leaq	8036(%rsp), %rax
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	8052(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %ecx
	andl	$-4, %ecx
	leal	1(%rcx), %eax
	cmpl	%ecx, %edx
	je	.L5
.L3:
	movslq	%eax, %rcx
	movl	%eax, 8032(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L5
	movslq	%ecx, %rsi
	addl	$2, %eax
	movl	%ecx, 8032(%rsp,%rsi,4)
	cmpl	%eax, %edx
	jl	.L5
	movslq	%eax, %rdx
	movl	%eax, 8032(%rsp,%rdx,4)
.L5:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L27
.L30:
	movl	$1, %r14d
	leaq	12(%rsp), %rbp
	leaq	20(%rsp), %r12
	leaq	.LC3(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	movl	4(%rsp), %r13d
	testl	%edx, %edx
	je	.L6
	leal	(%r13,%r13), %esi
	jle	.L17
	leal	-1(%rsi), %eax
	leal	-1(%rdx), %ecx
	cmpl	$2, %eax
	jbe	.L14
	cmpl	$2, %ecx
	jbe	.L14
	movl	%edx, %ecx
	movslq	%r13d, %rax
	leaq	8036(%rsp), %r8
	shrl	$2, %ecx
	leaq	8036(%rsp,%rax,8), %rdi
	xorl	%eax, %eax
	salq	$4, %rcx
.L15:
	movdqu	(%r8,%rax), %xmm3
	movups	%xmm3, (%rdi,%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L15
	movl	%edx, %eax
	andl	$-4, %eax
	leal	1(%rax), %ecx
	cmpl	%eax, %edx
	je	.L17
	movslq	%ecx, %rdi
	addl	%esi, %ecx
	movl	8032(%rsp,%rdi,4), %edi
	movslq	%ecx, %rcx
	movl	%edi, 8032(%rsp,%rcx,4)
	leal	2(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L17
	movslq	%ecx, %rdi
	addl	%esi, %ecx
	addl	$3, %eax
	movl	8032(%rsp,%rdi,4), %edi
	movslq	%ecx, %rcx
	movl	%edi, 8032(%rsp,%rcx,4)
	cmpl	%eax, %edx
	jl	.L17
	movslq	%eax, %rcx
	addl	%esi, %eax
	movl	8032(%rsp,%rcx,4), %ecx
	cltq
	movl	%ecx, 8032(%rsp,%rax,4)
.L17:
	leal	1(%rdx), %ecx
	leal	(%rdx,%rsi), %edi
	testl	%r13d, %r13d
	jle	.L9
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	movl	%ecx, %eax
	seta	%r8b
	negl	%eax
	cmpl	$2, %eax
	seta	%al
	testb	%al, %r8b
	je	.L21
	cmpl	%edi, %edx
	jge	.L21
	movl	$1, %r9d
	movslq	%edx, %rax
	leaq	8036(%rsp), %r8
	cmovl	%esi, %r9d
	leaq	8036(%rsp,%rax,4), %r10
	xorl	%eax, %eax
	movl	%r9d, %esi
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L22:
	movdqu	(%r10,%rax), %xmm4
	movups	%xmm4, (%r8,%rax)
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L22
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %ecx
	cmpl	%eax, %r9d
	je	.L9
	movslq	%ecx, %rax
	movl	8032(%rsp,%rax,4), %esi
	movl	%ecx, %eax
	subl	%edx, %eax
	cltq
	movl	%esi, 8032(%rsp,%rax,4)
	leal	1(%rcx), %eax
	cmpl	%edi, %eax
	jg	.L9
	movslq	%eax, %rsi
	subl	%edx, %eax
	addl	$2, %ecx
	movl	8032(%rsp,%rsi,4), %esi
	cltq
	movl	%esi, 8032(%rsp,%rax,4)
	cmpl	%edi, %ecx
	jg	.L9
	movslq	%ecx, %rax
	subl	%edx, %ecx
	movl	8032(%rsp,%rax,4), %eax
	movslq	%ecx, %rcx
	movl	%eax, 8032(%rsp,%rcx,4)
.L9:
	addl	$1, %r14d
	cmpl	%r14d, 8(%rsp)
	jge	.L26
	testl	%r13d, %r13d
	jle	.L29
.L27:
	movl	$1, %ebx
	leaq	8032(%rsp), %r15
	leaq	.LC4(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%r15,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	4(%rsp), %eax
	addl	%eax, %eax
	cmpl	%ebx, %eax
	jge	.L28
.L29:
	movq	24040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	addq	$24056, %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
	leal	(%r13,%r13), %r15d
	testl	%r15d, %r15d
	jle	.L9
	leaq	8036(%rsp), %r8
	movl	%r15d, %edx
	movq	%r12, %rdi
	salq	$2, %rdx
	movq	%r8, %rsi
	call	memcpy@PLT
	leal	1(%r15), %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	testb	$1, %al
	je	.L10
	movl	%eax, %edx
	sarl	%edx
	addl	$1, %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %edx
	movl	%edx, 8032(%rsp,%rax,4)
.L10:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L11
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	testb	$1, %al
	jne	.L12
	movl	%eax, %edx
	sarl	%edx
	addl	%r13d, %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %edx
	movl	%edx, 8032(%rsp,%rax,4)
.L12:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	8036(%rsp), %rax
	leaq	8040(%rsp,%rcx,4), %r8
	movslq	%esi, %rdi
.L19:
	movl	(%rax), %ecx
	movl	%ecx, (%rax,%rdi,4)
	addq	$4, %rax
	cmpq	%r8, %rax
	jne	.L19
	jmp	.L17
.L21:
	movslq	%edx, %rax
	leaq	8032(%rsp), %r15
	movslq	%ecx, %rcx
	imulq	$-4, %rax, %rax
	addq	%r15, %rax
	.p2align 4,,10
	.p2align 3
.L24:
	movl	(%r15,%rcx,4), %edx
	movl	%edx, (%rax,%rcx,4)
	addq	$1, %rcx
	cmpl	%ecx, %edi
	jge	.L24
	jmp	.L9
.L2:
	cmpl	$0, 8(%rsp)
	jg	.L30
	jmp	.L29
.L32:
	movl	$1, %eax
	jmp	.L3
.L60:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d%d"
.LC3:
	.string	"%d"
.LC4:
	.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
	leaq	-20480(%rsp), %r11
	.cfi_def_cfa 11, 20536
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3576, %rsp
	.cfi_def_cfa_offset 24112
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24040(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L32
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm2
	leaq	8036(%rsp), %rax
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	8052(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %ecx
	andl	$-4, %ecx
	leal	1(%rcx), %eax
	cmpl	%ecx, %edx
	je	.L5
.L3:
	movslq	%eax, %rcx
	movl	%eax, 8032(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L5
	movslq	%ecx, %rsi
	addl	$2, %eax
	movl	%ecx, 8032(%rsp,%rsi,4)
	cmpl	%eax, %edx
	jl	.L5
	movslq	%eax, %rdx
	movl	%eax, 8032(%rsp,%rdx,4)
.L5:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L27
.L30:
	movl	$1, %r14d
	leaq	12(%rsp), %rbp
	leaq	20(%rsp), %r12
	leaq	.LC3(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	movl	4(%rsp), %r13d
	testl	%edx, %edx
	je	.L6
	leal	(%r13,%r13), %esi
	jle	.L17
	leal	-1(%rsi), %eax
	leal	-1(%rdx), %ecx
	cmpl	$2, %eax
	jbe	.L14
	cmpl	$2, %ecx
	jbe	.L14
	movl	%edx, %ecx
	movslq	%r13d, %rax
	leaq	8036(%rsp), %r8
	shrl	$2, %ecx
	leaq	8036(%rsp,%rax,8), %rdi
	xorl	%eax, %eax
	salq	$4, %rcx
.L15:
	movdqu	(%r8,%rax), %xmm3
	movups	%xmm3, (%rdi,%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L15
	movl	%edx, %eax
	andl	$-4, %eax
	leal	1(%rax), %ecx
	cmpl	%eax, %edx
	je	.L17
	movslq	%ecx, %rdi
	addl	%esi, %ecx
	movl	8032(%rsp,%rdi,4), %edi
	movslq	%ecx, %rcx
	movl	%edi, 8032(%rsp,%rcx,4)
	leal	2(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L17
	movslq	%ecx, %rdi
	addl	%esi, %ecx
	addl	$3, %eax
	movl	8032(%rsp,%rdi,4), %edi
	movslq	%ecx, %rcx
	movl	%edi, 8032(%rsp,%rcx,4)
	cmpl	%eax, %edx
	jl	.L17
	movslq	%eax, %rcx
	addl	%esi, %eax
	movl	8032(%rsp,%rcx,4), %ecx
	cltq
	movl	%ecx, 8032(%rsp,%rax,4)
.L17:
	leal	1(%rdx), %ecx
	leal	(%rdx,%rsi), %edi
	testl	%r13d, %r13d
	jle	.L9
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	movl	%ecx, %eax
	seta	%r8b
	negl	%eax
	cmpl	$2, %eax
	seta	%al
	testb	%al, %r8b
	je	.L21
	cmpl	%edi, %edx
	jge	.L21
	movl	$1, %r9d
	movslq	%edx, %rax
	leaq	8036(%rsp), %r8
	cmovl	%esi, %r9d
	leaq	8036(%rsp,%rax,4), %r10
	xorl	%eax, %eax
	movl	%r9d, %esi
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L22:
	movdqu	(%r10,%rax), %xmm4
	movups	%xmm4, (%r8,%rax)
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L22
	movl	%r9d, %eax
	andl	$-4, %eax
	addl	%eax, %ecx
	cmpl	%eax, %r9d
	je	.L9
	movslq	%ecx, %rax
	movl	8032(%rsp,%rax,4), %esi
	movl	%ecx, %eax
	subl	%edx, %eax
	cltq
	movl	%esi, 8032(%rsp,%rax,4)
	leal	1(%rcx), %eax
	cmpl	%edi, %eax
	jg	.L9
	movslq	%eax, %rsi
	subl	%edx, %eax
	addl	$2, %ecx
	movl	8032(%rsp,%rsi,4), %esi
	cltq
	movl	%esi, 8032(%rsp,%rax,4)
	cmpl	%edi, %ecx
	jg	.L9
	movslq	%ecx, %rax
	subl	%edx, %ecx
	movl	8032(%rsp,%rax,4), %eax
	movslq	%ecx, %rcx
	movl	%eax, 8032(%rsp,%rcx,4)
.L9:
	addl	$1, %r14d
	cmpl	%r14d, 8(%rsp)
	jge	.L26
	testl	%r13d, %r13d
	jle	.L29
.L27:
	movl	$1, %ebx
	leaq	8032(%rsp), %r15
	leaq	.LC4(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%r15,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	4(%rsp), %eax
	addl	%eax, %eax
	cmpl	%ebx, %eax
	jge	.L28
.L29:
	movq	24040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L60
	addq	$24056, %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
	leal	(%r13,%r13), %r15d
	testl	%r15d, %r15d
	jle	.L9
	leaq	8036(%rsp), %r8
	movl	%r15d, %edx
	movq	%r12, %rdi
	salq	$2, %rdx
	movq	%r8, %rsi
	call	memcpy@PLT
	leal	1(%r15), %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L11:
	testb	$1, %al
	je	.L10
	movl	%eax, %edx
	sarl	%edx
	addl	$1, %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %edx
	movl	%edx, 8032(%rsp,%rax,4)
.L10:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L11
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	testb	$1, %al
	jne	.L12
	movl	%eax, %edx
	sarl	%edx
	addl	%r13d, %edx
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %edx
	movl	%edx, 8032(%rsp,%rax,4)
.L12:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L13
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	8036(%rsp), %rax
	leaq	8040(%rsp,%rcx,4), %r8
	movslq	%esi, %rdi
.L19:
	movl	(%rax), %ecx
	movl	%ecx, (%rax,%rdi,4)
	addq	$4, %rax
	cmpq	%r8, %rax
	jne	.L19
	jmp	.L17
.L21:
	movslq	%edx, %rax
	leaq	8032(%rsp), %r15
	movslq	%ecx, %rcx
	imulq	$-4, %rax, %rax
	addq	%r15, %rax
	.p2align 4,,10
	.p2align 3
.L24:
	movl	(%r15,%rcx,4), %edx
	movl	%edx, (%rax,%rcx,4)
	addq	$1, %rcx
	cmpl	%ecx, %edi
	jge	.L24
	jmp	.L9
.L2:
	cmpl	$0, 8(%rsp)
	jg	.L30
	jmp	.L29
.L32:
	movl	$1, %eax
	jmp	.L3
.L60:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	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>
int main(void)
{
	int n,m,c[4002],k,i,j,x[2002];
	scanf("%d%d",&n,&m);
	for(i=1;i<=n*2;i++) c[i]=i; 
	for(i=1;i<=m;i++){
		scanf("%d",&k);
		if(k==0){
			for(j=1;j<=n*2;j++) x[j]=c[j];
			for(j=1;j<=n*2;j++){
				if(j%2==1) c[j]=x[j/2+1];
			}
			for(j=1;j<=n*2;j++){
				if(j%2==0) c[j]=x[n+j/2];
			}
		}
		if(k!=0){
			for(j=1;j<=k;j++) c[n*2+j]=c[j];
			for(j=k+1;j<=n*2+k;j++) c[j-k]=c[j];
		}
	}
	for(i=1;i<=n*2;i++) printf("%d\n",c[i]);
	return 0;
}
2
2
1
0

2
4
3
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 main(void)
{
	int n,m,c[4002],k,i,j,x[2002];
	scanf("%d%d",&n,&m);
	for(i=1;i<=n*2;i++) c[i]=i; 
	for(i=1;i<=m;i++){
		scanf("%d",&k);
		if(k==0){
			for(j=1;j<=n*2;j++) x[j]=c[j];
			for(j=1;j<=n*2;j++){
				if(j%2==1) c[j]=x[j/2+1];
			}
			for(j=1;j<=n*2;j++){
				if(j%2==0) c[j]=x[n+j/2];
			}
		}
		if(k!=0){
			for(j=1;j<=k;j++) c[n*2+j]=c[j];
			for(j=k+1;j<=n*2+k;j++) c[j-k]=c[j];
		}
	}
	for(i=1;i<=n*2;i++) printf("%d\n",c[i]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	leaq	-20480(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3584, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24048(%rbp), %rdx
	leaq	-24052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24040(%rbp)
	jmp	.L2
.L3:
	movl	-24040(%rbp), %eax
	cltq
	movl	-24040(%rbp), %edx
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24040(%rbp)
.L2:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L3
	movl	$1, -24040(%rbp)
	jmp	.L4
.L19:
	leaq	-24044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -24036(%rbp)
	jmp	.L6
.L7:
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -24032(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L6:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L7
	movl	$1, -24036(%rbp)
	jmp	.L8
.L10:
	movl	-24036(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	$1, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L9:
	addl	$1, -24036(%rbp)
.L8:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L10
	movl	$1, -24036(%rbp)
	jmp	.L11
.L13:
	movl	-24036(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-24052(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L12:
	addl	$1, -24036(%rbp)
.L11:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L13
.L5:
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$1, -24036(%rbp)
	jmp	.L15
.L16:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24036(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L15:
	movl	-24044(%rbp), %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L16
	movl	-24044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24036(%rbp)
	jmp	.L17
.L18:
	movl	-24044(%rbp), %edx
	movl	-24036(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L17:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L18
.L14:
	addl	$1, -24040(%rbp)
.L4:
	movl	-24048(%rbp), %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L19
	movl	$1, -24040(%rbp)
	jmp	.L20
.L21:
	movl	-24040(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24040(%rbp)
.L20:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.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
	leaq	-20480(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3584, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-24048(%rbp), %rdx
	leaq	-24052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -24040(%rbp)
	jmp	.L2
.L3:
	movl	-24040(%rbp), %eax
	cltq
	movl	-24040(%rbp), %edx
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24040(%rbp)
.L2:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L3
	movl	$1, -24040(%rbp)
	jmp	.L4
.L19:
	leaq	-24044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -24036(%rbp)
	jmp	.L6
.L7:
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -24032(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L6:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L7
	movl	$1, -24036(%rbp)
	jmp	.L8
.L10:
	movl	-24036(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	addl	$1, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L9:
	addl	$1, -24036(%rbp)
.L8:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L10
	movl	$1, -24036(%rbp)
	jmp	.L11
.L13:
	movl	-24036(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	-24036(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-24052(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-24032(%rbp,%rax,4), %edx
	movl	-24036(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
.L12:
	addl	$1, -24036(%rbp)
.L11:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L13
.L5:
	movl	-24044(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$1, -24036(%rbp)
	jmp	.L15
.L16:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24036(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L15:
	movl	-24044(%rbp), %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L16
	movl	-24044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24036(%rbp)
	jmp	.L17
.L18:
	movl	-24044(%rbp), %edx
	movl	-24036(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-24036(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -24036(%rbp)
.L17:
	movl	-24052(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-24044(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24036(%rbp)
	jle	.L18
.L14:
	addl	$1, -24040(%rbp)
.L4:
	movl	-24048(%rbp), %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L19
	movl	$1, -24040(%rbp)
	jmp	.L20
.L21:
	movl	-24040(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -24040(%rbp)
.L20:
	movl	-24052(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -24040(%rbp)
	jle	.L21
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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:
