Given the following C code and 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);
}
```

Assembly Code:

```assembly
	.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:
```

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.
Optimized Assembly Code:

user
```assembly
	.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
```assembly
	.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:
```
```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);
}
```
Given the following C 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);
}
```

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.
Optimized Assembly Code:

9 3
0001000100

 1 3 2 3
Given the following C code and 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);
}
```

Assembly Code:

```assembly
	.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:
```

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.
Optimized Assembly Code:

train
```assembly
	.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:
```