Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#define N 1000

void swap(int a[],int x,int y){
	int temp=a[x];
	a[x]=a[y];
	a[y]=temp;
	return;
}

int main(){
	int n,q,i,b,e,t;
	int a[N];
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d %d",&b,&e,&t);
		for(int j=0;j<(e-b);j++){
			swap(a,b+j,t+j);
		}
	}
	
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[n-1]);
	
	return 0;
	
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap
	.type	swap, @function
swap:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap, .-swap
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4024(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4024(%rbp)
.L4:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L5
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L6
.L9:
	leaq	-4028(%rbp), %rcx
	leaq	-4032(%rbp), %rdx
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4020(%rbp)
	jmp	.L7
.L8:
	movl	-4028(%rbp), %edx
	movl	-4020(%rbp), %eax
	addl	%eax, %edx
	movl	-4036(%rbp), %ecx
	movl	-4020(%rbp), %eax
	addl	%eax, %ecx
	leaq	-4016(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	swap
	addl	$1, -4020(%rbp)
.L7:
	movl	-4032(%rbp), %eax
	movl	-4036(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -4020(%rbp)
	jl	.L8
	addl	$1, -4024(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L9
	movl	$0, -4024(%rbp)
	jmp	.L10
.L11:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4024(%rbp)
.L10:
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L11
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	swap
	.type	swap, @function
swap:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	leaq	(%rdi,%rsi,4), %rcx
	leaq	(%rdi,%rdx,4), %rax
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movl	%edx, (%rcx)
	movl	%esi, (%rax)
	ret
	.cfi_endproc
.LFE23:
	.size	swap, .-swap
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4056, %rsp
	.cfi_def_cfa_offset 4112
	movq	%fs:40, %rax
	movq	%rax, 4040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L4
	leaq	32(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, 12(%rsp)
	jg	.L5
.L4:
	leaq	16(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %r12
	leaq	20(%rsp), %rbp
	leaq	.LC1(%rip), %rbx
	leaq	32(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rcx
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	24(%rsp), %edi
	subl	%ecx, %edi
	testl	%edi, %edi
	jle	.L7
	movslq	28(%rsp), %r8
	movslq	%ecx, %r9
	leaq	0(,%r9,4), %rdx
	leaq	16(%rdx), %r11
	leaq	0(,%r8,4), %r10
	movq	%r8, %rsi
	leaq	16(,%r8,4), %rax
	cmpq	%r11, %r10
	setge	%r11b
	cmpq	%rax, %rdx
	setge	%al
	orb	%r11b, %al
	je	.L8
	cmpl	$1, %edi
	je	.L8
	leal	-1(%rdi), %eax
	movl	%edi, %r11d
	cmpl	$2, %eax
	jbe	.L20
	shrl	$2, %r11d
	addq	%r14, %rdx
	addq	%r14, %r10
	xorl	%eax, %eax
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rdx,%rax), %xmm0
	movdqu	(%r10,%rax), %xmm1
	movups	%xmm1, (%rdx,%rax)
	movups	%xmm0, (%r10,%rax)
	addq	$16, %rax
	cmpq	%rax, %r11
	jne	.L10
	movl	%edi, %eax
	andl	$-4, %eax
	movl	%eax, %r10d
	cmpl	%eax, %edi
	je	.L7
	subl	%eax, %edi
	movl	%edi, %r11d
	cmpl	$1, %edi
	je	.L12
.L9:
	addq	%rax, %r9
	addq	%r8, %rax
	leaq	(%r14,%rax,4), %rax
	leaq	(%r14,%r9,4), %rdx
	movq	(%rax), %r8
	movq	(%rdx), %rdi
	movq	%r8, (%rdx)
	movq	%rdi, (%rax)
	movl	%r11d, %eax
	andl	$-2, %eax
	addl	%eax, %r10d
	cmpl	%eax, %r11d
	je	.L7
.L12:
	leal	(%rcx,%r10), %eax
	cltq
	leaq	(%r14,%rax,4), %rdx
	leal	(%rsi,%r10), %eax
	cltq
	movl	(%rdx), %ecx
	leaq	(%r14,%rax,4), %rax
	movl	(%rax), %esi
	movl	%esi, (%rdx)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %r15d
	cmpl	%r15d, 16(%rsp)
	jg	.L16
.L6:
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L17
	xorl	%ebx, %ebx
	leaq	32(%rsp), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%r12,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%ebx, %eax
	jg	.L18
.L17:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	32(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	4040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$4056, %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
.L8:
	.cfi_restore_state
	leaq	(%r14,%rdx), %rax
	leal	-1(%rdi), %edx
	subq	%r9, %r8
	addq	%r9, %rdx
	leaq	36(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rax), %edx
	movl	(%rax,%r8,4), %ecx
	movl	%ecx, (%rax)
	movl	%edx, (%rax,%r8,4)
	addq	$4, %rax
	cmpq	%rsi, %rax
	jne	.L14
	jmp	.L7
.L20:
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	jmp	.L9
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	swap
	.type	swap, @function
swap:
.LFB23:
	.cfi_startproc
	endbr64
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	leaq	(%rdi,%rsi,4), %rcx
	leaq	(%rdi,%rdx,4), %rax
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movl	%edx, (%rcx)
	movl	%esi, (%rax)
	ret
	.cfi_endproc
.LFE23:
	.size	swap, .-swap
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$4056, %rsp
	.cfi_def_cfa_offset 4112
	movq	%fs:40, %rax
	movq	%rax, 4040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L4
	leaq	32(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$4, %rbp
	cmpl	%ebx, 12(%rsp)
	jg	.L5
.L4:
	leaq	16(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	xorl	%r15d, %r15d
	leaq	28(%rsp), %r13
	leaq	24(%rsp), %r12
	leaq	20(%rsp), %rbp
	leaq	.LC1(%rip), %rbx
	leaq	32(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rcx
	movq	%rbx, %rdi
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ecx
	movl	24(%rsp), %edi
	subl	%ecx, %edi
	testl	%edi, %edi
	jle	.L7
	movslq	28(%rsp), %r8
	movslq	%ecx, %r9
	leaq	0(,%r9,4), %rdx
	leaq	16(%rdx), %r11
	leaq	0(,%r8,4), %r10
	movq	%r8, %rsi
	leaq	16(,%r8,4), %rax
	cmpq	%r11, %r10
	setge	%r11b
	cmpq	%rax, %rdx
	setge	%al
	orb	%r11b, %al
	je	.L8
	cmpl	$1, %edi
	je	.L8
	leal	-1(%rdi), %eax
	movl	%edi, %r11d
	cmpl	$2, %eax
	jbe	.L20
	shrl	$2, %r11d
	addq	%r14, %rdx
	addq	%r14, %r10
	xorl	%eax, %eax
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rdx,%rax), %xmm0
	movdqu	(%r10,%rax), %xmm1
	movups	%xmm1, (%rdx,%rax)
	movups	%xmm0, (%r10,%rax)
	addq	$16, %rax
	cmpq	%rax, %r11
	jne	.L10
	movl	%edi, %eax
	andl	$-4, %eax
	movl	%eax, %r10d
	cmpl	%eax, %edi
	je	.L7
	subl	%eax, %edi
	movl	%edi, %r11d
	cmpl	$1, %edi
	je	.L12
.L9:
	addq	%rax, %r9
	addq	%r8, %rax
	leaq	(%r14,%rax,4), %rax
	leaq	(%r14,%r9,4), %rdx
	movq	(%rax), %r8
	movq	(%rdx), %rdi
	movq	%r8, (%rdx)
	movq	%rdi, (%rax)
	movl	%r11d, %eax
	andl	$-2, %eax
	addl	%eax, %r10d
	cmpl	%eax, %r11d
	je	.L7
.L12:
	leal	(%rcx,%r10), %eax
	cltq
	leaq	(%r14,%rax,4), %rdx
	leal	(%rsi,%r10), %eax
	cltq
	movl	(%rdx), %ecx
	leaq	(%r14,%rax,4), %rax
	movl	(%rax), %esi
	movl	%esi, (%rdx)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %r15d
	cmpl	%r15d, 16(%rsp)
	jg	.L16
.L6:
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L17
	xorl	%ebx, %ebx
	leaq	32(%rsp), %r12
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%r12,%rbx,4), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%ebx, %eax
	jg	.L18
.L17:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	32(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	4040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$4056, %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
.L8:
	.cfi_restore_state
	leaq	(%r14,%rdx), %rax
	leal	-1(%rdi), %edx
	subq	%r9, %r8
	addq	%r9, %rdx
	leaq	36(%rsp,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L14:
	movl	(%rax), %edx
	movl	(%rax,%r8,4), %ecx
	movl	%ecx, (%rax)
	movl	%edx, (%rax,%r8,4)
	addq	$4, %rax
	cmpq	%rsi, %rax
	jne	.L14
	jmp	.L7
.L20:
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	jmp	.L9
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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:

#include<stdio.h>
#define N 1000

void swap(int a[],int x,int y){
	int temp=a[x];
	a[x]=a[y];
	a[y]=temp;
	return;
}

int main(){
	int n,q,i,b,e,t;
	int a[N];
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d %d",&b,&e,&t);
		for(int j=0;j<(e-b);j++){
			swap(a,b+j,t+j);
		}
	}
	
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[n-1]);
	
	return 0;
	
}

11
1 2 3 4 5 6 7 8 9 10 11
2
1 4 7
 11
1 2 3 4 5 6 2 8 9 10 11
2
1 4 1
 11
1 2 3 3 5 6 2 8 9 10 11
2
1 4 1
 11
1 2 3 3 5 6 2 8 18 10 11
2
1 4 1
 11
1 0 3 3 5 6 2 8 18 10 11
2
1 4 1
 11
1 0 3 3 5 6 2 8 34 10 11
2
1 4 1
 11
1 0 3 3 5 6 2 8 14 10 11
2
1 4 1
 11
1 0 5 3 5 6 2 8 14 10 11
2
1 4 1
 11
1 0 5 3 5 6 1 8 14 10 11
2
1 4 1
 11
1 0 5 3 5 6 1 8 14 10 11
2
0 4 1

1 2 3 4 5 6 7 8 9 10 11
 1 2 3 4 5 6 2 8 9 10 11
 1 2 3 3 5 6 2 8 9 10 11
 1 2 3 3 5 6 2 8 18 10 11
 1 0 3 3 5 6 2 8 18 10 11
 1 0 3 3 5 6 2 8 34 10 11
 1 0 3 3 5 6 2 8 14 10 11
 1 0 5 3 5 6 2 8 14 10 11
 1 0 5 3 5 6 1 8 14 10 11
 5 3 5 1 0 6 1 8 14 10 11

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#define N 1000

void swap(int a[],int x,int y){
	int temp=a[x];
	a[x]=a[y];
	a[y]=temp;
	return;
}

int main(){
	int n,q,i,b,e,t;
	int a[N];
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d %d %d",&b,&e,&t);
		for(int j=0;j<(e-b);j++){
			swap(a,b+j,t+j);
		}
	}
	
	for(i=0;i<n-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[n-1]);
	
	return 0;
	
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap
	.type	swap, @function
swap:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap, .-swap
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4024(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4024(%rbp)
.L4:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L5
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L6
.L9:
	leaq	-4028(%rbp), %rcx
	leaq	-4032(%rbp), %rdx
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4020(%rbp)
	jmp	.L7
.L8:
	movl	-4028(%rbp), %edx
	movl	-4020(%rbp), %eax
	addl	%eax, %edx
	movl	-4036(%rbp), %ecx
	movl	-4020(%rbp), %eax
	addl	%eax, %ecx
	leaq	-4016(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	swap
	addl	$1, -4020(%rbp)
.L7:
	movl	-4032(%rbp), %eax
	movl	-4036(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -4020(%rbp)
	jl	.L8
	addl	$1, -4024(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L9
	movl	$0, -4024(%rbp)
	jmp	.L10
.L11:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4024(%rbp)
.L10:
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L11
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	swap
	.type	swap, @function
swap:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap, .-swap
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L4
.L5:
	leaq	-4016(%rbp), %rdx
	movl	-4024(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4024(%rbp)
.L4:
	movl	-4044(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L5
	leaq	-4040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4024(%rbp)
	jmp	.L6
.L9:
	leaq	-4028(%rbp), %rcx
	leaq	-4032(%rbp), %rdx
	leaq	-4036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4020(%rbp)
	jmp	.L7
.L8:
	movl	-4028(%rbp), %edx
	movl	-4020(%rbp), %eax
	addl	%eax, %edx
	movl	-4036(%rbp), %ecx
	movl	-4020(%rbp), %eax
	addl	%eax, %ecx
	leaq	-4016(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	swap
	addl	$1, -4020(%rbp)
.L7:
	movl	-4032(%rbp), %eax
	movl	-4036(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -4020(%rbp)
	jl	.L8
	addl	$1, -4024(%rbp)
.L6:
	movl	-4040(%rbp), %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L9
	movl	$0, -4024(%rbp)
	jmp	.L10
.L11:
	movl	-4024(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4024(%rbp)
.L10:
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -4024(%rbp)
	jl	.L11
	movl	-4044(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
