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

```c
#include <stdio.h>
#include <string.h>

char buffer[3276800];

int main(void) {
	char* pos;
	int count;
	while(1) {
		fgets(buffer,sizeof(buffer),stdin);
		pos=strchr(buffer,'\n');
		if(pos==NULL)pos=&buffer[strlen(buffer)];
		pos[0]=' ';
		pos[1]=0;
		if(strcmp(buffer,"END OF INPUT ")==0)break;
		for(pos=buffer,count=0;*pos!=0;pos++) {
			if(*pos==' ') {
				printf("%d",count);
				count=0;
			} else {
				count++;
			}
		}
		putchar('\n');
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 3276800
buffer:
	.zero	3276800
	.section	.rodata
.LC0:
	.string	"END OF INPUT "
.LC1:
	.string	"%d"
	.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
.L9:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$3276800, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$10, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strchr@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	buffer(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movb	$32, (%rax)
	movq	-8(%rbp), %rax
	addq	$1, %rax
	movb	$0, (%rax)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	leaq	buffer(%rip), %rax
	movq	%rax, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jne	.L6
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -12(%rbp)
	jmp	.L7
.L6:
	addl	$1, -12(%rbp)
.L7:
	addq	$1, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L8
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L9
.L12:
	nop
	movl	$0, %eax
	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	"END OF INPUT "
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	buffer(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$3276800, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movl	$10, %esi
	movq	%rbp, %rdi
	call	strchr@PLT
	testq	%rax, %rax
	je	.L18
.L2:
	movl	$32, %edx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	movw	%dx, (%rax)
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L3
	movzbl	0(%rbp), %eax
	testb	%al, %al
	je	.L4
	xorl	%edx, %edx
	leaq	buffer(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$32, %al
	je	.L19
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	addl	$1, %edx
	testb	%al, %al
	jne	.L7
.L4:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movzbl	(%rbx), %eax
	testb	%al, %al
	je	.L4
	xorl	%edx, %edx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rdi
	call	strlen@PLT
	addq	%rbp, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 3276800
buffer:
	.zero	3276800
	.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	"END OF INPUT "
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	buffer(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L8:
	movq	stdin(%rip), %rdx
	movl	$3276800, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movl	$10, %esi
	movq	%rbp, %rdi
	call	strchr@PLT
	testq	%rax, %rax
	je	.L18
.L2:
	movl	$32, %edx
	movq	%r13, %rsi
	movq	%rbp, %rdi
	movw	%dx, (%rax)
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L3
	movzbl	0(%rbp), %eax
	testb	%al, %al
	je	.L4
	xorl	%edx, %edx
	leaq	buffer(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$32, %al
	je	.L19
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	addl	$1, %edx
	testb	%al, %al
	jne	.L7
.L4:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movzbl	(%rbx), %eax
	testb	%al, %al
	je	.L4
	xorl	%edx, %edx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rdi
	call	strlen@PLT
	addq	%rbp, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 3276800
buffer:
	.zero	3276800
	.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:

#include <stdio.h>
#include <string.h>

char buffer[3276800];

int main(void) {
	char* pos;
	int count;
	while(1) {
		fgets(buffer,sizeof(buffer),stdin);
		pos=strchr(buffer,'\n');
		if(pos==NULL)pos=&buffer[strlen(buffer)];
		pos[0]=' ';
		pos[1]=0;
		if(strcmp(buffer,"END OF INPUT ")==0)break;
		for(pos=buffer,count=0;*pos!=0;pos++) {
			if(*pos==' ') {
				printf("%d",count);
				count=0;
			} else {
				count++;
			}
		}
		putchar('\n');
	}
	return 0;
}
Yes I have a number
How I wish I could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes I have a rebmun
How I wish I could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes I have a rebmun
How J wish I could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes H have a rebmun
How J wish I could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes H have a rebmun
How J hisw I could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes H have a rebmun
How J hisw J could calculate an unused bolor for space
Thank you
END OF INPUT
 Yes H have a rebmun
How J hisw J could calculate an unused bolor rof space
Thank you
END OF INPUT
 Yes H havd a rebmun
How J hisw J could calculate an unused bolor rof space
Thank you
END OF INPUT
 Yes H hvad a rebmun
How J hisw J could calculate an unused bolor rof space
Thank you
END OF INPUT
 Yes H hvad a rebmun
How J hisw J could calculate an unused bolor rof space
Tiank you
END OF INPUT

31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53
 31416
31415926535
53

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

```c
#include <stdio.h>
#include <string.h>

char buffer[3276800];

int main(void) {
	char* pos;
	int count;
	while(1) {
		fgets(buffer,sizeof(buffer),stdin);
		pos=strchr(buffer,'\n');
		if(pos==NULL)pos=&buffer[strlen(buffer)];
		pos[0]=' ';
		pos[1]=0;
		if(strcmp(buffer,"END OF INPUT ")==0)break;
		for(pos=buffer,count=0;*pos!=0;pos++) {
			if(*pos==' ') {
				printf("%d",count);
				count=0;
			} else {
				count++;
			}
		}
		putchar('\n');
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 3276800
buffer:
	.zero	3276800
	.section	.rodata
.LC0:
	.string	"END OF INPUT "
.LC1:
	.string	"%d"
	.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
.L9:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$3276800, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$10, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strchr@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	buffer(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movb	$32, (%rax)
	movq	-8(%rbp), %rax
	addq	$1, %rax
	movb	$0, (%rax)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	leaq	buffer(%rip), %rax
	movq	%rax, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jne	.L6
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -12(%rbp)
	jmp	.L7
.L6:
	addl	$1, -12(%rbp)
.L7:
	addq	$1, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L8
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L9
.L12:
	nop
	movl	$0, %eax
	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	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 3276800
buffer:
	.zero	3276800
	.section	.rodata
.LC0:
	.string	"END OF INPUT "
.LC1:
	.string	"%d"
	.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
.L9:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$3276800, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$10, %esi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strchr@PLT
	movq	%rax, -8(%rbp)
	cmpq	$0, -8(%rbp)
	jne	.L2
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	buffer(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
.L2:
	movq	-8(%rbp), %rax
	movb	$32, (%rax)
	movq	-8(%rbp), %rax
	addq	$1, %rax
	movb	$0, (%rax)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rsi
	leaq	buffer(%rip), %rax
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L12
	leaq	buffer(%rip), %rax
	movq	%rax, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L8:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jne	.L6
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -12(%rbp)
	jmp	.L7
.L6:
	addl	$1, -12(%rbp)
.L7:
	addq	$1, -8(%rbp)
.L5:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L8
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L9
.L12:
	nop
	movl	$0, %eax
	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:
