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>
#include <stdbool.h>

int main()
{
    char str1[105];
    char str2[] = "keyence";
    bool flag = false;
    int i, j;
    scanf("%s", str1);
    i = j = 0;
    while (i <= strlen(str1))
    {
        if (str1[i] == str2[j])
        {
            i++;
            j++;
            if (j == 7)
            {
                flag = true;
                break;
            }
            continue;
        }
        else
        {
            while (i <= strlen(str1))
            {
                if (str1[i] == str2[j])
                    if (strcmp(str1 + i, str2 + j) == 0)
                    {
                        flag = true;
                        break;
                    }
                i++;
            }
        }
    }
    if (flag == true)
        printf("YES\n");
    else
        printf("NO\n");
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	subq	$168, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$28538298447783275, %rax
	movq	%rax, -152(%rbp)
	movb	$0, -161(%rbp)
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -156(%rbp)
	movl	-156(%rbp), %eax
	movl	%eax, -160(%rbp)
	jmp	.L2
.L9:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	addl	$1, -160(%rbp)
	addl	$1, -156(%rbp)
	cmpl	$7, -156(%rbp)
	jne	.L2
	movb	$1, -161(%rbp)
	jmp	.L5
.L8:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-156(%rbp), %eax
	cltq
	leaq	-152(%rbp), %rdx
	addq	%rax, %rdx
	movl	-160(%rbp), %eax
	cltq
	leaq	-144(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movb	$1, -161(%rbp)
	jmp	.L2
.L7:
	addl	$1, -160(%rbp)
.L6:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L8
.L2:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L9
.L5:
	cmpb	$0, -161(%rbp)
	je	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	leaq	.LC0(%rip), %rdi
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$107, %r14d
	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
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	movabsq	$28538298447783275, %rax
	leaq	48(%rsp), %rbx
	movq	%rbx, %rsi
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leaq	40(%rsp), %rsi
	movb	$0, 31(%rsp)
	movq	%rax, %r12
	xorl	%eax, %eax
	movq	%rsi, 16(%rsp)
	movl	$0, 24(%rsp)
	cmpb	%r14b, 48(%rsp,%rax)
	jne	.L20
.L2:
	addl	$1, 24(%rsp)
	movl	24(%rsp), %edx
	cmpl	$7, %edx
	jne	.L21
.L4:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L11:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$184, %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
.L21:
	.cfi_restore_state
	addl	$1, %r15d
	movslq	%r15d, %rax
	cmpq	%r12, %rax
	ja	.L6
	movslq	%edx, %rcx
	movq	%rcx, (%rsp)
.L5:
	movzbl	40(%rsp,%rcx), %r14d
	cmpb	%r14b, 48(%rsp,%rax)
	je	.L2
.L20:
	movslq	24(%rsp), %rax
	movq	16(%rsp), %r13
	leal	1(%r15), %ecx
	movslq	%ecx, %rbp
	movq	%rax, 8(%rsp)
	addq	%rax, %r13
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rbp
.L3:
	movl	%ebp, %r15d
	cmpq	%r12, %rbp
	ja	.L6
	cmpb	%r14b, (%rbx,%rbp)
	jne	.L7
	movq	8(%rsp), %rax
	leaq	(%rbx,%rbp), %rdi
	movq	%r13, %rsi
	movq	%rax, (%rsp)
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movb	$1, 31(%rsp)
	movq	(%rsp), %rcx
	movslq	%r15d, %rax
	jmp	.L5
.L6:
	cmpb	$0, 31(%rsp)
	jne	.L4
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L11
.L22:
	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	"YES"
.LC2:
	.string	"NO"
	.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
	leaq	.LC0(%rip), %rdi
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	$107, %r14d
	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
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	movabsq	$28538298447783275, %rax
	leaq	48(%rsp), %rbx
	movq	%rbx, %rsi
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leaq	40(%rsp), %rsi
	movb	$0, 31(%rsp)
	movq	%rax, %r12
	xorl	%eax, %eax
	movq	%rsi, 16(%rsp)
	movl	$0, 24(%rsp)
	cmpb	%r14b, 48(%rsp,%rax)
	jne	.L20
.L2:
	addl	$1, 24(%rsp)
	movl	24(%rsp), %edx
	cmpl	$7, %edx
	jne	.L21
.L4:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L11:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$184, %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
.L21:
	.cfi_restore_state
	addl	$1, %r15d
	movslq	%r15d, %rax
	cmpq	%r12, %rax
	ja	.L6
	movslq	%edx, %rcx
	movq	%rcx, (%rsp)
.L5:
	movzbl	40(%rsp,%rcx), %r14d
	cmpb	%r14b, 48(%rsp,%rax)
	je	.L2
.L20:
	movslq	24(%rsp), %rax
	movq	16(%rsp), %r13
	leal	1(%r15), %ecx
	movslq	%ecx, %rbp
	movq	%rax, 8(%rsp)
	addq	%rax, %r13
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rbp
.L3:
	movl	%ebp, %r15d
	cmpq	%r12, %rbp
	ja	.L6
	cmpb	%r14b, (%rbx,%rbp)
	jne	.L7
	movq	8(%rsp), %rax
	leaq	(%rbx,%rbp), %rdi
	movq	%r13, %rsi
	movq	%rax, (%rsp)
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movb	$1, 31(%rsp)
	movq	(%rsp), %rcx
	movslq	%r15d, %rax
	jmp	.L5
.L6:
	cmpb	$0, 31(%rsp)
	jne	.L4
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L11
.L22:
	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>
#include <stdbool.h>

int main()
{
    char str1[105];
    char str2[] = "keyence";
    bool flag = false;
    int i, j;
    scanf("%s", str1);
    i = j = 0;
    while (i <= strlen(str1))
    {
        if (str1[i] == str2[j])
        {
            i++;
            j++;
            if (j == 7)
            {
                flag = true;
                break;
            }
            continue;
        }
        else
        {
            while (i <= strlen(str1))
            {
                if (str1[i] == str2[j])
                    if (strcmp(str1 + i, str2 + j) == 0)
                    {
                        flag = true;
                        break;
                    }
                i++;
            }
        }
    }
    if (flag == true)
        printf("YES\n");
    else
        printf("NO\n");
}
ecneyek
 ashkfyha
 eeyofscienck
 mnyszsbzpf
 ecneyel
 arhkfyha
 eeyofsciencj
 mnyszsb{pf
 ecleyen
 arhkyfha

NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO

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>
#include <stdbool.h>

int main()
{
    char str1[105];
    char str2[] = "keyence";
    bool flag = false;
    int i, j;
    scanf("%s", str1);
    i = j = 0;
    while (i <= strlen(str1))
    {
        if (str1[i] == str2[j])
        {
            i++;
            j++;
            if (j == 7)
            {
                flag = true;
                break;
            }
            continue;
        }
        else
        {
            while (i <= strlen(str1))
            {
                if (str1[i] == str2[j])
                    if (strcmp(str1 + i, str2 + j) == 0)
                    {
                        flag = true;
                        break;
                    }
                i++;
            }
        }
    }
    if (flag == true)
        printf("YES\n");
    else
        printf("NO\n");
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	subq	$168, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$28538298447783275, %rax
	movq	%rax, -152(%rbp)
	movb	$0, -161(%rbp)
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -156(%rbp)
	movl	-156(%rbp), %eax
	movl	%eax, -160(%rbp)
	jmp	.L2
.L9:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	addl	$1, -160(%rbp)
	addl	$1, -156(%rbp)
	cmpl	$7, -156(%rbp)
	jne	.L2
	movb	$1, -161(%rbp)
	jmp	.L5
.L8:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-156(%rbp), %eax
	cltq
	leaq	-152(%rbp), %rdx
	addq	%rax, %rdx
	movl	-160(%rbp), %eax
	cltq
	leaq	-144(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movb	$1, -161(%rbp)
	jmp	.L2
.L7:
	addl	$1, -160(%rbp)
.L6:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L8
.L2:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L9
.L5:
	cmpb	$0, -161(%rbp)
	je	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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
	subq	$168, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movabsq	$28538298447783275, %rax
	movq	%rax, -152(%rbp)
	movb	$0, -161(%rbp)
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -156(%rbp)
	movl	-156(%rbp), %eax
	movl	%eax, -160(%rbp)
	jmp	.L2
.L9:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	addl	$1, -160(%rbp)
	addl	$1, -156(%rbp)
	cmpl	$7, -156(%rbp)
	jne	.L2
	movb	$1, -161(%rbp)
	jmp	.L5
.L8:
	movl	-160(%rbp), %eax
	cltq
	movzbl	-144(%rbp,%rax), %edx
	movl	-156(%rbp), %eax
	cltq
	movzbl	-152(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-156(%rbp), %eax
	cltq
	leaq	-152(%rbp), %rdx
	addq	%rax, %rdx
	movl	-160(%rbp), %eax
	cltq
	leaq	-144(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movb	$1, -161(%rbp)
	jmp	.L2
.L7:
	addl	$1, -160(%rbp)
.L6:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L8
.L2:
	movl	-160(%rbp), %eax
	movslq	%eax, %rbx
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jbe	.L9
.L5:
	cmpb	$0, -161(%rbp)
	je	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
