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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100001];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    String S;
    S=string_input();

    //D[0]~D[3]に与えられた文字列を入れる
    String* D;
    NEW(D,4);
    NEW(D[0],6);
    D[0]="dream";
    NEW(D[1],8);
    D[1]="dreamer";
    NEW(D[2],6);
    D[2]="erase";
    NEW(D[3],7);
    D[3]="eraser";

    //DPMapを作る
    int N=strlen(S);
    int Map[N+1];
    for(int i=1;i<=N;i++) Map[i]=0;
    Map[0]=1;

    //Mapを埋める
    for(int i=1;i<=N;i++){
        for(int j=0;j<4;j++){
            if(i<strlen(D[j])) continue;

            int flg=1;
            for(int k=0;k<strlen(D[j]);k++){
                if(S[i-strlen(D[j])+k]!=D[j][k]){
                    flg=0;
                    break;
                }
            }

            if(flg) Map[i]=Map[i-strlen(D[j])];
        }
    }

    if(Map[N]) printf("YES\n");
    else printf("NO\n");

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"not enough memory"
	.text
	.globl	string_input
	.type	string_input, @function
string_input:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1728, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -100028(%rbp)
	movl	-100028(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -100024(%rbp)
	cmpq	$0, -100024(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -100032(%rbp)
	jmp	.L3
.L4:
	movl	-100032(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rax, %rdx
	movl	-100032(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, (%rdx)
	addl	$1, -100032(%rbp)
.L3:
	movl	-100032(%rbp), %eax
	cmpl	-100028(%rbp), %eax
	jl	.L4
	movl	-100028(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movq	-100024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	string_input, .-string_input
	.section	.rodata
.LC2:
	.string	"dream"
.LC3:
	.string	"dreamer"
.LC4:
	.string	"erase"
.LC5:
	.string	"eraser"
.LC6:
	.string	"YES"
.LC7:
	.string	"NO"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	call	string_input
	movq	%rax, -72(%rbp)
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L9:
	movq	-64(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	8(%rax), %rbx
	movl	$8, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	movq	-64(%rbp), %rax
	addq	$8, %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	16(%rax), %rbx
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$16, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L11:
	movq	-64(%rbp), %rax
	addq	$16, %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	24(%rax), %rbx
	movl	$7, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$24, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movq	-64(%rbp), %rax
	addq	$24, %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-72(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -76(%rbp)
	movl	-76(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L13:
	cmpq	%rdx, %rsp
	je	.L14
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L13
.L14:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L15
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L15:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L16
.L17:
	movq	-48(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L16:
	movl	-96(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L17
	movq	-48(%rbp), %rax
	movl	$1, (%rax)
	movl	$1, -92(%rbp)
	jmp	.L18
.L27:
	movl	$0, -88(%rbp)
	jmp	.L19
.L26:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L32
	movl	$1, -84(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L22
.L25:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movl	-80(%rbp), %eax
	cltq
	addq	%rax, %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-80(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L23
	movl	$0, -84(%rbp)
	jmp	.L24
.L23:
	addl	$1, -80(%rbp)
.L22:
	movl	-80(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L25
.L24:
	cmpl	$0, -84(%rbp)
	je	.L21
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	-48(%rbp), %rax
	movl	(%rax,%rdx,4), %ecx
	movq	-48(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L21
.L32:
	nop
.L21:
	addl	$1, -88(%rbp)
.L19:
	cmpl	$3, -88(%rbp)
	jle	.L26
	addl	$1, -92(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L27
	movq	-48(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	je	.L28
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	"not enough memory"
	.text
	.p2align 4
	.globl	string_input
	.type	string_input, @function
string_input:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	1(%rax), %edi
	movq	%rax, %rbx
	movslq	%edi, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L2
	movq	%rax, %r8
	testq	%rbx, %rbx
	je	.L4
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	memcpy@PLT
	movq	%rax, %r8
.L4:
	movb	$0, (%r8,%rbx)
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$100024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	string_input, .-string_input
	.section	.rodata.str1.1
.LC2:
	.string	"dream"
.LC3:
	.string	"dreamer"
.LC4:
	.string	"erase"
.LC5:
	.string	"eraser"
.LC6:
	.string	"YES"
.LC7:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	string_input
	movl	$32, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, -72(%rbp)
	testq	%rax, %rax
	je	.L11
	movl	$6, %edi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	movq	-72(%rbp), %rbx
	leaq	.LC2(%rip), %rax
	movl	$8, %edi
	movq	%rax, (%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC3(%rip), %rax
	movl	$6, %edi
	movq	%rax, 8(%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC4(%rip), %rax
	movl	$7, %edi
	movq	%rax, 16(%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC5(%rip), %rax
	movq	%r12, %rdi
	movq	%rax, 24(%rbx)
	call	strlen@PLT
	movq	%rsp, %rcx
	movq	%rax, -88(%rbp)
	addl	$1, %eax
	cltq
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L13
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L48
.L13:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L14:
	leaq	3(%rsp), %r13
	movq	-88(%rbp), %rax
	movq	%r13, %rbx
	andq	$-4, %r13
	shrq	$2, %rbx
	testl	%eax, %eax
	jle	.L15
	leal	-1(%rax), %r15d
	leaq	4(%r13), %rdi
	xorl	%esi, %esi
	leaq	4(,%r15,4), %rdx
	call	memset@PLT
	leaq	2(%r15), %rax
	movl	$1, %r15d
	movl	$1, 0(,%rbx,4)
	movq	%rax, -80(%rbp)
	movq	-72(%rbp), %rax
	leaq	32(%rax), %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$5, %eax
	movq	-72(%rbp), %r14
	cmpq	%rax, %r15
	jnb	.L50
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$8, %r14
	cmpq	%rbx, %r14
	je	.L19
.L51:
	movq	(%r14), %rdi
	call	strlen@PLT
	cmpq	%rax, %r15
	jb	.L16
.L50:
	movq	%r15, %r9
	movq	(%r14), %rsi
	subq	%rax, %r9
	testq	%rax, %rax
	je	.L17
	xorl	%edx, %edx
	leaq	(%r12,%r9), %rdi
	.p2align 4,,10
	.p2align 3
.L18:
	movzbl	(%rsi,%rdx), %ecx
	cmpb	%cl, (%rdi,%rdx)
	jne	.L16
	addq	$1, %rdx
	cmpq	%rdx, %rax
	jne	.L18
.L17:
	movl	0(%r13,%r9,4), %eax
	addq	$8, %r14
	movl	%eax, 0(%r13,%r15,4)
	cmpq	%rbx, %r14
	jne	.L51
.L19:
	addq	$1, %r15
	cmpq	-80(%rbp), %r15
	jne	.L21
.L24:
	movslq	-88(%rbp), %rax
	movl	0(%r13,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
.L23:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L52
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L23
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L14
.L15:
	movl	$1, 0(,%rbx,4)
	jmp	.L24
.L11:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L52:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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	"not enough memory"
	.text
	.p2align 4
	.globl	string_input
	.type	string_input, @function
string_input:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1720, %rsp
	.cfi_def_cfa_offset 100048
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100008(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leal	1(%rax), %edi
	movq	%rax, %rbx
	movslq	%edi, %rdi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L2
	movq	%rax, %r8
	testq	%rbx, %rbx
	je	.L4
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movq	%rax, %rdi
	call	memcpy@PLT
	movq	%rax, %r8
.L4:
	movb	$0, (%r8,%rbx)
	movq	100008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$100024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movq	%r8, %rax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	string_input, .-string_input
	.section	.rodata.str1.1
.LC2:
	.string	"dream"
.LC3:
	.string	"dreamer"
.LC4:
	.string	"erase"
.LC5:
	.string	"eraser"
.LC6:
	.string	"YES"
.LC7:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	string_input
	movl	$32, %edi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rax, -72(%rbp)
	testq	%rax, %rax
	je	.L11
	movl	$6, %edi
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	movq	-72(%rbp), %rbx
	leaq	.LC2(%rip), %rax
	movl	$8, %edi
	movq	%rax, (%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC3(%rip), %rax
	movl	$6, %edi
	movq	%rax, 8(%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC4(%rip), %rax
	movl	$7, %edi
	movq	%rax, 16(%rbx)
	call	malloc@PLT
	testq	%rax, %rax
	je	.L11
	leaq	.LC5(%rip), %rax
	movq	%r12, %rdi
	movq	%rax, 24(%rbx)
	call	strlen@PLT
	movq	%rsp, %rcx
	movq	%rax, -88(%rbp)
	addl	$1, %eax
	cltq
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L13
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L48
.L13:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L14:
	leaq	3(%rsp), %r13
	movq	-88(%rbp), %rax
	movq	%r13, %rbx
	andq	$-4, %r13
	shrq	$2, %rbx
	testl	%eax, %eax
	jle	.L15
	leal	-1(%rax), %r15d
	leaq	4(%r13), %rdi
	xorl	%esi, %esi
	leaq	4(,%r15,4), %rdx
	call	memset@PLT
	leaq	2(%r15), %rax
	movl	$1, %r15d
	movl	$1, 0(,%rbx,4)
	movq	%rax, -80(%rbp)
	movq	-72(%rbp), %rax
	leaq	32(%rax), %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movl	$5, %eax
	movq	-72(%rbp), %r14
	cmpq	%rax, %r15
	jnb	.L50
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$8, %r14
	cmpq	%rbx, %r14
	je	.L19
.L51:
	movq	(%r14), %rdi
	call	strlen@PLT
	cmpq	%rax, %r15
	jb	.L16
.L50:
	movq	%r15, %r9
	movq	(%r14), %rsi
	subq	%rax, %r9
	testq	%rax, %rax
	je	.L17
	xorl	%edx, %edx
	leaq	(%r12,%r9), %rdi
	.p2align 4,,10
	.p2align 3
.L18:
	movzbl	(%rsi,%rdx), %ecx
	cmpb	%cl, (%rdi,%rdx)
	jne	.L16
	addq	$1, %rdx
	cmpq	%rdx, %rax
	jne	.L18
.L17:
	movl	0(%r13,%r9,4), %eax
	addq	$8, %r14
	movl	%eax, 0(%r13,%r15,4)
	cmpq	%rbx, %r14
	jne	.L51
.L19:
	addq	$1, %r15
	cmpq	-80(%rbp), %r15
	jne	.L21
.L24:
	movslq	-88(%rbp), %rax
	movl	0(%r13,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
.L23:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L52
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L23
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L14
.L15:
	movl	$1, 0(,%rbx,4)
	jmp	.L24
.L11:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L52:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100001];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    String S;
    S=string_input();

    //D[0]~D[3]に与えられた文字列を入れる
    String* D;
    NEW(D,4);
    NEW(D[0],6);
    D[0]="dream";
    NEW(D[1],8);
    D[1]="dreamer";
    NEW(D[2],6);
    D[2]="erase";
    NEW(D[3],7);
    D[3]="eraser";

    //DPMapを作る
    int N=strlen(S);
    int Map[N+1];
    for(int i=1;i<=N;i++) Map[i]=0;
    Map[0]=1;

    //Mapを埋める
    for(int i=1;i<=N;i++){
        for(int j=0;j<4;j++){
            if(i<strlen(D[j])) continue;

            int flg=1;
            for(int k=0;k<strlen(D[j]);k++){
                if(S[i-strlen(D[j])+k]!=D[j][k]){
                    flg=0;
                    break;
                }
            }

            if(flg) Map[i]=Map[i-strlen(D[j])];
        }
    }

    if(Map[N]) printf("YES\n");
    else printf("NO\n");

    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<stdlib.h>
#include<string.h>
#include<math.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

typedef char* String;

String string_input(void){
    int i,len;
    char buf[100001];
    String str;
    scanf("%s",buf);//buf=入力した文字列が入るchar型の配列
    
    len=strlen(buf);//len=文字列の長さを表すint型変数
    NEW(str,len+1);//strはただのポインタだから、ここでNEWを使ってメモリを確保しなくちゃいけない
    for(i=0;i<len;i++){
        str[i]=buf[i];
    }
    str[len]=0;
    
    return str;
}

int main(void){
    String S;
    S=string_input();

    //D[0]~D[3]に与えられた文字列を入れる
    String* D;
    NEW(D,4);
    NEW(D[0],6);
    D[0]="dream";
    NEW(D[1],8);
    D[1]="dreamer";
    NEW(D[2],6);
    D[2]="erase";
    NEW(D[3],7);
    D[3]="eraser";

    //DPMapを作る
    int N=strlen(S);
    int Map[N+1];
    for(int i=1;i<=N;i++) Map[i]=0;
    Map[0]=1;

    //Mapを埋める
    for(int i=1;i<=N;i++){
        for(int j=0;j<4;j++){
            if(i<strlen(D[j])) continue;

            int flg=1;
            for(int k=0;k<strlen(D[j]);k++){
                if(S[i-strlen(D[j])+k]!=D[j][k]){
                    flg=0;
                    break;
                }
            }

            if(flg) Map[i]=Map[i-strlen(D[j])];
        }
    }

    if(Map[N]) printf("YES\n");
    else printf("NO\n");

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"not enough memory"
	.text
	.globl	string_input
	.type	string_input, @function
string_input:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1728, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -100028(%rbp)
	movl	-100028(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -100024(%rbp)
	cmpq	$0, -100024(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -100032(%rbp)
	jmp	.L3
.L4:
	movl	-100032(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rax, %rdx
	movl	-100032(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, (%rdx)
	addl	$1, -100032(%rbp)
.L3:
	movl	-100032(%rbp), %eax
	cmpl	-100028(%rbp), %eax
	jl	.L4
	movl	-100028(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movq	-100024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	string_input, .-string_input
	.section	.rodata
.LC2:
	.string	"dream"
.LC3:
	.string	"dreamer"
.LC4:
	.string	"erase"
.LC5:
	.string	"eraser"
.LC6:
	.string	"YES"
.LC7:
	.string	"NO"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	call	string_input
	movq	%rax, -72(%rbp)
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L9:
	movq	-64(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	8(%rax), %rbx
	movl	$8, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	movq	-64(%rbp), %rax
	addq	$8, %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	16(%rax), %rbx
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$16, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L11:
	movq	-64(%rbp), %rax
	addq	$16, %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	24(%rax), %rbx
	movl	$7, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$24, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movq	-64(%rbp), %rax
	addq	$24, %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-72(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -76(%rbp)
	movl	-76(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L13:
	cmpq	%rdx, %rsp
	je	.L14
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L13
.L14:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L15
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L15:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L16
.L17:
	movq	-48(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L16:
	movl	-96(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L17
	movq	-48(%rbp), %rax
	movl	$1, (%rax)
	movl	$1, -92(%rbp)
	jmp	.L18
.L27:
	movl	$0, -88(%rbp)
	jmp	.L19
.L26:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L32
	movl	$1, -84(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L22
.L25:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movl	-80(%rbp), %eax
	cltq
	addq	%rax, %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-80(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L23
	movl	$0, -84(%rbp)
	jmp	.L24
.L23:
	addl	$1, -80(%rbp)
.L22:
	movl	-80(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L25
.L24:
	cmpl	$0, -84(%rbp)
	je	.L21
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	-48(%rbp), %rax
	movl	(%rax,%rdx,4), %ecx
	movq	-48(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L21
.L32:
	nop
.L21:
	addl	$1, -88(%rbp)
.L19:
	cmpl	$3, -88(%rbp)
	jle	.L26
	addl	$1, -92(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L27
	movq	-48(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	je	.L28
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	"not enough memory"
	.text
	.globl	string_input
	.type	string_input, @function
string_input:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-98304(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1728, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -100028(%rbp)
	movl	-100028(%rbp), %eax
	addl	$1, %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -100024(%rbp)
	cmpq	$0, -100024(%rbp)
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -100032(%rbp)
	jmp	.L3
.L4:
	movl	-100032(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rax, %rdx
	movl	-100032(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, (%rdx)
	addl	$1, -100032(%rbp)
.L3:
	movl	-100032(%rbp), %eax
	cmpl	-100028(%rbp), %eax
	jl	.L4
	movl	-100028(%rbp), %eax
	movslq	%eax, %rdx
	movq	-100024(%rbp), %rax
	addq	%rdx, %rax
	movb	$0, (%rax)
	movq	-100024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	string_input, .-string_input
	.section	.rodata
.LC2:
	.string	"dream"
.LC3:
	.string	"dreamer"
.LC4:
	.string	"erase"
.LC5:
	.string	"eraser"
.LC6:
	.string	"YES"
.LC7:
	.string	"NO"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %r12
	call	string_input
	movq	%rax, -72(%rbp)
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -64(%rbp)
	cmpq	$0, -64(%rbp)
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L8:
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L9:
	movq	-64(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	8(%rax), %rbx
	movl	$8, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L10:
	movq	-64(%rbp), %rax
	addq	$8, %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	16(%rax), %rbx
	movl	$6, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$16, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L11:
	movq	-64(%rbp), %rax
	addq	$16, %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-64(%rbp), %rax
	leaq	24(%rax), %rbx
	movl	$7, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movq	-64(%rbp), %rax
	addq	$24, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$1, %edi
	call	exit@PLT
.L12:
	movq	-64(%rbp), %rax
	addq	$24, %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, (%rax)
	movq	-72(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -76(%rbp)
	movl	-76(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -56(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -112(%rbp)
	movq	$0, -104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L13:
	cmpq	%rdx, %rsp
	je	.L14
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L13
.L14:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L15
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L15:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -48(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L16
.L17:
	movq	-48(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L16:
	movl	-96(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L17
	movq	-48(%rbp), %rax
	movl	$1, (%rax)
	movl	$1, -92(%rbp)
	jmp	.L18
.L27:
	movl	$0, -88(%rbp)
	jmp	.L19
.L26:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L32
	movl	$1, -84(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L22
.L25:
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movl	-80(%rbp), %eax
	cltq
	addq	%rax, %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-80(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L23
	movl	$0, -84(%rbp)
	jmp	.L24
.L23:
	addl	$1, -80(%rbp)
.L22:
	movl	-80(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	cmpq	%rax, %rbx
	jb	.L25
.L24:
	cmpl	$0, -84(%rbp)
	je	.L21
	movl	-92(%rbp), %eax
	movslq	%eax, %rbx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	%rax, %rbx
	movq	%rbx, %rdx
	movq	-48(%rbp), %rax
	movl	(%rax,%rdx,4), %ecx
	movq	-48(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L21
.L32:
	nop
.L21:
	addl	$1, -88(%rbp)
.L19:
	cmpl	$3, -88(%rbp)
	jle	.L26
	addl	$1, -92(%rbp)
.L18:
	movl	-92(%rbp), %eax
	cmpl	-76(%rbp), %eax
	jle	.L27
	movq	-48(%rbp), %rax
	movl	-76(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	je	.L28
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L29
.L28:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L29:
	movl	$0, %eax
	movq	%r12, %rsp
	movq	-40(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
