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 rep(i,n)for(int i=0;i<(int)(n);i++)
int main(){
	int n,color,a[100002],b[100002];
	scanf("%d",&n);
	rep(i,n) scanf("%d",&a[i]);//入力終
	rep(i,n+1) b[i]=-1;
	rep(i,n){
		color=0;
		while(a[i]<=b[color]){color++;}
		b[color]=a[i];
	}
	rep(i,n+1){
		if(b[i]==-1){printf("%d",i); return 0;}
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.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	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1344, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800048(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800048(%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, -800048(%rbp)
.L2:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800048(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	$-1, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jle	.L5
	movl	$0, -800040(%rbp)
	jmp	.L6
.L9:
	movl	$0, -800052(%rbp)
	jmp	.L7
.L8:
	addl	$1, -800052(%rbp)
.L7:
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
.L6:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800040(%rbp)
	jl	.L9
	movl	$0, -800036(%rbp)
	jmp	.L10
.L13:
	movl	-800036(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	-800036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L12
.L11:
	addl	$1, -800036(%rbp)
.L10:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800036(%rbp)
	jle	.L13
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1328, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%r13d, %r13d
	movq	%rbx, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r12d
	addq	$4, %r14
	cmpl	%r13d, %r12d
	jg	.L3
	testl	%r12d, %r12d
	js	.L5
	movslq	%r12d, %rax
	leaq	400032(%rsp), %rdi
	movl	$255, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
	movq	%rax, %rdi
	testl	%r12d, %r12d
	je	.L7
	leal	-1(%r12), %eax
	movq	%rbx, %rsi
	leaq	20(%rsp,%rax,4), %r8
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi), %ecx
	movl	$1, %eax
	xorl	%edx, %edx
	cmpl	%ecx, 400032(%rsp)
	jl	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%eax, %rdx
	addq	$1, %rax
	cmpl	%ecx, -4(%rdi,%rax,4)
	jge	.L8
.L9:
	addq	$4, %rsi
	movl	%ecx, 400032(%rsp,%rdx,4)
	cmpq	%r8, %rsi
	jne	.L13
.L7:
	xorl	%eax, %eax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %rax
	cmpl	%eax, %r12d
	jl	.L5
.L11:
	cmpl	$-1, (%rdi,%rax,4)
	movl	%eax, %edx
	jne	.L10
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	800040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$800048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	jne	.L5
	movl	$-1, 400032(%rsp)
	leaq	400032(%rsp), %rdi
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1328, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%r13d, %r13d
	movq	%rbx, %r14
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r12d
	addq	$4, %r14
	cmpl	%r13d, %r12d
	jg	.L3
	testl	%r12d, %r12d
	js	.L5
	movslq	%r12d, %rax
	leaq	400032(%rsp), %rdi
	movl	$255, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
	movq	%rax, %rdi
	testl	%r12d, %r12d
	je	.L7
	leal	-1(%r12), %eax
	movq	%rbx, %rsi
	leaq	20(%rsp,%rax,4), %r8
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi), %ecx
	movl	$1, %eax
	xorl	%edx, %edx
	cmpl	%ecx, 400032(%rsp)
	jl	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%eax, %rdx
	addq	$1, %rax
	cmpl	%ecx, -4(%rdi,%rax,4)
	jge	.L8
.L9:
	addq	$4, %rsi
	movl	%ecx, 400032(%rsp,%rdx,4)
	cmpq	%r8, %rsi
	jne	.L13
.L7:
	xorl	%eax, %eax
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$1, %rax
	cmpl	%eax, %r12d
	jl	.L5
.L11:
	cmpl	$-1, (%rdi,%rax,4)
	movl	%eax, %edx
	jne	.L10
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	800040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$800048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	jne	.L5
	movl	$-1, 400032(%rsp)
	leaq	400032(%rsp), %rdi
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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 rep(i,n)for(int i=0;i<(int)(n);i++)
int main(){
	int n,color,a[100002],b[100002];
	scanf("%d",&n);
	rep(i,n) scanf("%d",&a[i]);//入力終
	rep(i,n+1) b[i]=-1;
	rep(i,n){
		color=0;
		while(a[i]<=b[color]){color++;}
		b[color]=a[i];
	}
	rep(i,n+1){
		if(b[i]==-1){printf("%d",i); return 0;}
	}
}
4
0
-1
0
0
 4
1
0
0
0
 5
10
-1
1
13
3
 5
0
0
0
0
0
 5
1
4
5
7
14
 5
4
1
4
5
3
 4
1
-1
0
0
 5
4
1
4
9
3
 5
7
1
4
9
3
 4
-1
0
0
0

3 4 2 5 1 3 3 3 3 3
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 rep(i,n)for(int i=0;i<(int)(n);i++)
int main(){
	int n,color,a[100002],b[100002];
	scanf("%d",&n);
	rep(i,n) scanf("%d",&a[i]);//入力終
	rep(i,n+1) b[i]=-1;
	rep(i,n){
		color=0;
		while(a[i]<=b[color]){color++;}
		b[color]=a[i];
	}
	rep(i,n+1){
		if(b[i]==-1){printf("%d",i); return 0;}
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.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	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1344, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800048(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800048(%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, -800048(%rbp)
.L2:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800048(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	$-1, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jle	.L5
	movl	$0, -800040(%rbp)
	jmp	.L6
.L9:
	movl	$0, -800052(%rbp)
	jmp	.L7
.L8:
	addl	$1, -800052(%rbp)
.L7:
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
.L6:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800040(%rbp)
	jl	.L9
	movl	$0, -800036(%rbp)
	jmp	.L10
.L13:
	movl	-800036(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	-800036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L12
.L11:
	addl	$1, -800036(%rbp)
.L10:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800036(%rbp)
	jle	.L13
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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"
	.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	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1344, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800048(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800048(%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, -800048(%rbp)
.L2:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800048(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	$-1, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jle	.L5
	movl	$0, -800040(%rbp)
	jmp	.L6
.L9:
	movl	$0, -800052(%rbp)
	jmp	.L7
.L8:
	addl	$1, -800052(%rbp)
.L7:
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-800040(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
.L6:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800040(%rbp)
	jl	.L9
	movl	$0, -800036(%rbp)
	jmp	.L10
.L13:
	movl	-800036(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	-800036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	jmp	.L12
.L11:
	addl	$1, -800036(%rbp)
.L10:
	movl	-800056(%rbp), %eax
	cmpl	%eax, -800036(%rbp)
	jle	.L13
	movl	$0, %eax
.L12:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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:
