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>

char str[100000];
char before;

int main() {
  int i;
  int cnt = 0;

  scanf("%s", str);
  before = str[0];
  
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] != before) cnt++;
    before = str[i];
  }

  printf("%d\n", cnt);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	str
	.bss
	.align 32
	.type	str, @object
	.size	str, 100000
str:
	.zero	100000
	.globl	before
	.type	before, @object
	.size	before, 1
before:
	.zero	1
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.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	$16, %rsp
	movl	$0, -4(%rbp)
	leaq	str(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	str(%rip), %eax
	movb	%al, before(%rip)
	movl	$0, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movzbl	before(%rip), %eax
	cmpb	%al, %dl
	je	.L3
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, before(%rip)
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L4
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	leaq	str(%rip), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	str(%rip), %esi
	movb	%sil, before(%rip)
	testb	%sil, %sil
	je	.L6
	movzbl	1+str(%rip), %eax
	testb	%al, %al
	je	.L7
	leaq	2+str(%rip), %rdx
	xorl	%r8d, %r8d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%ecx, %eax
.L5:
	xorl	%ecx, %ecx
	cmpb	%al, %sil
	movl	%eax, %esi
	setne	%cl
	addq	$1, %rdx
	addl	%ecx, %r8d
	movzbl	-1(%rdx), %ecx
	testb	%cl, %cl
	jne	.L8
.L3:
	movb	%al, before(%rip)
.L2:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L2
.L7:
	movl	%esi, %eax
	xorl	%r8d, %r8d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	before
	.bss
	.type	before, @object
	.size	before, 1
before:
	.zero	1
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 100000
str:
	.zero	100000
	.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	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	leaq	str(%rip), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	str(%rip), %esi
	movb	%sil, before(%rip)
	testb	%sil, %sil
	je	.L6
	movzbl	1+str(%rip), %eax
	testb	%al, %al
	je	.L7
	leaq	2+str(%rip), %rdx
	xorl	%r8d, %r8d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%ecx, %eax
.L5:
	xorl	%ecx, %ecx
	cmpb	%al, %sil
	movl	%eax, %esi
	setne	%cl
	addq	$1, %rdx
	addl	%ecx, %r8d
	movzbl	-1(%rdx), %ecx
	testb	%cl, %cl
	jne	.L8
.L3:
	movb	%al, before(%rip)
.L2:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L2
.L7:
	movl	%esi, %eax
	xorl	%r8d, %r8d
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	before
	.bss
	.type	before, @object
	.size	before, 1
before:
	.zero	1
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 100000
str:
	.zero	100000
	.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>

char str[100000];
char before;

int main() {
  int i;
  int cnt = 0;

  scanf("%s", str);
  before = str[0];
  
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] != before) cnt++;
    before = str[i];
  }

  printf("%d\n", cnt);
  return 0;
}

BBBWW

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>

char str[100000];
char before;

int main() {
  int i;
  int cnt = 0;

  scanf("%s", str);
  before = str[0];
  
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] != before) cnt++;
    before = str[i];
  }

  printf("%d\n", cnt);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	str
	.bss
	.align 32
	.type	str, @object
	.size	str, 100000
str:
	.zero	100000
	.globl	before
	.type	before, @object
	.size	before, 1
before:
	.zero	1
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.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	$16, %rsp
	movl	$0, -4(%rbp)
	leaq	str(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	str(%rip), %eax
	movb	%al, before(%rip)
	movl	$0, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movzbl	before(%rip), %eax
	cmpb	%al, %dl
	je	.L3
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, before(%rip)
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L4
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	str
	.bss
	.align 32
	.type	str, @object
	.size	str, 100000
str:
	.zero	100000
	.globl	before
	.type	before, @object
	.size	before, 1
before:
	.zero	1
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.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	$16, %rsp
	movl	$0, -4(%rbp)
	leaq	str(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	str(%rip), %eax
	movb	%al, before(%rip)
	movl	$0, -8(%rbp)
	jmp	.L2
.L4:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movzbl	before(%rip), %eax
	cmpb	%al, %dl
	je	.L3
	addl	$1, -4(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movb	%al, before(%rip)
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cltq
	leaq	str(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L4
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
