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 <math.h>

int main(void) {
  int n, c = 0, ans = 300002, si[300002];
  char s[300002];

  if(scanf("%d", &n) == 1);
  if(scanf("%s", s) == 1);

  for(int i = 0; i < n; i++) {
    if(s[i] == 'W') {
      c++;
    }
    si[i] = c;
  }

  for(int i = 0; i < n; i++) {
    if(i == 0) {
      if(ans > n - si[n - 1]) {
        ans = n - si[n - 1];
        if(si[0] == 'W') {
          ans++;
        }
      }
    } else if(i == n - 1) {
      if(ans > si[i - 1]) {
        ans = si[i - 1];
      }
    } else {
      if (ans > si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]))) {
        ans = si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]));
      }
    }
  }

  printf("%d", ans);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-1499136(%rsp), %r11
	.cfi_def_cfa 11, 1499160
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$920, %rsp
	.cfi_def_cfa_offset 1500080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1500040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	1200032(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L15
	movslq	%r9d, %rsi
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%edi, %edi
	cmpb	$87, (%rbx,%rax)
	sete	%dil
	addl	%edi, %edx
	movl	%edx, (%rcx,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L4
	xorl	%eax, %eax
	leal	-1(%r9), %r10d
	cmpl	$87, 16(%rsp)
	movl	$300002, %edx
	movslq	%r10d, %rbx
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L7
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L9:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L22
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1500040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1500056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L24
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L5:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L11
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	leal	1(%rdi), %r8d
	cmpl	%edx, %edi
	cmovl	%r8d, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L8
.L24:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L12
.L15:
	movl	$300002, %edx
	jmp	.L2
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-1499136(%rsp), %r11
	.cfi_def_cfa 11, 1499160
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$920, %rsp
	.cfi_def_cfa_offset 1500080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1500040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	1200032(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L15
	movslq	%r9d, %rsi
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%edi, %edi
	cmpb	$87, (%rbx,%rax)
	sete	%dil
	addl	%edi, %edx
	movl	%edx, (%rcx,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L4
	xorl	%eax, %eax
	leal	-1(%r9), %r10d
	cmpl	$87, 16(%rsp)
	movl	$300002, %edx
	movslq	%r10d, %rbx
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L7
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L9:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L22
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1500040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1500056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L24
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L5:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L11
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	leal	1(%rdi), %r8d
	cmpl	%edx, %edi
	cmovl	%r8d, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L8
.L24:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L12
.L15:
	movl	$300002, %edx
	jmp	.L2
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-1499136(%rsp), %r11
	.cfi_def_cfa 11, 1499160
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$920, %rsp
	.cfi_def_cfa_offset 1500080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1500040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	1200032(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L15
	movslq	%r9d, %rsi
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%edi, %edi
	cmpb	$87, (%rbx,%rax)
	sete	%dil
	addl	%edi, %edx
	movl	%edx, (%rcx,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L4
	xorl	%eax, %eax
	leal	-1(%r9), %r10d
	cmpl	$87, 16(%rsp)
	movl	$300002, %edx
	movslq	%r10d, %rbx
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L7
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L9:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L22
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1500040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1500056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L24
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L5:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L11
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	leal	1(%rdi), %r8d
	cmpl	%edx, %edi
	cmovl	%r8d, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L8
.L24:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L12
.L15:
	movl	$300002, %edx
	jmp	.L2
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```
```c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void) {
  int n, c = 0, ans = 300002, si[300002];
  char s[300002];

  if(scanf("%d", &n) == 1);
  if(scanf("%s", s) == 1);

  for(int i = 0; i < n; i++) {
    if(s[i] == 'W') {
      c++;
    }
    si[i] = c;
  }

  for(int i = 0; i < n; i++) {
    if(i == 0) {
      if(ans > n - si[n - 1]) {
        ans = n - si[n - 1];
        if(si[0] == 'W') {
          ans++;
        }
      }
    } else if(i == n - 1) {
      if(ans > si[i - 1]) {
        ans = si[i - 1];
      }
    } else {
      if (ans > si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]))) {
        ans = si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]));
      }
    }
  }

  printf("%d", ans);

  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 <math.h>

int main(void) {
  int n, c = 0, ans = 300002, si[300002];
  char s[300002];

  if(scanf("%d", &n) == 1);
  if(scanf("%s", s) == 1);

  for(int i = 0; i < n; i++) {
    if(s[i] == 'W') {
      c++;
    }
    si[i] = c;
  }

  for(int i = 0; i < n; i++) {
    if(i == 0) {
      if(ans > n - si[n - 1]) {
        ans = n - si[n - 1];
        if(si[0] == 'W') {
          ans++;
        }
      }
    } else if(i == n - 1) {
      if(ans > si[i - 1]) {
        ans = si[i - 1];
      }
    } else {
      if (ans > si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]))) {
        ans = si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]));
      }
    }
  }

  printf("%d", ans);

  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:

5
WEEWW

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 <math.h>

int main(void) {
  int n, c = 0, ans = 300002, si[300002];
  char s[300002];

  if(scanf("%d", &n) == 1);
  if(scanf("%s", s) == 1);

  for(int i = 0; i < n; i++) {
    if(s[i] == 'W') {
      c++;
    }
    si[i] = c;
  }

  for(int i = 0; i < n; i++) {
    if(i == 0) {
      if(ans > n - si[n - 1]) {
        ans = n - si[n - 1];
        if(si[0] == 'W') {
          ans++;
        }
      }
    } else if(i == n - 1) {
      if(ans > si[i - 1]) {
        ans = si[i - 1];
      }
    } else {
      if (ans > si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]))) {
        ans = si[i - 1] + ((n - si[n - 1]) - (i + 1 - si[i]));
      }
    }
  }

  printf("%d", ans);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-1499136(%rsp), %r11
	.cfi_def_cfa 11, 1499160
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$920, %rsp
	.cfi_def_cfa_offset 1500080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1500040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	1200032(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L15
	movslq	%r9d, %rsi
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%edi, %edi
	cmpb	$87, (%rbx,%rax)
	sete	%dil
	addl	%edi, %edx
	movl	%edx, (%rcx,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L4
	xorl	%eax, %eax
	leal	-1(%r9), %r10d
	cmpl	$87, 16(%rsp)
	movl	$300002, %edx
	movslq	%r10d, %rbx
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L7
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L9:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L22
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1500040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1500056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L24
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L5:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L11
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	leal	1(%rdi), %r8d
	cmpl	%edx, %edi
	cmovl	%r8d, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L8
.L24:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L12
.L15:
	movl	$300002, %edx
	jmp	.L2
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-1499136(%rsp), %r11
	.cfi_def_cfa 11, 1499160
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$920, %rsp
	.cfi_def_cfa_offset 1500080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 1500040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	1200032(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L15
	movslq	%r9d, %rsi
	xorl	%eax, %eax
	leaq	16(%rsp), %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%edi, %edi
	cmpb	$87, (%rbx,%rax)
	sete	%dil
	addl	%edi, %edx
	movl	%edx, (%rcx,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L4
	xorl	%eax, %eax
	leal	-1(%r9), %r10d
	cmpl	$87, 16(%rsp)
	movl	$300002, %edx
	movslq	%r10d, %rbx
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L22:
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L7
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L8:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L9:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L22
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
	addq	$1, %rax
	cmpq	%rax, %rsi
	jne	.L9
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	1500040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$1500056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movl	-4(%rcx,%rax,4), %r11d
	cmpl	%eax, %r10d
	je	.L24
	subl	(%rcx,%rax,4), %r8d
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	subl	%r8d, %edi
	addl	%r11d, %edi
	cmpl	%edi, %edx
	cmovg	%edi, %edx
.L12:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L2
.L5:
	leal	1(%rax), %r8d
	testq	%rax, %rax
	jne	.L11
	movl	%r9d, %edi
	subl	16(%rsp,%rbx,4), %edi
	leal	1(%rdi), %r8d
	cmpl	%edx, %edi
	cmovl	%r8d, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L8
.L24:
	cmpl	%r11d, %edx
	cmovg	%r11d, %edx
	jmp	.L12
.L15:
	movl	$300002, %edx
	jmp	.L2
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:
```