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 MAX 200000


int main(){
  
  char S[MAX];
  scanf("%s",S);
  int n = strlen(S), i;
  int flag = 1;
  for(i = n-1; i>=0;){
    if(S[i]=='m'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='d'||S[i-3]!='r'||S[i-2]!='e'||S[i-1]!='a'){
        flag = 0;
        break;
      }
      i -= 5;
    }else if(S[i]=='e'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='e'||S[i-3]!='r'||S[i-2]!='a'||S[i-1]!='s'){
        flag = 0;
        break;
      }
      i -= 5;
      
    }else if(S[i]=='r'){
      if(i<5){
        flag = 0;
        break;
      }
      if(S[i-1]!='e'){
        flag = 0;
        break;
      }
      if(S[i-2]=='s'){
        if(S[i-5]!='e'||S[i-4]!='r'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 6;
      }else if(S[i-2]=='m'){
        if(i<6){
          flag = 0;
          break;
        }
        if(S[i-6]!='d'||S[i-5]!='r'||S[i-4]!='e'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 7;
      }else {
        flag = 0;
        break;
      }
    }else{
      flag = 0;
      break;
    }
  }
  
  if(flag) puts("YES");
  else puts("NO");
  
  return 0;
}
```

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
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-200016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200020(%rbp)
	movl	$1, -200024(%rbp)
	movl	-200020(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -200028(%rbp)
	jmp	.L2
.L22:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L3
	cmpl	$3, -200028(%rbp)
	jg	.L4
	movl	$0, -200024(%rbp)
	jmp	.L5
.L4:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L7
.L6:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L7:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L3:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L8
	cmpl	$3, -200028(%rbp)
	jg	.L9
	movl	$0, -200024(%rbp)
	jmp	.L5
.L9:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	je	.L11
.L10:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L11:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L8:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L12
	cmpl	$4, -200028(%rbp)
	jg	.L13
	movl	$0, -200024(%rbp)
	jmp	.L5
.L13:
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	je	.L14
	movl	$0, -200024(%rbp)
	jmp	.L5
.L14:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L15
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L17
.L16:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L17:
	subl	$6, -200028(%rbp)
	jmp	.L2
.L15:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L18
	cmpl	$5, -200028(%rbp)
	jg	.L19
	movl	$0, -200024(%rbp)
	jmp	.L5
.L19:
	movl	-200028(%rbp), %eax
	subl	$6, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L21
.L20:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L21:
	subl	$7, -200028(%rbp)
	jmp	.L2
.L18:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L12:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L2:
	cmpl	$0, -200028(%rbp)
	jns	.L22
.L5:
	cmpl	$0, -200024(%rbp)
	je	.L23
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L23:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3408, %rsp
	.cfi_def_cfa_offset 200032
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	testl	%eax, %eax
	je	.L2
	subl	$1, %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$101, %dl
	je	.L19
	cmpl	$4, %eax
	jle	.L4
	cmpb	$114, %dl
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	movzbl	(%rsp,%rdx), %edx
	cmpb	$115, %dl
	je	.L20
	cmpb	$109, %dl
	jne	.L4
	cmpl	$5, %eax
	je	.L4
	leal	-6(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$100, (%rsp,%rdx)
	jne	.L4
	leal	-5(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	subl	$7, %eax
.L5:
	cmpl	$-1, %eax
	je	.L2
.L8:
	movslq	%eax, %rdx
	movzbl	(%rsp,%rdx), %edx
	cmpb	$109, %dl
	jne	.L3
	cmpl	$3, %eax
	jle	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$100, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
.L17:
	subl	$5, %eax
	cmpl	$-1, %eax
	jne	.L8
.L2:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	cmpl	$3, %eax
	jle	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$115, (%rsp,%rdx)
	je	.L17
.L4:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L9:
	movq	200008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$200016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	leal	-5(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	subl	$6, %eax
	jmp	.L5
.L21:
	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	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3408, %rsp
	.cfi_def_cfa_offset 200032
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	testl	%eax, %eax
	je	.L2
	subl	$1, %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$101, %dl
	je	.L19
	cmpl	$4, %eax
	jle	.L4
	cmpb	$114, %dl
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	movzbl	(%rsp,%rdx), %edx
	cmpb	$115, %dl
	je	.L20
	cmpb	$109, %dl
	jne	.L4
	cmpl	$5, %eax
	je	.L4
	leal	-6(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$100, (%rsp,%rdx)
	jne	.L4
	leal	-5(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	subl	$7, %eax
.L5:
	cmpl	$-1, %eax
	je	.L2
.L8:
	movslq	%eax, %rdx
	movzbl	(%rsp,%rdx), %edx
	cmpb	$109, %dl
	jne	.L3
	cmpl	$3, %eax
	jle	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$100, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
.L17:
	subl	$5, %eax
	cmpl	$-1, %eax
	jne	.L8
.L2:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	cmpl	$3, %eax
	jle	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-2(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$115, (%rsp,%rdx)
	je	.L17
.L4:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L9:
	movq	200008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$200016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	leal	-5(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$101, (%rsp,%rdx)
	jne	.L4
	leal	-4(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$114, (%rsp,%rdx)
	jne	.L4
	leal	-3(%rax), %edx
	movslq	%edx, %rdx
	cmpb	$97, (%rsp,%rdx)
	jne	.L4
	subl	$6, %eax
	jmp	.L5
.L21:
	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 MAX 200000


int main(){
  
  char S[MAX];
  scanf("%s",S);
  int n = strlen(S), i;
  int flag = 1;
  for(i = n-1; i>=0;){
    if(S[i]=='m'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='d'||S[i-3]!='r'||S[i-2]!='e'||S[i-1]!='a'){
        flag = 0;
        break;
      }
      i -= 5;
    }else if(S[i]=='e'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='e'||S[i-3]!='r'||S[i-2]!='a'||S[i-1]!='s'){
        flag = 0;
        break;
      }
      i -= 5;
      
    }else if(S[i]=='r'){
      if(i<5){
        flag = 0;
        break;
      }
      if(S[i-1]!='e'){
        flag = 0;
        break;
      }
      if(S[i-2]=='s'){
        if(S[i-5]!='e'||S[i-4]!='r'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 6;
      }else if(S[i-2]=='m'){
        if(i<6){
          flag = 0;
          break;
        }
        if(S[i-6]!='d'||S[i-5]!='r'||S[i-4]!='e'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 7;
      }else {
        flag = 0;
        break;
      }
    }else{
      flag = 0;
      break;
    }
  }
  
  if(flag) puts("YES");
  else puts("NO");
  
  return 0;
}

dre`merer
 maerdesare
 resaremaerd
 dre`meqer
 er`sedream
 ersaremaerd
 reqem`erd
 eq`sedream
 ersaremadrd
 reqem`erc

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>
#define MAX 200000


int main(){
  
  char S[MAX];
  scanf("%s",S);
  int n = strlen(S), i;
  int flag = 1;
  for(i = n-1; i>=0;){
    if(S[i]=='m'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='d'||S[i-3]!='r'||S[i-2]!='e'||S[i-1]!='a'){
        flag = 0;
        break;
      }
      i -= 5;
    }else if(S[i]=='e'){
      if(i<4){
        flag = 0;
        break;
      }
      if(S[i-4]!='e'||S[i-3]!='r'||S[i-2]!='a'||S[i-1]!='s'){
        flag = 0;
        break;
      }
      i -= 5;
      
    }else if(S[i]=='r'){
      if(i<5){
        flag = 0;
        break;
      }
      if(S[i-1]!='e'){
        flag = 0;
        break;
      }
      if(S[i-2]=='s'){
        if(S[i-5]!='e'||S[i-4]!='r'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 6;
      }else if(S[i-2]=='m'){
        if(i<6){
          flag = 0;
          break;
        }
        if(S[i-6]!='d'||S[i-5]!='r'||S[i-4]!='e'||S[i-3]!='a'){
          flag = 0;
          break;
        }
        i -= 7;
      }else {
        flag = 0;
        break;
      }
    }else{
      flag = 0;
      break;
    }
  }
  
  if(flag) puts("YES");
  else puts("NO");
  
  return 0;
}
```

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
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-200016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200020(%rbp)
	movl	$1, -200024(%rbp)
	movl	-200020(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -200028(%rbp)
	jmp	.L2
.L22:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L3
	cmpl	$3, -200028(%rbp)
	jg	.L4
	movl	$0, -200024(%rbp)
	jmp	.L5
.L4:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L7
.L6:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L7:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L3:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L8
	cmpl	$3, -200028(%rbp)
	jg	.L9
	movl	$0, -200024(%rbp)
	jmp	.L5
.L9:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	je	.L11
.L10:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L11:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L8:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L12
	cmpl	$4, -200028(%rbp)
	jg	.L13
	movl	$0, -200024(%rbp)
	jmp	.L5
.L13:
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	je	.L14
	movl	$0, -200024(%rbp)
	jmp	.L5
.L14:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L15
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L17
.L16:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L17:
	subl	$6, -200028(%rbp)
	jmp	.L2
.L15:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L18
	cmpl	$5, -200028(%rbp)
	jg	.L19
	movl	$0, -200024(%rbp)
	jmp	.L5
.L19:
	movl	-200028(%rbp), %eax
	subl	$6, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L21
.L20:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L21:
	subl	$7, -200028(%rbp)
	jmp	.L2
.L18:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L12:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L2:
	cmpl	$0, -200028(%rbp)
	jns	.L22
.L5:
	cmpl	$0, -200024(%rbp)
	je	.L23
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L23:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3424, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-200016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200020(%rbp)
	movl	$1, -200024(%rbp)
	movl	-200020(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -200028(%rbp)
	jmp	.L2
.L22:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L3
	cmpl	$3, -200028(%rbp)
	jg	.L4
	movl	$0, -200024(%rbp)
	jmp	.L5
.L4:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L6
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L7
.L6:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L7:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L3:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L8
	cmpl	$3, -200028(%rbp)
	jg	.L9
	movl	$0, -200024(%rbp)
	jmp	.L5
.L9:
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	jne	.L10
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	je	.L11
.L10:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L11:
	subl	$5, -200028(%rbp)
	jmp	.L2
.L8:
	movl	-200028(%rbp), %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L12
	cmpl	$4, -200028(%rbp)
	jg	.L13
	movl	$0, -200024(%rbp)
	jmp	.L5
.L13:
	movl	-200028(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	je	.L14
	movl	$0, -200024(%rbp)
	jmp	.L5
.L14:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L15
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L16
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L17
.L16:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L17:
	subl	$6, -200028(%rbp)
	jmp	.L2
.L15:
	movl	-200028(%rbp), %eax
	subl	$2, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$109, %al
	jne	.L18
	cmpl	$5, -200028(%rbp)
	jg	.L19
	movl	$0, -200024(%rbp)
	jmp	.L5
.L19:
	movl	-200028(%rbp), %eax
	subl	$6, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$100, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$5, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$4, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$101, %al
	jne	.L20
	movl	-200028(%rbp), %eax
	subl	$3, %eax
	cltq
	movzbl	-200016(%rbp,%rax), %eax
	cmpb	$97, %al
	je	.L21
.L20:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L21:
	subl	$7, -200028(%rbp)
	jmp	.L2
.L18:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L12:
	movl	$0, -200024(%rbp)
	jmp	.L5
.L2:
	cmpl	$0, -200028(%rbp)
	jns	.L22
.L5:
	cmpl	$0, -200024(%rbp)
	je	.L23
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L24
.L23:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	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:
