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

```c
// Aizu Vol-5 0538: IOIOI
// 2017.9.1 bal4u@uu

#include <stdio.h>

char s[1000003];

int main()
{
	int n, m, ans, len;
	char *p, *e;

	while (scanf("%d", &n) && n) {
		scanf("%d%s", &m, s);
		p = s, e = s + m, len = 0, ans = 0;
		while (p < e) {
			if (*p == 'I' && *(p+1) == 'O') len++, p += 2;
			else {
				if (len > 0) {
					if (*p == 'O') len--;
					if (len >= n) ans += len - n + 1;
					len = 0;
				}
				p++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 1000003
s:
	.zero	1000003
	.section	.rodata
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\n"
.LC2:
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L10:
	leaq	-36(%rbp), %rax
	leaq	s(%rip), %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L3
.L8:
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$73, %al
	jne	.L4
	movq	-24(%rbp), %rax
	addq	$1, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L4
	addl	$1, -28(%rbp)
	addq	$2, -24(%rbp)
	jmp	.L3
.L4:
	cmpl	$0, -28(%rbp)
	jle	.L5
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L6
	subl	$1, -28(%rbp)
.L6:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L7
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	addl	$1, %eax
	addl	%eax, -32(%rbp)
.L7:
	movl	$0, -28(%rbp)
.L5:
	addq	$1, -24(%rbp)
.L3:
	movq	-24(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jb	.L8
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L9
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	s(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	4(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	movq	%r15, %rsi
	movq	%rbx, %rdx
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	addq	%rbx, %rsi
	cmpq	%rbx, %rsi
	jbe	.L13
	movl	(%rsp), %edi
	leaq	s(%rip), %rax
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%edx, %edx
	je	.L7
	cmpb	$79, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %edx
.L8:
	cmpl	%edx, %edi
	jg	.L7
	subl	%edi, %edx
	leal	1(%r8,%rdx), %r8d
.L7:
	addq	$1, %rax
	xorl	%edx, %edx
.L6:
	cmpq	%rsi, %rax
	jnb	.L3
.L9:
	movzbl	(%rax), %ecx
	cmpb	$73, %cl
	jne	.L4
	cmpb	$79, 1(%rax)
	je	.L24
	testl	%edx, %edx
	jne	.L8
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	addl	$1, %edx
	addq	$2, %rax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$24, %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
.L25:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 1000003
s:
	.zero	1000003
	.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%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	s(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	4(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	movq	%r15, %rsi
	movq	%rbx, %rdx
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rsi
	addq	%rbx, %rsi
	cmpq	%rbx, %rsi
	jbe	.L13
	movl	(%rsp), %edi
	leaq	s(%rip), %rax
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	testl	%edx, %edx
	je	.L7
	cmpb	$79, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %edx
.L8:
	cmpl	%edx, %edi
	jg	.L7
	subl	%edi, %edx
	leal	1(%r8,%rdx), %r8d
.L7:
	addq	$1, %rax
	xorl	%edx, %edx
.L6:
	cmpq	%rsi, %rax
	jnb	.L3
.L9:
	movzbl	(%rax), %ecx
	cmpb	$73, %cl
	jne	.L4
	cmpb	$79, 1(%rax)
	je	.L24
	testl	%edx, %edx
	jne	.L8
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	addl	$1, %edx
	addq	$2, %rax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L10:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$24, %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
.L25:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 1000003
s:
	.zero	1000003
	.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:

// Aizu Vol-5 0538: IOIOI
// 2017.9.1 bal4u@uu

#include <stdio.h>

char s[1000003];

int main()
{
	int n, m, ans, len;
	char *p, *e;

	while (scanf("%d", &n) && n) {
		scanf("%d%s", &m, s);
		p = s, e = s + m, len = 0, ans = 0;
		while (p < e) {
			if (*p == 'I' && *(p+1) == 'O') len++, p += 2;
			else {
				if (len > 0) {
					if (*p == 'O') len--;
					if (len >= n) ans += len - n + 1;
					len = 0;
				}
				p++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}
1
13
OIIOIOIOIIOIO
2
13
OOIOIOIOIIOII
0
 1
13
OOIOIOIOIIOII
3
13
OOIOIOIOIIOII
0
 1
25
OOIOIOIOIIOII
3
13
OOJOIOIOIIOIJ
0
 1
25
OIIOIOIOIIOIO
0
13
OOJOIOIOIIOIJ
0
 1
25
OOIOIOIOIIOII
1
13
JIOIIOIOIOIOO
0
 1
25
OIIOIOIOIIOIO
1
13
OOJOIOIOIIOIJ
0
 1
25
OOIOIOIOIJOII
0
13
OOIOIOIOIIOIJ
0
 1
31
JIOHIOIOIOHOO
0
2
IOOOHPIOJHOIJ
-3
 1
25
OIIOIOHOIIOIO
3
25
OOJOIOIOIIOIJ
0
 1
31
OOIOIOHOIHOIJ
0
19
OOHOIOIOIIOIJ
-2

3
2
 4
1
 4
0
 5
 4
4
 5
3
 3
 4
 4
0
 2

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

```c
// Aizu Vol-5 0538: IOIOI
// 2017.9.1 bal4u@uu

#include <stdio.h>

char s[1000003];

int main()
{
	int n, m, ans, len;
	char *p, *e;

	while (scanf("%d", &n) && n) {
		scanf("%d%s", &m, s);
		p = s, e = s + m, len = 0, ans = 0;
		while (p < e) {
			if (*p == 'I' && *(p+1) == 'O') len++, p += 2;
			else {
				if (len > 0) {
					if (*p == 'O') len--;
					if (len >= n) ans += len - n + 1;
					len = 0;
				}
				p++;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 1000003
s:
	.zero	1000003
	.section	.rodata
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\n"
.LC2:
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L10:
	leaq	-36(%rbp), %rax
	leaq	s(%rip), %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L3
.L8:
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$73, %al
	jne	.L4
	movq	-24(%rbp), %rax
	addq	$1, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L4
	addl	$1, -28(%rbp)
	addq	$2, -24(%rbp)
	jmp	.L3
.L4:
	cmpl	$0, -28(%rbp)
	jle	.L5
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L6
	subl	$1, -28(%rbp)
.L6:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L7
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	addl	$1, %eax
	addl	%eax, -32(%rbp)
.L7:
	movl	$0, -28(%rbp)
.L5:
	addq	$1, -24(%rbp)
.L3:
	movq	-24(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jb	.L8
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L9
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 1000003
s:
	.zero	1000003
	.section	.rodata
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\n"
.LC2:
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L10:
	leaq	-36(%rbp), %rax
	leaq	s(%rip), %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -24(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L3
.L8:
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$73, %al
	jne	.L4
	movq	-24(%rbp), %rax
	addq	$1, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L4
	addl	$1, -28(%rbp)
	addq	$2, -24(%rbp)
	jmp	.L3
.L4:
	cmpl	$0, -28(%rbp)
	jle	.L5
	movq	-24(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	jne	.L6
	subl	$1, -28(%rbp)
.L6:
	movl	-40(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L7
	movl	-40(%rbp), %edx
	movl	-28(%rbp), %eax
	subl	%edx, %eax
	addl	$1, %eax
	addl	%eax, -32(%rbp)
.L7:
	movl	$0, -28(%rbp)
.L5:
	addq	$1, -24(%rbp)
.L3:
	movq	-24(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jb	.L8
	movl	-32(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L9
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
