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>

#define N 1000

int main(){
    int i,j,tl,pl,flag;
    char t[N],p[N];

    scanf("%s",t);
    tl=strlen(t);

    scanf("%s",p);
    pl=strlen(p);

    for(i=0;i<tl;i++){
        if(t[i]==p[0]) flag=0;
        for(j=0;j<pl;j++){
            if(t[i+j]!=p[j]) flag=1;
        }
        if(flag==0) printf("%d\n",i);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.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	$2048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2024(%rbp)
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1008(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2020(%rbp)
	movl	$0, -2036(%rbp)
	jmp	.L2
.L8:
	movl	-2036(%rbp), %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movzbl	-1008(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$0, -2028(%rbp)
.L3:
	movl	$0, -2032(%rbp)
	jmp	.L4
.L6:
	movl	-2036(%rbp), %edx
	movl	-2032(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movl	-2032(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	cmpb	%al, %dl
	je	.L5
	movl	$1, -2028(%rbp)
.L5:
	addl	$1, -2032(%rbp)
.L4:
	movl	-2032(%rbp), %eax
	cmpl	-2020(%rbp), %eax
	jl	.L6
	cmpl	$0, -2028(%rbp)
	jne	.L7
	movl	-2036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	addl	$1, -2036(%rbp)
.L2:
	movl	-2036(%rbp), %eax
	cmpl	-2024(%rbp), %eax
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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	"%s"
.LC1:
	.string	"%d\n"
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$2040, %rsp
	.cfi_def_cfa_offset 2096
	movq	%fs:40, %rax
	movq	%rax, 2024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	1024(%rsp), %r12
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	%eax, 12(%rsp)
	movq	%rax, %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	testq	%r14, %r14
	je	.L2
	movl	12(%rsp), %ecx
	movq	%rax, %r15
	movl	%eax, %r13d
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movzbl	1024(%rsp), %eax
	cmpb	%al, 0(%rbp)
	je	.L23
	testq	%r15, %r15
	je	.L6
.L4:
	xorl	%eax, %eax
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movzbl	0(%rbp,%rax), %edi
	cmpb	%dil, (%r12,%rax)
	cmovne	%edx, %ebx
	addq	$1, %rax
	cmpl	%eax, %r13d
	jg	.L8
.L6:
	testl	%ebx, %ebx
	je	.L5
.L9:
	addl	$1, %r14d
	addq	$1, %rbp
	cmpl	%r14d, %ecx
	jne	.L10
.L2:
	movq	2024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$2040, %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
.L23:
	.cfi_restore_state
	xorl	%ebx, %ebx
	testq	%r15, %r15
	jne	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r14d, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%ecx, 12(%rsp)
	call	__printf_chk@PLT
	xorl	%ebx, %ebx
	movl	12(%rsp), %ecx
	leaq	.LC1(%rip), %rsi
	jmp	.L9
.L24:
	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	"%s"
.LC1:
	.string	"%d\n"
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$2040, %rsp
	.cfi_def_cfa_offset 2096
	movq	%fs:40, %rax
	movq	%rax, 2024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	leaq	1024(%rsp), %r12
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	%eax, 12(%rsp)
	movq	%rax, %r14
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	testq	%r14, %r14
	je	.L2
	movl	12(%rsp), %ecx
	movq	%rax, %r15
	movl	%eax, %r13d
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rsi
	.p2align 4,,10
	.p2align 3
.L10:
	movzbl	1024(%rsp), %eax
	cmpb	%al, 0(%rbp)
	je	.L23
	testq	%r15, %r15
	je	.L6
.L4:
	xorl	%eax, %eax
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movzbl	0(%rbp,%rax), %edi
	cmpb	%dil, (%r12,%rax)
	cmovne	%edx, %ebx
	addq	$1, %rax
	cmpl	%eax, %r13d
	jg	.L8
.L6:
	testl	%ebx, %ebx
	je	.L5
.L9:
	addl	$1, %r14d
	addq	$1, %rbp
	cmpl	%r14d, %ecx
	jne	.L10
.L2:
	movq	2024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$2040, %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
.L23:
	.cfi_restore_state
	xorl	%ebx, %ebx
	testq	%r15, %r15
	jne	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%r14d, %edx
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%ecx, 12(%rsp)
	call	__printf_chk@PLT
	xorl	%ebx, %ebx
	movl	12(%rsp), %ecx
	leaq	.LC1(%rip), %rsi
	jmp	.L9
.L24:
	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>

#define N 1000

int main(){
    int i,j,tl,pl,flag;
    char t[N],p[N];

    scanf("%s",t);
    tl=strlen(t);

    scanf("%s",p);
    pl=strlen(p);

    for(i=0;i<tl;i++){
        if(t[i]==p[0]) flag=0;
        for(j=0;j<pl;j++){
            if(t[i+j]!=p[j]) flag=1;
        }
        if(flag==0) printf("%d\n",i);
    }

    return 0;
}
aaabaa
aa
 aabaaa
ba
 aaabaa
ba
 aab`aa
aa
 xyzy
yz
 aaaaba
aa
 abaaaa
aa
 abaaaa
ab
 aaacab
aa
 aaaaba
ba

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

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>

#define N 1000

int main(){
    int i,j,tl,pl,flag;
    char t[N],p[N];

    scanf("%s",t);
    tl=strlen(t);

    scanf("%s",p);
    pl=strlen(p);

    for(i=0;i<tl;i++){
        if(t[i]==p[0]) flag=0;
        for(j=0;j<pl;j++){
            if(t[i+j]!=p[j]) flag=1;
        }
        if(flag==0) printf("%d\n",i);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.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	$2048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2024(%rbp)
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1008(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2020(%rbp)
	movl	$0, -2036(%rbp)
	jmp	.L2
.L8:
	movl	-2036(%rbp), %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movzbl	-1008(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$0, -2028(%rbp)
.L3:
	movl	$0, -2032(%rbp)
	jmp	.L4
.L6:
	movl	-2036(%rbp), %edx
	movl	-2032(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movl	-2032(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	cmpb	%al, %dl
	je	.L5
	movl	$1, -2028(%rbp)
.L5:
	addl	$1, -2032(%rbp)
.L4:
	movl	-2032(%rbp), %eax
	cmpl	-2020(%rbp), %eax
	jl	.L6
	cmpl	$0, -2028(%rbp)
	jne	.L7
	movl	-2036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	addl	$1, -2036(%rbp)
.L2:
	movl	-2036(%rbp), %eax
	cmpl	-2024(%rbp), %eax
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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	"%s"
.LC1:
	.string	"%d\n"
	.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	$2048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2024(%rbp)
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1008(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2020(%rbp)
	movl	$0, -2036(%rbp)
	jmp	.L2
.L8:
	movl	-2036(%rbp), %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movzbl	-1008(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$0, -2028(%rbp)
.L3:
	movl	$0, -2032(%rbp)
	jmp	.L4
.L6:
	movl	-2036(%rbp), %edx
	movl	-2032(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2016(%rbp,%rax), %edx
	movl	-2032(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	cmpb	%al, %dl
	je	.L5
	movl	$1, -2028(%rbp)
.L5:
	addl	$1, -2032(%rbp)
.L4:
	movl	-2032(%rbp), %eax
	cmpl	-2020(%rbp), %eax
	jl	.L6
	cmpl	$0, -2028(%rbp)
	jne	.L7
	movl	-2036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L7:
	addl	$1, -2036(%rbp)
.L2:
	movl	-2036(%rbp), %eax
	cmpl	-2024(%rbp), %eax
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
