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>
#define MAXLEN 100000
void run();
int check(int data[], int len);

int main(int argc, char const *argv[]) {
  run();
  return 0;
}

void run(){
  char *input = (char*)malloc(sizeof(char) * MAXLEN);
  scanf("%s", input);
  int data[MAXLEN];
  int len = strlen(input);
  for(int i = 0; i < len; i++){
    if(input[i] == 'B') data[i] = 0;
    if(input[i] == 'W') data[i] = 1;
  }
  int count = 0;
  for(int i = 0; i < len - 1; i++){
    if(data[i] != data[i+1]) count++;
  }
  printf("%d\n", count);
}

int check(int data[], int len){
  int ini = data[0];
  for(int i = 1; i < len; i++){
    if(data[i] != ini){
      return 1;
    }
  }
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movq	%rsi, -16(%rbp)
	movl	$0, %eax
	call	run
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2736, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$100000, %edi
	call	malloc@PLT
	movq	%rax, -400024(%rbp)
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -400028(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L4
.L7:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L5
	movl	-400040(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
.L5:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L6
	movl	-400040(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
.L6:
	addl	$1, -400040(%rbp)
.L4:
	movl	-400040(%rbp), %eax
	cmpl	-400028(%rbp), %eax
	jl	.L7
	movl	$0, -400036(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L8
.L10:
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400032(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L9
	addl	$1, -400036(%rbp)
.L9:
	addl	$1, -400032(%rbp)
.L8:
	movl	-400028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L10
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	check
	.type	check, @function
check:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L13
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
	movl	$1, %eax
	jmp	.L15
.L14:
	addl	$1, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L16
	movl	$0, %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	check, .-check
	.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	"%d\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2704, %rsp
	.cfi_def_cfa_offset 400032
	movl	$100000, %edi
	movq	%fs:40, %rax
	movq	%rax, 400008(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rsi
	movq	%rax, %rbx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	movq	%rbx, %rdx
	movq	%rsp, %rcx
	movq	%rsi, %r8
	leaq	1(%rbx,%rsi), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$87, %sil
	jne	.L4
	movl	$1, (%rcx)
.L4:
	addq	$1, %rdx
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	je	.L2
.L5:
	movzbl	(%rdx), %esi
	cmpb	$66, %sil
	jne	.L3
	addq	$1, %rdx
	movl	$0, (%rcx)
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	jne	.L5
.L2:
	testl	%r8d, %r8d
	jle	.L16
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%r8d, %edx
	pxor	%xmm1, %xmm1
	movq	%rsp, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	movdqu	4(%rax), %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L8
	movdqa	%xmm1, %xmm0
	movl	%r8d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L6
.L7:
	leal	1(%rax), %ecx
	movslq	%eax, %rdi
	movslq	%ecx, %rsi
	movl	(%rsp,%rsi,4), %esi
	cmpl	%esi, (%rsp,%rdi,4)
	je	.L10
	addl	$1, %edx
.L10:
	cmpl	%ecx, %r8d
	jle	.L6
	leal	2(%rax), %ecx
	movslq	%ecx, %rdi
	movl	(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	setne	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
	cmpl	%ecx, %r8d
	jle	.L6
	addl	$3, %eax
	cltq
	cmpl	%edi, (%rsp,%rax,4)
	je	.L6
	addl	$1, %edx
.L6:
	movq	400008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$400016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L6
.L17:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB53:
	.cfi_startproc
	endbr64
	movl	(%rdi), %edx
	cmpl	$1, %esi
	jle	.L30
	leal	-2(%rsi), %ecx
	leaq	4(%rdi), %rax
	leaq	8(%rdi,%rcx,4), %rcx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L30
.L29:
	cmpl	%edx, (%rax)
	je	.L33
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L30:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	check, .-check
	.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	"%d\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397328
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2704, %rsp
	.cfi_def_cfa_offset 400032
	movl	$100000, %edi
	movq	%fs:40, %rax
	movq	%rax, 400008(%rsp)
	xorl	%eax, %eax
	call	malloc@PLT
	leaq	.LC0(%rip), %rdi
	movq	%rax, %rsi
	movq	%rax, %rbx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leal	-1(%rax), %r8d
	testl	%eax, %eax
	jle	.L2
	leal	-1(%rax), %esi
	movq	%rbx, %rdx
	movq	%rsp, %rcx
	movq	%rsi, %r8
	leaq	1(%rbx,%rsi), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$87, %sil
	jne	.L4
	movl	$1, (%rcx)
.L4:
	addq	$1, %rdx
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	je	.L2
.L5:
	movzbl	(%rdx), %esi
	cmpb	$66, %sil
	jne	.L3
	addq	$1, %rdx
	movl	$0, (%rcx)
	addq	$4, %rcx
	cmpq	%rdi, %rdx
	jne	.L5
.L2:
	testl	%r8d, %r8d
	jle	.L16
	subl	$2, %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%r8d, %edx
	pxor	%xmm1, %xmm1
	movq	%rsp, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	movdqu	4(%rax), %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L8
	movdqa	%xmm1, %xmm0
	movl	%r8d, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r8b
	je	.L6
.L7:
	leal	1(%rax), %ecx
	movslq	%eax, %rdi
	movslq	%ecx, %rsi
	movl	(%rsp,%rsi,4), %esi
	cmpl	%esi, (%rsp,%rdi,4)
	je	.L10
	addl	$1, %edx
.L10:
	cmpl	%ecx, %r8d
	jle	.L6
	leal	2(%rax), %ecx
	movslq	%ecx, %rdi
	movl	(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	setne	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
	cmpl	%ecx, %r8d
	jle	.L6
	addl	$3, %eax
	cltq
	cmpl	%edi, (%rsp,%rax,4)
	je	.L6
	addl	$1, %edx
.L6:
	movq	400008(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$400016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 8
	jmp	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L6
.L17:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.text
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB53:
	.cfi_startproc
	endbr64
	movl	(%rdi), %edx
	cmpl	$1, %esi
	jle	.L30
	leal	-2(%rsi), %ecx
	leaq	4(%rdi), %rax
	leaq	8(%rdi,%rcx,4), %rcx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L30
.L29:
	cmpl	%edx, (%rax)
	je	.L33
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L30:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	check, .-check
	.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>
#define MAXLEN 100000
void run();
int check(int data[], int len);

int main(int argc, char const *argv[]) {
  run();
  return 0;
}

void run(){
  char *input = (char*)malloc(sizeof(char) * MAXLEN);
  scanf("%s", input);
  int data[MAXLEN];
  int len = strlen(input);
  for(int i = 0; i < len; i++){
    if(input[i] == 'B') data[i] = 0;
    if(input[i] == 'W') data[i] = 1;
  }
  int count = 0;
  for(int i = 0; i < len - 1; i++){
    if(data[i] != data[i+1]) count++;
  }
  printf("%d\n", count);
}

int check(int data[], int len){
  int ini = data[0];
  for(int i = 1; i < len; i++){
    if(data[i] != ini){
      return 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>
#define MAXLEN 100000
void run();
int check(int data[], int len);

int main(int argc, char const *argv[]) {
  run();
  return 0;
}

void run(){
  char *input = (char*)malloc(sizeof(char) * MAXLEN);
  scanf("%s", input);
  int data[MAXLEN];
  int len = strlen(input);
  for(int i = 0; i < len; i++){
    if(input[i] == 'B') data[i] = 0;
    if(input[i] == 'W') data[i] = 1;
  }
  int count = 0;
  for(int i = 0; i < len - 1; i++){
    if(data[i] != data[i+1]) count++;
  }
  printf("%d\n", count);
}

int check(int data[], int len){
  int ini = data[0];
  for(int i = 1; i < len; i++){
    if(data[i] != ini){
      return 1;
    }
  }
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movq	%rsi, -16(%rbp)
	movl	$0, %eax
	call	run
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2736, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$100000, %edi
	call	malloc@PLT
	movq	%rax, -400024(%rbp)
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -400028(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L4
.L7:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L5
	movl	-400040(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
.L5:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L6
	movl	-400040(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
.L6:
	addl	$1, -400040(%rbp)
.L4:
	movl	-400040(%rbp), %eax
	cmpl	-400028(%rbp), %eax
	jl	.L7
	movl	$0, -400036(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L8
.L10:
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400032(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L9
	addl	$1, -400036(%rbp)
.L9:
	addl	$1, -400032(%rbp)
.L8:
	movl	-400028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L10
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	check
	.type	check, @function
check:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L13
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
	movl	$1, %eax
	jmp	.L15
.L14:
	addl	$1, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L16
	movl	$0, %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	check, .-check
	.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
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movq	%rsi, -16(%rbp)
	movl	$0, %eax
	call	run
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2736, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$100000, %edi
	call	malloc@PLT
	movq	%rax, -400024(%rbp)
	movq	-400024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400024(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -400028(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L4
.L7:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L5
	movl	-400040(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
.L5:
	movl	-400040(%rbp), %eax
	movslq	%eax, %rdx
	movq	-400024(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L6
	movl	-400040(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
.L6:
	addl	$1, -400040(%rbp)
.L4:
	movl	-400040(%rbp), %eax
	cmpl	-400028(%rbp), %eax
	jl	.L7
	movl	$0, -400036(%rbp)
	movl	$0, -400032(%rbp)
	jmp	.L8
.L10:
	movl	-400032(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400032(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L9
	addl	$1, -400036(%rbp)
.L9:
	addl	$1, -400032(%rbp)
.L8:
	movl	-400028(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -400032(%rbp)
	jl	.L10
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	run, .-run
	.globl	check
	.type	check, @function
check:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L13
.L16:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L14
	movl	$1, %eax
	jmp	.L15
.L14:
	addl	$1, -8(%rbp)
.L13:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L16
	movl	$0, %eax
.L15:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	check, .-check
	.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:
