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 input[10001];

int main(void)
{
    int i, len, j, joi = 0, ioi = 0;
    while (scanf("%s",input) != EOF) {
        joi = 0;
        ioi = 0;
        len = strlen(input);
        for (i = 0; i < len-2; i++) {
            if (strncmp("JOI", &input[i], 3) == 0) {
                joi++;
            }
        }
        for (i = 0; i < len-2; i++) {
            if (strncmp("IOI", &input[i], 3) == 0) {
                ioi++;
            }
        }
        printf("%d\n%d\n",joi, ioi);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 10001
input:
	.zero	10001
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%d\n%d\n"
.LC3:
	.string	"%s"
	.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	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L3
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L3:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L7
	addl	$1, -8(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	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	"%d\n%d\n"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$79, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	input(%rip), %rbx
	leaq	1(%rbx), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L16
	movq	%rbx, %rdi
	call	strlen@PLT
	cmpq	$2, %rax
	jbe	.L11
	leaq	input(%rip), %rdx
	leal	-3(%rax), %ecx
	xorl	%r8d, %r8d
	movl	$74, %edi
	addq	%r13, %rcx
	movq	%rdx, %rbx
	movq	%rdx, %rax
	movl	$73, %r10d
	.p2align 4,,10
	.p2align 3
.L6:
	movzbl	(%rax), %esi
	cmpl	%esi, %edi
	jne	.L5
	movzbl	1(%rax), %esi
	cmpl	%esi, %r14d
	jne	.L5
	movzbl	2(%rax), %r9d
	movl	%r10d, %esi
	subl	%r9d, %esi
	cmpl	$1, %esi
	adcl	$0, %r8d
.L5:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L6
	xorl	%r9d, %r9d
	movl	$73, %esi
	.p2align 4,,10
	.p2align 3
.L9:
	movzbl	(%rdx), %eax
	cmpl	%eax, %esi
	jne	.L8
	movzbl	1(%rdx), %eax
	cmpl	%eax, %r14d
	jne	.L8
	movzbl	2(%rdx), %edi
	movl	%esi, %eax
	subl	%edi, %eax
	cmpl	$1, %eax
	adcl	$0, %r9d
.L8:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	jne	.L9
.L3:
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 10001
input:
	.zero	10001
	.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	"%d\n%d\n"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$79, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	input(%rip), %rbx
	leaq	1(%rbx), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L16
	movq	%rbx, %rdi
	call	strlen@PLT
	cmpq	$2, %rax
	jbe	.L11
	leaq	input(%rip), %rdx
	leal	-3(%rax), %ecx
	xorl	%r8d, %r8d
	movl	$74, %edi
	addq	%r13, %rcx
	movq	%rdx, %rbx
	movq	%rdx, %rax
	movl	$73, %r10d
	.p2align 4,,10
	.p2align 3
.L6:
	movzbl	(%rax), %esi
	cmpl	%esi, %edi
	jne	.L5
	movzbl	1(%rax), %esi
	cmpl	%esi, %r14d
	jne	.L5
	movzbl	2(%rax), %r9d
	movl	%r10d, %esi
	subl	%r9d, %esi
	cmpl	$1, %esi
	adcl	$0, %r8d
.L5:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L6
	xorl	%r9d, %r9d
	movl	$73, %esi
	.p2align 4,,10
	.p2align 3
.L9:
	movzbl	(%rdx), %eax
	cmpl	%eax, %esi
	jne	.L8
	movzbl	1(%rdx), %eax
	cmpl	%eax, %r14d
	jne	.L8
	movzbl	2(%rdx), %edi
	movl	%esi, %eax
	subl	%edi, %eax
	cmpl	$1, %eax
	adcl	$0, %r9d
.L8:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	jne	.L9
.L3:
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L16:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 10001
input:
	.zero	10001
	.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 input[10001];

int main(void)
{
    int i, len, j, joi = 0, ioi = 0;
    while (scanf("%s",input) != EOF) {
        joi = 0;
        ioi = 0;
        len = strlen(input);
        for (i = 0; i < len-2; i++) {
            if (strncmp("JOI", &input[i], 3) == 0) {
                joi++;
            }
        }
        for (i = 0; i < len-2; i++) {
            if (strncmp("IOI", &input[i], 3) == 0) {
                ioi++;
            }
        }
        printf("%d\n%d\n",joi, ioi);
    }
    return 0;
}
JOIJOI
JOIOIOIOI
JOIOIOIJXNXNIOJIOIOJ
 eonN
 JOIJOI
JOIOINIOI
JOIOIOIJXNXNIOJIOIOJ
 JOIJOI
JOIOINIOI
JOIOIJOINXNXJIOIOIOJ
 JOIJOI
JOIOINIOI
JOIPIJOINXNXJIOIOIOJ
 JOIJOH
JOIOINIOI
JOIPIJOINXNXJIOIOIOJ
 JOIJOG
JOIOINIOI
JOIPIJOINXOXJINIOIOJ
 GOJIOJ
JOIOINIOI
JOIPIJOINXOXJINIOIOJ
 GOJIOJ
JOIOINJOI
JOIPIJOINXOXJINIOIOJ
 GOJIOJ
JOIOINJOJ
JOIPIJOINXOXJINIOIOJ

2
0
1
3
1
3
 0
0
 2
0
1
2
1
3
 2
0
1
2
2
3
 2
0
1
2
2
2
 1
0
1
2
2
2
 1
0
1
2
2
1
 0
0
1
2
2
1
 0
0
2
1
2
1
 0
0
1
1
2
1

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 input[10001];

int main(void)
{
    int i, len, j, joi = 0, ioi = 0;
    while (scanf("%s",input) != EOF) {
        joi = 0;
        ioi = 0;
        len = strlen(input);
        for (i = 0; i < len-2; i++) {
            if (strncmp("JOI", &input[i], 3) == 0) {
                joi++;
            }
        }
        for (i = 0; i < len-2; i++) {
            if (strncmp("IOI", &input[i], 3) == 0) {
                ioi++;
            }
        }
        printf("%d\n%d\n",joi, ioi);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 10001
input:
	.zero	10001
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%d\n%d\n"
.LC3:
	.string	"%s"
	.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	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L3
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L3:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L7
	addl	$1, -8(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	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	input
	.bss
	.align 32
	.type	input, @object
	.size	input, 10001
input:
	.zero	10001
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%d\n%d\n"
.LC3:
	.string	"%s"
	.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	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, -12(%rbp)
	movl	$0, -8(%rbp)
	leaq	input(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -4(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L3
.L5:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -12(%rbp)
.L4:
	addl	$1, -16(%rbp)
.L3:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	input(%rip), %rdx
	addq	%rdx, %rax
	movl	$3, %edx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	strncmp@PLT
	testl	%eax, %eax
	jne	.L7
	addl	$1, -8(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-4(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	input(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	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:
