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>

struct data{
	int start;
	int finish;
};

struct data arr[100005];
struct data temp[100005];
void mergesort(struct data *arr, int left, int right)
{
	if(left==right)
	{
		return;
	}
	
	int mid=(left+right)/2;
	mergesort(arr,left,mid);
	mergesort(arr,mid+1,right);
	
	int l=left;
	int tl=mid;
	int r=mid+1;
	int tr=right;
	int idx=left;
	
	while(l<=tl && r<=tr)
	{
		if(arr[l].finish<arr[r].finish)
		{
			temp[idx]=arr[l++];
		}
		else
		{
			temp[idx]=arr[r++];
		}
		idx++;
	}
	
	while(l<=tl)
	{
		temp[idx++]=arr[l++];
	}
	
	while(r<=tr)
	{
		temp[idx++]=arr[r++];
	}
	
	for(int i=left;i<=right;i++)
	{
		arr[i]=temp[i];
	}
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d",&arr[i].start,&arr[i].finish);		
	}
	
	int count=1;
	int idx=0;
	mergesort(arr,0,n-1);
	
	for(int i=1;i<n;i++)
	{
		if(arr[idx].finish<arr[i].start)
		{
			count++;
			idx=i;
		}
	}
	printf("%d\n",count);
	
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	arr
	.bss
	.align 32
	.type	arr, @object
	.size	arr, 800040
arr:
	.zero	800040
	.globl	temp
	.align 32
	.type	temp, @object
	.size	temp, 800040
temp:
	.zero	800040
	.text
	.globl	mergesort
	.type	mergesort, @function
mergesort:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	cmpl	-48(%rbp), %eax
	je	.L15
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
.L6:
	addl	$1, -20(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L9
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L8
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L9:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L10
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L12
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jle	.L14
	jmp	.L1
.L15:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mergesort, .-mergesort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L17
.L18:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L18
	movl	$1, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	arr(%rip), %rax
	movq	%rax, %rdi
	call	mergesort
	movl	$1, -12(%rbp)
	jmp	.L19
.L21:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	addl	$1, -20(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L20:
	addl	$1, -12(%rbp)
.L19:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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
	.type	mergesort.part.0, @function
mergesort.part.0:
.LFB25:
	.cfi_startproc
	leal	(%rsi,%rdx), %eax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%eax, %r12d
	shrl	$31, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	addl	%eax, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	sarl	%r12d
	leal	1(%r12), %r15d
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	%r15d, %ebp
	cmpl	%r12d, %esi
	je	.L2
	movl	%r12d, %edx
	call	mergesort.part.0
	cmpl	%r15d, %r13d
	je	.L3
.L18:
	movl	%r13d, %edx
	movl	%r15d, %esi
	movq	%rbx, %rdi
	call	mergesort.part.0
.L3:
	cmpl	%r15d, %r13d
	jl	.L19
	cmpl	%r12d, %r14d
	jg	.L19
.L17:
	leal	1(%r14), %eax
	movl	%r14d, %edx
	leaq	-8+temp(%rip), %rdi
	cltq
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L36:
	movq	(%rsi), %rcx
	addl	$1, %edx
	movl	%eax, %esi
	movq	%rcx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpl	%edx, %r12d
	jl	.L9
.L37:
	cmpl	%ebp, %r13d
	jl	.L4
.L7:
	movslq	%edx, %rcx
	leaq	(%rbx,%rcx,8), %rsi
	movslq	%ebp, %rcx
	leaq	(%rbx,%rcx,8), %rcx
	movl	4(%rcx), %r9d
	cmpl	%r9d, 4(%rsi)
	jl	.L36
	movq	(%rcx), %rcx
	movl	%eax, %esi
	addl	$1, %ebp
	movq	%rcx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpl	%edx, %r12d
	jge	.L37
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	%ebp, %r13d
	jl	.L15
	movl	%r13d, %r8d
	movslq	%esi, %rsi
	leaq	temp(%rip), %rcx
	xorl	%eax, %eax
	subl	%ebp, %r8d
	movslq	%ebp, %rbp
	leaq	(%rcx,%rsi,8), %rcx
	leaq	(%rbx,%rbp,8), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	(%rdi,%rax,8), %rdx
	movq	%rdx, (%rcx,%rax,8)
	movq	%rax, %rdx
	addq	$1, %rax
	cmpq	%rdx, %r8
	jne	.L14
.L15:
	movslq	%r14d, %rax
	leaq	temp(%rip), %rcx
	cmpl	%r13d, %r14d
	jg	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%rcx,%rax,8), %rdx
	movq	%rdx, (%rbx,%rax,8)
	addq	$1, %rax
	cmpl	%eax, %r13d
	jge	.L16
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L19:
	.cfi_restore_state
	movl	%r14d, %esi
	movl	%r14d, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%edx, %r12d
	jl	.L9
	movslq	%edx, %rax
	leaq	temp(%rip), %rcx
	subl	%edx, %r12d
	leaq	(%rbx,%rax,8), %r8
	movslq	%esi, %rax
	leaq	(%rcx,%rax,8), %rdi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%r8,%rax,8), %rcx
	movq	%rcx, (%rdi,%rax,8)
	movq	%rax, %rcx
	addq	$1, %rax
	cmpq	%rcx, %r12
	jne	.L10
	addl	%r15d, %esi
	subl	%edx, %esi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L2:
	cmpl	%r15d, %edx
	jne	.L18
	jmp	.L17
	.cfi_endproc
.LFE25:
	.size	mergesort.part.0, .-mergesort.part.0
	.p2align 4
	.globl	mergesort
	.type	mergesort, @function
mergesort:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edx, %esi
	je	.L38
	jmp	mergesort.part.0
	.p2align 4,,10
	.p2align 3
.L38:
	ret
	.cfi_endproc
.LFE23:
	.size	mergesort, .-mergesort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L41
	leaq	arr(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L42:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %eax
	jg	.L42
.L41:
	movl	%eax, %edx
	subl	$1, %edx
	je	.L43
	xorl	%esi, %esi
	leaq	arr(%rip), %rdi
	call	mergesort.part.0
	movl	4(%rsp), %eax
.L43:
	cmpl	$1, %eax
	jle	.L48
	movslq	%eax, %rdx
	xorl	%esi, %esi
	movl	$1, %eax
	movl	$1, %r8d
	leaq	arr(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%esi, %rcx
	movl	(%rdi,%rax,8), %ebx
	cmpl	%ebx, 4(%rdi,%rcx,8)
	jge	.L45
	addl	$1, %r8d
	movl	%eax, %esi
.L45:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L46
.L44:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L48:
	.cfi_restore_state
	movl	$1, %r8d
	jmp	.L44
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	temp
	.bss
	.align 32
	.type	temp, @object
	.size	temp, 800040
temp:
	.zero	800040
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 800040
arr:
	.zero	800040
	.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
	.type	mergesort.part.0, @function
mergesort.part.0:
.LFB25:
	.cfi_startproc
	leal	(%rsi,%rdx), %eax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	%esi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%eax, %r12d
	shrl	$31, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	addl	%eax, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rdi, %rbx
	sarl	%r12d
	leal	1(%r12), %r15d
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	%r15d, %ebp
	cmpl	%r12d, %esi
	je	.L2
	movl	%r12d, %edx
	call	mergesort.part.0
	cmpl	%r15d, %r13d
	je	.L3
.L18:
	movl	%r13d, %edx
	movl	%r15d, %esi
	movq	%rbx, %rdi
	call	mergesort.part.0
.L3:
	cmpl	%r15d, %r13d
	jl	.L19
	cmpl	%r12d, %r14d
	jg	.L19
.L17:
	leal	1(%r14), %eax
	movl	%r14d, %edx
	leaq	-8+temp(%rip), %rdi
	cltq
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L36:
	movq	(%rsi), %rcx
	addl	$1, %edx
	movl	%eax, %esi
	movq	%rcx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpl	%edx, %r12d
	jl	.L9
.L37:
	cmpl	%ebp, %r13d
	jl	.L4
.L7:
	movslq	%edx, %rcx
	leaq	(%rbx,%rcx,8), %rsi
	movslq	%ebp, %rcx
	leaq	(%rbx,%rcx,8), %rcx
	movl	4(%rcx), %r9d
	cmpl	%r9d, 4(%rsi)
	jl	.L36
	movq	(%rcx), %rcx
	movl	%eax, %esi
	addl	$1, %ebp
	movq	%rcx, (%rdi,%rax,8)
	addq	$1, %rax
	cmpl	%edx, %r12d
	jge	.L37
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	%ebp, %r13d
	jl	.L15
	movl	%r13d, %r8d
	movslq	%esi, %rsi
	leaq	temp(%rip), %rcx
	xorl	%eax, %eax
	subl	%ebp, %r8d
	movslq	%ebp, %rbp
	leaq	(%rcx,%rsi,8), %rcx
	leaq	(%rbx,%rbp,8), %rdi
	.p2align 4,,10
	.p2align 3
.L14:
	movq	(%rdi,%rax,8), %rdx
	movq	%rdx, (%rcx,%rax,8)
	movq	%rax, %rdx
	addq	$1, %rax
	cmpq	%rdx, %r8
	jne	.L14
.L15:
	movslq	%r14d, %rax
	leaq	temp(%rip), %rcx
	cmpl	%r13d, %r14d
	jg	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%rcx,%rax,8), %rdx
	movq	%rdx, (%rbx,%rax,8)
	addq	$1, %rax
	cmpl	%eax, %r13d
	jge	.L16
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L19:
	.cfi_restore_state
	movl	%r14d, %esi
	movl	%r14d, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%edx, %r12d
	jl	.L9
	movslq	%edx, %rax
	leaq	temp(%rip), %rcx
	subl	%edx, %r12d
	leaq	(%rbx,%rax,8), %r8
	movslq	%esi, %rax
	leaq	(%rcx,%rax,8), %rdi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%r8,%rax,8), %rcx
	movq	%rcx, (%rdi,%rax,8)
	movq	%rax, %rcx
	addq	$1, %rax
	cmpq	%rcx, %r12
	jne	.L10
	addl	%r15d, %esi
	subl	%edx, %esi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L2:
	cmpl	%r15d, %edx
	jne	.L18
	jmp	.L17
	.cfi_endproc
.LFE25:
	.size	mergesort.part.0, .-mergesort.part.0
	.p2align 4
	.globl	mergesort
	.type	mergesort, @function
mergesort:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edx, %esi
	je	.L38
	jmp	mergesort.part.0
	.p2align 4,,10
	.p2align 3
.L38:
	ret
	.cfi_endproc
.LFE23:
	.size	mergesort, .-mergesort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L41
	leaq	arr(%rip), %rbx
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L42:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addl	$1, %ebp
	addq	$8, %rbx
	cmpl	%ebp, %eax
	jg	.L42
.L41:
	movl	%eax, %edx
	subl	$1, %edx
	je	.L43
	xorl	%esi, %esi
	leaq	arr(%rip), %rdi
	call	mergesort.part.0
	movl	4(%rsp), %eax
.L43:
	cmpl	$1, %eax
	jle	.L48
	movslq	%eax, %rdx
	xorl	%esi, %esi
	movl	$1, %eax
	movl	$1, %r8d
	leaq	arr(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%esi, %rcx
	movl	(%rdi,%rax,8), %ebx
	cmpl	%ebx, 4(%rdi,%rcx,8)
	jge	.L45
	addl	$1, %r8d
	movl	%eax, %esi
.L45:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L46
.L44:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L48:
	.cfi_restore_state
	movl	$1, %r8d
	jmp	.L44
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	temp
	.bss
	.align 32
	.type	temp, @object
	.size	temp, 800040
temp:
	.zero	800040
	.globl	arr
	.align 32
	.type	arr, @object
	.size	arr, 800040
arr:
	.zero	800040
	.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>

struct data{
	int start;
	int finish;
};

struct data arr[100005];
struct data temp[100005];
void mergesort(struct data *arr, int left, int right)
{
	if(left==right)
	{
		return;
	}
	
	int mid=(left+right)/2;
	mergesort(arr,left,mid);
	mergesort(arr,mid+1,right);
	
	int l=left;
	int tl=mid;
	int r=mid+1;
	int tr=right;
	int idx=left;
	
	while(l<=tl && r<=tr)
	{
		if(arr[l].finish<arr[r].finish)
		{
			temp[idx]=arr[l++];
		}
		else
		{
			temp[idx]=arr[r++];
		}
		idx++;
	}
	
	while(l<=tl)
	{
		temp[idx++]=arr[l++];
	}
	
	while(r<=tr)
	{
		temp[idx++]=arr[r++];
	}
	
	for(int i=left;i<=right;i++)
	{
		arr[i]=temp[i];
	}
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d",&arr[i].start,&arr[i].finish);		
	}
	
	int count=1;
	int idx=0;
	mergesort(arr,0,n-1);
	
	for(int i=1;i<n;i++)
	{
		if(arr[idx].finish<arr[i].start)
		{
			count++;
			idx=i;
		}
	}
	printf("%d\n",count);
	
}

5
2 2
3 9
3 5
5 9
6 8
 3
1 1
2 3
3 4
 3
0 5
3 4
2 5
 5
3 2
5 5
4 3
0 3
6 8
 5
2 2
3 9
4 5
5 9
6 8
 3
1 1
2 4
3 4
 3
-1 5
3 4
2 5
 5
2 2
3 9
4 5
1 9
6 8
 3
1 1
2 4
3 3
 3
-1 5
3 4
2 7

3
 2
 1
 4
 3
 2
 1
 3
 2
 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>

struct data{
	int start;
	int finish;
};

struct data arr[100005];
struct data temp[100005];
void mergesort(struct data *arr, int left, int right)
{
	if(left==right)
	{
		return;
	}
	
	int mid=(left+right)/2;
	mergesort(arr,left,mid);
	mergesort(arr,mid+1,right);
	
	int l=left;
	int tl=mid;
	int r=mid+1;
	int tr=right;
	int idx=left;
	
	while(l<=tl && r<=tr)
	{
		if(arr[l].finish<arr[r].finish)
		{
			temp[idx]=arr[l++];
		}
		else
		{
			temp[idx]=arr[r++];
		}
		idx++;
	}
	
	while(l<=tl)
	{
		temp[idx++]=arr[l++];
	}
	
	while(r<=tr)
	{
		temp[idx++]=arr[r++];
	}
	
	for(int i=left;i<=right;i++)
	{
		arr[i]=temp[i];
	}
}

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d %d",&arr[i].start,&arr[i].finish);		
	}
	
	int count=1;
	int idx=0;
	mergesort(arr,0,n-1);
	
	for(int i=1;i<n;i++)
	{
		if(arr[idx].finish<arr[i].start)
		{
			count++;
			idx=i;
		}
	}
	printf("%d\n",count);
	
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	arr
	.bss
	.align 32
	.type	arr, @object
	.size	arr, 800040
arr:
	.zero	800040
	.globl	temp
	.align 32
	.type	temp, @object
	.size	temp, 800040
temp:
	.zero	800040
	.text
	.globl	mergesort
	.type	mergesort, @function
mergesort:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	cmpl	-48(%rbp), %eax
	je	.L15
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
.L6:
	addl	$1, -20(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L9
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L8
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L9:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L10
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L12
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jle	.L14
	jmp	.L1
.L15:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mergesort, .-mergesort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L17
.L18:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L18
	movl	$1, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	arr(%rip), %rax
	movq	%rax, %rdi
	call	mergesort
	movl	$1, -12(%rbp)
	jmp	.L19
.L21:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	addl	$1, -20(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L20:
	addl	$1, -12(%rbp)
.L19:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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	arr
	.bss
	.align 32
	.type	arr, @object
	.size	arr, 800040
arr:
	.zero	800040
	.globl	temp
	.align 32
	.type	temp, @object
	.size	temp, 800040
temp:
	.zero	800040
	.text
	.globl	mergesort
	.type	mergesort, @function
mergesort:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	%edx, -48(%rbp)
	movl	-44(%rbp), %eax
	cmpl	-48(%rbp), %eax
	je	.L15
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-48(%rbp), %edx
	movq	-40(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	mergesort
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L4
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L5
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rax), %rax
	movq	%rax, (%rcx,%rdx)
.L6:
	addl	$1, -20(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L9
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L8
	jmp	.L9
.L10:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L9:
	movl	-28(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L10
	jmp	.L11
.L12:
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -24(%rbp)
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-20(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -20(%rbp)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rdx
	movq	(%rsi), %rax
	movq	%rax, (%rcx,%rdx)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jle	.L12
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	temp(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jle	.L14
	jmp	.L1
.L15:
	nop
.L1:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	mergesort, .-mergesort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L17
.L18:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	arr(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -24(%rbp)
.L17:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L18
	movl	$1, -20(%rbp)
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	arr(%rip), %rax
	movq	%rax, %rdi
	call	mergesort
	movl	$1, -12(%rbp)
	jmp	.L19
.L21:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+arr(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	arr(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L20
	addl	$1, -20(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L20:
	addl	$1, -12(%rbp)
.L19:
	movl	-28(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L21
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.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:
