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

```c
// 420 Digits K
// 2019.12.26 bal4u

#include <stdio.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); while ((c = gc()) >= '0');
	return n;
}

char A[200005];
typedef struct { char a; int i; } T;
T a[200005], b[200005];
int f[128];

void distsort(T *ain, T *aout, int sz) {
	int i, x;

	for (i = 0; i < sz; ++i) ++f[ain[i].a];
	for (i = '9'; i > '0'; i--) f[i-1] += f[i];
	for (i = sz-1; i >= 0; i--) {
		x = ain[i].a, aout[--f[x]].a = x, aout[f[x]].i = ain[i].i;
	}
}

int main()
{
	int i, k, K, N;
	
    N = in(), K = in();
    if (K == 0) {
        while (N--) pc(gc()), gc();
    } else {
        for (i = 0; i < N; ++i) {
			A[i] = gc(), gc();
			b[i].i = i, b[i].a = A[i];
		}
		distsort(b, a, N);
		
		k = -1;
		for (i = 0; K < N; ++i) {
			if (a[i].a < A[K]) break;
			if (k < a[i].i && a[i].i < K) {
				pc(a[i].a), k = a[i].i, ++K;
			}
		}
		while (K < N) pc(A[K++]);
	}
	pc('\n');
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.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
.LFE0:
	.size	in, .-in
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 200005
A:
	.zero	200005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1600040
b:
	.zero	1600040
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 512
f:
	.zero	512
	.text
	.globl	distsort
	.type	distsort, @function
distsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L5:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L6
	movl	$57, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -8(%rbp)
.L7:
	cmpl	$48, -8(%rbp)
	jg	.L8
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	4(%rax), %eax
	movl	%eax, 4(%rdx)
	subl	$1, -8(%rbp)
.L9:
	cmpl	$0, -8(%rbp)
	jns	.L10
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	distsort, .-distsort
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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, -4(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L12
	jmp	.L13
.L14:
	call	getchar_unlocked@PLT
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	call	getchar_unlocked@PLT
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
	jmp	.L15
.L12:
	movl	$0, -16(%rbp)
	jmp	.L16
.L17:
	call	getchar_unlocked@PLT
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+b(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movb	%al, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L17
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	distsort
	movl	$-1, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L18
.L22:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	A(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	cmpb	%al, %dl
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	addl	$1, -8(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L22
	jmp	.L23
.L26:
	nop
	jmp	.L23
.L24:
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L23:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
.L15:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
.LFB23:
	.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
.LFE23:
	.size	in, .-in
	.p2align 4
	.globl	distsort
	.type	distsort, @function
distsort:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	testl	%edx, %edx
	jle	.L13
	leal	-1(%rdx), %edx
	movq	%rdi, %rax
	leaq	f(%rip), %rcx
	leaq	8(%rdi,%rdx,8), %r9
	.p2align 4,,10
	.p2align 3
.L14:
	movsbq	(%rax), %rdx
	addq	$8, %rax
	addl	$1, (%rcx,%rdx,4)
	cmpq	%r9, %rax
	jne	.L14
.L13:
	movl	228+f(%rip), %eax
	addl	224+f(%rip), %eax
	movl	%eax, 224+f(%rip)
	addl	220+f(%rip), %eax
	movl	%eax, 220+f(%rip)
	addl	216+f(%rip), %eax
	movl	%eax, 216+f(%rip)
	addl	212+f(%rip), %eax
	movl	%eax, 212+f(%rip)
	addl	208+f(%rip), %eax
	movl	%eax, 208+f(%rip)
	addl	204+f(%rip), %eax
	movl	%eax, 204+f(%rip)
	addl	200+f(%rip), %eax
	movl	%eax, 200+f(%rip)
	addl	196+f(%rip), %eax
	movl	%eax, 196+f(%rip)
	addl	%eax, 192+f(%rip)
	testl	%r8d, %r8d
	jle	.L12
	movslq	%r8d, %rax
	leaq	f(%rip), %rcx
	salq	$3, %rax
	leaq	-8(%rdi,%rax), %r9
	leaq	(%rdi,%rax), %rdx
	leal	-1(%r8), %eax
	salq	$3, %rax
	subq	%rax, %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movsbq	-8(%rdx), %r8
	subq	$8, %rdx
	movl	(%rcx,%r8,4), %eax
	subl	$1, %eax
	movl	%eax, (%rcx,%r8,4)
	cltq
	leaq	(%rsi,%rax,8), %rax
	movb	%r8b, (%rax)
	movl	4(%rdx), %edi
	movl	%edi, 4(%rax)
	cmpq	%r9, %rdx
	jne	.L16
.L12:
	ret
	.cfi_endproc
.LFE24:
	.size	distsort, .-distsort
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.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, %r13d
	xorl	%eax, %eax
	call	in
	testl	%eax, %eax
	je	.L20
	movl	%eax, %r12d
	testl	%r13d, %r13d
	jle	.L66
	leaq	b(%rip), %r15
	movq	stdin(%rip), %rdi
	movslq	%r13d, %rcx
	xorl	%ebx, %ebx
	leaq	A(%rip), %rbp
	leaq	4(%r15), %rdx
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L32:
	leaq	1(%rax), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rax), %eax
.L33:
	movb	%al, 0(%rbp,%rbx)
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L67
	addq	$1, %rax
	movq	%rax, 8(%rdi)
	movzbl	0(%rbp,%rbx), %eax
	movl	%r14d, (%rdx,%rbx,8)
	movb	%al, (%r15,%rbx,8)
	addq	$1, %rbx
	cmpq	%rbx, %rcx
	je	.L36
.L37:
	movq	8(%rdi), %rax
	movl	%ebx, %r14d
	cmpq	16(%rdi), %rax
	jb	.L32
	movq	%rcx, 8(%rsp)
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rsp), %rcx
	leaq	4+b(%rip), %rdx
	jmp	.L33
.L20:
	testl	%r13d, %r13d
	je	.L65
	.p2align 4,,10
	.p2align 3
.L31:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L68
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L26:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rdx
	cmpq	48(%rdi), %rdx
	jnb	.L69
	leaq	1(%rdx), %rcx
	movq	%rcx, 40(%rdi)
	movb	%al, (%rdx)
.L28:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L70
	addq	$1, %rax
	movq	%rax, 8(%rdi)
.L30:
	subl	$1, %r13d
	jne	.L31
.L65:
	movq	stdout(%rip), %rdi
.L24:
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L71
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
.L62:
	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
.L66:
	.cfi_restore_state
	leaq	b(%rip), %r15
.L36:
	movl	%r13d, %edx
	leaq	a(%rip), %rsi
	movq	%r15, %rdi
	call	distsort
	cmpl	%r12d, %r13d
	jle	.L65
	movq	stdout(%rip), %rdi
	leaq	4+a(%rip), %rbx
	orl	$-1, %ecx
	leaq	A(%rip), %rbp
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L39:
	addq	$8, %rbx
	cmpl	%r13d, %r12d
	jge	.L24
.L42:
	movslq	%r12d, %rax
	movzbl	-4(%rbx), %esi
	movq	40(%rdi), %rdx
	movq	48(%rdi), %r8
	cmpb	0(%rbp,%rax), %sil
	jl	.L38
	movl	(%rbx), %eax
	cmpl	%ecx, %eax
	jle	.L39
	cmpl	%r12d, %eax
	jge	.L39
	cmpq	%rdx, %r8
	jbe	.L72
	leaq	1(%rdx), %rax
	movq	%rax, 40(%rdi)
	movb	%sil, (%rdx)
.L41:
	movl	(%rbx), %ecx
	movq	stdout(%rip), %rdi
	addl	$1, %r12d
	jmp	.L39
.L38:
	cmpl	%r12d, %r13d
	jle	.L24
	leaq	0(%rbp,%rax), %rbx
	leaq	1+A(%rip), %rdx
	leal	-1(%r13), %ebp
	addq	%rdx, %rax
	subl	%r12d, %ebp
	addq	%rax, %rbp
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
.L44:
	addq	$1, %rbx
	movq	stdout(%rip), %rdi
	cmpq	%rbx, %rbp
	je	.L24
.L45:
	movzbl	(%rbx), %esi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L43
	call	__overflow@PLT
	jmp	.L44
.L67:
	movq	%rcx, 8(%rsp)
	call	__uflow@PLT
	movzbl	0(%rbp,%rbx), %eax
	movq	8(%rsp), %rcx
	leaq	4+b(%rip), %rdx
	movl	%r14d, (%rdx,%rbx,8)
	movb	%al, (%r15,%rbx,8)
	addq	$1, %rbx
	cmpq	%rbx, %rcx
	je	.L36
	movq	stdin(%rip), %rdi
	jmp	.L37
.L68:
	call	__uflow@PLT
	jmp	.L26
.L70:
	call	__uflow@PLT
	jmp	.L30
.L69:
	movzbl	%al, %esi
	call	__overflow@PLT
	jmp	.L28
.L72:
	call	__overflow@PLT
	jmp	.L41
.L71:
	movl	$10, %esi
	call	__overflow@PLT
	jmp	.L62
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 512
f:
	.zero	512
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1600040
b:
	.zero	1600040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 200005
A:
	.zero	200005
	.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:
.LFB23:
	.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
.LFE23:
	.size	in, .-in
	.p2align 4
	.globl	distsort
	.type	distsort, @function
distsort:
.LFB24:
	.cfi_startproc
	endbr64
	movl	%edx, %r8d
	testl	%edx, %edx
	jle	.L13
	leal	-1(%rdx), %edx
	movq	%rdi, %rax
	leaq	f(%rip), %rcx
	leaq	8(%rdi,%rdx,8), %r9
	.p2align 4,,10
	.p2align 3
.L14:
	movsbq	(%rax), %rdx
	addq	$8, %rax
	addl	$1, (%rcx,%rdx,4)
	cmpq	%r9, %rax
	jne	.L14
.L13:
	movl	228+f(%rip), %eax
	addl	224+f(%rip), %eax
	movl	%eax, 224+f(%rip)
	addl	220+f(%rip), %eax
	movl	%eax, 220+f(%rip)
	addl	216+f(%rip), %eax
	movl	%eax, 216+f(%rip)
	addl	212+f(%rip), %eax
	movl	%eax, 212+f(%rip)
	addl	208+f(%rip), %eax
	movl	%eax, 208+f(%rip)
	addl	204+f(%rip), %eax
	movl	%eax, 204+f(%rip)
	addl	200+f(%rip), %eax
	movl	%eax, 200+f(%rip)
	addl	196+f(%rip), %eax
	movl	%eax, 196+f(%rip)
	addl	%eax, 192+f(%rip)
	testl	%r8d, %r8d
	jle	.L12
	movslq	%r8d, %rax
	leaq	f(%rip), %rcx
	salq	$3, %rax
	leaq	-8(%rdi,%rax), %r9
	leaq	(%rdi,%rax), %rdx
	leal	-1(%r8), %eax
	salq	$3, %rax
	subq	%rax, %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movsbq	-8(%rdx), %r8
	subq	$8, %rdx
	movl	(%rcx,%r8,4), %eax
	subl	$1, %eax
	movl	%eax, (%rcx,%r8,4)
	cltq
	leaq	(%rsi,%rax,8), %rax
	movb	%r8b, (%rax)
	movl	4(%rdx), %edi
	movl	%edi, 4(%rax)
	cmpq	%r9, %rdx
	jne	.L16
.L12:
	ret
	.cfi_endproc
.LFE24:
	.size	distsort, .-distsort
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.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, %r13d
	xorl	%eax, %eax
	call	in
	testl	%eax, %eax
	je	.L20
	movl	%eax, %r12d
	testl	%r13d, %r13d
	jle	.L66
	leaq	b(%rip), %r15
	movq	stdin(%rip), %rdi
	movslq	%r13d, %rcx
	xorl	%ebx, %ebx
	leaq	A(%rip), %rbp
	leaq	4(%r15), %rdx
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L32:
	leaq	1(%rax), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rax), %eax
.L33:
	movb	%al, 0(%rbp,%rbx)
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L67
	addq	$1, %rax
	movq	%rax, 8(%rdi)
	movzbl	0(%rbp,%rbx), %eax
	movl	%r14d, (%rdx,%rbx,8)
	movb	%al, (%r15,%rbx,8)
	addq	$1, %rbx
	cmpq	%rbx, %rcx
	je	.L36
.L37:
	movq	8(%rdi), %rax
	movl	%ebx, %r14d
	cmpq	16(%rdi), %rax
	jb	.L32
	movq	%rcx, 8(%rsp)
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rsp), %rcx
	leaq	4+b(%rip), %rdx
	jmp	.L33
.L20:
	testl	%r13d, %r13d
	je	.L65
	.p2align 4,,10
	.p2align 3
.L31:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L68
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L26:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rdx
	cmpq	48(%rdi), %rdx
	jnb	.L69
	leaq	1(%rdx), %rcx
	movq	%rcx, 40(%rdi)
	movb	%al, (%rdx)
.L28:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jnb	.L70
	addq	$1, %rax
	movq	%rax, 8(%rdi)
.L30:
	subl	$1, %r13d
	jne	.L31
.L65:
	movq	stdout(%rip), %rdi
.L24:
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L71
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
.L62:
	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
.L66:
	.cfi_restore_state
	leaq	b(%rip), %r15
.L36:
	movl	%r13d, %edx
	leaq	a(%rip), %rsi
	movq	%r15, %rdi
	call	distsort
	cmpl	%r12d, %r13d
	jle	.L65
	movq	stdout(%rip), %rdi
	leaq	4+a(%rip), %rbx
	orl	$-1, %ecx
	leaq	A(%rip), %rbp
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L39:
	addq	$8, %rbx
	cmpl	%r13d, %r12d
	jge	.L24
.L42:
	movslq	%r12d, %rax
	movzbl	-4(%rbx), %esi
	movq	40(%rdi), %rdx
	movq	48(%rdi), %r8
	cmpb	0(%rbp,%rax), %sil
	jl	.L38
	movl	(%rbx), %eax
	cmpl	%ecx, %eax
	jle	.L39
	cmpl	%r12d, %eax
	jge	.L39
	cmpq	%rdx, %r8
	jbe	.L72
	leaq	1(%rdx), %rax
	movq	%rax, 40(%rdi)
	movb	%sil, (%rdx)
.L41:
	movl	(%rbx), %ecx
	movq	stdout(%rip), %rdi
	addl	$1, %r12d
	jmp	.L39
.L38:
	cmpl	%r12d, %r13d
	jle	.L24
	leaq	0(%rbp,%rax), %rbx
	leaq	1+A(%rip), %rdx
	leal	-1(%r13), %ebp
	addq	%rdx, %rax
	subl	%r12d, %ebp
	addq	%rax, %rbp
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
.L44:
	addq	$1, %rbx
	movq	stdout(%rip), %rdi
	cmpq	%rbx, %rbp
	je	.L24
.L45:
	movzbl	(%rbx), %esi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jb	.L43
	call	__overflow@PLT
	jmp	.L44
.L67:
	movq	%rcx, 8(%rsp)
	call	__uflow@PLT
	movzbl	0(%rbp,%rbx), %eax
	movq	8(%rsp), %rcx
	leaq	4+b(%rip), %rdx
	movl	%r14d, (%rdx,%rbx,8)
	movb	%al, (%r15,%rbx,8)
	addq	$1, %rbx
	cmpq	%rbx, %rcx
	je	.L36
	movq	stdin(%rip), %rdi
	jmp	.L37
.L68:
	call	__uflow@PLT
	jmp	.L26
.L70:
	call	__uflow@PLT
	jmp	.L30
.L69:
	movzbl	%al, %esi
	call	__overflow@PLT
	jmp	.L28
.L72:
	call	__overflow@PLT
	jmp	.L41
.L71:
	movl	$10, %esi
	call	__overflow@PLT
	jmp	.L62
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 512
f:
	.zero	512
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1600040
b:
	.zero	1600040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 200005
A:
	.zero	200005
	.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:

// 420 Digits K
// 2019.12.26 bal4u

#include <stdio.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); while ((c = gc()) >= '0');
	return n;
}

char A[200005];
typedef struct { char a; int i; } T;
T a[200005], b[200005];
int f[128];

void distsort(T *ain, T *aout, int sz) {
	int i, x;

	for (i = 0; i < sz; ++i) ++f[ain[i].a];
	for (i = '9'; i > '0'; i--) f[i-1] += f[i];
	for (i = sz-1; i >= 0; i--) {
		x = ain[i].a, aout[--f[x]].a = x, aout[f[x]].i = ain[i].i;
	}
}

int main()
{
	int i, k, K, N;
	
    N = in(), K = in();
    if (K == 0) {
        while (N--) pc(gc()), gc();
    } else {
        for (i = 0; i < N; ++i) {
			A[i] = gc(), gc();
			b[i].i = i, b[i].a = A[i];
		}
		distsort(b, a, N);
		
		k = -1;
		for (i = 0; K < N; ++i) {
			if (a[i].a < A[K]) break;
			if (k < a[i].i && a[i].i < K) {
				pc(a[i].a), k = a[i].i, ++K;
			}
		}
		while (K < N) pc(A[K++]);
	}
	pc('\n');
	return 0;
}

7 3
1 4 1 4 2 1 3

4423

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

```c
// 420 Digits K
// 2019.12.26 bal4u

#include <stdio.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); while ((c = gc()) >= '0');
	return n;
}

char A[200005];
typedef struct { char a; int i; } T;
T a[200005], b[200005];
int f[128];

void distsort(T *ain, T *aout, int sz) {
	int i, x;

	for (i = 0; i < sz; ++i) ++f[ain[i].a];
	for (i = '9'; i > '0'; i--) f[i-1] += f[i];
	for (i = sz-1; i >= 0; i--) {
		x = ain[i].a, aout[--f[x]].a = x, aout[f[x]].i = ain[i].i;
	}
}

int main()
{
	int i, k, K, N;
	
    N = in(), K = in();
    if (K == 0) {
        while (N--) pc(gc()), gc();
    } else {
        for (i = 0; i < N; ++i) {
			A[i] = gc(), gc();
			b[i].i = i, b[i].a = A[i];
		}
		distsort(b, a, N);
		
		k = -1;
		for (i = 0; K < N; ++i) {
			if (a[i].a < A[K]) break;
			if (k < a[i].i && a[i].i < K) {
				pc(a[i].a), k = a[i].i, ++K;
			}
		}
		while (K < N) pc(A[K++]);
	}
	pc('\n');
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.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
.LFE0:
	.size	in, .-in
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 200005
A:
	.zero	200005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1600040
b:
	.zero	1600040
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 512
f:
	.zero	512
	.text
	.globl	distsort
	.type	distsort, @function
distsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L5:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L6
	movl	$57, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -8(%rbp)
.L7:
	cmpl	$48, -8(%rbp)
	jg	.L8
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	4(%rax), %eax
	movl	%eax, 4(%rdx)
	subl	$1, -8(%rbp)
.L9:
	cmpl	$0, -8(%rbp)
	jns	.L10
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	distsort, .-distsort
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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, -4(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L12
	jmp	.L13
.L14:
	call	getchar_unlocked@PLT
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	call	getchar_unlocked@PLT
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
	jmp	.L15
.L12:
	movl	$0, -16(%rbp)
	jmp	.L16
.L17:
	call	getchar_unlocked@PLT
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+b(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movb	%al, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L17
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	distsort
	movl	$-1, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L18
.L22:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	A(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	cmpb	%al, %dl
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	addl	$1, -8(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L22
	jmp	.L23
.L26:
	nop
	jmp	.L23
.L24:
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L23:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
.L15:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
.LFB0:
	.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
.LFE0:
	.size	in, .-in
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 200005
A:
	.zero	200005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600040
a:
	.zero	1600040
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 1600040
b:
	.zero	1600040
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 512
f:
	.zero	512
	.text
	.globl	distsort
	.type	distsort, @function
distsort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	%edx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L5
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L5:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L6
	movl	$57, -8(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -8(%rbp)
.L7:
	cmpl	$48, -8(%rbp)
	jg	.L8
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movb	%dl, (%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	f(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	4(%rax), %eax
	movl	%eax, 4(%rdx)
	subl	$1, -8(%rbp)
.L9:
	cmpl	$0, -8(%rbp)
	jns	.L10
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	distsort, .-distsort
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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, -4(%rbp)
	movl	$0, %eax
	call	in
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L12
	jmp	.L13
.L14:
	call	getchar_unlocked@PLT
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	call	getchar_unlocked@PLT
.L13:
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -4(%rbp)
	testl	%eax, %eax
	jne	.L14
	jmp	.L15
.L12:
	movl	$0, -16(%rbp)
	jmp	.L16
.L17:
	call	getchar_unlocked@PLT
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+b(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movb	%al, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L16:
	movl	-16(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L17
	movl	-4(%rbp), %eax
	movl	%eax, %edx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	distsort
	movl	$-1, -12(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L18
.L22:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	A(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	cmpb	%al, %dl
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -8(%rbp)
	jle	.L21
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	addl	$1, -8(%rbp)
.L21:
	addl	$1, -16(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L22
	jmp	.L23
.L26:
	nop
	jmp	.L23
.L24:
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	A(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L23:
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L24
.L15:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
