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>

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    int a[n+2];
    a[0] = 1; a[n+1] = -1;
    /*for(int i=1; i<=n; i++){
        char c;
        scanf("%c", &c);
        if(c == 'L'){
            a[i] = -1;
        }else{
            a[i] = 1;
        }
    }*/
    char str[n+1];
    scanf("%s", str);
    for(int i=0; i<n; i++){
        if(str[i] == 'L'){
            a[i+1] = -1;
        }else{
            a[i+1] = 1;
        }
    }
    int x = a[1];
    for(int i=2; i<=n; i++){
        if(a[i] != x){
            k--;
            for(i; i<=n; i++){
                if(a[i] == x){
                    i--;
                    break;
                }
                a[i] *= -1;
            }
        }
        if(k == 0){
            break;
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++){
        if(a[i] == a[i + a[i]]){
            ans++;
        }
    }
    printf("%d", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-112(%rbp), %rdx
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$2, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movq	-80(%rbp), %rax
	movl	$1, (%rax)
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -108(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rdx
	movl	-108(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$76, %al
	jne	.L9
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	jmp	.L10
.L9:
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
.L10:
	addl	$1, -108(%rbp)
.L8:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-80(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -92(%rbp)
	movl	$2, -104(%rbp)
	jmp	.L12
.L19:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	je	.L13
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L14
.L16:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	jne	.L15
	subl	$1, -104(%rbp)
	jmp	.L13
.L15:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	negl	%eax
	movl	%eax, %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L16
.L13:
	movl	-112(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L19
	jmp	.L18
.L25:
	nop
.L18:
	movl	$0, -100(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L20
.L22:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-96(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L21
	addl	$1, -100(%rbp)
.L21:
	addl	$1, -96(%rbp)
.L20:
	movl	-116(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L22
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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	"%d%d"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rsi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	movq	%rsp, %rsi
	leal	2(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L3
.L74:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L74
.L3:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L75
.L4:
	leaq	3(%rsp), %rbx
	addl	$1, %eax
	movq	%rsp, %rcx
	movq	%rbx, %r13
	cltq
	andq	$-4, %rbx
	shrq	$2, %r13
	movl	$1, 0(,%r13,4)
	movl	$-1, (%rbx,%rax,4)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L75:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L76
.L7:
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %r12
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %esi
	testl	%esi, %esi
	jle	.L40
	leal	-1(%rsi), %eax
	cmpl	$14, %eax
	jbe	.L41
	movl	%esi, %ecx
	leaq	4(%rbx), %rax
	pxor	%xmm5, %xmm5
	movq	%rsp, %rdx
	shrl	$4, %ecx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm3, %xmm3
	salq	$4, %rcx
	addq	%rsp, %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rdx), %xmm0
	movdqa	%xmm5, %xmm2
	addq	$16, %rdx
	addq	$64, %rax
	pcmpeqb	%xmm7, %xmm0
	por	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm3, %xmm2
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm1, %xmm4
	punpckhwd	%xmm2, %xmm1
	punpcklwd	%xmm2, %xmm4
	movdqa	%xmm0, %xmm2
	movups	%xmm1, -48(%rax)
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	movups	%xmm4, -64(%rax)
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movups	%xmm2, -32(%rax)
	movups	%xmm0, -16(%rax)
	cmpq	%rcx, %rdx
	jne	.L10
	movl	%esi, %eax
	andl	$-16, %eax
	testb	$15, %sil
	je	.L11
.L9:
	movslq	%eax, %rdx
	xorl	%edi, %edi
	leal	1(%rax), %ecx
	cmpb	$76, (%r12,%rdx)
	leaq	(%rbx,%rdx,4), %rdx
	setne	%dil
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 4(%rdx)
	cmpl	%esi, %ecx
	jge	.L13
	movslq	%ecx, %rcx
	leal	2(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 8(%rdx)
	cmpl	%esi, %edi
	jge	.L11
	movslq	%edi, %rdi
	leal	3(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 12(%rdx)
	cmpl	%esi, %ecx
	jge	.L11
	movslq	%ecx, %rcx
	leal	4(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 16(%rdx)
	cmpl	%esi, %edi
	jge	.L11
	movslq	%edi, %rdi
	leal	5(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 20(%rdx)
	cmpl	%esi, %ecx
	jge	.L11
	movslq	%ecx, %rcx
	leal	6(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 24(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	7(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 28(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	8(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 32(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	9(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 36(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	10(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 40(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	11(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 44(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	12(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 48(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	13(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 52(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	addl	$14, %eax
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 56(%rdx)
	cmpl	%eax, %esi
	jle	.L11
	cltq
	cmpb	$76, (%r12,%rax)
	setne	%al
	movzbl	%al, %eax
	leal	-1(%rax,%rax), %eax
	movl	%eax, 60(%rdx)
.L11:
	movl	4(,%r13,4), %edi
.L38:
	movl	-44(%rbp), %r9d
	xorl	%r8d, %r8d
	movl	$2, %edx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L28:
	testl	%r9d, %r9d
	je	.L77
.L31:
	addl	$1, %edx
	cmpl	%esi, %edx
	jg	.L78
.L34:
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	cmpl	%edi, %eax
	je	.L28
	subl	$1, %r9d
	leaq	(%rbx,%rcx,4), %rcx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L30:
	movl	4(%rcx), %eax
	addq	$4, %rcx
	cmpl	%edi, %eax
	je	.L57
.L29:
	negl	%eax
	movl	%edx, %r8d
	addl	$1, %edx
	movl	%eax, (%rcx)
	cmpl	%esi, %edx
	jle	.L30
	movl	$1, %r8d
.L80:
	testl	%r9d, %r9d
	jne	.L31
.L77:
	testb	%r8b, %r8b
	je	.L33
	movl	$0, -44(%rbp)
.L33:
	movl	$1, %eax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rax,4), %ecx
	leal	(%rcx,%rax), %edx
	movslq	%edx, %rdx
	cmpl	%ecx, (%rbx,%rdx,4)
	jne	.L36
	addl	$1, %r8d
.L36:
	addq	$1, %rax
	cmpl	%eax, %esi
	jge	.L37
.L8:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L79
	leaq	-24(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L57:
	.cfi_restore_state
	movl	%r8d, %edx
	movl	$1, %r8d
	jmp	.L80
.L78:
	testb	%r8b, %r8b
	je	.L33
	movl	%r9d, -44(%rbp)
	jmp	.L33
.L13:
	movl	4(,%r13,4), %edi
	cmpl	$1, %esi
	jne	.L38
	jmp	.L33
.L40:
	xorl	%r8d, %r8d
	jmp	.L8
.L41:
	xorl	%eax, %eax
	jmp	.L9
.L76:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L79:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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	"%d%d"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r13
	pushq	%r12
	leaq	-44(%rbp), %rdx
	leaq	-48(%rbp), %rsi
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 13, -24
	.cfi_offset 12, -32
	.cfi_offset 3, -40
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	movq	%rsp, %rsi
	leal	2(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L3
.L74:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L74
.L3:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L75
.L4:
	leaq	3(%rsp), %rbx
	addl	$1, %eax
	movq	%rsp, %rcx
	movq	%rbx, %r13
	cltq
	andq	$-4, %rbx
	shrq	$2, %r13
	movl	$1, 0(,%r13,4)
	movl	$-1, (%rbx,%rax,4)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L75:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L76
.L7:
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %r12
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %esi
	testl	%esi, %esi
	jle	.L40
	leal	-1(%rsi), %eax
	cmpl	$14, %eax
	jbe	.L41
	movl	%esi, %ecx
	leaq	4(%rbx), %rax
	pxor	%xmm5, %xmm5
	movq	%rsp, %rdx
	shrl	$4, %ecx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm3, %xmm3
	salq	$4, %rcx
	addq	%rsp, %rcx
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rdx), %xmm0
	movdqa	%xmm5, %xmm2
	addq	$16, %rdx
	addq	$64, %rax
	pcmpeqb	%xmm7, %xmm0
	por	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm3, %xmm2
	pcmpgtw	%xmm1, %xmm2
	movdqa	%xmm1, %xmm4
	punpckhwd	%xmm2, %xmm1
	punpcklwd	%xmm2, %xmm4
	movdqa	%xmm0, %xmm2
	movups	%xmm1, -48(%rax)
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	movups	%xmm4, -64(%rax)
	punpcklwd	%xmm1, %xmm2
	punpckhwd	%xmm1, %xmm0
	movups	%xmm2, -32(%rax)
	movups	%xmm0, -16(%rax)
	cmpq	%rcx, %rdx
	jne	.L10
	movl	%esi, %eax
	andl	$-16, %eax
	testb	$15, %sil
	je	.L11
.L9:
	movslq	%eax, %rdx
	xorl	%edi, %edi
	leal	1(%rax), %ecx
	cmpb	$76, (%r12,%rdx)
	leaq	(%rbx,%rdx,4), %rdx
	setne	%dil
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 4(%rdx)
	cmpl	%esi, %ecx
	jge	.L13
	movslq	%ecx, %rcx
	leal	2(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 8(%rdx)
	cmpl	%esi, %edi
	jge	.L11
	movslq	%edi, %rdi
	leal	3(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 12(%rdx)
	cmpl	%esi, %ecx
	jge	.L11
	movslq	%ecx, %rcx
	leal	4(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 16(%rdx)
	cmpl	%esi, %edi
	jge	.L11
	movslq	%edi, %rdi
	leal	5(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 20(%rdx)
	cmpl	%esi, %ecx
	jge	.L11
	movslq	%ecx, %rcx
	leal	6(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 24(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	7(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 28(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	8(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 32(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	9(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 36(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	10(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 40(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	11(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 44(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	leal	12(%rax), %edi
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 48(%rdx)
	cmpl	%edi, %esi
	jle	.L11
	movslq	%edi, %rdi
	leal	13(%rax), %ecx
	cmpb	$76, (%r12,%rdi)
	setne	%dil
	movzbl	%dil, %edi
	leal	-1(%rdi,%rdi), %edi
	movl	%edi, 52(%rdx)
	cmpl	%ecx, %esi
	jle	.L11
	movslq	%ecx, %rcx
	addl	$14, %eax
	cmpb	$76, (%r12,%rcx)
	setne	%cl
	movzbl	%cl, %ecx
	leal	-1(%rcx,%rcx), %ecx
	movl	%ecx, 56(%rdx)
	cmpl	%eax, %esi
	jle	.L11
	cltq
	cmpb	$76, (%r12,%rax)
	setne	%al
	movzbl	%al, %eax
	leal	-1(%rax,%rax), %eax
	movl	%eax, 60(%rdx)
.L11:
	movl	4(,%r13,4), %edi
.L38:
	movl	-44(%rbp), %r9d
	xorl	%r8d, %r8d
	movl	$2, %edx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L28:
	testl	%r9d, %r9d
	je	.L77
.L31:
	addl	$1, %edx
	cmpl	%esi, %edx
	jg	.L78
.L34:
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	cmpl	%edi, %eax
	je	.L28
	subl	$1, %r9d
	leaq	(%rbx,%rcx,4), %rcx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L30:
	movl	4(%rcx), %eax
	addq	$4, %rcx
	cmpl	%edi, %eax
	je	.L57
.L29:
	negl	%eax
	movl	%edx, %r8d
	addl	$1, %edx
	movl	%eax, (%rcx)
	cmpl	%esi, %edx
	jle	.L30
	movl	$1, %r8d
.L80:
	testl	%r9d, %r9d
	jne	.L31
.L77:
	testb	%r8b, %r8b
	je	.L33
	movl	$0, -44(%rbp)
.L33:
	movl	$1, %eax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rax,4), %ecx
	leal	(%rcx,%rax), %edx
	movslq	%edx, %rdx
	cmpl	%ecx, (%rbx,%rdx,4)
	jne	.L36
	addl	$1, %r8d
.L36:
	addq	$1, %rax
	cmpl	%eax, %esi
	jge	.L37
.L8:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L79
	leaq	-24(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L57:
	.cfi_restore_state
	movl	%r8d, %edx
	movl	$1, %r8d
	jmp	.L80
.L78:
	testb	%r8b, %r8b
	je	.L33
	movl	%r9d, -44(%rbp)
	jmp	.L33
.L13:
	movl	4(,%r13,4), %edi
	cmpl	$1, %esi
	jne	.L38
	jmp	.L33
.L40:
	xorl	%r8d, %r8d
	jmp	.L8
.L41:
	xorl	%eax, %eax
	jmp	.L9
.L76:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L79:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.byte	76
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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>

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    int a[n+2];
    a[0] = 1; a[n+1] = -1;
    /*for(int i=1; i<=n; i++){
        char c;
        scanf("%c", &c);
        if(c == 'L'){
            a[i] = -1;
        }else{
            a[i] = 1;
        }
    }*/
    char str[n+1];
    scanf("%s", str);
    for(int i=0; i<n; i++){
        if(str[i] == 'L'){
            a[i+1] = -1;
        }else{
            a[i+1] = 1;
        }
    }
    int x = a[1];
    for(int i=2; i<=n; i++){
        if(a[i] != x){
            k--;
            for(i; i<=n; i++){
                if(a[i] == x){
                    i--;
                    break;
                }
                a[i] *= -1;
            }
        }
        if(k == 0){
            break;
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++){
        if(a[i] == a[i + a[i]]){
            ans++;
        }
    }
    printf("%d", ans);

    return 0;
}
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 5 7 6 4 9 11 12
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>

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    int a[n+2];
    a[0] = 1; a[n+1] = -1;
    /*for(int i=1; i<=n; i++){
        char c;
        scanf("%c", &c);
        if(c == 'L'){
            a[i] = -1;
        }else{
            a[i] = 1;
        }
    }*/
    char str[n+1];
    scanf("%s", str);
    for(int i=0; i<n; i++){
        if(str[i] == 'L'){
            a[i+1] = -1;
        }else{
            a[i+1] = 1;
        }
    }
    int x = a[1];
    for(int i=2; i<=n; i++){
        if(a[i] != x){
            k--;
            for(i; i<=n; i++){
                if(a[i] == x){
                    i--;
                    break;
                }
                a[i] *= -1;
            }
        }
        if(k == 0){
            break;
        }
    }
    int ans = 0;
    for(int i=1; i<=n; i++){
        if(a[i] == a[i + a[i]]){
            ans++;
        }
    }
    printf("%d", ans);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-112(%rbp), %rdx
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$2, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movq	-80(%rbp), %rax
	movl	$1, (%rax)
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -108(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rdx
	movl	-108(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$76, %al
	jne	.L9
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	jmp	.L10
.L9:
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
.L10:
	addl	$1, -108(%rbp)
.L8:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-80(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -92(%rbp)
	movl	$2, -104(%rbp)
	jmp	.L12
.L19:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	je	.L13
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L14
.L16:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	jne	.L15
	subl	$1, -104(%rbp)
	jmp	.L13
.L15:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	negl	%eax
	movl	%eax, %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L16
.L13:
	movl	-112(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L19
	jmp	.L18
.L25:
	nop
.L18:
	movl	$0, -100(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L20
.L22:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-96(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L21
	addl	$1, -100(%rbp)
.L21:
	addl	$1, -96(%rbp)
.L20:
	movl	-116(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L22
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-112(%rbp), %rdx
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$2, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movq	-80(%rbp), %rax
	movl	$1, (%rax)
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -108(%rbp)
	jmp	.L8
.L11:
	movq	-64(%rbp), %rdx
	movl	-108(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$76, %al
	jne	.L9
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$-1, (%rax,%rdx,4)
	jmp	.L10
.L9:
	movl	-108(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
.L10:
	addl	$1, -108(%rbp)
.L8:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L11
	movq	-80(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -92(%rbp)
	movl	$2, -104(%rbp)
	jmp	.L12
.L19:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	je	.L13
	movl	-112(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -112(%rbp)
	jmp	.L14
.L16:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -92(%rbp)
	jne	.L15
	subl	$1, -104(%rbp)
	jmp	.L13
.L15:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	negl	%eax
	movl	%eax, %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L14:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L16
.L13:
	movl	-112(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	addl	$1, -104(%rbp)
.L12:
	movl	-116(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jle	.L19
	jmp	.L18
.L25:
	nop
.L18:
	movl	$0, -100(%rbp)
	movl	$1, -96(%rbp)
	jmp	.L20
.L22:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-96(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L21
	addl	$1, -100(%rbp)
.L21:
	addl	$1, -96(%rbp)
.L20:
	movl	-116(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L22
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
