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(){
	int n,m,i,j,k,l,o;
	int d[403];
	scanf("%d",&n);
	for(i=1;i<=2*n;i++)d[i]=i;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&k);
		int tmp[403],tmp2[403];
		if(!k){
			for(j=1;j<=n;j++){
				tmp[j]=d[j];
				tmp2[j]=d[j+n];
			}
			for(j=1,l=1;j<=2*n;j++){
				d[l++]=tmp[j];
				d[l++]=tmp2[j];
			}
		}
		else {
			l=2*n-k;
			for(j=1;j<=k || j<=l;j++){
				if(j<=k)tmp[j]=d[j];
				if(j<=l)d[j]=d[k+j];
			}
			for(j=l+1,l=1;j<=2*n;j++)d[j]=tmp[l++];
		}
	}
	for(j=1;j<=2*n;j++)printf("%d\n",d[j]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$800, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4888(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4876(%rbp)
	jmp	.L2
.L3:
	movl	-4876(%rbp), %eax
	cltq
	movl	-4876(%rbp), %edx
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4876(%rbp)
.L2:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4876(%rbp)
	jle	.L3
	leaq	-4884(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4876(%rbp)
	jmp	.L4
.L17:
	leaq	-4880(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4880(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -4872(%rbp)
	jmp	.L6
.L7:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
	movl	-4888(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -1632(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L6:
	movl	-4888(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L7
	movl	$1, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L8
.L9:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-3248(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1632(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L8:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L9
	jmp	.L10
.L5:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	movl	-4880(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4868(%rbp)
	movl	$1, -4872(%rbp)
	jmp	.L11
.L14:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jg	.L12
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
.L12:
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jg	.L13
	movl	-4880(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
.L13:
	addl	$1, -4872(%rbp)
.L11:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L14
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jle	.L14
	movl	-4868(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L15
.L16:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	cltq
	movl	-3248(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L15:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L16
.L10:
	addl	$1, -4876(%rbp)
.L4:
	movl	-4884(%rbp), %eax
	cmpl	%eax, -4876(%rbp)
	jl	.L17
	movl	$1, -4872(%rbp)
	jmp	.L18
.L19:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4872(%rbp)
.L18:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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"
.LC3:
	.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	$824, %rsp
	.cfi_def_cfa_offset 4976
	leaq	.LC1(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4904(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L8
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L34
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm0
	leaq	52(%rsp), %rax
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	68(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rax, %rcx
	jne	.L6
	movl	%edx, %ecx
	andl	$-4, %ecx
	leal	1(%rcx), %eax
	cmpl	%ecx, %edx
	je	.L8
.L5:
	movslq	%eax, %rcx
	movl	%eax, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L8
	movslq	%ecx, %rsi
	addl	$2, %eax
	movl	%ecx, 48(%rsp,%rsi,4)
	cmpl	%edx, %eax
	jg	.L8
	movslq	%eax, %rdx
	movl	%eax, 48(%rsp,%rdx,4)
.L8:
	leaq	40(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	leaq	44(%rsp), %rax
	leaq	1668(%rsp), %rbp
	movq	%rax, (%rsp)
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L55
	.p2align 4,,10
	.p2align 3
.L3:
	movq	(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r15d
	movl	36(%rsp), %r13d
	testl	%r15d, %r15d
	jne	.L10
	leal	(%r13,%r13), %r15d
	testl	%r13d, %r13d
	jle	.L11
	movslq	%r13d, %rcx
	leaq	52(%rsp), %rsi
	leaq	48(%rsp), %r14
	movq	%rbp, %rdi
	leaq	0(,%rcx,4), %rdx
	movq	%rcx, 16(%rsp)
	movq	%rdx, 8(%rsp)
	call	memcpy@PLT
	movq	16(%rsp), %rcx
	movq	8(%rsp), %rdx
	leaq	3284(%rsp), %rdi
	leaq	4(%r14,%rcx,4), %rsi
	call	memcpy@PLT
.L14:
	testl	%r15d, %r15d
	movl	$1, %ecx
	cmovg	%r15d, %ecx
	cmpl	$3, %r15d
	jle	.L35
	movl	%ecx, %eax
	leaq	1664(%rsp), %rdi
	shrl	$2, %eax
	leaq	3280(%rsp), %rsi
	leal	-1(%rax), %edx
	movl	$4, %eax
	salq	$4, %rdx
	addq	$20, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rdi,%rax), %xmm0
	movdqu	(%rsi,%rax), %xmm3
	movdqa	%xmm0, %xmm1
	punpckhdq	%xmm3, %xmm0
	punpckldq	%xmm3, %xmm1
	movups	%xmm0, 12(%r14,%rax,2)
	movups	%xmm1, -4(%r14,%rax,2)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L13
	movl	%ecx, %esi
	andl	$-4, %esi
	leal	1(%rsi), %eax
	leal	1(%rsi,%rsi), %edx
	cmpl	%esi, %ecx
	je	.L15
.L12:
	subl	%esi, %ecx
	cmpl	$1, %ecx
	je	.L17
	leaq	4(,%rsi,4), %rdi
	leaq	4(%r14,%rsi,8), %rsi
	movq	1664(%rsp,%rdi), %xmm0
	movq	3280(%rsp,%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	pshufd	$14, %xmm0, %xmm0
	movq	%xmm2, (%rsi)
	movq	%xmm0, 8(%rsi)
	movl	%ecx, %esi
	andl	$-2, %esi
	addl	%esi, %eax
	leal	(%rdx,%rsi,2), %edx
	cmpl	%esi, %ecx
	je	.L15
.L17:
	cltq
	movd	1664(%rsp,%rax,4), %xmm0
	movd	3280(%rsp,%rax,4), %xmm5
	movslq	%edx, %rax
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%r14,%rax,4)
.L15:
	addl	$1, %ebx
	cmpl	%ebx, 40(%rsp)
	jg	.L3
.L29:
	movl	$1, %ebx
	leaq	48(%rsp), %r14
	leaq	.LC3(%rip), %rbp
	testl	%r13d, %r13d
	jle	.L31
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r14,%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
	jge	.L30
.L31:
	movq	4904(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$4920, %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
.L10:
	.cfi_restore_state
	leal	(%r13,%r13), %r8d
	movl	%r8d, %r14d
	subl	%r15d, %r14d
	testl	%r14d, %r14d
	jg	.L20
	testl	%r15d, %r15d
	jle	.L25
.L20:
	cmpl	%r14d, %r15d
	movl	%r14d, %ecx
	cmovge	%r15d, %ecx
	testl	%r15d, %r15d
	jle	.L36
	movslq	%r15d, %rdx
	leaq	52(%rsp), %rsi
	movq	%rbp, %rdi
	movl	%r8d, 28(%rsp)
	salq	$2, %rdx
	movl	%ecx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	memcpy@PLT
	movq	8(%rsp), %rdx
	movl	28(%rsp), %r8d
	leal	1(%r15), %edi
	movl	16(%rsp), %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L24:
	cmpl	%eax, %r14d
	jl	.L23
	leal	(%rax,%r15), %esi
	movslq	%esi, %rsi
	movl	48(%rsp,%rsi,4), %esi
	movl	%esi, (%rdx)
.L23:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%edi, %eax
	jne	.L24
	cmpl	%eax, %ecx
	jl	.L25
.L22:
	cltq
	.p2align 4,,10
	.p2align 3
.L27:
	cmpl	%eax, %r14d
	jl	.L26
	leal	(%r15,%rax), %edx
	movslq	%edx, %rdx
	movl	48(%rsp,%rdx,4), %edx
	movl	%edx, 48(%rsp,%rax,4)
.L26:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jge	.L27
.L25:
	leal	1(%r14), %eax
	cmpl	%eax, %r8d
	jl	.L15
	subl	$1, %r8d
	cltq
	movq	%rbp, %rsi
	subl	%r14d, %r8d
	leaq	48(%rsp,%rax,4), %rdi
	leaq	4(,%r8,4), %rdx
	call	memcpy@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	jmp	.L22
.L11:
	leaq	48(%rsp), %r14
	testl	%r15d, %r15d
	jle	.L15
	jmp	.L14
.L35:
	xorl	%esi, %esi
	movl	$1, %edx
	movl	$1, %eax
	jmp	.L12
.L55:
	movl	36(%rsp), %r13d
	jmp	.L29
.L34:
	movl	$1, %eax
	jmp	.L5
.L56:
	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"
.LC3:
	.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	$824, %rsp
	.cfi_def_cfa_offset 4976
	leaq	.LC1(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4904(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %eax
	leal	(%rax,%rax), %edx
	testl	%edx, %edx
	jle	.L8
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L34
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm0
	leaq	52(%rsp), %rax
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	68(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rax, %rcx
	jne	.L6
	movl	%edx, %ecx
	andl	$-4, %ecx
	leal	1(%rcx), %eax
	cmpl	%ecx, %edx
	je	.L8
.L5:
	movslq	%eax, %rcx
	movl	%eax, 48(%rsp,%rcx,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jl	.L8
	movslq	%ecx, %rsi
	addl	$2, %eax
	movl	%ecx, 48(%rsp,%rsi,4)
	cmpl	%edx, %eax
	jg	.L8
	movslq	%eax, %rdx
	movl	%eax, 48(%rsp,%rdx,4)
.L8:
	leaq	40(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	call	__isoc99_scanf@PLT
	leaq	44(%rsp), %rax
	leaq	1668(%rsp), %rbp
	movq	%rax, (%rsp)
	movl	40(%rsp), %eax
	testl	%eax, %eax
	jle	.L55
	.p2align 4,,10
	.p2align 3
.L3:
	movq	(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r15d
	movl	36(%rsp), %r13d
	testl	%r15d, %r15d
	jne	.L10
	leal	(%r13,%r13), %r15d
	testl	%r13d, %r13d
	jle	.L11
	movslq	%r13d, %rcx
	leaq	52(%rsp), %rsi
	leaq	48(%rsp), %r14
	movq	%rbp, %rdi
	leaq	0(,%rcx,4), %rdx
	movq	%rcx, 16(%rsp)
	movq	%rdx, 8(%rsp)
	call	memcpy@PLT
	movq	16(%rsp), %rcx
	movq	8(%rsp), %rdx
	leaq	3284(%rsp), %rdi
	leaq	4(%r14,%rcx,4), %rsi
	call	memcpy@PLT
.L14:
	testl	%r15d, %r15d
	movl	$1, %ecx
	cmovg	%r15d, %ecx
	cmpl	$3, %r15d
	jle	.L35
	movl	%ecx, %eax
	leaq	1664(%rsp), %rdi
	shrl	$2, %eax
	leaq	3280(%rsp), %rsi
	leal	-1(%rax), %edx
	movl	$4, %eax
	salq	$4, %rdx
	addq	$20, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rdi,%rax), %xmm0
	movdqu	(%rsi,%rax), %xmm3
	movdqa	%xmm0, %xmm1
	punpckhdq	%xmm3, %xmm0
	punpckldq	%xmm3, %xmm1
	movups	%xmm0, 12(%r14,%rax,2)
	movups	%xmm1, -4(%r14,%rax,2)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L13
	movl	%ecx, %esi
	andl	$-4, %esi
	leal	1(%rsi), %eax
	leal	1(%rsi,%rsi), %edx
	cmpl	%esi, %ecx
	je	.L15
.L12:
	subl	%esi, %ecx
	cmpl	$1, %ecx
	je	.L17
	leaq	4(,%rsi,4), %rdi
	leaq	4(%r14,%rsi,8), %rsi
	movq	1664(%rsp,%rdi), %xmm0
	movq	3280(%rsp,%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	pshufd	$14, %xmm0, %xmm0
	movq	%xmm2, (%rsi)
	movq	%xmm0, 8(%rsi)
	movl	%ecx, %esi
	andl	$-2, %esi
	addl	%esi, %eax
	leal	(%rdx,%rsi,2), %edx
	cmpl	%esi, %ecx
	je	.L15
.L17:
	cltq
	movd	1664(%rsp,%rax,4), %xmm0
	movd	3280(%rsp,%rax,4), %xmm5
	movslq	%edx, %rax
	punpckldq	%xmm5, %xmm0
	movq	%xmm0, (%r14,%rax,4)
.L15:
	addl	$1, %ebx
	cmpl	%ebx, 40(%rsp)
	jg	.L3
.L29:
	movl	$1, %ebx
	leaq	48(%rsp), %r14
	leaq	.LC3(%rip), %rbp
	testl	%r13d, %r13d
	jle	.L31
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r14,%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
	jge	.L30
.L31:
	movq	4904(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$4920, %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
.L10:
	.cfi_restore_state
	leal	(%r13,%r13), %r8d
	movl	%r8d, %r14d
	subl	%r15d, %r14d
	testl	%r14d, %r14d
	jg	.L20
	testl	%r15d, %r15d
	jle	.L25
.L20:
	cmpl	%r14d, %r15d
	movl	%r14d, %ecx
	cmovge	%r15d, %ecx
	testl	%r15d, %r15d
	jle	.L36
	movslq	%r15d, %rdx
	leaq	52(%rsp), %rsi
	movq	%rbp, %rdi
	movl	%r8d, 28(%rsp)
	salq	$2, %rdx
	movl	%ecx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	memcpy@PLT
	movq	8(%rsp), %rdx
	movl	28(%rsp), %r8d
	leal	1(%r15), %edi
	movl	16(%rsp), %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L24:
	cmpl	%eax, %r14d
	jl	.L23
	leal	(%rax,%r15), %esi
	movslq	%esi, %rsi
	movl	48(%rsp,%rsi,4), %esi
	movl	%esi, (%rdx)
.L23:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%edi, %eax
	jne	.L24
	cmpl	%eax, %ecx
	jl	.L25
.L22:
	cltq
	.p2align 4,,10
	.p2align 3
.L27:
	cmpl	%eax, %r14d
	jl	.L26
	leal	(%r15,%rax), %edx
	movslq	%edx, %rdx
	movl	48(%rsp,%rdx,4), %edx
	movl	%edx, 48(%rsp,%rax,4)
.L26:
	addq	$1, %rax
	cmpl	%eax, %ecx
	jge	.L27
.L25:
	leal	1(%r14), %eax
	cmpl	%eax, %r8d
	jl	.L15
	subl	$1, %r8d
	cltq
	movq	%rbp, %rsi
	subl	%r14d, %r8d
	leaq	48(%rsp,%rax,4), %rdi
	leaq	4(,%r8,4), %rdx
	call	memcpy@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L36:
	movl	$1, %eax
	jmp	.L22
.L11:
	leaq	48(%rsp), %r14
	testl	%r15d, %r15d
	jle	.L15
	jmp	.L14
.L35:
	xorl	%esi, %esi
	movl	$1, %edx
	movl	$1, %eax
	jmp	.L12
.L55:
	movl	36(%rsp), %r13d
	jmp	.L29
.L34:
	movl	$1, %eax
	jmp	.L5
.L56:
	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(){
	int n,m,i,j,k,l,o;
	int d[403];
	scanf("%d",&n);
	for(i=1;i<=2*n;i++)d[i]=i;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&k);
		int tmp[403],tmp2[403];
		if(!k){
			for(j=1;j<=n;j++){
				tmp[j]=d[j];
				tmp2[j]=d[j+n];
			}
			for(j=1,l=1;j<=2*n;j++){
				d[l++]=tmp[j];
				d[l++]=tmp2[j];
			}
		}
		else {
			l=2*n-k;
			for(j=1;j<=k || j<=l;j++){
				if(j<=k)tmp[j]=d[j];
				if(j<=l)d[j]=d[k+j];
			}
			for(j=l+1,l=1;j<=2*n;j++)d[j]=tmp[l++];
		}
	}
	for(j=1;j<=2*n;j++)printf("%d\n",d[j]);
	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(){
	int n,m,i,j,k,l,o;
	int d[403];
	scanf("%d",&n);
	for(i=1;i<=2*n;i++)d[i]=i;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&k);
		int tmp[403],tmp2[403];
		if(!k){
			for(j=1;j<=n;j++){
				tmp[j]=d[j];
				tmp2[j]=d[j+n];
			}
			for(j=1,l=1;j<=2*n;j++){
				d[l++]=tmp[j];
				d[l++]=tmp2[j];
			}
		}
		else {
			l=2*n-k;
			for(j=1;j<=k || j<=l;j++){
				if(j<=k)tmp[j]=d[j];
				if(j<=l)d[j]=d[k+j];
			}
			for(j=l+1,l=1;j<=2*n;j++)d[j]=tmp[l++];
		}
	}
	for(j=1;j<=2*n;j++)printf("%d\n",d[j]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$800, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4888(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4876(%rbp)
	jmp	.L2
.L3:
	movl	-4876(%rbp), %eax
	cltq
	movl	-4876(%rbp), %edx
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4876(%rbp)
.L2:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4876(%rbp)
	jle	.L3
	leaq	-4884(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4876(%rbp)
	jmp	.L4
.L17:
	leaq	-4880(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4880(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -4872(%rbp)
	jmp	.L6
.L7:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
	movl	-4888(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -1632(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L6:
	movl	-4888(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L7
	movl	$1, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L8
.L9:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-3248(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1632(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L8:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L9
	jmp	.L10
.L5:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	movl	-4880(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4868(%rbp)
	movl	$1, -4872(%rbp)
	jmp	.L11
.L14:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jg	.L12
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
.L12:
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jg	.L13
	movl	-4880(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
.L13:
	addl	$1, -4872(%rbp)
.L11:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L14
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jle	.L14
	movl	-4868(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L15
.L16:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	cltq
	movl	-3248(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L15:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L16
.L10:
	addl	$1, -4876(%rbp)
.L4:
	movl	-4884(%rbp), %eax
	cmpl	%eax, -4876(%rbp)
	jl	.L17
	movl	$1, -4872(%rbp)
	jmp	.L18
.L19:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4872(%rbp)
.L18:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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"
.LC1:
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$800, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4888(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -4876(%rbp)
	jmp	.L2
.L3:
	movl	-4876(%rbp), %eax
	cltq
	movl	-4876(%rbp), %edx
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4876(%rbp)
.L2:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4876(%rbp)
	jle	.L3
	leaq	-4884(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4876(%rbp)
	jmp	.L4
.L17:
	leaq	-4880(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4880(%rbp), %eax
	testl	%eax, %eax
	jne	.L5
	movl	$1, -4872(%rbp)
	jmp	.L6
.L7:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
	movl	-4888(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -1632(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L6:
	movl	-4888(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L7
	movl	$1, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L8
.L9:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-3248(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	movl	-4872(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1632(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L8:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L9
	jmp	.L10
.L5:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	movl	-4880(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -4868(%rbp)
	movl	$1, -4872(%rbp)
	jmp	.L11
.L14:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jg	.L12
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -3248(%rbp,%rax,4)
.L12:
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jg	.L13
	movl	-4880(%rbp), %edx
	movl	-4872(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-4864(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
.L13:
	addl	$1, -4872(%rbp)
.L11:
	movl	-4880(%rbp), %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L14
	movl	-4872(%rbp), %eax
	cmpl	-4868(%rbp), %eax
	jle	.L14
	movl	-4868(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4872(%rbp)
	movl	$1, -4868(%rbp)
	jmp	.L15
.L16:
	movl	-4868(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -4868(%rbp)
	cltq
	movl	-3248(%rbp,%rax,4), %edx
	movl	-4872(%rbp), %eax
	cltq
	movl	%edx, -4864(%rbp,%rax,4)
	addl	$1, -4872(%rbp)
.L15:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L16
.L10:
	addl	$1, -4876(%rbp)
.L4:
	movl	-4884(%rbp), %eax
	cmpl	%eax, -4876(%rbp)
	jl	.L17
	movl	$1, -4872(%rbp)
	jmp	.L18
.L19:
	movl	-4872(%rbp), %eax
	cltq
	movl	-4864(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4872(%rbp)
.L18:
	movl	-4888(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -4872(%rbp)
	jle	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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:
