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>

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

Assembly Code:

```assembly
	.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:
```

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	"%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
```assembly
	.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:
```
```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;
}
```
Given the following C 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;
}
```

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:

BBBWW

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>

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

Assembly Code:

```assembly
	.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:
```

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	"%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:
```