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 <stdlib.h>
#include <string.h>
int main(void){
    int n,num,i,o,sum;
    char *line,temp[1000001];
    for(;line=malloc(1000001),sum=0,scanf("%d",&n),n;){
        for(i=0;i<n*2;i+=2){
            temp[i]='I';
            temp[i+1]='O';
        }
        temp[i++]='I';
        temp[i]=0;
        scanf("%d",&num);
        scanf("\n%s",line);
        while(line != NULL){
            line=strstr(line,temp);
            if(line != NULL){
                sum++;
                line++;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"\n%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -1000032(%rbp)
	jmp	.L3
.L4:
	movl	-1000032(%rbp), %eax
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	addl	$1, %eax
	cltq
	movb	$79, -1000016(%rbp,%rax)
	addl	$2, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L4
	movl	-1000032(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1000032(%rbp)
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	cltq
	movb	$0, -1000016(%rbp,%rax)
	leaq	-1000036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-1000024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L6:
	leaq	-1000016(%rbp), %rdx
	movq	-1000024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strstr@PLT
	movq	%rax, -1000024(%rbp)
	cmpq	$0, -1000024(%rbp)
	je	.L5
	addl	$1, -1000028(%rbp)
	addq	$1, -1000024(%rbp)
.L5:
	cmpq	$0, -1000024(%rbp)
	jne	.L6
	movl	-1000028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movl	$1000001, %edi
	call	malloc@PLT
	movq	%rax, -1000024(%rbp)
	movl	$0, -1000028(%rbp)
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000040(%rbp), %eax
	testl	%eax, %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
.LFE6:
	.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
.LC2:
	.string	"%d"
.LC3:
	.string	"\n%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$616, %rsp
	.cfi_def_cfa_offset 1000096
	leaq	.LC2(%rip), %rbp
	leaq	.LC3(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$1000001, %edi
	call	malloc@PLT
	movq	%r13, %rsi
	movq	%rbp, %rdi
	movq	%rax, %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	je	.L10
	addl	%esi, %esi
	movl	$1, %eax
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L12
	leal	-1(%rsi), %eax
	movl	%eax, %edi
	shrl	%edi
	leal	1(%rdi), %edx
	cmpl	$13, %eax
	jbe	.L14
	movl	%edx, %ecx
	leaq	16(%rsp), %rax
	shrl	$3, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	.LC0(%rip), %xmm0
	addq	$16, %rax
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %ecx
	andl	$-8, %ecx
	leal	(%rcx,%rcx), %eax
	cmpl	%ecx, %edx
	je	.L5
.L3:
	subl	%ecx, %edi
	leal	1(%rdi), %r9d
	cmpl	$2, %edi
	jbe	.L6
	movq	.LC1(%rip), %rbx
	movq	%rbx, 16(%rsp,%rcx,2)
	movl	%r9d, %ecx
	andl	$-4, %ecx
	leal	(%rax,%rcx,2), %eax
	cmpl	%ecx, %r9d
	je	.L5
.L6:
	movslq	%eax, %rcx
	movb	$73, 16(%rsp,%rcx)
	leal	1(%rax), %ecx
	movslq	%ecx, %rcx
	movb	$79, 16(%rsp,%rcx)
	leal	2(%rax), %ecx
	cmpl	%ecx, %esi
	jle	.L5
	movslq	%ecx, %rcx
	movb	$73, 16(%rsp,%rcx)
	leal	3(%rax), %ecx
	movslq	%ecx, %rcx
	movb	$79, 16(%rsp,%rcx)
	leal	4(%rax), %ecx
	cmpl	%ecx, %esi
	jle	.L5
	addl	$5, %eax
	movslq	%ecx, %rcx
	cltq
	movb	$73, 16(%rsp,%rcx)
	movb	$79, 16(%rsp,%rax)
.L5:
	addl	%edx, %edx
	leal	1(%rdx), %eax
.L12:
	movslq	%edx, %rdx
	cltq
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	movb	$73, 16(%rsp,%rdx)
	xorl	%r12d, %r12d
	movb	$0, 16(%rsp,%rax)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	testq	%r14, %r14
	je	.L8
	leaq	16(%rsp), %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	call	strstr@PLT
	testq	%rax, %rax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	1(%rax), %r14
	movq	%rbx, %rsi
	addl	$1, %r12d
	movq	%r14, %rdi
	call	strstr@PLT
	testq	%rax, %rax
	jne	.L22
.L8:
	movl	%r12d, %edx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L10:
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1000040, %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
.L14:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L3
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.set	.LC1,.LC0
	.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
.LC2:
	.string	"%d"
.LC3:
	.string	"\n%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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
	leaq	-999424(%rsp), %r11
	.cfi_def_cfa 11, 999480
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$616, %rsp
	.cfi_def_cfa_offset 1000096
	leaq	.LC2(%rip), %rbp
	leaq	.LC3(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 1000024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$1000001, %edi
	call	malloc@PLT
	movq	%r13, %rsi
	movq	%rbp, %rdi
	movq	%rax, %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	je	.L10
	addl	%esi, %esi
	movl	$1, %eax
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L12
	leal	-1(%rsi), %eax
	movl	%eax, %edi
	shrl	%edi
	leal	1(%rdi), %edx
	cmpl	$13, %eax
	jbe	.L14
	movl	%edx, %ecx
	leaq	16(%rsp), %rax
	shrl	$3, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	32(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	.LC0(%rip), %xmm0
	addq	$16, %rax
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	movl	%edx, %ecx
	andl	$-8, %ecx
	leal	(%rcx,%rcx), %eax
	cmpl	%ecx, %edx
	je	.L5
.L3:
	subl	%ecx, %edi
	leal	1(%rdi), %r9d
	cmpl	$2, %edi
	jbe	.L6
	movq	.LC1(%rip), %rbx
	movq	%rbx, 16(%rsp,%rcx,2)
	movl	%r9d, %ecx
	andl	$-4, %ecx
	leal	(%rax,%rcx,2), %eax
	cmpl	%ecx, %r9d
	je	.L5
.L6:
	movslq	%eax, %rcx
	movb	$73, 16(%rsp,%rcx)
	leal	1(%rax), %ecx
	movslq	%ecx, %rcx
	movb	$79, 16(%rsp,%rcx)
	leal	2(%rax), %ecx
	cmpl	%ecx, %esi
	jle	.L5
	movslq	%ecx, %rcx
	movb	$73, 16(%rsp,%rcx)
	leal	3(%rax), %ecx
	movslq	%ecx, %rcx
	movb	$79, 16(%rsp,%rcx)
	leal	4(%rax), %ecx
	cmpl	%ecx, %esi
	jle	.L5
	addl	$5, %eax
	movslq	%ecx, %rcx
	cltq
	movb	$73, 16(%rsp,%rcx)
	movb	$79, 16(%rsp,%rax)
.L5:
	addl	%edx, %edx
	leal	1(%rdx), %eax
.L12:
	movslq	%edx, %rdx
	cltq
	leaq	12(%rsp), %rsi
	movq	%rbp, %rdi
	movb	$73, 16(%rsp,%rdx)
	xorl	%r12d, %r12d
	movb	$0, 16(%rsp,%rax)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	testq	%r14, %r14
	je	.L8
	leaq	16(%rsp), %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	call	strstr@PLT
	testq	%rax, %rax
	je	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	1(%rax), %r14
	movq	%rbx, %rsi
	addl	$1, %r12d
	movq	%r14, %rdi
	call	strstr@PLT
	testq	%rax, %rax
	jne	.L22
.L8:
	movl	%r12d, %edx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L10:
	movq	1000024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1000040, %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
.L14:
	.cfi_restore_state
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L3
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.byte	73
	.byte	79
	.set	.LC1,.LC0
	.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 <stdlib.h>
#include <string.h>
int main(void){
    int n,num,i,o,sum;
    char *line,temp[1000001];
    for(;line=malloc(1000001),sum=0,scanf("%d",&n),n;){
        for(i=0;i<n*2;i+=2){
            temp[i]='I';
            temp[i+1]='O';
        }
        temp[i++]='I';
        temp[i]=0;
        scanf("%d",&num);
        scanf("\n%s",line);
        while(line != NULL){
            line=strstr(line,temp);
            if(line != NULL){
                sum++;
                line++;
            }
        }
        printf("%d\n",sum);
    }
    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

4
2
 4
1
 4
0
 4
 4
4
 4
3
 3
 2
 2
0
 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 <stdlib.h>
#include <string.h>
int main(void){
    int n,num,i,o,sum;
    char *line,temp[1000001];
    for(;line=malloc(1000001),sum=0,scanf("%d",&n),n;){
        for(i=0;i<n*2;i+=2){
            temp[i]='I';
            temp[i+1]='O';
        }
        temp[i++]='I';
        temp[i]=0;
        scanf("%d",&num);
        scanf("\n%s",line);
        while(line != NULL){
            line=strstr(line,temp);
            if(line != NULL){
                sum++;
                line++;
            }
        }
        printf("%d\n",sum);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"\n%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -1000032(%rbp)
	jmp	.L3
.L4:
	movl	-1000032(%rbp), %eax
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	addl	$1, %eax
	cltq
	movb	$79, -1000016(%rbp,%rax)
	addl	$2, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L4
	movl	-1000032(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1000032(%rbp)
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	cltq
	movb	$0, -1000016(%rbp,%rax)
	leaq	-1000036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-1000024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L6:
	leaq	-1000016(%rbp), %rdx
	movq	-1000024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strstr@PLT
	movq	%rax, -1000024(%rbp)
	cmpq	$0, -1000024(%rbp)
	je	.L5
	addl	$1, -1000028(%rbp)
	addq	$1, -1000024(%rbp)
.L5:
	cmpq	$0, -1000024(%rbp)
	jne	.L6
	movl	-1000028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movl	$1000001, %edi
	call	malloc@PLT
	movq	%rax, -1000024(%rbp)
	movl	$0, -1000028(%rbp)
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000040(%rbp), %eax
	testl	%eax, %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
.LFE6:
	.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"
.LC1:
	.string	"\n%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$624, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	$0, -1000032(%rbp)
	jmp	.L3
.L4:
	movl	-1000032(%rbp), %eax
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	addl	$1, %eax
	cltq
	movb	$79, -1000016(%rbp,%rax)
	addl	$2, -1000032(%rbp)
.L3:
	movl	-1000040(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1000032(%rbp)
	jl	.L4
	movl	-1000032(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1000032(%rbp)
	cltq
	movb	$73, -1000016(%rbp,%rax)
	movl	-1000032(%rbp), %eax
	cltq
	movb	$0, -1000016(%rbp,%rax)
	leaq	-1000036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-1000024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L5
.L6:
	leaq	-1000016(%rbp), %rdx
	movq	-1000024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strstr@PLT
	movq	%rax, -1000024(%rbp)
	cmpq	$0, -1000024(%rbp)
	je	.L5
	addl	$1, -1000028(%rbp)
	addq	$1, -1000024(%rbp)
.L5:
	cmpq	$0, -1000024(%rbp)
	jne	.L6
	movl	-1000028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movl	$1000001, %edi
	call	malloc@PLT
	movq	%rax, -1000024(%rbp)
	movl	$0, -1000028(%rbp)
	leaq	-1000040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1000040(%rbp), %eax
	testl	%eax, %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
.LFE6:
	.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:
