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(int argc, char **argv){
  char T[1001];
  char P[1001];
  int i, j, count, len;
  
  scanf("%s", T); 
  scanf("%s", P); 
    
  len=strlen(P);
  for(i=0;T[i]!='\0';i++) {
    if (T[i]==P[0]) {
      count=1;
      for(j=1;(T[i+j]==P[j])&&(P[j]!='\0');j++){
        count++;
      }   
      if(count==len){
        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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$2064, %rsp
	movl	%edi, -2052(%rbp)
	movq	%rsi, -2064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2036(%rbp)
	movl	$0, -2048(%rbp)
	jmp	.L2
.L7:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movzbl	-1024(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$1, -2040(%rbp)
	movl	$1, -2044(%rbp)
	jmp	.L4
.L6:
	addl	$1, -2040(%rbp)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2048(%rbp), %edx
	movl	-2044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L5
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-2040(%rbp), %eax
	cmpl	-2036(%rbp), %eax
	jne	.L3
	movl	-2048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	testb	%al, %al
	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
.LC0:
	.string	"%s"
.LC1:
	.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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$2040, %rsp
	.cfi_def_cfa_offset 2096
	movq	%fs:40, %rax
	movq	%rax, 2024(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	leaq	1008(%rsp), %r12
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movzbl	(%rsp), %ecx
	testb	%cl, %cl
	je	.L2
	movq	%rax, %r13
	movl	%eax, %r14d
	leaq	.LC1(%rip), %r15
	xorl	%r8d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	movzbl	1(%rbx), %ecx
	testb	%cl, %cl
	je	.L2
.L9:
	addq	$1, %rbx
	movl	%ebp, %r8d
.L7:
	leal	1(%r8), %ebp
	cmpb	%cl, 1008(%rsp)
	jne	.L3
	movzbl	1009(%rsp), %eax
	movzbl	1(%rbx), %ecx
	testb	%al, %al
	je	.L4
	cmpb	%cl, %al
	jne	.L4
	movl	$2, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	(%r12,%rax), %edx
	cmpb	%dl, (%rbx,%rax)
	movl	%eax, %edi
	sete	%sil
	testb	%dl, %dl
	setne	%dl
	addq	$1, %rax
	testb	%dl, %sil
	jne	.L5
	cmpl	%edi, %r14d
	jne	.L9
.L8:
	movl	%r8d, %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L2:
	movq	2024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	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
.L4:
	.cfi_restore_state
	cmpq	$1, %r13
	jne	.L3
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
.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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$2040, %rsp
	.cfi_def_cfa_offset 2096
	movq	%fs:40, %rax
	movq	%rax, 2024(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	leaq	1008(%rsp), %r12
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rdi
	call	strlen@PLT
	movzbl	(%rsp), %ecx
	testb	%cl, %cl
	je	.L2
	movq	%rax, %r13
	movl	%eax, %r14d
	leaq	.LC1(%rip), %r15
	xorl	%r8d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L3:
	movzbl	1(%rbx), %ecx
	testb	%cl, %cl
	je	.L2
.L9:
	addq	$1, %rbx
	movl	%ebp, %r8d
.L7:
	leal	1(%r8), %ebp
	cmpb	%cl, 1008(%rsp)
	jne	.L3
	movzbl	1009(%rsp), %eax
	movzbl	1(%rbx), %ecx
	testb	%al, %al
	je	.L4
	cmpb	%cl, %al
	jne	.L4
	movl	$2, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	(%r12,%rax), %edx
	cmpb	%dl, (%rbx,%rax)
	movl	%eax, %edi
	sete	%sil
	testb	%dl, %dl
	setne	%dl
	addq	$1, %rax
	testb	%dl, %sil
	jne	.L5
	cmpl	%edi, %r14d
	jne	.L9
.L8:
	movl	%r8d, %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L2:
	movq	2024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	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
.L4:
	.cfi_restore_state
	cmpq	$1, %r13
	jne	.L3
	jmp	.L8
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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 <stdlib.h>
#include <string.h>
  
int main(int argc, char **argv){
  char T[1001];
  char P[1001];
  int i, j, count, len;
  
  scanf("%s", T); 
  scanf("%s", P); 
    
  len=strlen(P);
  for(i=0;T[i]!='\0';i++) {
    if (T[i]==P[0]) {
      count=1;
      for(j=1;(T[i+j]==P[j])&&(P[j]!='\0');j++){
        count++;
      }   
      if(count==len){
        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 <stdlib.h>
#include <string.h>
  
int main(int argc, char **argv){
  char T[1001];
  char P[1001];
  int i, j, count, len;
  
  scanf("%s", T); 
  scanf("%s", P); 
    
  len=strlen(P);
  for(i=0;T[i]!='\0';i++) {
    if (T[i]==P[0]) {
      count=1;
      for(j=1;(T[i+j]==P[j])&&(P[j]!='\0');j++){
        count++;
      }   
      if(count==len){
        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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$2064, %rsp
	movl	%edi, -2052(%rbp)
	movq	%rsi, -2064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2036(%rbp)
	movl	$0, -2048(%rbp)
	jmp	.L2
.L7:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movzbl	-1024(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$1, -2040(%rbp)
	movl	$1, -2044(%rbp)
	jmp	.L4
.L6:
	addl	$1, -2040(%rbp)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2048(%rbp), %edx
	movl	-2044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L5
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-2040(%rbp), %eax
	cmpl	-2036(%rbp), %eax
	jne	.L3
	movl	-2048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	testb	%al, %al
	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	"%s"
.LC1:
	.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
	subq	$2064, %rsp
	movl	%edi, -2052(%rbp)
	movq	%rsi, -2064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -2036(%rbp)
	movl	$0, -2048(%rbp)
	jmp	.L2
.L7:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movzbl	-1024(%rbp), %eax
	cmpb	%al, %dl
	jne	.L3
	movl	$1, -2040(%rbp)
	movl	$1, -2044(%rbp)
	jmp	.L4
.L6:
	addl	$1, -2040(%rbp)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2048(%rbp), %edx
	movl	-2044(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L5
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-2040(%rbp), %eax
	cmpl	-2036(%rbp), %eax
	jne	.L3
	movl	-2048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L3:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2048(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	testb	%al, %al
	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:
