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 str[100001];
  int i, joi, ioi;

  while (scanf("%s", str) != EOF){
    joi = 0;
    ioi = 0;
    for (i = 0; i < strlen(str) - 2; i++){
      if (str[i] == 'J' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        joi++;
      }
      else if(str[i] == 'I' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        ioi++;
      }
    }
    printf("%d\n%d\n", joi, ioi);
  }


  return (0);

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n%d\n"
.LC1:
	.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
	pushq	%rbx
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -100040(%rbp)
	movl	$0, -100036(%rbp)
	movl	$0, -100044(%rbp)
	jmp	.L3
.L6:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$74, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L4
	addl	$1, -100040(%rbp)
	jmp	.L5
.L4:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -100036(%rbp)
.L5:
	addl	$1, -100044(%rbp)
.L3:
	movl	-100044(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$2, %rax
	cmpq	%rax, %rbx
	jb	.L6
	movl	-100036(%rbp), %edx
	movl	-100040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-100032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	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	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1712, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L6
	movq	%rbx, %rdi
	call	strlen@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	cmpq	$2, %rax
	je	.L8
	movq	%rbx, %rdx
	leaq	-2(%rsp,%rax), %rcx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$73, %al
	jne	.L4
	cmpb	$79, 1(%rdx)
	jne	.L4
	xorl	%eax, %eax
	cmpb	$73, 2(%rdx)
	sete	%al
	addl	%eax, %r9d
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	je	.L8
.L5:
	movzbl	(%rdx), %eax
	cmpb	$74, %al
	jne	.L3
	cmpb	$79, 1(%rdx)
	jne	.L4
	xorl	%eax, %eax
	cmpb	$73, 2(%rdx)
	sete	%al
	addq	$1, %rdx
	addl	%eax, %r8d
	cmpq	%rcx, %rdx
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	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
.L6:
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$100016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	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	"%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	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1712, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L6
	movq	%rbx, %rdi
	call	strlen@PLT
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	cmpq	$2, %rax
	je	.L8
	movq	%rbx, %rdx
	leaq	-2(%rsp,%rax), %rcx
	xorl	%r9d, %r9d
	xorl	%r8d, %r8d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$73, %al
	jne	.L4
	cmpb	$79, 1(%rdx)
	jne	.L4
	xorl	%eax, %eax
	cmpb	$73, 2(%rdx)
	sete	%al
	addl	%eax, %r9d
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	je	.L8
.L5:
	movzbl	(%rdx), %eax
	cmpb	$74, %al
	jne	.L3
	cmpb	$79, 1(%rdx)
	jne	.L4
	xorl	%eax, %eax
	cmpb	$73, 2(%rdx)
	sete	%al
	addq	$1, %rdx
	addl	%eax, %r8d
	cmpq	%rcx, %rdx
	jne	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	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
.L6:
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$100016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	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 str[100001];
  int i, joi, ioi;

  while (scanf("%s", str) != EOF){
    joi = 0;
    ioi = 0;
    for (i = 0; i < strlen(str) - 2; i++){
      if (str[i] == 'J' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        joi++;
      }
      else if(str[i] == 'I' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        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>

int main(void)
{
  char str[100001];
  int i, joi, ioi;

  while (scanf("%s", str) != EOF){
    joi = 0;
    ioi = 0;
    for (i = 0; i < strlen(str) - 2; i++){
      if (str[i] == 'J' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        joi++;
      }
      else if(str[i] == 'I' && str[i + 1] == 'O' && str[i + 2] == 'I'){
        ioi++;
      }
    }
    printf("%d\n%d\n", joi, ioi);
  }


  return (0);

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n%d\n"
.LC1:
	.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
	pushq	%rbx
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -100040(%rbp)
	movl	$0, -100036(%rbp)
	movl	$0, -100044(%rbp)
	jmp	.L3
.L6:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$74, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L4
	addl	$1, -100040(%rbp)
	jmp	.L5
.L4:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -100036(%rbp)
.L5:
	addl	$1, -100044(%rbp)
.L3:
	movl	-100044(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$2, %rax
	cmpq	%rax, %rbx
	jb	.L6
	movl	-100036(%rbp), %edx
	movl	-100040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-100032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	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	"%d\n%d\n"
.LC1:
	.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
	pushq	%rbx
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -100040(%rbp)
	movl	$0, -100036(%rbp)
	movl	$0, -100044(%rbp)
	jmp	.L3
.L6:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$74, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L4
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L4
	addl	$1, -100040(%rbp)
	jmp	.L5
.L4:
	movl	-100044(%rbp), %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$79, %al
	jne	.L5
	movl	-100044(%rbp), %eax
	addl	$2, %eax
	cltq
	movzbl	-100032(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -100036(%rbp)
.L5:
	addl	$1, -100044(%rbp)
.L3:
	movl	-100044(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$2, %rax
	cmpq	%rax, %rbx
	jb	.L6
	movl	-100036(%rbp), %edx
	movl	-100040(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-100032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	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:
