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

```c
// AOJ 1367: Rearranging a Sequence
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

typedef struct { int id, a; } T;
T tbl[200002];

int cmp(T *a, T *b) { return b->id - a->id; }

char buf[100], *p;
int getInt(void)
{
	int n = 0;
//	if (*p == ' ') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ - '0');
	return n;
}

int main()
{
	int n, m, i, j;
	register T *tp;

	fgets(p = buf, 50, stdin); n = getInt(), p++, m = getInt(); 
//	scanf("%d%d", &n, &m);
	for (tp = tbl+1, j = n, i = 1; i <= n; i++, tp++) tp->id = j--, tp->a = i;
	while (m-- > 0) {
		fgets(p = buf, 50, stdin); j = getInt();
//		scanf("%d", &j);
		tbl[j].id = i++;
	}
	qsort(tbl+1, n, sizeof(T), cmp);
	for (tp = tbl+1, i = 1; i <= n; i++, tp++) printf("%d\n", tp->a);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600016
tbl:
	.zero	1600016
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L4
.L5:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L5
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -20(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	call	getInt
	movl	%eax, -32(%rbp)
	leaq	8+tbl(%rip), %rbx
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -24(%rbp)
	movl	%eax, (%rbx)
	movl	-28(%rbp), %eax
	movl	%eax, 4(%rbx)
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L8:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L11:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	8+tbl(%rip), %rdi
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	leaq	8+tbl(%rip), %rbx
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	4(%rbx), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L12:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB40:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L6
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, p(%rip)
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	leal	(%r8,%r8,4), %ecx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rcx,2), %r8d
	jg	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getInt, .-getInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$50, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	buf(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	leaq	1(%rax), %rdx
	jle	.L9
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdx, p(%rip)
	movq	%rdx, %rax
	movsbl	-1(%rdx), %esi
	addq	$1, %rdx
	leal	(%r14,%r14,4), %edi
	cmpb	$47, -1(%rdx)
	leal	-48(%rsi,%rdi,2), %r14d
	jg	.L10
	leaq	1(%rax), %rdx
	movslq	%r14d, %rcx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	movq	%rcx, 8(%rsp)
	jle	.L14
.L12:
	addq	$2, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rsi,2), %edx
	jg	.L15
	testl	%r14d, %r14d
	jle	.L19
.L17:
	movl	$1, %eax
	testl	%r14d, %r14d
	movl	%eax, %edi
	cmovg	%r14d, %edi
	cmpl	$1, %r14d
	je	.L37
	movl	%edi, %esi
	movd	%eax, %xmm3
	movdqa	.LC1(%rip), %xmm2
	movd	%r14d, %xmm0
	shrl	%esi
	leaq	8+tbl(%rip), %rbx
	punpckldq	%xmm3, %xmm0
	subl	$1, %esi
	leaq	16(%rbx), %r8
	movq	%rbx, %rax
	punpcklqdq	%xmm0, %xmm0
	salq	$4, %rsi
	paddd	.LC0(%rip), %xmm0
	addq	%r8, %rsi
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L21
	movl	%edi, %eax
	movl	%edi, %esi
	orl	$1, %eax
	andl	$-2, %esi
	movd	%eax, %xmm1
	movl	%r14d, %eax
	subl	%esi, %eax
	movd	%eax, %xmm0
	movl	%esi, %eax
	leaq	(%rbx,%rax,8), %rax
	cmpl	%edi, %esi
	je	.L22
.L20:
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rax)
.L22:
	movl	$2, %eax
	leal	1(%r14), %r15d
	testl	%r14d, %r14d
	cmovle	%eax, %r15d
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	jle	.L53
.L23:
	leaq	tbl(%rip), %r12
	leal	(%r15,%rax), %ebp
	.p2align 4,,10
	.p2align 3
.L29:
	movq	stdin(%rip), %rdx
	movl	$50, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L38
	addq	$1, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rsi,2), %edx
	jg	.L28
.L27:
	movl	%ebp, %eax
	movslq	%edx, %rdx
	subl	%r15d, %eax
	movl	%r15d, (%r12,%rdx,8)
	leal	1(%r15), %edx
	testl	%eax, %eax
	jle	.L54
	movl	%edx, %r15d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L38:
	xorl	%edx, %edx
	jmp	.L27
.L53:
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
.L33:
	movl	$1, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L31:
	movl	4(%rbx), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebp
	addq	$8, %rbx
	call	__printf_chk@PLT
	cmpl	%r14d, %ebp
	jle	.L31
.L47:
	addq	$24, %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
.L54:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
	testl	%r14d, %r14d
	jg	.L33
	jmp	.L47
.L9:
	movq	%rdx, p(%rip)
	xorl	%r14d, %r14d
	cmpb	$47, 1(%rax)
	movq	$0, 8(%rsp)
	jg	.L12
.L32:
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	leaq	8+tbl(%rip), %rdi
	call	qsort@PLT
	jmp	.L47
.L19:
	testl	%edx, %edx
	jle	.L32
	leal	-1(%rdx), %eax
	movl	$1, %r15d
	leaq	8+tbl(%rip), %rbx
	jmp	.L23
.L14:
	xorl	%edx, %edx
	testl	%r14d, %r14d
	jg	.L17
	jmp	.L32
.L37:
	movl	$1, %eax
	leaq	8+tbl(%rip), %rbx
	movd	%eax, %xmm0
	movd	%eax, %xmm1
	movq	%rbx, %rax
	jmp	.L20
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 1600016
tbl:
	.zero	1600016
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	0
	.long	-1
	.long	1
	.align 16
.LC1:
	.long	-2
	.long	2
	.long	-2
	.long	2
	.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	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB40:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L6
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, p(%rip)
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	leal	(%r8,%r8,4), %ecx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rcx,2), %r8d
	jg	.L5
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getInt, .-getInt
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$50, %esi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	buf(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	stdin(%rip), %rdx
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	leaq	1(%rax), %rdx
	jle	.L9
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdx, p(%rip)
	movq	%rdx, %rax
	movsbl	-1(%rdx), %esi
	addq	$1, %rdx
	leal	(%r14,%r14,4), %edi
	cmpb	$47, -1(%rdx)
	leal	-48(%rsi,%rdi,2), %r14d
	jg	.L10
	leaq	1(%rax), %rdx
	movslq	%r14d, %rcx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	movq	%rcx, 8(%rsp)
	jle	.L14
.L12:
	addq	$2, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rsi,2), %edx
	jg	.L15
	testl	%r14d, %r14d
	jle	.L19
.L17:
	movl	$1, %eax
	testl	%r14d, %r14d
	movl	%eax, %edi
	cmovg	%r14d, %edi
	cmpl	$1, %r14d
	je	.L37
	movl	%edi, %esi
	movd	%eax, %xmm3
	movdqa	.LC1(%rip), %xmm2
	movd	%r14d, %xmm0
	shrl	%esi
	leaq	8+tbl(%rip), %rbx
	punpckldq	%xmm3, %xmm0
	subl	$1, %esi
	leaq	16(%rbx), %r8
	movq	%rbx, %rax
	punpcklqdq	%xmm0, %xmm0
	salq	$4, %rsi
	paddd	.LC0(%rip), %xmm0
	addq	%r8, %rsi
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	movups	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L21
	movl	%edi, %eax
	movl	%edi, %esi
	orl	$1, %eax
	andl	$-2, %esi
	movd	%eax, %xmm1
	movl	%r14d, %eax
	subl	%esi, %eax
	movd	%eax, %xmm0
	movl	%esi, %eax
	leaq	(%rbx,%rax,8), %rax
	cmpl	%edi, %esi
	je	.L22
.L20:
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rax)
.L22:
	movl	$2, %eax
	leal	1(%r14), %r15d
	testl	%r14d, %r14d
	cmovle	%eax, %r15d
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	jle	.L53
.L23:
	leaq	tbl(%rip), %r12
	leal	(%r15,%rax), %ebp
	.p2align 4,,10
	.p2align 3
.L29:
	movq	stdin(%rip), %rdx
	movl	$50, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L38
	addq	$1, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	addq	$1, %rax
	movsbl	-2(%rax), %edx
	cmpb	$47, -1(%rax)
	leal	-48(%rdx,%rsi,2), %edx
	jg	.L28
.L27:
	movl	%ebp, %eax
	movslq	%edx, %rdx
	subl	%r15d, %eax
	movl	%r15d, (%r12,%rdx,8)
	leal	1(%r15), %edx
	testl	%eax, %eax
	jle	.L54
	movl	%edx, %r15d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L38:
	xorl	%edx, %edx
	jmp	.L27
.L53:
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
.L33:
	movl	$1, %ebp
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L31:
	movl	4(%rbx), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebp
	addq	$8, %rbx
	call	__printf_chk@PLT
	cmpl	%r14d, %ebp
	jle	.L31
.L47:
	addq	$24, %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
.L54:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	movq	%rbx, %rdi
	call	qsort@PLT
	testl	%r14d, %r14d
	jg	.L33
	jmp	.L47
.L9:
	movq	%rdx, p(%rip)
	xorl	%r14d, %r14d
	cmpb	$47, 1(%rax)
	movq	$0, 8(%rsp)
	jg	.L12
.L32:
	movq	8(%rsp), %rsi
	leaq	cmp(%rip), %rcx
	movl	$8, %edx
	leaq	8+tbl(%rip), %rdi
	call	qsort@PLT
	jmp	.L47
.L19:
	testl	%edx, %edx
	jle	.L32
	leal	-1(%rdx), %eax
	movl	$1, %r15d
	leaq	8+tbl(%rip), %rbx
	jmp	.L23
.L14:
	xorl	%edx, %edx
	testl	%r14d, %r14d
	jg	.L17
	jmp	.L32
.L37:
	movl	$1, %eax
	leaq	8+tbl(%rip), %rbx
	movd	%eax, %xmm0
	movd	%eax, %xmm1
	movq	%rbx, %rax
	jmp	.L20
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 1600016
tbl:
	.zero	1600016
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	0
	.long	-1
	.long	1
	.align 16
.LC1:
	.long	-2
	.long	2
	.long	-2
	.long	2
	.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:

// AOJ 1367: Rearranging a Sequence
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

typedef struct { int id, a; } T;
T tbl[200002];

int cmp(T *a, T *b) { return b->id - a->id; }

char buf[100], *p;
int getInt(void)
{
	int n = 0;
//	if (*p == ' ') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ - '0');
	return n;
}

int main()
{
	int n, m, i, j;
	register T *tp;

	fgets(p = buf, 50, stdin); n = getInt(), p++, m = getInt(); 
//	scanf("%d%d", &n, &m);
	for (tp = tbl+1, j = n, i = 1; i <= n; i++, tp++) tp->id = j--, tp->a = i;
	while (m-- > 0) {
		fgets(p = buf, 50, stdin); j = getInt();
//		scanf("%d", &j);
		tbl[j].id = i++;
	}
	qsort(tbl+1, n, sizeof(T), cmp);
	for (tp = tbl+1, i = 1; i <= n; i++, tp++) printf("%d\n", tp->a);
	return 0;
}
5 0
4
2
5
 2 0
4
2
6
 5 3
5
2
5
 3 0
4
0
6
 7 0
3
0
6
 9 0
3
0
6
 9 1
4
0
6
 1 0
10
0
0
 10 1
4
0
6
 10 1
8
0
6

1
2
3
4
5
 1
2
 5
2
1
3
4
 1
2
3
 1
2
3
4
5
6
7
 1
2
3
4
5
6
7
8
9
 4
1
2
3
5
6
7
8
9
 1
 4
1
2
3
5
6
7
8
9
10
 8
1
2
3
4
5
6
7
9
10

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

```c
// AOJ 1367: Rearranging a Sequence
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

typedef struct { int id, a; } T;
T tbl[200002];

int cmp(T *a, T *b) { return b->id - a->id; }

char buf[100], *p;
int getInt(void)
{
	int n = 0;
//	if (*p == ' ') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ - '0');
	return n;
}

int main()
{
	int n, m, i, j;
	register T *tp;

	fgets(p = buf, 50, stdin); n = getInt(), p++, m = getInt(); 
//	scanf("%d%d", &n, &m);
	for (tp = tbl+1, j = n, i = 1; i <= n; i++, tp++) tp->id = j--, tp->a = i;
	while (m-- > 0) {
		fgets(p = buf, 50, stdin); j = getInt();
//		scanf("%d", &j);
		tbl[j].id = i++;
	}
	qsort(tbl+1, n, sizeof(T), cmp);
	for (tp = tbl+1, i = 1; i <= n; i++, tp++) printf("%d\n", tp->a);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600016
tbl:
	.zero	1600016
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L4
.L5:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L5
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -20(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	call	getInt
	movl	%eax, -32(%rbp)
	leaq	8+tbl(%rip), %rbx
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -24(%rbp)
	movl	%eax, (%rbx)
	movl	-28(%rbp), %eax
	movl	%eax, 4(%rbx)
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L8:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L11:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	8+tbl(%rip), %rdi
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	leaq	8+tbl(%rip), %rbx
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	4(%rbx), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L12:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600016
tbl:
	.zero	1600016
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L4
.L5:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L5
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getInt, .-getInt
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -20(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	call	getInt
	movl	%eax, -32(%rbp)
	leaq	8+tbl(%rip), %rbx
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L8
.L9:
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -24(%rbp)
	movl	%eax, (%rbx)
	movl	-28(%rbp), %eax
	movl	%eax, 4(%rbx)
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L8:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L11:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$50, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	call	getInt
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -28(%rbp)
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	8+tbl(%rip), %rdi
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rsi
	call	qsort@PLT
	leaq	8+tbl(%rip), %rbx
	movl	$1, -28(%rbp)
	jmp	.L12
.L13:
	movl	4(%rbx), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -28(%rbp)
	addq	$8, %rbx
.L12:
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
