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 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;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	now
	.bss
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"lu"
.LC3:
	.string	"ld"
.LC4:
	.string	"ru"
.LC5:
	.string	"rd"
.LC6:
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L10:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	movl	$0, -16(%rbp)
	jmp	.L3
.L9:
	leaq	-11(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-11(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L4
	movl	$1, left(%rip)
	jmp	.L5
.L4:
	leaq	-11(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L6
	movl	$-1, left(%rip)
	jmp	.L5
.L6:
	leaq	-11(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L7
	movl	$1, right(%rip)
	jmp	.L5
.L7:
	leaq	-11(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L5
	movl	$-1, right(%rip)
.L5:
	movl	now(%rip), %edx
	movl	right(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	now(%rip), %edx
	movl	left(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	right(%rip), %eax
	movl	%eax, now(%rip)
	movl	count(%rip), %eax
	addl	$1, %eax
	movl	%eax, count(%rip)
.L8:
	addl	$1, -16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	movl	count(%rip), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L15
	movl	$0, %eax
	jmp	.L16
.L15:
	addl	$1, -4(%rbp)
.L14:
	cmpl	$1, -4(%rbp)
	jle	.L17
	movl	$1, %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cmp_char, .-cmp_char
	.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	%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
	.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:

#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;
}
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 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;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	now
	.bss
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"lu"
.LC3:
	.string	"ld"
.LC4:
	.string	"ru"
.LC5:
	.string	"rd"
.LC6:
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L10:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	movl	$0, -16(%rbp)
	jmp	.L3
.L9:
	leaq	-11(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-11(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L4
	movl	$1, left(%rip)
	jmp	.L5
.L4:
	leaq	-11(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L6
	movl	$-1, left(%rip)
	jmp	.L5
.L6:
	leaq	-11(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L7
	movl	$1, right(%rip)
	jmp	.L5
.L7:
	leaq	-11(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L5
	movl	$-1, right(%rip)
.L5:
	movl	now(%rip), %edx
	movl	right(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	now(%rip), %edx
	movl	left(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	right(%rip), %eax
	movl	%eax, now(%rip)
	movl	count(%rip), %eax
	addl	$1, %eax
	movl	%eax, count(%rip)
.L8:
	addl	$1, -16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	movl	count(%rip), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L15
	movl	$0, %eax
	jmp	.L16
.L15:
	addl	$1, -4(%rbp)
.L14:
	cmpl	$1, -4(%rbp)
	jle	.L17
	movl	$1, %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cmp_char, .-cmp_char
	.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
	.globl	now
	.bss
	.align 4
	.type	now, @object
	.size	now, 4
now:
	.zero	4
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	count
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"lu"
.LC3:
	.string	"ld"
.LC4:
	.string	"ru"
.LC5:
	.string	"rd"
.LC6:
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L10:
	movl	$0, count(%rip)
	movl	$-1, now(%rip)
	movl	$-1, right(%rip)
	movl	$-1, left(%rip)
	movl	$0, -16(%rbp)
	jmp	.L3
.L9:
	leaq	-11(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-11(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L4
	movl	$1, left(%rip)
	jmp	.L5
.L4:
	leaq	-11(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L6
	movl	$-1, left(%rip)
	jmp	.L5
.L6:
	leaq	-11(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L7
	movl	$1, right(%rip)
	jmp	.L5
.L7:
	leaq	-11(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	cmp_char
	testl	%eax, %eax
	je	.L5
	movl	$-1, right(%rip)
.L5:
	movl	now(%rip), %edx
	movl	right(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	now(%rip), %edx
	movl	left(%rip), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	right(%rip), %eax
	movl	%eax, now(%rip)
	movl	count(%rip), %eax
	addl	$1, %eax
	movl	%eax, count(%rip)
.L8:
	addl	$1, -16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	movl	count(%rip), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	cmp_char
	.type	cmp_char, @function
cmp_char:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	je	.L15
	movl	$0, %eax
	jmp	.L16
.L15:
	addl	$1, -4(%rbp)
.L14:
	cmpl	$1, -4(%rbp)
	jle	.L17
	movl	$1, %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cmp_char, .-cmp_char
	.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:
