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 a[2000],b[1000],n,m,k,card[2000],x,y,z,i,s;
	scanf("%d %d",&n,&m);
	for(x=0;x<n*2;x++){
		a[x]=x+1;
	}
	for(x=0;x<m;x++){
		scanf("%d",&k);
		i=2*n-k;
		if(k>=1 && k<=2*n-1){
			for(y=0;y<i;y++){
				card[y]=a[k+y];
			}
			for(y=0;y<k;y++){
				card[i]=a[y];
				++i;
			}}
		else if(k==0){
			s=1;
			for(y=0;y<n;y++){
				b[y]=a[n+y];
				card[s-1]=a[y];
				card[s]=b[y];
				s+=2;
			}}
		for(y=0;y<2*n;y++){
			a[y]=card[y];
		}}
	for(x=0;x<2*n;x++){
		printf("%d\n",a[x]);
	}
	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	-16384(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20040(%rbp), %rdx
	leaq	-20044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20032(%rbp)
	jmp	.L2
.L3:
	movl	-20032(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20032(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20032(%rbp)
.L2:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L3
	movl	$0, -20032(%rbp)
	jmp	.L4
.L15:
	leaq	-20036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	movl	-20036(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -20024(%rbp)
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	movl	-20044(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-20036(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, -20028(%rbp)
	jmp	.L6
.L7:
	movl	-20036(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L6:
	movl	-20028(%rbp), %eax
	cmpl	-20024(%rbp), %eax
	jl	.L7
	movl	$0, -20028(%rbp)
	jmp	.L8
.L9:
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20024(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20024(%rbp)
	addl	$1, -20028(%rbp)
.L8:
	movl	-20036(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L9
	jmp	.L10
.L5:
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$1, -20020(%rbp)
	movl	$0, -20028(%rbp)
	jmp	.L11
.L12:
	movl	-20044(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -20016(%rbp,%rax,4)
	movl	-20020(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -8016(%rbp,%rax,4)
	movl	-20028(%rbp), %eax
	cltq
	movl	-20016(%rbp,%rax,4), %edx
	movl	-20020(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$2, -20020(%rbp)
	addl	$1, -20028(%rbp)
.L11:
	movl	-20044(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L12
.L10:
	movl	$0, -20028(%rbp)
	jmp	.L13
.L14:
	movl	-20028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L13:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L14
	addl	$1, -20032(%rbp)
.L4:
	movl	-20040(%rbp), %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L15
	movl	$0, -20032(%rbp)
	jmp	.L16
.L17:
	movl	-20032(%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, -20032(%rbp)
.L16:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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"
.LC4:
	.string	"%d"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3784, %rsp
	.cfi_def_cfa_offset 16128
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 16056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rdx
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC2(%rip), %xmm3
	leaq	48(%rsp), %rax
	shrl	$2, %ecx
	movdqa	.LC3(%rip), %xmm2
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	64(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addq	$16, %rax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %eax
	andl	$-4, %eax
	testb	$3, %dl
	je	.L5
.L3:
	leal	1(%rax), %ecx
	movslq	%eax, %rsi
	movl	%ecx, 48(%rsp,%rsi,4)
	cmpl	%ecx, %edx
	jle	.L5
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movl	%esi, 48(%rsp,%rcx,4)
	cmpl	%edx, %esi
	jge	.L5
	movslq	%esi, %rsi
	addl	$3, %eax
	movl	%eax, 48(%rsp,%rsi,4)
.L5:
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
.L22:
	xorl	%ebx, %ebx
	leaq	44(%rsp), %r12
	leaq	.LC4(%rip), %rbp
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L40:
	cmpl	%eax, %ecx
	jg	.L38
.L7:
	leaq	48(%rsp), %r13
	leaq	8048(%rsp), %r14
	testl	%ecx, %ecx
	jle	.L18
.L9:
	leal	-1(%rcx), %eax
	testl	%ecx, %ecx
	movq	%r14, %rsi
	movq	%r13, %rdi
	leaq	4(,%rax,4), %rdx
	movl	$4, %eax
	cmovle	%rax, %rdx
	call	memcpy@PLT
.L18:
	addl	$1, %ebx
	cmpl	%ebx, 40(%rsp)
	jle	.L39
.L11:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %r15d
	movl	44(%rsp), %eax
	leal	(%r15,%r15), %ecx
	testl	%eax, %eax
	jg	.L40
	jne	.L7
	testl	%r15d, %r15d
	jle	.L7
	leal	-1(%r15), %edx
	cmpl	$2, %edx
	jbe	.L25
	movl	%r15d, %edx
	movslq	%r15d, %rax
	leaq	48(%rsp), %r13
	shrl	$2, %edx
	leaq	0(%r13,%rax,4), %rsi
	leaq	8048(%rsp), %r14
	xorl	%eax, %eax
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movdqa	0(%r13,%rax), %xmm0
	movdqu	(%rsi,%rax), %xmm1
	movdqa	%xmm0, %xmm2
	punpckhdq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movaps	%xmm0, 16(%r14,%rax,2)
	movaps	%xmm2, (%r14,%rax,2)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L14
	movl	%r15d, %esi
	andl	$-4, %esi
	movl	%esi, %eax
	leal	1(%rsi,%rsi), %edx
	cmpl	%r15d, %esi
	je	.L7
.L13:
	movl	%r15d, %edi
	subl	%esi, %edi
	cmpl	$1, %edi
	je	.L16
	movslq	%r15d, %r8
	movq	48(%rsp,%rsi,4), %xmm0
	leaq	(%r14,%rsi,8), %r9
	addq	%rsi, %r8
	movl	%edi, %esi
	movq	48(%rsp,%r8,4), %xmm1
	movdqa	%xmm0, %xmm2
	andl	$-2, %esi
	addl	%esi, %eax
	leal	(%rdx,%rsi,2), %edx
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	pshufd	$14, %xmm0, %xmm0
	movq	%xmm2, (%r9)
	movq	%xmm0, 8(%r9)
	cmpl	%esi, %edi
	je	.L7
.L16:
	movslq	%eax, %rsi
	addl	%r15d, %eax
	cltq
	movd	48(%rsp,%rsi,4), %xmm0
	movl	48(%rsp,%rax,4), %eax
	movd	%eax, %xmm4
	leal	-1(%rdx), %eax
	punpckldq	%xmm4, %xmm0
	cltq
	movq	%xmm0, (%r14,%rax,4)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L38:
	movl	%ecx, %edx
	subl	%eax, %edx
	testl	%edx, %edx
	jle	.L41
	movslq	%edx, %r10
	movslq	%eax, %r9
	leaq	48(%rsp), %r13
	movl	%ecx, 28(%rsp)
	leaq	8048(%rsp), %r14
	leaq	0(%r13,%r9,4), %rsi
	movq	%r10, 16(%rsp)
	leaq	0(,%r10,4), %rdx
	movq	%r14, %rdi
	movq	%r9, 8(%rsp)
	call	memcpy@PLT
	movq	8(%rsp), %r9
	movq	16(%rsp), %r10
	movl	28(%rsp), %ecx
.L10:
	leaq	(%r14,%r10,4), %rdi
	leaq	0(,%r9,4), %rdx
	movq	%r13, %rsi
	movl	%ecx, 8(%rsp)
	call	memcpy@PLT
	movl	8(%rsp), %ecx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%r15d, %r15d
	jle	.L21
.L19:
	xorl	%ebx, %ebx
	leaq	48(%rsp), %r13
	leaq	.LC5(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movl	0(%r13,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	36(%rsp), %eax
	addl	%eax, %eax
	cmpl	%ebx, %eax
	jg	.L20
.L21:
	movq	16056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$16072, %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
.L25:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$1, %edx
	leaq	8048(%rsp), %r14
	jmp	.L13
.L41:
	leaq	48(%rsp), %r13
	leaq	8048(%rsp), %r14
	movslq	%edx, %r10
	movslq	%eax, %r9
	jmp	.L10
.L2:
	cmpl	$0, 40(%rsp)
	jg	.L22
	jmp	.L21
.L24:
	xorl	%eax, %eax
	jmp	.L3
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC4:
	.string	"%d"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3784, %rsp
	.cfi_def_cfa_offset 16128
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 16056(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rdx
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L2
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC2(%rip), %xmm3
	leaq	48(%rsp), %rax
	shrl	$2, %ecx
	movdqa	.LC3(%rip), %xmm2
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	64(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addq	$16, %rax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %eax
	andl	$-4, %eax
	testb	$3, %dl
	je	.L5
.L3:
	leal	1(%rax), %ecx
	movslq	%eax, %rsi
	movl	%ecx, 48(%rsp,%rsi,4)
	cmpl	%ecx, %edx
	jle	.L5
	leal	2(%rax), %esi
	movslq	%ecx, %rcx
	movl	%esi, 48(%rsp,%rcx,4)
	cmpl	%edx, %esi
	jge	.L5
	movslq	%esi, %rsi
	addl	$3, %eax
	movl	%eax, 48(%rsp,%rsi,4)
.L5:
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
.L22:
	xorl	%ebx, %ebx
	leaq	44(%rsp), %r12
	leaq	.LC4(%rip), %rbp
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L40:
	cmpl	%eax, %ecx
	jg	.L38
.L7:
	leaq	48(%rsp), %r13
	leaq	8048(%rsp), %r14
	testl	%ecx, %ecx
	jle	.L18
.L9:
	leal	-1(%rcx), %eax
	testl	%ecx, %ecx
	movq	%r14, %rsi
	movq	%r13, %rdi
	leaq	4(,%rax,4), %rdx
	movl	$4, %eax
	cmovle	%rax, %rdx
	call	memcpy@PLT
.L18:
	addl	$1, %ebx
	cmpl	%ebx, 40(%rsp)
	jle	.L39
.L11:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %r15d
	movl	44(%rsp), %eax
	leal	(%r15,%r15), %ecx
	testl	%eax, %eax
	jg	.L40
	jne	.L7
	testl	%r15d, %r15d
	jle	.L7
	leal	-1(%r15), %edx
	cmpl	$2, %edx
	jbe	.L25
	movl	%r15d, %edx
	movslq	%r15d, %rax
	leaq	48(%rsp), %r13
	shrl	$2, %edx
	leaq	0(%r13,%rax,4), %rsi
	leaq	8048(%rsp), %r14
	xorl	%eax, %eax
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L14:
	movdqa	0(%r13,%rax), %xmm0
	movdqu	(%rsi,%rax), %xmm1
	movdqa	%xmm0, %xmm2
	punpckhdq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movaps	%xmm0, 16(%r14,%rax,2)
	movaps	%xmm2, (%r14,%rax,2)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L14
	movl	%r15d, %esi
	andl	$-4, %esi
	movl	%esi, %eax
	leal	1(%rsi,%rsi), %edx
	cmpl	%r15d, %esi
	je	.L7
.L13:
	movl	%r15d, %edi
	subl	%esi, %edi
	cmpl	$1, %edi
	je	.L16
	movslq	%r15d, %r8
	movq	48(%rsp,%rsi,4), %xmm0
	leaq	(%r14,%rsi,8), %r9
	addq	%rsi, %r8
	movl	%edi, %esi
	movq	48(%rsp,%r8,4), %xmm1
	movdqa	%xmm0, %xmm2
	andl	$-2, %esi
	addl	%esi, %eax
	leal	(%rdx,%rsi,2), %edx
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	pshufd	$14, %xmm0, %xmm0
	movq	%xmm2, (%r9)
	movq	%xmm0, 8(%r9)
	cmpl	%esi, %edi
	je	.L7
.L16:
	movslq	%eax, %rsi
	addl	%r15d, %eax
	cltq
	movd	48(%rsp,%rsi,4), %xmm0
	movl	48(%rsp,%rax,4), %eax
	movd	%eax, %xmm4
	leal	-1(%rdx), %eax
	punpckldq	%xmm4, %xmm0
	cltq
	movq	%xmm0, (%r14,%rax,4)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L38:
	movl	%ecx, %edx
	subl	%eax, %edx
	testl	%edx, %edx
	jle	.L41
	movslq	%edx, %r10
	movslq	%eax, %r9
	leaq	48(%rsp), %r13
	movl	%ecx, 28(%rsp)
	leaq	8048(%rsp), %r14
	leaq	0(%r13,%r9,4), %rsi
	movq	%r10, 16(%rsp)
	leaq	0(,%r10,4), %rdx
	movq	%r14, %rdi
	movq	%r9, 8(%rsp)
	call	memcpy@PLT
	movq	8(%rsp), %r9
	movq	16(%rsp), %r10
	movl	28(%rsp), %ecx
.L10:
	leaq	(%r14,%r10,4), %rdi
	leaq	0(,%r9,4), %rdx
	movq	%r13, %rsi
	movl	%ecx, 8(%rsp)
	call	memcpy@PLT
	movl	8(%rsp), %ecx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	testl	%r15d, %r15d
	jle	.L21
.L19:
	xorl	%ebx, %ebx
	leaq	48(%rsp), %r13
	leaq	.LC5(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L20:
	movl	0(%r13,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	36(%rsp), %eax
	addl	%eax, %eax
	cmpl	%ebx, %eax
	jg	.L20
.L21:
	movq	16056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$16072, %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
.L25:
	.cfi_restore_state
	xorl	%esi, %esi
	movl	$1, %edx
	leaq	8048(%rsp), %r14
	jmp	.L13
.L41:
	leaq	48(%rsp), %r13
	leaq	8048(%rsp), %r14
	movslq	%edx, %r10
	movslq	%eax, %r9
	jmp	.L10
.L2:
	cmpl	$0, 40(%rsp)
	jg	.L22
	jmp	.L21
.L24:
	xorl	%eax, %eax
	jmp	.L3
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 a[2000],b[1000],n,m,k,card[2000],x,y,z,i,s;
	scanf("%d %d",&n,&m);
	for(x=0;x<n*2;x++){
		a[x]=x+1;
	}
	for(x=0;x<m;x++){
		scanf("%d",&k);
		i=2*n-k;
		if(k>=1 && k<=2*n-1){
			for(y=0;y<i;y++){
				card[y]=a[k+y];
			}
			for(y=0;y<k;y++){
				card[i]=a[y];
				++i;
			}}
		else if(k==0){
			s=1;
			for(y=0;y<n;y++){
				b[y]=a[n+y];
				card[s-1]=a[y];
				card[s]=b[y];
				s+=2;
			}}
		for(y=0;y<2*n;y++){
			a[y]=card[y];
		}}
	for(x=0;x<2*n;x++){
		printf("%d\n",a[x]);
	}
	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 a[2000],b[1000],n,m,k,card[2000],x,y,z,i,s;
	scanf("%d %d",&n,&m);
	for(x=0;x<n*2;x++){
		a[x]=x+1;
	}
	for(x=0;x<m;x++){
		scanf("%d",&k);
		i=2*n-k;
		if(k>=1 && k<=2*n-1){
			for(y=0;y<i;y++){
				card[y]=a[k+y];
			}
			for(y=0;y<k;y++){
				card[i]=a[y];
				++i;
			}}
		else if(k==0){
			s=1;
			for(y=0;y<n;y++){
				b[y]=a[n+y];
				card[s-1]=a[y];
				card[s]=b[y];
				s+=2;
			}}
		for(y=0;y<2*n;y++){
			a[y]=card[y];
		}}
	for(x=0;x<2*n;x++){
		printf("%d\n",a[x]);
	}
	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	-16384(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20040(%rbp), %rdx
	leaq	-20044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20032(%rbp)
	jmp	.L2
.L3:
	movl	-20032(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20032(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20032(%rbp)
.L2:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L3
	movl	$0, -20032(%rbp)
	jmp	.L4
.L15:
	leaq	-20036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	movl	-20036(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -20024(%rbp)
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	movl	-20044(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-20036(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, -20028(%rbp)
	jmp	.L6
.L7:
	movl	-20036(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L6:
	movl	-20028(%rbp), %eax
	cmpl	-20024(%rbp), %eax
	jl	.L7
	movl	$0, -20028(%rbp)
	jmp	.L8
.L9:
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20024(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20024(%rbp)
	addl	$1, -20028(%rbp)
.L8:
	movl	-20036(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L9
	jmp	.L10
.L5:
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$1, -20020(%rbp)
	movl	$0, -20028(%rbp)
	jmp	.L11
.L12:
	movl	-20044(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -20016(%rbp,%rax,4)
	movl	-20020(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -8016(%rbp,%rax,4)
	movl	-20028(%rbp), %eax
	cltq
	movl	-20016(%rbp,%rax,4), %edx
	movl	-20020(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$2, -20020(%rbp)
	addl	$1, -20028(%rbp)
.L11:
	movl	-20044(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L12
.L10:
	movl	$0, -20028(%rbp)
	jmp	.L13
.L14:
	movl	-20028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L13:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L14
	addl	$1, -20032(%rbp)
.L4:
	movl	-20040(%rbp), %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L15
	movl	$0, -20032(%rbp)
	jmp	.L16
.L17:
	movl	-20032(%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, -20032(%rbp)
.L16:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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	-16384(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20040(%rbp), %rdx
	leaq	-20044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -20032(%rbp)
	jmp	.L2
.L3:
	movl	-20032(%rbp), %eax
	leal	1(%rax), %edx
	movl	-20032(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20032(%rbp)
.L2:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L3
	movl	$0, -20032(%rbp)
	jmp	.L4
.L15:
	leaq	-20036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	movl	-20036(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -20024(%rbp)
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jle	.L5
	movl	-20044(%rbp), %eax
	leal	(%rax,%rax), %edx
	movl	-20036(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, -20028(%rbp)
	jmp	.L6
.L7:
	movl	-20036(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L6:
	movl	-20028(%rbp), %eax
	cmpl	-20024(%rbp), %eax
	jl	.L7
	movl	$0, -20028(%rbp)
	jmp	.L8
.L9:
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20024(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$1, -20024(%rbp)
	addl	$1, -20028(%rbp)
.L8:
	movl	-20036(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L9
	jmp	.L10
.L5:
	movl	-20036(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$1, -20020(%rbp)
	movl	$0, -20028(%rbp)
	jmp	.L11
.L12:
	movl	-20044(%rbp), %edx
	movl	-20028(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -20016(%rbp,%rax,4)
	movl	-20020(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-20028(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -8016(%rbp,%rax,4)
	movl	-20028(%rbp), %eax
	cltq
	movl	-20016(%rbp,%rax,4), %edx
	movl	-20020(%rbp), %eax
	cltq
	movl	%edx, -8016(%rbp,%rax,4)
	addl	$2, -20020(%rbp)
	addl	$1, -20028(%rbp)
.L11:
	movl	-20044(%rbp), %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L12
.L10:
	movl	$0, -20028(%rbp)
	jmp	.L13
.L14:
	movl	-20028(%rbp), %eax
	cltq
	movl	-8016(%rbp,%rax,4), %edx
	movl	-20028(%rbp), %eax
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -20028(%rbp)
.L13:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20028(%rbp)
	jl	.L14
	addl	$1, -20032(%rbp)
.L4:
	movl	-20040(%rbp), %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L15
	movl	$0, -20032(%rbp)
	jmp	.L16
.L17:
	movl	-20032(%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, -20032(%rbp)
.L16:
	movl	-20044(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20032(%rbp)
	jl	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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:
