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

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3472, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -200064(%rbp)
	movb	$45, -200065(%rbp)
	leaq	-200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200048(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200060(%rbp)
	movq	$0, -200056(%rbp)
	jmp	.L2
.L4:
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -200065(%rbp)
	je	.L3
	movl	-200064(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -200064(%rbp)
	leaq	-200048(%rbp), %rcx
	movq	-200056(%rbp), %rdx
	addq	%rcx, %rdx
	movzbl	(%rdx), %edx
	cltq
	movb	%dl, -100032(%rbp,%rax)
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, -200065(%rbp)
.L3:
	addq	$1, -200056(%rbp)
.L2:
	movl	-200060(%rbp), %eax
	cltq
	cmpq	%rax, -200056(%rbp)
	jl	.L4
	movl	-200064(%rbp), %eax
	cltq
	movb	$0, -100032(%rbp,%rax)
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$1, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%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
	.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:

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

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3472, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -200064(%rbp)
	movb	$45, -200065(%rbp)
	leaq	-200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200048(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200060(%rbp)
	movq	$0, -200056(%rbp)
	jmp	.L2
.L4:
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -200065(%rbp)
	je	.L3
	movl	-200064(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -200064(%rbp)
	leaq	-200048(%rbp), %rcx
	movq	-200056(%rbp), %rdx
	addq	%rcx, %rdx
	movzbl	(%rdx), %edx
	cltq
	movb	%dl, -100032(%rbp,%rax)
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, -200065(%rbp)
.L3:
	addq	$1, -200056(%rbp)
.L2:
	movl	-200060(%rbp), %eax
	cltq
	cmpq	%rax, -200056(%rbp)
	jl	.L4
	movl	-200064(%rbp), %eax
	cltq
	movb	$0, -100032(%rbp,%rax)
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$1, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-196608(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3472, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -200064(%rbp)
	movb	$45, -200065(%rbp)
	leaq	-200048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200048(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -200060(%rbp)
	movq	$0, -200056(%rbp)
	jmp	.L2
.L4:
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -200065(%rbp)
	je	.L3
	movl	-200064(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -200064(%rbp)
	leaq	-200048(%rbp), %rcx
	movq	-200056(%rbp), %rdx
	addq	%rcx, %rdx
	movzbl	(%rdx), %edx
	cltq
	movb	%dl, -100032(%rbp,%rax)
	leaq	-200048(%rbp), %rdx
	movq	-200056(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, -200065(%rbp)
.L3:
	addq	$1, -200056(%rbp)
.L2:
	movl	-200060(%rbp), %eax
	cltq
	cmpq	%rax, -200056(%rbp)
	jl	.L4
	movl	-200064(%rbp), %eax
	cltq
	movb	$0, -100032(%rbp,%rax)
	leaq	-100032(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subq	$1, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
