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>

int main(void){

  int n,i;

  for(;;){
    scanf("%d",&n);
    if(n==0)break;

    int m=0,point=0,state=0;
    char s[n][2];

    for(i=0;i<n;i++)scanf("%s",s[i]);

    for(i=0;i<n;i++){

      if(state==0){
	if(s[i][1]=='d')point--;
	if(s[i][1]=='u'){
	  point++;
	  if(point==2){
	  m++;
	  state=1;
	  point=0;
	  }
	}
      }

      else if(state==1){
	if(s[i][1]=='u')point--;
	if(s[i][1]=='d'){
	  point++;
	  if(point==2){
	  m++;
	  state=0;
	  point=0;
	  }
	}
      }
    }
    
    printf("%d\n",m);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.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
	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
.L15:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	(%rax,%rax), %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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L7
.L8:
	movl	-88(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -88(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L8
	movl	$0, -88(%rbp)
	jmp	.L9
.L14:
	cmpl	$0, -76(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L11
	subl	$1, -80(%rbp)
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$1, -76(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L12
.L10:
	cmpl	$1, -76(%rbp)
	jne	.L12
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L13
	subl	$1, -80(%rbp)
.L13:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$0, -76(%rbp)
	movl	$0, -80(%rbp)
.L12:
	addl	$1, -88(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L14
	movl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rax
	movq	%rax, -72(%rbp)
	.p2align 4,,10
	.p2align 3
.L22:
	movq	-72(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %r13
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	testl	%esi, %esi
	je	.L2
	movslq	%esi, %rax
	movq	%rsp, %rcx
	leaq	15(%rax,%rax), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L4
.L35:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L35
.L4:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L5
	orq	$0, -8(%rsp,%rdx)
.L5:
	movq	%rsp, %r12
	movq	%rsp, %r15
	xorl	%r14d, %r14d
	testl	%esi, %esi
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	addq	$2, %r15
	cmpl	%r14d, %esi
	jg	.L8
	testl	%esi, %esi
	jle	.L10
	xorl	%r8d, %r8d
	xorl	%eax, %eax
.L9:
	addl	$1, %eax
	xorl	%edi, %edi
	cltq
	movzbl	-1(%r12,%rax,2), %ecx
	movl	%eax, %edx
	cmpb	$100, %cl
	je	.L36
.L11:
	cmpb	$117, %cl
	jne	.L32
	addl	$1, %edi
	cmpl	$2, %edi
	je	.L15
.L32:
	cmpl	%eax, %esi
	jle	.L7
.L14:
	addq	$1, %rax
	movzbl	-1(%r12,%rax,2), %ecx
	movl	%eax, %edx
	cmpb	$100, %cl
	jne	.L11
.L36:
	subl	$1, %edi
	cmpl	%eax, %esi
	jg	.L14
.L7:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsp
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L15:
	leal	1(%r8), %r9d
	cmpl	%eax, %esi
	jle	.L25
	addl	$1, %edx
	xorl	%edi, %edi
	movslq	%edx, %rdx
	movzbl	-1(%r12,%rdx,2), %ecx
	movl	%edx, %eax
	cmpb	$117, %cl
	je	.L37
.L17:
	cmpb	$100, %cl
	jne	.L18
	addl	$1, %edi
	cmpl	$2, %edi
	je	.L38
.L18:
	cmpl	%edx, %esi
	jle	.L25
.L21:
	addq	$1, %rdx
	movzbl	-1(%r12,%rdx,2), %ecx
	movl	%edx, %eax
	cmpb	$117, %cl
	jne	.L17
.L37:
	subl	$1, %edi
	cmpl	%edx, %esi
	jg	.L21
.L25:
	movl	%r9d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L38:
	addl	$2, %r8d
	cmpl	%edx, %esi
	jg	.L9
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	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
.L10:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rax
	movq	%rax, -72(%rbp)
	.p2align 4,,10
	.p2align 3
.L22:
	movq	-72(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %r13
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	testl	%esi, %esi
	je	.L2
	movslq	%esi, %rax
	movq	%rsp, %rcx
	leaq	15(%rax,%rax), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L4
.L35:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L35
.L4:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L5
	orq	$0, -8(%rsp,%rdx)
.L5:
	movq	%rsp, %r12
	movq	%rsp, %r15
	xorl	%r14d, %r14d
	testl	%esi, %esi
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %esi
	addq	$2, %r15
	cmpl	%r14d, %esi
	jg	.L8
	testl	%esi, %esi
	jle	.L10
	xorl	%r8d, %r8d
	xorl	%eax, %eax
.L9:
	addl	$1, %eax
	xorl	%edi, %edi
	cltq
	movzbl	-1(%r12,%rax,2), %ecx
	movl	%eax, %edx
	cmpb	$100, %cl
	je	.L36
.L11:
	cmpb	$117, %cl
	jne	.L32
	addl	$1, %edi
	cmpl	$2, %edi
	je	.L15
.L32:
	cmpl	%eax, %esi
	jle	.L7
.L14:
	addq	$1, %rax
	movzbl	-1(%r12,%rax,2), %ecx
	movl	%eax, %edx
	cmpb	$100, %cl
	jne	.L11
.L36:
	subl	$1, %edi
	cmpl	%eax, %esi
	jg	.L14
.L7:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rsp
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L15:
	leal	1(%r8), %r9d
	cmpl	%eax, %esi
	jle	.L25
	addl	$1, %edx
	xorl	%edi, %edi
	movslq	%edx, %rdx
	movzbl	-1(%r12,%rdx,2), %ecx
	movl	%edx, %eax
	cmpb	$117, %cl
	je	.L37
.L17:
	cmpb	$100, %cl
	jne	.L18
	addl	$1, %edi
	cmpl	$2, %edi
	je	.L38
.L18:
	cmpl	%edx, %esi
	jle	.L25
.L21:
	addq	$1, %rdx
	movzbl	-1(%r12,%rdx,2), %ecx
	movl	%edx, %eax
	cmpb	$117, %cl
	jne	.L17
.L37:
	subl	$1, %edi
	cmpl	%edx, %esi
	jg	.L21
.L25:
	movl	%r9d, %r8d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L38:
	addl	$2, %r8d
	cmpl	%edx, %esi
	jg	.L9
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	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
.L10:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void){

  int n,i;

  for(;;){
    scanf("%d",&n);
    if(n==0)break;

    int m=0,point=0,state=0;
    char s[n][2];

    for(i=0;i<n;i++)scanf("%s",s[i]);

    for(i=0;i<n;i++){

      if(state==0){
	if(s[i][1]=='d')point--;
	if(s[i][1]=='u'){
	  point++;
	  if(point==2){
	  m++;
	  state=1;
	  point=0;
	  }
	}
      }

      else if(state==1){
	if(s[i][1]=='u')point--;
	if(s[i][1]=='d'){
	  point++;
	  if(point==2){
	  m++;
	  state=0;
	  point=0;
	  }
	}
      }
    }
    
    printf("%d\n",m);
  }

  return 0;
}
4
lu ru ld rd
4
lu ld lu ru
0
lu
10
ru lu ld rd ru rd ru lu rd ld
0
 4
lu ru ld rd
0
lu ld lu ru
0
ul
10
vr lu ld rd rv rd ru lu rc kd
0
 4
lu ru ld rd
4
lu ld lu ru
0
ul
10
ru lu ld rd ru rd ru lu rd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
lu
10
ru lu ld rd su rd ru lu rd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
ul
10
ru lu ld rd rt rd ru lu rd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
lu
10
ru lu ld rd su rd ru lu sd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
ul
10
ru lu ld rd rt dr ru lu rd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
lu
10
ru lu ld dr su rd ru lu sd ld
0
 4
lu ru ld rd
4
lu ld lu ru
0
ul
10
ru lu ld rd rt dr ru lu rd dl
0
 4
lu ru ld rd
4
lu ld lu ru
0
lu
10
ru lu ld rd ru rd ru lu rc ld
0

2
1
 2
 2
1
 2
1
 2
1
 2
1
 2
1
 2
1
 2
1
 2
1

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>

int main(void){

  int n,i;

  for(;;){
    scanf("%d",&n);
    if(n==0)break;

    int m=0,point=0,state=0;
    char s[n][2];

    for(i=0;i<n;i++)scanf("%s",s[i]);

    for(i=0;i<n;i++){

      if(state==0){
	if(s[i][1]=='d')point--;
	if(s[i][1]=='u'){
	  point++;
	  if(point==2){
	  m++;
	  state=1;
	  point=0;
	  }
	}
      }

      else if(state==1){
	if(s[i][1]=='u')point--;
	if(s[i][1]=='d'){
	  point++;
	  if(point==2){
	  m++;
	  state=0;
	  point=0;
	  }
	}
      }
    }
    
    printf("%d\n",m);
  }

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.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
	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
.L15:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	(%rax,%rax), %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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L7
.L8:
	movl	-88(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -88(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L8
	movl	$0, -88(%rbp)
	jmp	.L9
.L14:
	cmpl	$0, -76(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L11
	subl	$1, -80(%rbp)
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$1, -76(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L12
.L10:
	cmpl	$1, -76(%rbp)
	jne	.L12
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L13
	subl	$1, -80(%rbp)
.L13:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$0, -76(%rbp)
	movl	$0, -80(%rbp)
.L12:
	addl	$1, -88(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L14
	movl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.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
	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
.L15:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$0, -84(%rbp)
	movl	$0, -80(%rbp)
	movl	$0, -76(%rbp)
	movl	-92(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	cltq
	leaq	(%rax,%rax), %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
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -88(%rbp)
	jmp	.L7
.L8:
	movl	-88(%rbp), %eax
	cltq
	leaq	(%rax,%rax), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -88(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L8
	movl	$0, -88(%rbp)
	jmp	.L9
.L14:
	cmpl	$0, -76(%rbp)
	jne	.L10
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L11
	subl	$1, -80(%rbp)
.L11:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$1, -76(%rbp)
	movl	$0, -80(%rbp)
	jmp	.L12
.L10:
	cmpl	$1, -76(%rbp)
	jne	.L12
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$117, %al
	jne	.L13
	subl	$1, -80(%rbp)
.L13:
	movq	-64(%rbp), %rax
	movl	-88(%rbp), %edx
	movslq	%edx, %rdx
	movzbl	1(%rax,%rdx,2), %eax
	cmpb	$100, %al
	jne	.L12
	addl	$1, -80(%rbp)
	cmpl	$2, -80(%rbp)
	jne	.L12
	addl	$1, -84(%rbp)
	movl	$0, -76(%rbp)
	movl	$0, -80(%rbp)
.L12:
	addl	$1, -88(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -88(%rbp)
	jl	.L14
	movl	-84(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	%rbx, %rsp
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
