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

```c
#include<stdio.h>
int main(void){
	int n;
	int a[100100]={0};
	int i;
	int h,flg,tmp;
	int l,r;
	int del=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	h=n;
	flg=0;
	while(h>1||flg){
		if(h>1) h=h/1.3;
		if(h==10||h==9) h=11;
		flg=0;
		for(i=0;i<n-h;i++){
			if(a[i]>a[i+h]){
				tmp=a[i];
				a[i]=a[i+h];
				a[i+h]=tmp;
				flg=1;
			}
		}
	}
	l=-1;r=n;
	while(r-l>2){
		l++;r--;
		while(r-l>2&&a[l]!=a[l+1]) l++;
		while(r-l>2&&a[r]!=a[r-1]) r--;
		if(a[l]==a[l+1]||a[r]==a[r-1]){
			del+=2;
		}
	}
	printf("%d\n",n-del);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3136, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400416(%rbp), %rax
	movl	$400400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400424(%rbp)
	leaq	-400448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400444(%rbp)
	jmp	.L2
.L3:
	leaq	-400416(%rbp), %rdx
	movl	-400444(%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, -400444(%rbp)
.L2:
	movl	-400448(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L3
	movl	-400448(%rbp), %eax
	movl	%eax, -400440(%rbp)
	movl	$0, -400436(%rbp)
	jmp	.L4
.L11:
	cmpl	$1, -400440(%rbp)
	jle	.L5
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-400440(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm1
	divsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, -400440(%rbp)
.L5:
	cmpl	$10, -400440(%rbp)
	je	.L6
	cmpl	$9, -400440(%rbp)
	jne	.L7
.L6:
	movl	$11, -400440(%rbp)
.L7:
	movl	$0, -400436(%rbp)
	movl	$0, -400444(%rbp)
	jmp	.L8
.L10:
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %ecx
	movl	-400440(%rbp), %eax
	addl	%ecx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	movl	%eax, -400420(%rbp)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %eax
	cltq
	movl	%edx, -400416(%rbp,%rax,4)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400420(%rbp), %edx
	movl	%edx, -400416(%rbp,%rax,4)
	movl	$1, -400436(%rbp)
.L9:
	addl	$1, -400444(%rbp)
.L8:
	movl	-400448(%rbp), %eax
	subl	-400440(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L10
.L4:
	cmpl	$1, -400440(%rbp)
	jg	.L11
	cmpl	$0, -400436(%rbp)
	jne	.L11
	movl	$-1, -400432(%rbp)
	movl	-400448(%rbp), %eax
	movl	%eax, -400428(%rbp)
	jmp	.L12
.L20:
	addl	$1, -400432(%rbp)
	subl	$1, -400428(%rbp)
	jmp	.L13
.L15:
	addl	$1, -400432(%rbp)
.L13:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L16
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L15
	jmp	.L16
.L18:
	subl	$1, -400428(%rbp)
.L16:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L17
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
.L17:
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L12
.L19:
	addl	$2, -400424(%rbp)
.L12:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jg	.L20
	movl	-400448(%rbp), %eax
	subl	-400424(%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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	-858993459
	.long	1073007820
	.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
.LC0:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3128, %rsp
	.cfi_def_cfa_offset 400480
	movl	$400400, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 400424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	movq	%rbx, %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	cmpl	$1, %edx
	jle	.L2
	movsd	.LC1(%rip), %xmm1
	leal	-11(%rdx), %ebp
	movl	%edx, %r11d
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	$1, %r11d
	jle	.L4
.L18:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r11d, %xmm0
	divsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %r11d
.L4:
	leal	-9(%r11), %eax
	cmpl	$1, %eax
	jbe	.L5
	movl	%edx, %r9d
	subl	%r11d, %r9d
	cmpl	$1, %r11d
	setg	%r12b
	testl	%r9d, %r9d
	jle	.L20
.L17:
	movslq	%r11d, %r8
	xorl	%r10d, %r10d
	xorl	%ecx, %ecx
	salq	$2, %r8
	leaq	(%rbx,%r8), %rax
	negq	%r8
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rax,%r8), %esi
	movl	(%rax), %edi
	cmpl	%edi, %esi
	jle	.L7
	movl	%edi, (%rax,%r8)
	movl	$1, %r10d
	movl	%esi, (%rax)
.L7:
	addl	$1, %ecx
	addq	$4, %rax
	cmpl	%r9d, %ecx
	jl	.L8
.L6:
	testl	%r10d, %r10d
	jne	.L28
	testb	%r12b, %r12b
	jne	.L28
	movl	%edx, %r10d
	xorl	%r11d, %r11d
	movq	$-1, %rsi
	.p2align 4,,10
	.p2align 3
.L15:
	leal	-1(%r10), %eax
	leal	1(%rsi), %r9d
	movl	%eax, %ecx
	leaq	(%rbx,%rsi,4), %rdi
	subl	%r9d, %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdi, %r8
	subl	$1, %ecx
	addq	$4, %rdi
	movl	8(%r8), %ebp
	cmpl	%ebp, 4(%r8)
	je	.L33
.L11:
	movslq	%r9d, %rsi
	movl	%ecx, %r8d
	leal	1(%rsi), %r9d
	cmpl	$2, %ecx
	jg	.L34
	movslq	%r9d, %r9
	movslq	%esi, %rcx
	movl	16(%rsp,%r9,4), %edi
	cmpl	%edi, 16(%rsp,%rcx,4)
	je	.L21
	subl	$2, %r10d
	movslq	%eax, %rcx
	movslq	%r10d, %r10
	movl	16(%rsp,%r10,4), %edi
	cmpl	%edi, 16(%rsp,%rcx,4)
	je	.L21
.L14:
	subl	%r11d, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	400424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$400440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movslq	%r10d, %r10
	subl	%esi, %eax
	leaq	(%rbx,%r10,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	leal	(%rsi,%rax), %r10d
	movl	%eax, %r8d
	cmpl	$2, %eax
	jle	.L12
	movq	%rcx, %rdi
	subl	$1, %eax
	subq	$4, %rcx
	movl	-8(%rdi), %r9d
	cmpl	%r9d, -4(%rdi)
	jne	.L13
.L12:
	addl	$2, %r11d
	cmpl	$2, %r8d
	jg	.L15
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$11, %r11d
	movl	%ebp, %r9d
	movl	$1, %r12d
	testl	%ebp, %ebp
	jg	.L17
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%eax, %r10d
	addl	$2, %r11d
	cmpl	$2, %r8d
	jg	.L15
	jmp	.L14
.L20:
	xorl	%r10d, %r10d
	jmp	.L6
.L2:
	xorl	%r11d, %r11d
	jmp	.L14
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	-858993459
	.long	1073007820
	.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
.LC0:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3128, %rsp
	.cfi_def_cfa_offset 400480
	movl	$400400, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 400424(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	movq	%rbx, %r12
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %r12
	cmpl	%ebp, %edx
	jg	.L3
	cmpl	$1, %edx
	jle	.L2
	movsd	.LC1(%rip), %xmm1
	leal	-11(%rdx), %ebp
	movl	%edx, %r11d
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	$1, %r11d
	jle	.L4
.L18:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%r11d, %xmm0
	divsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %r11d
.L4:
	leal	-9(%r11), %eax
	cmpl	$1, %eax
	jbe	.L5
	movl	%edx, %r9d
	subl	%r11d, %r9d
	cmpl	$1, %r11d
	setg	%r12b
	testl	%r9d, %r9d
	jle	.L20
.L17:
	movslq	%r11d, %r8
	xorl	%r10d, %r10d
	xorl	%ecx, %ecx
	salq	$2, %r8
	leaq	(%rbx,%r8), %rax
	negq	%r8
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rax,%r8), %esi
	movl	(%rax), %edi
	cmpl	%edi, %esi
	jle	.L7
	movl	%edi, (%rax,%r8)
	movl	$1, %r10d
	movl	%esi, (%rax)
.L7:
	addl	$1, %ecx
	addq	$4, %rax
	cmpl	%r9d, %ecx
	jl	.L8
.L6:
	testl	%r10d, %r10d
	jne	.L28
	testb	%r12b, %r12b
	jne	.L28
	movl	%edx, %r10d
	xorl	%r11d, %r11d
	movq	$-1, %rsi
	.p2align 4,,10
	.p2align 3
.L15:
	leal	-1(%r10), %eax
	leal	1(%rsi), %r9d
	movl	%eax, %ecx
	leaq	(%rbx,%rsi,4), %rdi
	subl	%r9d, %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdi, %r8
	subl	$1, %ecx
	addq	$4, %rdi
	movl	8(%r8), %ebp
	cmpl	%ebp, 4(%r8)
	je	.L33
.L11:
	movslq	%r9d, %rsi
	movl	%ecx, %r8d
	leal	1(%rsi), %r9d
	cmpl	$2, %ecx
	jg	.L34
	movslq	%r9d, %r9
	movslq	%esi, %rcx
	movl	16(%rsp,%r9,4), %edi
	cmpl	%edi, 16(%rsp,%rcx,4)
	je	.L21
	subl	$2, %r10d
	movslq	%eax, %rcx
	movslq	%r10d, %r10
	movl	16(%rsp,%r10,4), %edi
	cmpl	%edi, 16(%rsp,%rcx,4)
	je	.L21
.L14:
	subl	%r11d, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	400424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$400440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L33:
	.cfi_restore_state
	movslq	%r10d, %r10
	subl	%esi, %eax
	leaq	(%rbx,%r10,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	leal	(%rsi,%rax), %r10d
	movl	%eax, %r8d
	cmpl	$2, %eax
	jle	.L12
	movq	%rcx, %rdi
	subl	$1, %eax
	subq	$4, %rcx
	movl	-8(%rdi), %r9d
	cmpl	%r9d, -4(%rdi)
	jne	.L13
.L12:
	addl	$2, %r11d
	cmpl	$2, %r8d
	jg	.L15
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$11, %r11d
	movl	%ebp, %r9d
	movl	$1, %r12d
	testl	%ebp, %ebp
	jg	.L17
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%eax, %r10d
	addl	$2, %r11d
	cmpl	$2, %r8d
	jg	.L15
	jmp	.L14
.L20:
	xorl	%r10d, %r10d
	jmp	.L6
.L2:
	xorl	%r11d, %r11d
	jmp	.L14
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	-858993459
	.long	1073007820
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
int main(void){
	int n;
	int a[100100]={0};
	int i;
	int h,flg,tmp;
	int l,r;
	int del=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	h=n;
	flg=0;
	while(h>1||flg){
		if(h>1) h=h/1.3;
		if(h==10||h==9) h=11;
		flg=0;
		for(i=0;i<n-h;i++){
			if(a[i]>a[i+h]){
				tmp=a[i];
				a[i]=a[i+h];
				a[i+h]=tmp;
				flg=1;
			}
		}
	}
	l=-1;r=n;
	while(r-l>2){
		l++;r--;
		while(r-l>2&&a[l]!=a[l+1]) l++;
		while(r-l>2&&a[r]!=a[r-1]) r--;
		if(a[l]==a[l+1]||a[r]==a[r-1]){
			del+=2;
		}
	}
	printf("%d\n",n-del);
	return 0;
}
5
1 2 0 3 7
 15
1 3 5 2 1 3 2 0 8 6 2 6 11 1 1
 5
2 2 -1 9 16
 15
1 12 6 0 1 2 2 0 8 6 4 6 21 1 3
 15
1 2 9 -1 0 12 1 -1 1 11 -2 4 13 4 3
 5
-4 -4 0 0 0
 15
0 -4 1 8 0 1 -1 -25 49 -3 -35 -2 -8 2 -9
 5
1 2 0 3 11
 15
1 3 5 1 1 3 2 0 8 6 2 6 11 1 1
 5
1 2 0 3 18

5
 7
 3
 9
 11
 1
 13
 5
 7
 5

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

```c
#include<stdio.h>
int main(void){
	int n;
	int a[100100]={0};
	int i;
	int h,flg,tmp;
	int l,r;
	int del=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	h=n;
	flg=0;
	while(h>1||flg){
		if(h>1) h=h/1.3;
		if(h==10||h==9) h=11;
		flg=0;
		for(i=0;i<n-h;i++){
			if(a[i]>a[i+h]){
				tmp=a[i];
				a[i]=a[i+h];
				a[i+h]=tmp;
				flg=1;
			}
		}
	}
	l=-1;r=n;
	while(r-l>2){
		l++;r--;
		while(r-l>2&&a[l]!=a[l+1]) l++;
		while(r-l>2&&a[r]!=a[r-1]) r--;
		if(a[l]==a[l+1]||a[r]==a[r-1]){
			del+=2;
		}
	}
	printf("%d\n",n-del);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3136, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400416(%rbp), %rax
	movl	$400400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400424(%rbp)
	leaq	-400448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400444(%rbp)
	jmp	.L2
.L3:
	leaq	-400416(%rbp), %rdx
	movl	-400444(%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, -400444(%rbp)
.L2:
	movl	-400448(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L3
	movl	-400448(%rbp), %eax
	movl	%eax, -400440(%rbp)
	movl	$0, -400436(%rbp)
	jmp	.L4
.L11:
	cmpl	$1, -400440(%rbp)
	jle	.L5
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-400440(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm1
	divsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, -400440(%rbp)
.L5:
	cmpl	$10, -400440(%rbp)
	je	.L6
	cmpl	$9, -400440(%rbp)
	jne	.L7
.L6:
	movl	$11, -400440(%rbp)
.L7:
	movl	$0, -400436(%rbp)
	movl	$0, -400444(%rbp)
	jmp	.L8
.L10:
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %ecx
	movl	-400440(%rbp), %eax
	addl	%ecx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	movl	%eax, -400420(%rbp)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %eax
	cltq
	movl	%edx, -400416(%rbp,%rax,4)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400420(%rbp), %edx
	movl	%edx, -400416(%rbp,%rax,4)
	movl	$1, -400436(%rbp)
.L9:
	addl	$1, -400444(%rbp)
.L8:
	movl	-400448(%rbp), %eax
	subl	-400440(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L10
.L4:
	cmpl	$1, -400440(%rbp)
	jg	.L11
	cmpl	$0, -400436(%rbp)
	jne	.L11
	movl	$-1, -400432(%rbp)
	movl	-400448(%rbp), %eax
	movl	%eax, -400428(%rbp)
	jmp	.L12
.L20:
	addl	$1, -400432(%rbp)
	subl	$1, -400428(%rbp)
	jmp	.L13
.L15:
	addl	$1, -400432(%rbp)
.L13:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L16
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L15
	jmp	.L16
.L18:
	subl	$1, -400428(%rbp)
.L16:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L17
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
.L17:
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L12
.L19:
	addl	$2, -400424(%rbp)
.L12:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jg	.L20
	movl	-400448(%rbp), %eax
	subl	-400424(%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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	-858993459
	.long	1073007820
	.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"
.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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3136, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400416(%rbp), %rax
	movl	$400400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400424(%rbp)
	leaq	-400448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400444(%rbp)
	jmp	.L2
.L3:
	leaq	-400416(%rbp), %rdx
	movl	-400444(%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, -400444(%rbp)
.L2:
	movl	-400448(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L3
	movl	-400448(%rbp), %eax
	movl	%eax, -400440(%rbp)
	movl	$0, -400436(%rbp)
	jmp	.L4
.L11:
	cmpl	$1, -400440(%rbp)
	jle	.L5
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-400440(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm1
	divsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, -400440(%rbp)
.L5:
	cmpl	$10, -400440(%rbp)
	je	.L6
	cmpl	$9, -400440(%rbp)
	jne	.L7
.L6:
	movl	$11, -400440(%rbp)
.L7:
	movl	$0, -400436(%rbp)
	movl	$0, -400444(%rbp)
	jmp	.L8
.L10:
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %ecx
	movl	-400440(%rbp), %eax
	addl	%ecx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400444(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	movl	%eax, -400420(%rbp)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400444(%rbp), %eax
	cltq
	movl	%edx, -400416(%rbp,%rax,4)
	movl	-400444(%rbp), %edx
	movl	-400440(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-400420(%rbp), %edx
	movl	%edx, -400416(%rbp,%rax,4)
	movl	$1, -400436(%rbp)
.L9:
	addl	$1, -400444(%rbp)
.L8:
	movl	-400448(%rbp), %eax
	subl	-400440(%rbp), %eax
	cmpl	%eax, -400444(%rbp)
	jl	.L10
.L4:
	cmpl	$1, -400440(%rbp)
	jg	.L11
	cmpl	$0, -400436(%rbp)
	jne	.L11
	movl	$-1, -400432(%rbp)
	movl	-400448(%rbp), %eax
	movl	%eax, -400428(%rbp)
	jmp	.L12
.L20:
	addl	$1, -400432(%rbp)
	subl	$1, -400428(%rbp)
	jmp	.L13
.L15:
	addl	$1, -400432(%rbp)
.L13:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L16
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L15
	jmp	.L16
.L18:
	subl	$1, -400428(%rbp)
.L16:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jle	.L17
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
.L17:
	movl	-400432(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400432(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400428(%rbp), %eax
	cltq
	movl	-400416(%rbp,%rax,4), %edx
	movl	-400428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L12
.L19:
	addl	$2, -400424(%rbp)
.L12:
	movl	-400428(%rbp), %eax
	subl	-400432(%rbp), %eax
	cmpl	$2, %eax
	jg	.L20
	movl	-400448(%rbp), %eax
	subl	-400424(%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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	-858993459
	.long	1073007820
	.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:
