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>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll n;
ll a[200010];

int main(){
	scanf("%lld",&n);
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		a[t-1]=i;
	}
	ll ans=1,temp=1;
	rep(i,1,n){
		if(a[i-1]<a[i])temp++;
		else {ans=max(ans,temp);temp=1;}
	}
	ans=max(ans,temp);
	printf("%lld",n-ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600080
a:
	.zero	1600080
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -40(%rbp)
	jmp	.L2
.L3:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -40(%rbp)
.L2:
	movq	n(%rip), %rax
	cmpq	%rax, -40(%rbp)
	jl	.L3
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movq	$1, -16(%rbp)
	jmp	.L4
.L7:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	addq	$1, -24(%rbp)
	jmp	.L6
.L5:
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	$1, -24(%rbp)
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	n(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L7
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	n(%rip), %rax
	subq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rdx
	testq	%rdx, %rdx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%rsp, %r13
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	movq	n(%rip), %rdx
	movq	%rbx, -8(%rbp,%rax,8)
	addq	$1, %rbx
	cmpq	%rbx, %rdx
	jg	.L3
	cmpq	$1, %rdx
	jle	.L2
	movq	0(%rbp), %rcx
	leaq	0(%rbp,%rdx,8), %r9
	movl	$1, %esi
	leaq	8+a(%rip), %rax
	movl	$1, %edi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$8, %rax
	addq	$1, %rsi
	cmpq	%r9, %rax
	je	.L7
.L6:
	movq	%rcx, %r8
	movq	(%rax), %rcx
	cmpq	%r8, %rcx
	jg	.L13
	cmpq	%rsi, %rdi
	cmovl	%rsi, %rdi
	addq	$8, %rax
	movl	$1, %esi
	cmpq	%r9, %rax
	jne	.L6
.L7:
	cmpq	%rsi, %rdi
	cmovl	%rsi, %rdi
	xorl	%eax, %eax
	movq	%r12, %rsi
	subq	%rdi, %rdx
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$24, %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
.L2:
	.cfi_restore_state
	movl	$1, %esi
	movl	$1, %edi
	jmp	.L7
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600080
a:
	.zero	1600080
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	n(%rip), %rdx
	testq	%rdx, %rdx
	jle	.L2
	xorl	%ebx, %ebx
	movq	%rsp, %r13
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rax
	movq	n(%rip), %rdx
	movq	%rbx, -8(%rbp,%rax,8)
	addq	$1, %rbx
	cmpq	%rbx, %rdx
	jg	.L3
	cmpq	$1, %rdx
	jle	.L2
	movq	0(%rbp), %rcx
	leaq	0(%rbp,%rdx,8), %r9
	movl	$1, %esi
	leaq	8+a(%rip), %rax
	movl	$1, %edi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$8, %rax
	addq	$1, %rsi
	cmpq	%r9, %rax
	je	.L7
.L6:
	movq	%rcx, %r8
	movq	(%rax), %rcx
	cmpq	%r8, %rcx
	jg	.L13
	cmpq	%rsi, %rdi
	cmovl	%rsi, %rdi
	addq	$8, %rax
	movl	$1, %esi
	cmpq	%r9, %rax
	jne	.L6
.L7:
	cmpq	%rsi, %rdi
	cmovl	%rsi, %rdi
	xorl	%eax, %eax
	movq	%r12, %rsi
	subq	%rdi, %rdx
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$24, %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
.L2:
	.cfi_restore_state
	movl	$1, %esi
	movl	$1, %edi
	jmp	.L7
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600080
a:
	.zero	1600080
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.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>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll n;
ll a[200010];

int main(){
	scanf("%lld",&n);
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		a[t-1]=i;
	}
	ll ans=1,temp=1;
	rep(i,1,n){
		if(a[i-1]<a[i])temp++;
		else {ans=max(ans,temp);temp=1;}
	}
	ans=max(ans,temp);
	printf("%lld",n-ans);
}
6
2
3
5
1
4
6
 8
6
3
2
1
7
4
8
5
 4
1
4
2
3
 6
3
1
5
2
4
6
 4
3
1
2
4
 8
6
3
1
2
5
4
8
7
 4
2
4
1
3
 8
6
3
2
1
4
7
8
5
 6
2
5
3
1
4
6
 8
6
3
2
1
7
4
5
8

3 5 1 4 2 6 2 5 3 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>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))

ll n;
ll a[200010];

int main(){
	scanf("%lld",&n);
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		a[t-1]=i;
	}
	ll ans=1,temp=1;
	rep(i,1,n){
		if(a[i-1]<a[i])temp++;
		else {ans=max(ans,temp);temp=1;}
	}
	ans=max(ans,temp);
	printf("%lld",n-ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600080
a:
	.zero	1600080
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -40(%rbp)
	jmp	.L2
.L3:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -40(%rbp)
.L2:
	movq	n(%rip), %rax
	cmpq	%rax, -40(%rbp)
	jl	.L3
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movq	$1, -16(%rbp)
	jmp	.L4
.L7:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	addq	$1, -24(%rbp)
	jmp	.L6
.L5:
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	$1, -24(%rbp)
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	n(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L7
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	n(%rip), %rax
	subq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	n
	.bss
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600080
a:
	.zero	1600080
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -40(%rbp)
	jmp	.L2
.L3:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-48(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -40(%rbp)
.L2:
	movq	n(%rip), %rax
	cmpq	%rax, -40(%rbp)
	jl	.L3
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movq	$1, -16(%rbp)
	jmp	.L4
.L7:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	addq	$1, -24(%rbp)
	jmp	.L6
.L5:
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	$1, -24(%rbp)
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	n(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L7
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	cmpq	%rax, %rdx
	cmovge	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	n(%rip), %rax
	subq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
