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>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)

#define INF 100000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	long i, j;
	char S[100010];
	char a[100010];
	int idx = 0;
	int len;
	char pre = '-';
	
	ss(S);
	len = strlen(S);
	for(i=0;i<len;i++) {
		if(pre != S[i]) {
			a[idx++] = S[i];
			pre = S[i];
		}
	}
	a[idx] = '\0';
	
	pl(strlen(a)-1);
	
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3440, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200040(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rbx, %rdx
	addq	%rbx, %rax
	movl	$45, %ecx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %edi
	movzbl	(%rdx), %ecx
	cmpb	%dil, %cl
	je	.L3
	movslq	%esi, %rdi
	addl	$1, %esi
	movb	%cl, 100016(%rsp,%rdi)
.L3:
	addq	$1, %rdx
	cmpq	%rax, %rdx
	jne	.L4
.L2:
	movslq	%esi, %rsi
	leaq	100016(%rsp), %rdi
	movb	$0, 100016(%rsp,%rsi)
	call	strlen@PLT
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leaq	-1(%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	200040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$200048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3440, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200040(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rbx, %rdx
	addq	%rbx, %rax
	movl	$45, %ecx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %edi
	movzbl	(%rdx), %ecx
	cmpb	%dil, %cl
	je	.L3
	movslq	%esi, %rdi
	addl	$1, %esi
	movb	%cl, 100016(%rsp,%rdi)
.L3:
	addq	$1, %rdx
	cmpq	%rax, %rdx
	jne	.L4
.L2:
	movslq	%esi, %rsi
	leaq	100016(%rsp), %rdi
	movb	$0, 100016(%rsp,%rsi)
	call	strlen@PLT
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leaq	-1(%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	200040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$200048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3440, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200040(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rbx, %rdx
	addq	%rbx, %rax
	movl	$45, %ecx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %edi
	movzbl	(%rdx), %ecx
	cmpb	%dil, %cl
	je	.L3
	movslq	%esi, %rdi
	addl	$1, %esi
	movb	%cl, 100016(%rsp,%rdi)
.L3:
	addq	$1, %rdx
	cmpq	%rax, %rdx
	jne	.L4
.L2:
	movslq	%esi, %rsi
	leaq	100016(%rsp), %rdi
	movb	$0, 100016(%rsp,%rsi)
	call	strlen@PLT
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leaq	-1(%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	200040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$200048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
```
```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)

#define INF 100000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	long i, j;
	char S[100010];
	char a[100010];
	int idx = 0;
	int len;
	char pre = '-';
	
	ss(S);
	len = strlen(S);
	for(i=0;i<len;i++) {
		if(pre != S[i]) {
			a[idx++] = S[i];
			pre = S[i];
		}
	}
	a[idx] = '\0';
	
	pl(strlen(a)-1);
	
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)

#define INF 100000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	long i, j;
	char S[100010];
	char a[100010];
	int idx = 0;
	int len;
	char pre = '-';
	
	ss(S);
	len = strlen(S);
	for(i=0;i<len;i++) {
		if(pre != S[i]) {
			a[idx++] = S[i];
			pre = S[i];
		}
	}
	a[idx] = '\0';
	
	pl(strlen(a)-1);
	
	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>
#include<stdlib.h>
#include<string.h>
#include<math.h>

#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)

#define INF 100000000000
#define M 1000000007

#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	long i, j;
	char S[100010];
	char a[100010];
	int idx = 0;
	int len;
	char pre = '-';
	
	ss(S);
	len = strlen(S);
	for(i=0;i<len;i++) {
		if(pre != S[i]) {
			a[idx++] = S[i];
			pre = S[i];
		}
	}
	a[idx] = '\0';
	
	pl(strlen(a)-1);
	
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3440, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200040(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rbx, %rdx
	addq	%rbx, %rax
	movl	$45, %ecx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %edi
	movzbl	(%rdx), %ecx
	cmpb	%dil, %cl
	je	.L3
	movslq	%esi, %rdi
	addl	$1, %esi
	movb	%cl, 100016(%rsp,%rdi)
.L3:
	addq	$1, %rdx
	cmpq	%rax, %rdx
	jne	.L4
.L2:
	movslq	%esi, %rsi
	leaq	100016(%rsp), %rdi
	movb	$0, 100016(%rsp,%rsi)
	call	strlen@PLT
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leaq	-1(%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	200040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$200048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196624
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3440, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 200040(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	testq	%rax, %rax
	je	.L6
	movq	%rbx, %rdx
	addq	%rbx, %rax
	movl	$45, %ecx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%ecx, %edi
	movzbl	(%rdx), %ecx
	cmpb	%dil, %cl
	je	.L3
	movslq	%esi, %rdi
	addl	$1, %esi
	movb	%cl, 100016(%rsp,%rdi)
.L3:
	addq	$1, %rdx
	cmpq	%rax, %rdx
	jne	.L4
.L2:
	movslq	%esi, %rsi
	leaq	100016(%rsp), %rdi
	movb	$0, 100016(%rsp,%rsi)
	call	strlen@PLT
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	leaq	-1(%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	200040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L10
	addq	$200048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L2
.L10:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
```