Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
int n,k,i,c,p,r;
int main() {
  scanf("%d%d\n", &n, &k); k = -2 * k;
  while(i++ < n)if((c = getchar_unlocked()) != p)k++, p=c;
  printf("%d",n - (k < 1 ? 1 : k));
}
  ```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	k(%rip), %eax
	negl	%eax
	addl	%eax, %eax
	movl	%eax, k(%rip)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	cmpl	p(%rip), %eax
	movl	%eax, c(%rip)
	jne	.L8
.L3:
	movl	i(%rip), %eax
	movl	n(%rip), %esi
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	k(%rip), %eax
	movl	$1, %edx
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	call	printf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	$1, k(%rip)
	movl	%eax, p(%rip)
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:
```

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	"%d%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	k(%rip), %eax
	negl	%eax
	addl	%eax, %eax
	movl	%eax, k(%rip)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	cmpl	p(%rip), %eax
	movl	%eax, c(%rip)
	jne	.L8
.L3:
	movl	i(%rip), %eax
	movl	n(%rip), %esi
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	k(%rip), %eax
	movl	$1, %edx
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	call	printf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	$1, k(%rip)
	movl	%eax, p(%rip)
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	k(%rip), %eax
	negl	%eax
	addl	%eax, %eax
	movl	%eax, k(%rip)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	cmpl	p(%rip), %eax
	movl	%eax, c(%rip)
	jne	.L8
.L3:
	movl	i(%rip), %eax
	movl	n(%rip), %esi
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	k(%rip), %eax
	movl	$1, %edx
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	call	printf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	$1, k(%rip)
	movl	%eax, p(%rip)
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:
```
```c
int n,k,i,c,p,r;
int main() {
  scanf("%d%d\n", &n, &k); k = -2 * k;
  while(i++ < n)if((c = getchar_unlocked()) != p)k++, p=c;
  printf("%d",n - (k < 1 ? 1 : k));
}
  ```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
int n,k,i,c,p,r;
int main() {
  scanf("%d%d\n", &n, &k); k = -2 * k;
  while(i++ < n)if((c = getchar_unlocked()) != p)k++, p=c;
  printf("%d",n - (k < 1 ? 1 : k));
}
  ```

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:

6 2
LRLRRL
 9 3
RRRLRLRLL
 9 0
RRRLRLRLL
 6 0
LRRLRL
 9 1
RRRRLLRLL
 9 1
RLRRLLLRR
 6 1
RRLLRL
 10 2
LLLLLRRRRR
 13 4
LRRLRLRRLRLLR
 13 8
LRRLRLRRLRLLR

5 8 3 1 7 6 4 9 11 12
Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
int n,k,i,c,p,r;
int main() {
  scanf("%d%d\n", &n, &k); k = -2 * k;
  while(i++ < n)if((c = getchar_unlocked()) != p)k++, p=c;
  printf("%d",n - (k < 1 ? 1 : k));
}
  ```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	k(%rip), %eax
	negl	%eax
	addl	%eax, %eax
	movl	%eax, k(%rip)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	cmpl	p(%rip), %eax
	movl	%eax, c(%rip)
	jne	.L8
.L3:
	movl	i(%rip), %eax
	movl	n(%rip), %esi
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	k(%rip), %eax
	movl	$1, %edx
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	call	printf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	$1, k(%rip)
	movl	%eax, p(%rip)
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:
```

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	"%d%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	leaq	k(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	k(%rip), %eax
	negl	%eax
	addl	%eax, %eax
	movl	%eax, k(%rip)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	call	getchar_unlocked@PLT
	cmpl	p(%rip), %eax
	movl	%eax, c(%rip)
	jne	.L8
.L3:
	movl	i(%rip), %eax
	movl	n(%rip), %esi
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	k(%rip), %eax
	movl	$1, %edx
	leaq	.LC1(%rip), %rdi
	testl	%eax, %eax
	cmovle	%edx, %eax
	subl	%eax, %esi
	xorl	%eax, %eax
	call	printf@PLT
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	$1, k(%rip)
	movl	%eax, p(%rip)
	jmp	.L3
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	r
	.bss
	.align 4
	.type	r, @object
	.size	r, 4
r:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:
```