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

```c
// AOJ 2890: Pivots
// 2019.2.22 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int in2(char *s)
{
	int n = 0, c;
	
	*s++ = c = gc();
	do {
		n = 10 * n + (c & 0xf);
		*s++ = c = gc();
	} while (c >= '0');
	*(s-1) = 0;
	return n;
}

void out(char *s)
{
	while (*s) pc(*s++);
}

typedef struct { int pre, nxt; char a[7]; } T;
T tbl[100005]; int top, end;
int idx[100005];
int N;

int main()
{
	int i, Q, pre, nxt;

	N = in(), Q = in();
	for (i = 0; i < N; i++) {
		tbl[i].pre = i - 1, tbl[i].nxt = i + 1;
		idx[in2(tbl[i].a)] = i;
	}
	top = 0, end = N - 1;
	tbl[top].pre = tbl[end].nxt = -1;

	while (Q--) {
		i = idx[in()];
		pre = tbl[i].pre, nxt = tbl[i].nxt;
		if (pre >= 0) tbl[i].nxt = top, tbl[top].pre = i;
		if (nxt >= 0) tbl[i].pre = end, tbl[end].nxt = i;
		if (pre >= 0) end = pre; else end = i;
		if (nxt >= 0) top = nxt; else top = i;
		tbl[top].pre = tbl[end].nxt = -1;
	}
	out(tbl[top].a);
	for (nxt = tbl[top].nxt; nxt >= 0; nxt = tbl[nxt].nxt)
		pc(' '), out(tbl[nxt].a);
	pc('\n');
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	in2
	.type	in2, @function
in2:
.LFB7:
	.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	%rdi, -24(%rbp)
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
.L5:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	cmpl	$47, -4(%rbp)
	jg	.L5
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	in2, .-in2
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	jmp	.L8
.L9:
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600080
tbl:
	.zero	1600080
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	idx
	.align 32
	.type	idx, @object
	.size	idx, 400020
idx:
	.zero	400020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	in2
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	idx(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L12
	movl	$0, top(%rip)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L20:
	movl	$0, %eax
	call	in
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	js	.L14
	movl	top(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L14:
	cmpl	$0, -8(%rbp)
	js	.L15
	movl	end(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L15:
	cmpl	$0, -4(%rbp)
	js	.L16
	movl	-4(%rbp), %eax
	movl	%eax, end(%rip)
	jmp	.L17
.L16:
	movl	-16(%rbp), %eax
	movl	%eax, end(%rip)
.L17:
	cmpl	$0, -8(%rbp)
	js	.L18
	movl	-8(%rbp), %eax
	movl	%eax, top(%rip)
	jmp	.L19
.L18:
	movl	-16(%rbp), %eax
	movl	%eax, top(%rip)
.L19:
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L20
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L21
.L22:
	movl	$32, %edi
	call	putchar_unlocked@PLT
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L21:
	cmpl	$0, -8(%rbp)
	jns	.L22
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	in
	.type	in, @function
in:
.LFB39:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE39:
	.size	in, .-in
	.p2align 4
	.globl	in2
	.type	in2, @function
in2:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L20
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L14:
	movb	%al, (%r12)
	leaq	1(%r12), %rbx
	xorl	%r12d, %r12d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	1(%rax), %rdx
	addq	$1, %rbx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbx)
	cmpl	$47, %eax
	jle	.L17
.L18:
	movq	stdin(%rip), %rdi
	andl	$15, %eax
	leal	(%r12,%r12,4), %edx
	leal	(%rax,%rdx,2), %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L15
	call	__uflow@PLT
	addq	$1, %rbx
	movb	%al, -1(%rbx)
	cmpl	$47, %eax
	jg	.L18
.L17:
	movb	$0, -1(%rbx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	call	__uflow@PLT
	jmp	.L14
	.cfi_endproc
.LFE40:
	.size	in2, .-in2
	.p2align 4
	.globl	out
	.type	out, @function
out:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movzbl	(%rdi), %esi
	movq	%rdi, %rbx
	testb	%sil, %sil
	jne	.L25
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L23:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	je	.L21
.L25:
	movq	stdout(%rip), %rdi
	addq	$1, %rbx
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L23
	call	__overflow@PLT
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L25
.L21:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	out, .-out
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	call	in
	movl	%eax, N(%rip)
	xorl	%eax, %eax
	call	in
	movl	%eax, %r14d
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L34
	leaq	9+tbl(%rip), %r15
	xorl	%r13d, %r13d
	leaq	idx(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L41:
	movq	stdin(%rip), %rdi
	leal	-1(%r13), %eax
	movl	%r13d, 12(%rsp)
	addl	$1, %r13d
	movl	%eax, -9(%r15)
	movq	%r15, %rbp
	movl	%r13d, -5(%r15)
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L82
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L36:
	movb	%al, -1(%r15)
	xorl	%r12d, %r12d
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	leaq	1(%rax), %rcx
	addq	$1, %rbp
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbp)
	cmpl	$47, %eax
	jle	.L39
.L40:
	andl	$15, %eax
	leal	(%r12,%r12,4), %ecx
	leal	(%rax,%rcx,2), %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L37
	call	__uflow@PLT
	addq	$1, %rbp
	movb	%al, -1(%rbp)
	cmpl	$47, %eax
	jle	.L39
	movq	stdin(%rip), %rdi
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L39:
	movl	12(%rsp), %eax
	movslq	%r12d, %r12
	movb	$0, -1(%rbp)
	addq	$16, %r15
	movl	%eax, (%rbx,%r12,4)
	movl	N(%rip), %eax
	cmpl	%eax, %r13d
	jl	.L41
.L34:
	subl	$1, %eax
	xorl	%esi, %esi
	leaq	tbl(%rip), %r13
	movl	$0, top(%rip)
	movl	%eax, end(%rip)
	cltq
	movl	$-1, tbl(%rip)
	salq	$4, %rax
	movl	$-1, 4(%r13,%rax)
	testl	%r14d, %r14d
	je	.L42
	movl	%r14d, %ebp
	leaq	idx(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L52:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L83
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L44:
	xorl	%r12d, %r12d
	jmp	.L48
	.p2align 4,,10
	.p2align 3
.L45:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L47
.L46:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L48:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L45
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L47
	movq	stdin(%rip), %rdi
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%r12d, %r12
	movslq	(%rbx,%r12,4), %rsi
	movq	%rsi, %rdx
	movq	%rsi, %r14
	salq	$4, %rdx
	addq	%r13, %rdx
	movslq	(%rdx), %rax
	movl	4(%rdx), %edi
	testl	%eax, %eax
	js	.L49
	movslq	top(%rip), %rcx
	movl	%ecx, 4(%rdx)
	salq	$4, %rcx
	movl	%esi, 0(%r13,%rcx)
	testl	%edi, %edi
	js	.L51
.L81:
	movslq	end(%rip), %rcx
	movslq	%edi, %rsi
	movl	%ecx, (%rdx)
	salq	$4, %rcx
	movl	%r14d, 4(%r13,%rcx)
	movq	%rsi, %r14
.L51:
	movl	%eax, end(%rip)
	salq	$4, %rax
	movl	$-1, 4(%r13,%rax)
	movq	%rsi, %rax
	salq	$4, %rax
	movl	%r14d, top(%rip)
	movl	$-1, 0(%r13,%rax)
	subl	$1, %ebp
	jne	.L52
.L42:
	salq	$4, %rsi
	leaq	8(%r13,%rsi), %rdi
	call	out
	movslq	top(%rip), %rax
	salq	$4, %rax
	movslq	4(%r13,%rax), %rbp
	testl	%ebp, %ebp
	js	.L59
	.p2align 4,,10
	.p2align 3
.L53:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L84
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$32, (%rax)
.L57:
	movq	%rbp, %rax
	salq	$4, %rax
	leaq	8(%r13,%rax), %rbx
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L58
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L60:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	je	.L62
.L58:
	movq	stdout(%rip), %rdi
	addq	$1, %rbx
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L60
	call	__overflow@PLT
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L58
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rbp, %rbx
	salq	$4, %rbx
	movslq	4(%r13,%rbx), %rbp
	testl	%ebp, %ebp
	jns	.L53
.L59:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L85
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
.L79:
	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
	.p2align 4,,10
	.p2align 3
.L49:
	.cfi_restore_state
	movslq	%esi, %rax
	testl	%edi, %edi
	jns	.L81
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L82:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L84:
	movl	$32, %esi
	call	__overflow@PLT
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L83:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L44
.L85:
	movl	$10, %esi
	call	__overflow@PLT
	jmp	.L79
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	idx
	.align 32
	.type	idx, @object
	.size	idx, 400020
idx:
	.zero	400020
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 1600080
tbl:
	.zero	1600080
	.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	in
	.type	in, @function
in:
.LFB39:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE39:
	.size	in, .-in
	.p2align 4
	.globl	in2
	.type	in2, @function
in2:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	%rdi, %r12
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L20
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L14:
	movb	%al, (%r12)
	leaq	1(%r12), %rbx
	xorl	%r12d, %r12d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	1(%rax), %rdx
	addq	$1, %rbx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbx)
	cmpl	$47, %eax
	jle	.L17
.L18:
	movq	stdin(%rip), %rdi
	andl	$15, %eax
	leal	(%r12,%r12,4), %edx
	leal	(%rax,%rdx,2), %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L15
	call	__uflow@PLT
	addq	$1, %rbx
	movb	%al, -1(%rbx)
	cmpl	$47, %eax
	jg	.L18
.L17:
	movb	$0, -1(%rbx)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	%r12d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	call	__uflow@PLT
	jmp	.L14
	.cfi_endproc
.LFE40:
	.size	in2, .-in2
	.p2align 4
	.globl	out
	.type	out, @function
out:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movzbl	(%rdi), %esi
	movq	%rdi, %rbx
	testb	%sil, %sil
	jne	.L25
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L23:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	je	.L21
.L25:
	movq	stdout(%rip), %rdi
	addq	$1, %rbx
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L23
	call	__overflow@PLT
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L25
.L21:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	out, .-out
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	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
	call	in
	movl	%eax, N(%rip)
	xorl	%eax, %eax
	call	in
	movl	%eax, %r14d
	movl	N(%rip), %eax
	testl	%eax, %eax
	jle	.L34
	leaq	9+tbl(%rip), %r15
	xorl	%r13d, %r13d
	leaq	idx(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L41:
	movq	stdin(%rip), %rdi
	leal	-1(%r13), %eax
	movl	%r13d, 12(%rsp)
	addl	$1, %r13d
	movl	%eax, -9(%r15)
	movq	%r15, %rbp
	movl	%r13d, -5(%r15)
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L82
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L36:
	movb	%al, -1(%r15)
	xorl	%r12d, %r12d
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L37:
	leaq	1(%rax), %rcx
	addq	$1, %rbp
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbp)
	cmpl	$47, %eax
	jle	.L39
.L40:
	andl	$15, %eax
	leal	(%r12,%r12,4), %ecx
	leal	(%rax,%rcx,2), %r12d
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L37
	call	__uflow@PLT
	addq	$1, %rbp
	movb	%al, -1(%rbp)
	cmpl	$47, %eax
	jle	.L39
	movq	stdin(%rip), %rdi
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L39:
	movl	12(%rsp), %eax
	movslq	%r12d, %r12
	movb	$0, -1(%rbp)
	addq	$16, %r15
	movl	%eax, (%rbx,%r12,4)
	movl	N(%rip), %eax
	cmpl	%eax, %r13d
	jl	.L41
.L34:
	subl	$1, %eax
	xorl	%esi, %esi
	leaq	tbl(%rip), %r13
	movl	$0, top(%rip)
	movl	%eax, end(%rip)
	cltq
	movl	$-1, tbl(%rip)
	salq	$4, %rax
	movl	$-1, 4(%r13,%rax)
	testl	%r14d, %r14d
	je	.L42
	movl	%r14d, %ebp
	leaq	idx(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L52:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L83
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L44:
	xorl	%r12d, %r12d
	jmp	.L48
	.p2align 4,,10
	.p2align 3
.L45:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L47
.L46:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L48:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L45
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L47
	movq	stdin(%rip), %rdi
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movslq	%r12d, %r12
	movslq	(%rbx,%r12,4), %rsi
	movq	%rsi, %rdx
	movq	%rsi, %r14
	salq	$4, %rdx
	addq	%r13, %rdx
	movslq	(%rdx), %rax
	movl	4(%rdx), %edi
	testl	%eax, %eax
	js	.L49
	movslq	top(%rip), %rcx
	movl	%ecx, 4(%rdx)
	salq	$4, %rcx
	movl	%esi, 0(%r13,%rcx)
	testl	%edi, %edi
	js	.L51
.L81:
	movslq	end(%rip), %rcx
	movslq	%edi, %rsi
	movl	%ecx, (%rdx)
	salq	$4, %rcx
	movl	%r14d, 4(%r13,%rcx)
	movq	%rsi, %r14
.L51:
	movl	%eax, end(%rip)
	salq	$4, %rax
	movl	$-1, 4(%r13,%rax)
	movq	%rsi, %rax
	salq	$4, %rax
	movl	%r14d, top(%rip)
	movl	$-1, 0(%r13,%rax)
	subl	$1, %ebp
	jne	.L52
.L42:
	salq	$4, %rsi
	leaq	8(%r13,%rsi), %rdi
	call	out
	movslq	top(%rip), %rax
	salq	$4, %rax
	movslq	4(%r13,%rax), %rbp
	testl	%ebp, %ebp
	js	.L59
	.p2align 4,,10
	.p2align 3
.L53:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L84
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$32, (%rax)
.L57:
	movq	%rbp, %rax
	salq	$4, %rax
	leaq	8(%r13,%rax), %rbx
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L58
	jmp	.L62
	.p2align 4,,10
	.p2align 3
.L60:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	je	.L62
.L58:
	movq	stdout(%rip), %rdi
	addq	$1, %rbx
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L60
	call	__overflow@PLT
	movzbl	(%rbx), %esi
	testb	%sil, %sil
	jne	.L58
	.p2align 4,,10
	.p2align 3
.L62:
	movq	%rbp, %rbx
	salq	$4, %rbx
	movslq	4(%r13,%rbx), %rbp
	testl	%ebp, %ebp
	jns	.L53
.L59:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L85
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
.L79:
	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
	.p2align 4,,10
	.p2align 3
.L49:
	.cfi_restore_state
	movslq	%esi, %rax
	testl	%edi, %edi
	jns	.L81
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L82:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L84:
	movl	$32, %esi
	call	__overflow@PLT
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L83:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L44
.L85:
	movl	$10, %esi
	call	__overflow@PLT
	jmp	.L79
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	idx
	.align 32
	.type	idx, @object
	.size	idx, 400020
idx:
	.zero	400020
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 1600080
tbl:
	.zero	1600080
	.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 2890: Pivots
// 2019.2.22 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int in2(char *s)
{
	int n = 0, c;
	
	*s++ = c = gc();
	do {
		n = 10 * n + (c & 0xf);
		*s++ = c = gc();
	} while (c >= '0');
	*(s-1) = 0;
	return n;
}

void out(char *s)
{
	while (*s) pc(*s++);
}

typedef struct { int pre, nxt; char a[7]; } T;
T tbl[100005]; int top, end;
int idx[100005];
int N;

int main()
{
	int i, Q, pre, nxt;

	N = in(), Q = in();
	for (i = 0; i < N; i++) {
		tbl[i].pre = i - 1, tbl[i].nxt = i + 1;
		idx[in2(tbl[i].a)] = i;
	}
	top = 0, end = N - 1;
	tbl[top].pre = tbl[end].nxt = -1;

	while (Q--) {
		i = idx[in()];
		pre = tbl[i].pre, nxt = tbl[i].nxt;
		if (pre >= 0) tbl[i].nxt = top, tbl[top].pre = i;
		if (nxt >= 0) tbl[i].pre = end, tbl[end].nxt = i;
		if (pre >= 0) end = pre; else end = i;
		if (nxt >= 0) top = nxt; else top = i;
		tbl[top].pre = tbl[end].nxt = -1;
	}
	out(tbl[top].a);
	for (nxt = tbl[top].nxt; nxt >= 0; nxt = tbl[nxt].nxt)
		pc(' '), out(tbl[nxt].a);
	pc('\n');
	return 0;
}

5 2
1 5 3 2 4
5 3
 5 0
1 5 3 2 4
5 3
 5 2
1 5 3 2 4
3 2
 5 1
1 5 3 2 4
5 3
 5 2
1 5 3 2 4
3 1
 5 1
1 5 3 2 4
1 3
 5 1
1 5 3 2 4
4 2
 5 1
1 5 3 2 4
3 2
 1 0
1 5 3 2 4
9 1
 5 1
1 5 3 2 4
2 1

2 4 5 1 3
 1 5 3 2 4
 4 3 1 5 2
 3 2 4 5 1
 5 1 2 4 3
 5 3 2 4 1
 4 1 5 3 2
 2 4 3 1 5
 1
 4 2 1 5 3

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

```c
// AOJ 2890: Pivots
// 2019.2.22 bal4u

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

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int in2(char *s)
{
	int n = 0, c;
	
	*s++ = c = gc();
	do {
		n = 10 * n + (c & 0xf);
		*s++ = c = gc();
	} while (c >= '0');
	*(s-1) = 0;
	return n;
}

void out(char *s)
{
	while (*s) pc(*s++);
}

typedef struct { int pre, nxt; char a[7]; } T;
T tbl[100005]; int top, end;
int idx[100005];
int N;

int main()
{
	int i, Q, pre, nxt;

	N = in(), Q = in();
	for (i = 0; i < N; i++) {
		tbl[i].pre = i - 1, tbl[i].nxt = i + 1;
		idx[in2(tbl[i].a)] = i;
	}
	top = 0, end = N - 1;
	tbl[top].pre = tbl[end].nxt = -1;

	while (Q--) {
		i = idx[in()];
		pre = tbl[i].pre, nxt = tbl[i].nxt;
		if (pre >= 0) tbl[i].nxt = top, tbl[top].pre = i;
		if (nxt >= 0) tbl[i].pre = end, tbl[end].nxt = i;
		if (pre >= 0) end = pre; else end = i;
		if (nxt >= 0) top = nxt; else top = i;
		tbl[top].pre = tbl[end].nxt = -1;
	}
	out(tbl[top].a);
	for (nxt = tbl[top].nxt; nxt >= 0; nxt = tbl[nxt].nxt)
		pc(' '), out(tbl[nxt].a);
	pc('\n');
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	in2
	.type	in2, @function
in2:
.LFB7:
	.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	%rdi, -24(%rbp)
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
.L5:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	cmpl	$47, -4(%rbp)
	jg	.L5
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	in2, .-in2
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	jmp	.L8
.L9:
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600080
tbl:
	.zero	1600080
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	idx
	.align 32
	.type	idx, @object
	.size	idx, 400020
idx:
	.zero	400020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	in2
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	idx(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L12
	movl	$0, top(%rip)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L20:
	movl	$0, %eax
	call	in
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	js	.L14
	movl	top(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L14:
	cmpl	$0, -8(%rbp)
	js	.L15
	movl	end(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L15:
	cmpl	$0, -4(%rbp)
	js	.L16
	movl	-4(%rbp), %eax
	movl	%eax, end(%rip)
	jmp	.L17
.L16:
	movl	-16(%rbp), %eax
	movl	%eax, end(%rip)
.L17:
	cmpl	$0, -8(%rbp)
	js	.L18
	movl	-8(%rbp), %eax
	movl	%eax, top(%rip)
	jmp	.L19
.L18:
	movl	-16(%rbp), %eax
	movl	%eax, top(%rip)
.L19:
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L20
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L21
.L22:
	movl	$32, %edi
	call	putchar_unlocked@PLT
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L21:
	cmpl	$0, -8(%rbp)
	jns	.L22
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	in2
	.type	in2, @function
in2:
.LFB7:
	.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	%rdi, -24(%rbp)
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
.L5:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -24(%rbp)
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	cmpl	$47, -4(%rbp)
	jg	.L5
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	in2, .-in2
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	jmp	.L8
.L9:
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 1600080
tbl:
	.zero	1600080
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	idx
	.align 32
	.type	idx, @object
	.size	idx, 400020
idx:
	.zero	400020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, N(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L11
.L12:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	in2
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	idx(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L11:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L12
	movl	$0, top(%rip)
	movl	N(%rip), %eax
	subl	$1, %eax
	movl	%eax, end(%rip)
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L13
.L20:
	movl	$0, %eax
	call	in
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	idx(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	js	.L14
	movl	top(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L14:
	cmpl	$0, -8(%rbp)
	js	.L15
	movl	end(%rip), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	end(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L15:
	cmpl	$0, -4(%rbp)
	js	.L16
	movl	-4(%rbp), %eax
	movl	%eax, end(%rip)
	jmp	.L17
.L16:
	movl	-16(%rbp), %eax
	movl	%eax, end(%rip)
.L17:
	cmpl	$0, -8(%rbp)
	js	.L18
	movl	-8(%rbp), %eax
	movl	%eax, top(%rip)
	jmp	.L19
.L18:
	movl	-16(%rbp), %eax
	movl	%eax, top(%rip)
.L19:
	movl	end(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	4+tbl(%rip), %rdx
	movl	$-1, (%rcx,%rdx)
	movl	top(%rip), %edx
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	4+tbl(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	movq	%rdx, %rcx
	salq	$4, %rcx
	leaq	tbl(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L13:
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -12(%rbp)
	testl	%eax, %eax
	jne	.L20
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	top(%rip), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L21
.L22:
	movl	$32, %edi
	call	putchar_unlocked@PLT
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	addq	$8, %rax
	movq	%rax, %rdi
	call	out
	movl	-8(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+tbl(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
.L21:
	cmpl	$0, -8(%rbp)
	jns	.L22
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
