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

```c
char buf[1<<17],out[2<<17];
outsz=2<<17;
sz;
K;
main()
{
	int id=read(0,buf,1<<17)-2;
	while(buf[sz]>='0')++sz;
	++sz;
	for(;;)
	{
		int k=buf[sz++];
		if(k<'0')break;
		K=K*10+k-'0';
	}
	while(id>sz)
	{
		int nxt=-1;
		for(int j=id-sz<K?id-sz:K;j;--j)
		{
			if(~buf[id-j]&1)
			{
				nxt=id-j;
				do{
					out[--outsz]=j%10+'0';
				}while(j/=10);
				out[--outsz]=32;
				break;
			}
		}
		if(nxt<0)
		{
			puts("-1");
			return 0;
		}
		id=nxt;
	}
	write(1,out+outsz,(2<<17)-outsz);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 131072
buf:
	.zero	131072
	.globl	out
	.align 32
	.type	out, @object
	.size	out, 262144
out:
	.zero	262144
	.globl	outsz
	.data
	.align 4
	.type	outsz, @object
	.size	outsz, 4
outsz:
	.long	262144
	.globl	sz
	.bss
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.section	.rodata
.LC0:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$131072, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	subl	$2, %eax
	movl	%eax, -16(%rbp)
	jmp	.L2
.L3:
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L2:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L3
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jle	.L17
	movl	K(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, K(%rip)
	jmp	.L6
.L17:
	nop
	jmp	.L7
.L15:
	movl	$-1, -12(%rbp)
	movl	sz(%rip), %ecx
	movl	-16(%rbp), %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	K(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L8
.L12:
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L10:
	movl	-8(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %edx
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	movl	%edx, %ecx
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L10
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	$32, (%rax,%rdx)
	jmp	.L11
.L9:
	subl	$1, -8(%rbp)
.L8:
	cmpl	$0, -8(%rbp)
	jne	.L12
.L11:
	cmpl	$0, -12(%rbp)
	jns	.L13
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L7:
	movl	sz(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L15
	movl	outsz(%rip), %eax
	movl	$262144, %edx
	subl	%eax, %edx
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$131072, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	movq	%rbx, %rsi
	call	read@PLT
	movslq	sz(%rip), %rdx
	leal	-2(%rax), %ebp
	cmpb	$47, (%rbx,%rdx)
	movq	%rdx, %rax
	jle	.L2
	addl	$1, %eax
	leaq	-1(%rbx), %rcx
	movslq	%eax, %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, %eax
	addq	$1, %rdx
	cmpb	$47, (%rcx,%rdx)
	jg	.L3
.L2:
	leal	1(%rax), %edx
	leal	2(%rax), %r8d
	movl	K(%rip), %esi
	movslq	%edx, %rdx
	movl	%r8d, sz(%rip)
	movsbl	(%rbx,%rdx), %edx
	cmpl	$47, %edx
	jle	.L4
	addl	$3, %eax
	leaq	-1+buf(%rip), %rcx
	cltq
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%rsi,%rsi,4), %esi
	movl	%eax, %r8d
	leal	-48(%rdx,%rsi,2), %esi
	movsbl	(%rcx,%rax), %edx
	addq	$1, %rax
	cmpl	$47, %edx
	jg	.L6
	movl	%esi, K(%rip)
	movl	%r8d, sz(%rip)
.L4:
	movl	outsz(%rip), %r10d
	leaq	-1+out(%rip), %rdi
	xorl	%r12d, %r12d
	leaq	1(%rdi), %r9
	movl	%r10d, %ecx
	cmpl	%r8d, %ebp
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%ebp, %eax
	subl	%r8d, %eax
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	testl	%eax, %eax
	je	.L31
	movl	%ebp, %edx
	subl	%eax, %edx
	movslq	%edx, %rdx
	addq	%rbx, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rdx
	subl	$1, %eax
	je	.L31
.L12:
	movl	%ebp, %r11d
	subl	%eax, %r11d
	testb	$1, (%rdx)
	jne	.L9
	movslq	%ecx, %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	%eax, %rdx
	movl	%eax, %r12d
	movl	%ecx, %ebp
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %r12d
	sarq	$34, %rdx
	subl	%r12d, %edx
	leal	(%rdx,%rdx,4), %r12d
	addl	%r12d, %r12d
	subl	%r12d, %eax
	addl	$48, %eax
	movb	%al, (%rdi,%rcx)
	movl	%edx, %eax
	subq	$1, %rcx
	testl	%edx, %edx
	jne	.L10
	leal	-2(%rbp), %ecx
	movl	$1, %r12d
	movslq	%ecx, %rax
	movb	$32, (%r9,%rax)
	testl	%r11d, %r11d
	js	.L30
	movl	%r11d, %ebp
	cmpl	%r8d, %ebp
	jg	.L14
.L33:
	testb	%r12b, %r12b
	je	.L15
	movl	%ecx, outsz(%rip)
	movl	%ecx, %r10d
.L15:
	movslq	%r10d, %rsi
	movl	$262144, %edx
	movl	$1, %edi
	leaq	out(%rip), %rax
	subl	%r10d, %edx
	addq	%rax, %rsi
	xorl	%eax, %eax
	call	write@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	testb	%r12b, %r12b
	je	.L8
.L30:
	movl	%ecx, outsz(%rip)
.L8:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
.L13:
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	K
	.bss
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	outsz
	.data
	.align 4
	.type	outsz, @object
	.size	outsz, 4
outsz:
	.long	262144
	.globl	out
	.bss
	.align 32
	.type	out, @object
	.size	out, 262144
out:
	.zero	262144
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 131072
buf:
	.zero	131072
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$131072, %edx
	xorl	%edi, %edi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	movq	%rbx, %rsi
	call	read@PLT
	movslq	sz(%rip), %rdx
	leal	-2(%rax), %ebp
	cmpb	$47, (%rbx,%rdx)
	movq	%rdx, %rax
	jle	.L2
	addl	$1, %eax
	leaq	-1(%rbx), %rcx
	movslq	%eax, %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, %eax
	addq	$1, %rdx
	cmpb	$47, (%rcx,%rdx)
	jg	.L3
.L2:
	leal	1(%rax), %edx
	leal	2(%rax), %r8d
	movl	K(%rip), %esi
	movslq	%edx, %rdx
	movl	%r8d, sz(%rip)
	movsbl	(%rbx,%rdx), %edx
	cmpl	$47, %edx
	jle	.L4
	addl	$3, %eax
	leaq	-1+buf(%rip), %rcx
	cltq
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%rsi,%rsi,4), %esi
	movl	%eax, %r8d
	leal	-48(%rdx,%rsi,2), %esi
	movsbl	(%rcx,%rax), %edx
	addq	$1, %rax
	cmpl	$47, %edx
	jg	.L6
	movl	%esi, K(%rip)
	movl	%r8d, sz(%rip)
.L4:
	movl	outsz(%rip), %r10d
	leaq	-1+out(%rip), %rdi
	xorl	%r12d, %r12d
	leaq	1(%rdi), %r9
	movl	%r10d, %ecx
	cmpl	%r8d, %ebp
	jle	.L33
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%ebp, %eax
	subl	%r8d, %eax
	cmpl	%esi, %eax
	cmovg	%esi, %eax
	testl	%eax, %eax
	je	.L31
	movl	%ebp, %edx
	subl	%eax, %edx
	movslq	%edx, %rdx
	addq	%rbx, %rdx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rdx
	subl	$1, %eax
	je	.L31
.L12:
	movl	%ebp, %r11d
	subl	%eax, %r11d
	testb	$1, (%rdx)
	jne	.L9
	movslq	%ecx, %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	%eax, %rdx
	movl	%eax, %r12d
	movl	%ecx, %ebp
	imulq	$1717986919, %rdx, %rdx
	sarl	$31, %r12d
	sarq	$34, %rdx
	subl	%r12d, %edx
	leal	(%rdx,%rdx,4), %r12d
	addl	%r12d, %r12d
	subl	%r12d, %eax
	addl	$48, %eax
	movb	%al, (%rdi,%rcx)
	movl	%edx, %eax
	subq	$1, %rcx
	testl	%edx, %edx
	jne	.L10
	leal	-2(%rbp), %ecx
	movl	$1, %r12d
	movslq	%ecx, %rax
	movb	$32, (%r9,%rax)
	testl	%r11d, %r11d
	js	.L30
	movl	%r11d, %ebp
	cmpl	%r8d, %ebp
	jg	.L14
.L33:
	testb	%r12b, %r12b
	je	.L15
	movl	%ecx, outsz(%rip)
	movl	%ecx, %r10d
.L15:
	movslq	%r10d, %rsi
	movl	$262144, %edx
	movl	$1, %edi
	leaq	out(%rip), %rax
	subl	%r10d, %edx
	addq	%rax, %rsi
	xorl	%eax, %eax
	call	write@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L31:
	testb	%r12b, %r12b
	je	.L8
.L30:
	movl	%ecx, outsz(%rip)
.L8:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
.L13:
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	K
	.bss
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	sz
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	outsz
	.data
	.align 4
	.type	outsz, @object
	.size	outsz, 4
outsz:
	.long	262144
	.globl	out
	.bss
	.align 32
	.type	out, @object
	.size	out, 262144
out:
	.zero	262144
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 131072
buf:
	.zero	131072
	.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:

char buf[1<<17],out[2<<17];
outsz=2<<17;
sz;
K;
main()
{
	int id=read(0,buf,1<<17)-2;
	while(buf[sz]>='0')++sz;
	++sz;
	for(;;)
	{
		int k=buf[sz++];
		if(k<'0')break;
		K=K*10+k-'0';
	}
	while(id>sz)
	{
		int nxt=-1;
		for(int j=id-sz<K?id-sz:K;j;--j)
		{
			if(~buf[id-j]&1)
			{
				nxt=id-j;
				do{
					out[--outsz]=j%10+'0';
				}while(j/=10);
				out[--outsz]=32;
				break;
			}
		}
		if(nxt<0)
		{
			puts("-1");
			return 0;
		}
		id=nxt;
	}
	write(1,out+outsz,(2<<17)-outsz);
}

9 3
0001000100

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

```c
char buf[1<<17],out[2<<17];
outsz=2<<17;
sz;
K;
main()
{
	int id=read(0,buf,1<<17)-2;
	while(buf[sz]>='0')++sz;
	++sz;
	for(;;)
	{
		int k=buf[sz++];
		if(k<'0')break;
		K=K*10+k-'0';
	}
	while(id>sz)
	{
		int nxt=-1;
		for(int j=id-sz<K?id-sz:K;j;--j)
		{
			if(~buf[id-j]&1)
			{
				nxt=id-j;
				do{
					out[--outsz]=j%10+'0';
				}while(j/=10);
				out[--outsz]=32;
				break;
			}
		}
		if(nxt<0)
		{
			puts("-1");
			return 0;
		}
		id=nxt;
	}
	write(1,out+outsz,(2<<17)-outsz);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 131072
buf:
	.zero	131072
	.globl	out
	.align 32
	.type	out, @object
	.size	out, 262144
out:
	.zero	262144
	.globl	outsz
	.data
	.align 4
	.type	outsz, @object
	.size	outsz, 4
outsz:
	.long	262144
	.globl	sz
	.bss
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.section	.rodata
.LC0:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$131072, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	subl	$2, %eax
	movl	%eax, -16(%rbp)
	jmp	.L2
.L3:
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L2:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L3
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jle	.L17
	movl	K(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, K(%rip)
	jmp	.L6
.L17:
	nop
	jmp	.L7
.L15:
	movl	$-1, -12(%rbp)
	movl	sz(%rip), %ecx
	movl	-16(%rbp), %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	K(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L8
.L12:
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L10:
	movl	-8(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %edx
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	movl	%edx, %ecx
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L10
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	$32, (%rax,%rdx)
	jmp	.L11
.L9:
	subl	$1, -8(%rbp)
.L8:
	cmpl	$0, -8(%rbp)
	jne	.L12
.L11:
	cmpl	$0, -12(%rbp)
	jns	.L13
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L7:
	movl	sz(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L15
	movl	outsz(%rip), %eax
	movl	$262144, %edx
	subl	%eax, %edx
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 131072
buf:
	.zero	131072
	.globl	out
	.align 32
	.type	out, @object
	.size	out, 262144
out:
	.zero	262144
	.globl	outsz
	.data
	.align 4
	.type	outsz, @object
	.size	outsz, 4
outsz:
	.long	262144
	.globl	sz
	.bss
	.align 4
	.type	sz, @object
	.size	sz, 4
sz:
	.zero	4
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.section	.rodata
.LC0:
	.string	"-1"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$131072, %edx
	leaq	buf(%rip), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	movl	$0, %eax
	call	read@PLT
	subl	$2, %eax
	movl	%eax, -16(%rbp)
	jmp	.L2
.L3:
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L2:
	movl	sz(%rip), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$47, %al
	jg	.L3
	movl	sz(%rip), %eax
	addl	$1, %eax
	movl	%eax, sz(%rip)
.L6:
	movl	sz(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, sz(%rip)
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jle	.L17
	movl	K(%rip), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	subl	$48, %eax
	movl	%eax, K(%rip)
	jmp	.L6
.L17:
	nop
	jmp	.L7
.L15:
	movl	$-1, -12(%rbp)
	movl	sz(%rip), %ecx
	movl	-16(%rbp), %eax
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	K(%rip), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L8
.L12:
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	buf(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L9
	movl	-16(%rbp), %eax
	subl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L10:
	movl	-8(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %edx
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	movl	%edx, %ecx
	cltq
	leaq	out(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L10
	movl	outsz(%rip), %eax
	subl	$1, %eax
	movl	%eax, outsz(%rip)
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rdx
	movb	$32, (%rax,%rdx)
	jmp	.L11
.L9:
	subl	$1, -8(%rbp)
.L8:
	cmpl	$0, -8(%rbp)
	jne	.L12
.L11:
	cmpl	$0, -12(%rbp)
	jns	.L13
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
.L7:
	movl	sz(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L15
	movl	outsz(%rip), %eax
	movl	$262144, %edx
	subl	%eax, %edx
	movl	outsz(%rip), %eax
	cltq
	leaq	out(%rip), %rcx
	addq	%rcx, %rax
	movq	%rax, %rsi
	movl	$1, %edi
	movl	$0, %eax
	call	write@PLT
	movl	$0, %eax
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
