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>

int main(void){
	char a[10005];
	char b[5];
	int ioi=0;
	int joi=0;
	
	while (scanf("%s",a)!=EOF){
		ioi=0;
		joi=0;
		int length;
		length= (int)strlen(a);
		
		int i;
		for (i=0;i<(length-2);i++){
			strncpy(b,&a[i],3);
			if (strcmp(b,"JOI")==0){
				joi++;
			}else if (strcmp(b,"IOI")==0){
				ioi++;
			}
		}
		printf("%d\n",joi);
		printf("%d\n",ioi);
	}					
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1856, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	jmp	.L2
.L7:
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -10028(%rbp)
	movl	$0, -10032(%rbp)
	jmp	.L3
.L6:
	leaq	-10016(%rbp), %rdx
	movl	-10032(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	leaq	-10021(%rbp), %rax
	movl	$3, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncpy@PLT
	leaq	-10021(%rbp), %rax
	leaq	.LC0(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -10036(%rbp)
	jmp	.L5
.L4:
	leaq	-10021(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	addl	$1, -10040(%rbp)
.L5:
	addl	$1, -10032(%rbp)
.L3:
	movl	-10028(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -10032(%rbp)
	jl	.L6
	movl	-10036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-10040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-10016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10096
	leaq	.LC2(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L17
	movq	%rbp, %rdi
	call	strlen@PLT
	cmpq	$2, %rax
	jbe	.L13
	subl	$3, %eax
	movq	%rbp, %r15
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	leaq	17(%rsp,%rax), %rbx
	leaq	11(%rsp), %rdi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	cmpl	$4804425, (%rdi)
	sete	%al
	addq	$1, %r15
	addl	%eax, %r12d
	cmpq	%rbx, %r15
	je	.L3
.L10:
	movl	$3, %edx
	movq	%r15, %rsi
	call	strncpy@PLT
	cmpl	$4804426, (%rax)
	movq	%rax, %rdi
	jne	.L4
	addq	$1, %r15
	addl	$1, %r13d
	cmpq	%rbx, %r15
	jne	.L10
.L3:
	movl	%r13d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%r12d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L17:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$10040, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	jmp	.L3
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10096
	leaq	.LC2(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L17
	movq	%rbp, %rdi
	call	strlen@PLT
	cmpq	$2, %rax
	jbe	.L13
	subl	$3, %eax
	movq	%rbp, %r15
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	leaq	17(%rsp,%rax), %rbx
	leaq	11(%rsp), %rdi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	cmpl	$4804425, (%rdi)
	sete	%al
	addq	$1, %r15
	addl	%eax, %r12d
	cmpq	%rbx, %r15
	je	.L3
.L10:
	movl	$3, %edx
	movq	%r15, %rsi
	call	strncpy@PLT
	cmpl	$4804426, (%rax)
	movq	%rax, %rdi
	jne	.L4
	addq	$1, %r15
	addl	$1, %r13d
	cmpq	%rbx, %r15
	jne	.L10
.L3:
	movl	%r13d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	%r12d, %edx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L17:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$10040, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	jmp	.L3
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

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

int main(void){
	char a[10005];
	char b[5];
	int ioi=0;
	int joi=0;
	
	while (scanf("%s",a)!=EOF){
		ioi=0;
		joi=0;
		int length;
		length= (int)strlen(a);
		
		int i;
		for (i=0;i<(length-2);i++){
			strncpy(b,&a[i],3);
			if (strcmp(b,"JOI")==0){
				joi++;
			}else if (strcmp(b,"IOI")==0){
				ioi++;
			}
		}
		printf("%d\n",joi);
		printf("%d\n",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>

int main(void){
	char a[10005];
	char b[5];
	int ioi=0;
	int joi=0;
	
	while (scanf("%s",a)!=EOF){
		ioi=0;
		joi=0;
		int length;
		length= (int)strlen(a);
		
		int i;
		for (i=0;i<(length-2);i++){
			strncpy(b,&a[i],3);
			if (strcmp(b,"JOI")==0){
				joi++;
			}else if (strcmp(b,"IOI")==0){
				ioi++;
			}
		}
		printf("%d\n",joi);
		printf("%d\n",ioi);
	}					
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1856, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	jmp	.L2
.L7:
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -10028(%rbp)
	movl	$0, -10032(%rbp)
	jmp	.L3
.L6:
	leaq	-10016(%rbp), %rdx
	movl	-10032(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	leaq	-10021(%rbp), %rax
	movl	$3, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncpy@PLT
	leaq	-10021(%rbp), %rax
	leaq	.LC0(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -10036(%rbp)
	jmp	.L5
.L4:
	leaq	-10021(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	addl	$1, -10040(%rbp)
.L5:
	addl	$1, -10032(%rbp)
.L3:
	movl	-10028(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -10032(%rbp)
	jl	.L6
	movl	-10036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-10040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-10016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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
	.section	.rodata
.LC0:
	.string	"JOI"
.LC1:
	.string	"IOI"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1856, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	jmp	.L2
.L7:
	movl	$0, -10040(%rbp)
	movl	$0, -10036(%rbp)
	leaq	-10016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -10028(%rbp)
	movl	$0, -10032(%rbp)
	jmp	.L3
.L6:
	leaq	-10016(%rbp), %rdx
	movl	-10032(%rbp), %eax
	cltq
	leaq	(%rdx,%rax), %rcx
	leaq	-10021(%rbp), %rax
	movl	$3, %edx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncpy@PLT
	leaq	-10021(%rbp), %rax
	leaq	.LC0(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	addl	$1, -10036(%rbp)
	jmp	.L5
.L4:
	leaq	-10021(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	addl	$1, -10040(%rbp)
.L5:
	addl	$1, -10032(%rbp)
.L3:
	movl	-10028(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -10032(%rbp)
	jl	.L6
	movl	-10036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-10040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-10016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	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:
