Given the following C code and 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;
}
```

Assembly Code:

```assembly
	.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:
```

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	"%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
```assembly
	.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:
```
```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;
}
```
Given the following C 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;
}
```

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:

BBBWW

1

Given the following C code and 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;
}
```

Assembly Code:

```assembly
	.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:
```

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	"%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:
```