Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int now, right, left, count;

int cmp_char(char a[], char b[]);

int main(void)
{
    char input[3];
    int data, i;

    scanf("%d",&data);
    while (data) {
        count = 0;
        now = -1;
        right = -1;
        left = -1;
        for (i = 0; i < data; i++) {
            scanf("%s",input);
            if (cmp_char(input, "lu")) {
                left = 1;
            } else if (cmp_char(input, "ld")) {
                left = -1;
            } else if (cmp_char(input, "ru")) {
                right = 1;
            } else if (cmp_char(input, "rd")) {
                right = -1;
            }
            if (now != right && now != left) {
                now = right;
                count++;
            }
        }
        printf("%d\n",count);
        scanf("%d",&data);
    }
    return 0;
}

int cmp_char(char a[], char b[])
{
    int i;
    for (i = 0; i < 2; i++) {
        if (a[i] != b[i]) {
            return 0;
        }
    }
    return 1;
}```

Assembly Code:

```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	testl	%eax, %eax
	jle	.L14
	xorl	%ebx, %ebx
	leaq	5(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	5(%rsp), %eax
	cmpb	$108, %al
	jne	.L4
	movzbl	6(%rsp), %eax
	movl	right(%rip), %edx
	cmpb	$117, %al
	jne	.L5
	movl	$1, left(%rip)
.L6:
	movl	now(%rip), %eax
	cmpl	%edx, %eax
	je	.L10
	cmpl	left(%rip), %eax
	je	.L10
	addl	$1, count(%rip)
	movl	%edx, now(%rip)
.L10:
	addl	$1, %ebx
	cmpl	%ebx, (%rsp)
	jg	.L11
	movl	count(%rip), %edx
.L3:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jne	.L2
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %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
.L5:
	.cfi_restore_state
	cmpb	$100, %al
	jne	.L6
	movl	$-1, left(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$114, %al
	jne	.L9
	movzbl	6(%rsp), %eax
	cmpb	$117, %al
	jne	.L8
	movl	$1, right(%rip)
	movl	$1, %edx
	jmp	.L6
.L8:
	cmpb	$100, %al
	jne	.L9
	movl	$-1, right(%rip)
	movl	$-1, %edx
	jmp	.L6
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movl	right(%rip), %edx
	jmp	.L6
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rsi), %eax
	cmpb	%al, (%rdi)
	jne	.L26
	movzbl	1(%rsi), %eax
	cmpb	%al, 1(%rdi)
	sete	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	cmp_char, .-cmp_char
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	now
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.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.
Optimized Assembly Code:

user
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	testl	%eax, %eax
	jle	.L14
	xorl	%ebx, %ebx
	leaq	5(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	5(%rsp), %eax
	cmpb	$108, %al
	jne	.L4
	movzbl	6(%rsp), %eax
	movl	right(%rip), %edx
	cmpb	$117, %al
	jne	.L5
	movl	$1, left(%rip)
.L6:
	movl	now(%rip), %eax
	cmpl	%edx, %eax
	je	.L10
	cmpl	left(%rip), %eax
	je	.L10
	addl	$1, count(%rip)
	movl	%edx, now(%rip)
.L10:
	addl	$1, %ebx
	cmpl	%ebx, (%rsp)
	jg	.L11
	movl	count(%rip), %edx
.L3:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jne	.L2
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %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
.L5:
	.cfi_restore_state
	cmpb	$100, %al
	jne	.L6
	movl	$-1, left(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$114, %al
	jne	.L9
	movzbl	6(%rsp), %eax
	cmpb	$117, %al
	jne	.L8
	movl	$1, right(%rip)
	movl	$1, %edx
	jmp	.L6
.L8:
	cmpb	$100, %al
	jne	.L9
	movl	$-1, right(%rip)
	movl	$-1, %edx
	jmp	.L6
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movl	right(%rip), %edx
	jmp	.L6
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rsi), %eax
	cmpb	%al, (%rdi)
	jne	.L26
	movzbl	1(%rsi), %eax
	cmpb	%al, 1(%rdi)
	sete	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	cmp_char, .-cmp_char
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	now
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.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
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	testl	%eax, %eax
	jle	.L14
	xorl	%ebx, %ebx
	leaq	5(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	5(%rsp), %eax
	cmpb	$108, %al
	jne	.L4
	movzbl	6(%rsp), %eax
	movl	right(%rip), %edx
	cmpb	$117, %al
	jne	.L5
	movl	$1, left(%rip)
.L6:
	movl	now(%rip), %eax
	cmpl	%edx, %eax
	je	.L10
	cmpl	left(%rip), %eax
	je	.L10
	addl	$1, count(%rip)
	movl	%edx, now(%rip)
.L10:
	addl	$1, %ebx
	cmpl	%ebx, (%rsp)
	jg	.L11
	movl	count(%rip), %edx
.L3:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jne	.L2
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %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
.L5:
	.cfi_restore_state
	cmpb	$100, %al
	jne	.L6
	movl	$-1, left(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$114, %al
	jne	.L9
	movzbl	6(%rsp), %eax
	cmpb	$117, %al
	jne	.L8
	movl	$1, right(%rip)
	movl	$1, %edx
	jmp	.L6
.L8:
	cmpb	$100, %al
	jne	.L9
	movl	$-1, right(%rip)
	movl	$-1, %edx
	jmp	.L6
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movl	right(%rip), %edx
	jmp	.L6
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rsi), %eax
	cmpb	%al, (%rdi)
	jne	.L26
	movzbl	1(%rsi), %eax
	cmpb	%al, 1(%rdi)
	sete	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	cmp_char, .-cmp_char
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	now
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.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:
```
```c
#include <stdio.h>

int now, right, left, count;

int cmp_char(char a[], char b[]);

int main(void)
{
    char input[3];
    int data, i;

    scanf("%d",&data);
    while (data) {
        count = 0;
        now = -1;
        right = -1;
        left = -1;
        for (i = 0; i < data; i++) {
            scanf("%s",input);
            if (cmp_char(input, "lu")) {
                left = 1;
            } else if (cmp_char(input, "ld")) {
                left = -1;
            } else if (cmp_char(input, "ru")) {
                right = 1;
            } else if (cmp_char(input, "rd")) {
                right = -1;
            }
            if (now != right && now != left) {
                now = right;
                count++;
            }
        }
        printf("%d\n",count);
        scanf("%d",&data);
    }
    return 0;
}

int cmp_char(char a[], char b[])
{
    int i;
    for (i = 0; i < 2; i++) {
        if (a[i] != b[i]) {
            return 0;
        }
    }
    return 1;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int now, right, left, count;

int cmp_char(char a[], char b[]);

int main(void)
{
    char input[3];
    int data, i;

    scanf("%d",&data);
    while (data) {
        count = 0;
        now = -1;
        right = -1;
        left = -1;
        for (i = 0; i < data; i++) {
            scanf("%s",input);
            if (cmp_char(input, "lu")) {
                left = 1;
            } else if (cmp_char(input, "ld")) {
                left = -1;
            } else if (cmp_char(input, "ru")) {
                right = 1;
            } else if (cmp_char(input, "rd")) {
                right = -1;
            }
            if (now != right && now != left) {
                now = right;
                count++;
            }
        }
        printf("%d\n",count);
        scanf("%d",&data);
    }
    return 0;
}

int cmp_char(char a[], char b[])
{
    int i;
    for (i = 0; i < 2; i++) {
        if (a[i] != b[i]) {
            return 0;
        }
    }
    return 1;
}```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int now, right, left, count;

int cmp_char(char a[], char b[]);

int main(void)
{
    char input[3];
    int data, i;

    scanf("%d",&data);
    while (data) {
        count = 0;
        now = -1;
        right = -1;
        left = -1;
        for (i = 0; i < data; i++) {
            scanf("%s",input);
            if (cmp_char(input, "lu")) {
                left = 1;
            } else if (cmp_char(input, "ld")) {
                left = -1;
            } else if (cmp_char(input, "ru")) {
                right = 1;
            } else if (cmp_char(input, "rd")) {
                right = -1;
            }
            if (now != right && now != left) {
                now = right;
                count++;
            }
        }
        printf("%d\n",count);
        scanf("%d",&data);
    }
    return 0;
}

int cmp_char(char a[], char b[])
{
    int i;
    for (i = 0; i < 2; i++) {
        if (a[i] != b[i]) {
            return 0;
        }
    }
    return 1;
}```

Assembly Code:

```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	testl	%eax, %eax
	jle	.L14
	xorl	%ebx, %ebx
	leaq	5(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	5(%rsp), %eax
	cmpb	$108, %al
	jne	.L4
	movzbl	6(%rsp), %eax
	movl	right(%rip), %edx
	cmpb	$117, %al
	jne	.L5
	movl	$1, left(%rip)
.L6:
	movl	now(%rip), %eax
	cmpl	%edx, %eax
	je	.L10
	cmpl	left(%rip), %eax
	je	.L10
	addl	$1, count(%rip)
	movl	%edx, now(%rip)
.L10:
	addl	$1, %ebx
	cmpl	%ebx, (%rsp)
	jg	.L11
	movl	count(%rip), %edx
.L3:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jne	.L2
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %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
.L5:
	.cfi_restore_state
	cmpb	$100, %al
	jne	.L6
	movl	$-1, left(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$114, %al
	jne	.L9
	movzbl	6(%rsp), %eax
	cmpb	$117, %al
	jne	.L8
	movl	$1, right(%rip)
	movl	$1, %edx
	jmp	.L6
.L8:
	cmpb	$100, %al
	jne	.L9
	movl	$-1, right(%rip)
	movl	$-1, %edx
	jmp	.L6
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movl	right(%rip), %edx
	jmp	.L6
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rsi), %eax
	cmpb	%al, (%rdi)
	jne	.L26
	movzbl	1(%rsi), %eax
	cmpb	%al, 1(%rdi)
	sete	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	cmp_char, .-cmp_char
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	now
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.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.
Optimized Assembly Code:

train
```assembly
	.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	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC2(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r14
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	je	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	testl	%eax, %eax
	jle	.L14
	xorl	%ebx, %ebx
	leaq	5(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	5(%rsp), %eax
	cmpb	$108, %al
	jne	.L4
	movzbl	6(%rsp), %eax
	movl	right(%rip), %edx
	cmpb	$117, %al
	jne	.L5
	movl	$1, left(%rip)
.L6:
	movl	now(%rip), %eax
	cmpl	%edx, %eax
	je	.L10
	cmpl	left(%rip), %eax
	je	.L10
	addl	$1, count(%rip)
	movl	%edx, now(%rip)
.L10:
	addl	$1, %ebx
	cmpl	%ebx, (%rsp)
	jg	.L11
	movl	count(%rip), %edx
.L3:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jne	.L2
.L12:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$24, %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
.L5:
	.cfi_restore_state
	cmpb	$100, %al
	jne	.L6
	movl	$-1, left(%rip)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$114, %al
	jne	.L9
	movzbl	6(%rsp), %eax
	cmpb	$117, %al
	jne	.L8
	movl	$1, right(%rip)
	movl	$1, %edx
	jmp	.L6
.L8:
	cmpb	$100, %al
	jne	.L9
	movl	$-1, right(%rip)
	movl	$-1, %edx
	jmp	.L6
.L14:
	xorl	%edx, %edx
	jmp	.L3
.L9:
	movl	right(%rip), %edx
	jmp	.L6
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rsi), %eax
	cmpb	%al, (%rdi)
	jne	.L26
	movzbl	1(%rsi), %eax
	cmpb	%al, 1(%rdi)
	sete	%al
	movzbl	%al, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	cmp_char, .-cmp_char
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	now
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.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:
```