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(void) {

  long n,k;
	scanf("%ld %ld", &n, &k);
  char s[n+1];
  scanf("%s", s);
  char head = s[0];
  long count_other = 0;
  for (long i = 1; i < n; i++) {
    if (s[i-1] == head && s[i] != head) {
      count_other++;
    }
  }
  long happy;
  if (s[n-1] == head) {
    happy = n-1-(count_other)*2;
  } else {
    happy = n-(count_other)*2;
  }
  if (count_other <= k) {
    happy = n-1;
  } else {
    happy += k*2;
  }
  printf("%ld\n", happy);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"%ld\n"
	.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	$88, %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	-104(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movq	%rax, %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	$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
	movq	-64(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -113(%rbp)
	movq	$0, -96(%rbp)
	movq	$1, -88(%rbp)
	jmp	.L5
.L7:
	movq	-88(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L6
	movq	-64(%rbp), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -113(%rbp)
	je	.L6
	addq	$1, -96(%rbp)
.L6:
	addq	$1, -88(%rbp)
.L5:
	movq	-112(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jl	.L7
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L8
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-96(%rbp), %rax
	leaq	(%rax,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -80(%rbp)
	jmp	.L9
.L8:
	movq	-112(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	%rdx, %rdx
	subq	%rdx, %rax
	movq	%rax, -80(%rbp)
.L9:
	movq	-104(%rbp), %rax
	cmpq	%rax, -96(%rbp)
	jg	.L10
	movq	-112(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	jmp	.L11
.L10:
	movq	-104(%rbp), %rax
	addq	%rax, %rax
	addq	%rax, -80(%rbp)
.L11:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"%ld\n"
	.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	%rbx
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rsi
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rax
	movq	%rsp, %rcx
	addq	$16, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L19:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L19
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L20
.L4:
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %rbx
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %r8
	movzbl	(%rsp), %edx
	cmpq	$1, %r8
	jle	.L12
	leaq	-1(%r8), %r9
	movq	%rsp, %rax
	xorl	%esi, %esi
	leaq	(%rsp,%r9), %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	%dl, (%rax)
	jne	.L6
	xorl	%edi, %edi
	cmpb	%dl, 1(%rax)
	setne	%dil
	addq	%rdi, %rsi
.L6:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L7
.L5:
	leaq	(%rsi,%rsi), %rax
	movq	%r8, %rcx
	subq	%rax, %rcx
	cmpb	%dl, -1(%rbx,%r8)
	jne	.L9
	movq	%r9, %rcx
	subq	%rax, %rcx
.L9:
	movq	-32(%rbp), %rax
	movl	$1, %edi
	cmpq	%rsi, %rax
	leaq	(%rcx,%rax,2), %rdx
	leaq	.LC2(%rip), %rsi
	cmovge	%r9, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L21
	movq	-8(%rbp), %rbx
	xorl	%eax, %eax
	leave
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L20:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L12:
	xorl	%esi, %esi
	leaq	-1(%r8), %r9
	jmp	.L5
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"%ld\n"
	.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	%rbx
	leaq	-32(%rbp), %rdx
	leaq	-40(%rbp), %rsi
	subq	$40, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %rax
	movq	%rsp, %rcx
	addq	$16, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L19:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L19
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L20
.L4:
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, %rbx
	call	__isoc99_scanf@PLT
	movq	-40(%rbp), %r8
	movzbl	(%rsp), %edx
	cmpq	$1, %r8
	jle	.L12
	leaq	-1(%r8), %r9
	movq	%rsp, %rax
	xorl	%esi, %esi
	leaq	(%rsp,%r9), %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	%dl, (%rax)
	jne	.L6
	xorl	%edi, %edi
	cmpb	%dl, 1(%rax)
	setne	%dil
	addq	%rdi, %rsi
.L6:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L7
.L5:
	leaq	(%rsi,%rsi), %rax
	movq	%r8, %rcx
	subq	%rax, %rcx
	cmpb	%dl, -1(%rbx,%r8)
	jne	.L9
	movq	%r9, %rcx
	subq	%rax, %rcx
.L9:
	movq	-32(%rbp), %rax
	movl	$1, %edi
	cmpq	%rsi, %rax
	leaq	(%rcx,%rax,2), %rdx
	leaq	.LC2(%rip), %rsi
	cmovge	%r9, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-24(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L21
	movq	-8(%rbp), %rbx
	xorl	%eax, %eax
	leave
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L20:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L12:
	xorl	%esi, %esi
	leaq	-1(%r8), %r9
	jmp	.L5
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void) {

  long n,k;
	scanf("%ld %ld", &n, &k);
  char s[n+1];
  scanf("%s", s);
  char head = s[0];
  long count_other = 0;
  for (long i = 1; i < n; i++) {
    if (s[i-1] == head && s[i] != head) {
      count_other++;
    }
  }
  long happy;
  if (s[n-1] == head) {
    happy = n-1-(count_other)*2;
  } else {
    happy = n-(count_other)*2;
  }
  if (count_other <= k) {
    happy = n-1;
  } else {
    happy += k*2;
  }
  printf("%ld\n", happy);

  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
 1
 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(void) {

  long n,k;
	scanf("%ld %ld", &n, &k);
  char s[n+1];
  scanf("%s", s);
  char head = s[0];
  long count_other = 0;
  for (long i = 1; i < n; i++) {
    if (s[i-1] == head && s[i] != head) {
      count_other++;
    }
  }
  long happy;
  if (s[n-1] == head) {
    happy = n-1-(count_other)*2;
  } else {
    happy = n-(count_other)*2;
  }
  if (count_other <= k) {
    happy = n-1;
  } else {
    happy += k*2;
  }
  printf("%ld\n", happy);

  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"%ld\n"
	.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	$88, %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	-104(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movq	%rax, %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	$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
	movq	-64(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -113(%rbp)
	movq	$0, -96(%rbp)
	movq	$1, -88(%rbp)
	jmp	.L5
.L7:
	movq	-88(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L6
	movq	-64(%rbp), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -113(%rbp)
	je	.L6
	addq	$1, -96(%rbp)
.L6:
	addq	$1, -88(%rbp)
.L5:
	movq	-112(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jl	.L7
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L8
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-96(%rbp), %rax
	leaq	(%rax,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -80(%rbp)
	jmp	.L9
.L8:
	movq	-112(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	%rdx, %rdx
	subq	%rdx, %rax
	movq	%rax, -80(%rbp)
.L9:
	movq	-104(%rbp), %rax
	cmpq	%rax, -96(%rbp)
	jg	.L10
	movq	-112(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	jmp	.L11
.L10:
	movq	-104(%rbp), %rax
	addq	%rax, %rax
	addq	%rax, -80(%rbp)
.L11:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"%ld\n"
	.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	$88, %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	-104(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-112(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	movq	%rax, %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	$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
	movq	-64(%rbp), %rax
	movzbl	(%rax), %eax
	movb	%al, -113(%rbp)
	movq	$0, -96(%rbp)
	movq	$1, -88(%rbp)
	jmp	.L5
.L7:
	movq	-88(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L6
	movq	-64(%rbp), %rdx
	movq	-88(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, -113(%rbp)
	je	.L6
	addq	$1, -96(%rbp)
.L6:
	addq	$1, -88(%rbp)
.L5:
	movq	-112(%rbp), %rax
	cmpq	%rax, -88(%rbp)
	jl	.L7
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-64(%rbp), %rax
	movzbl	(%rax,%rdx), %eax
	cmpb	%al, -113(%rbp)
	jne	.L8
	movq	-112(%rbp), %rax
	leaq	-1(%rax), %rdx
	movq	-96(%rbp), %rax
	leaq	(%rax,%rax), %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	movq	%rax, -80(%rbp)
	jmp	.L9
.L8:
	movq	-112(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	%rdx, %rdx
	subq	%rdx, %rax
	movq	%rax, -80(%rbp)
.L9:
	movq	-104(%rbp), %rax
	cmpq	%rax, -96(%rbp)
	jg	.L10
	movq	-112(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	jmp	.L11
.L10:
	movq	-104(%rbp), %rax
	addq	%rax, %rax
	addq	%rax, -80(%rbp)
.L11:
	movq	-80(%rbp), %rax
	movq	%rax, %rsi
	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	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
