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,M,S[50][3]={0};
	int i,j;
	char H[51][51];
	
	scanf("%d%d",&N,&M);
	for(i=0;i<N;i++) scanf("%s",H[i]);
	
	for(i=0;i<N;i++){
		for(j=0;j<M;j++){
			if(H[i][j]!='W'&&i<N-2) S[i][0]++;
			if(H[i][j]!='B'&&i>0&&i<N-1) S[i][1]++;
			if(H[i][j]!='R'&&i>1) S[i][2]++;
		}
		if(i<N-1){
			S[i+1][0]=S[i][0];
			S[i+1][1]=S[i][1];
			S[i+1][2]=S[i][2];
		}
	}
	
	int min=2500;
	for(i=0;i<N-2;i++){
		for(j=i+1;j<N-1;j++){
			if(min>S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2]){
				min=S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2];
			}
		}
	}
	
	printf("%d\n",min);
	
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\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
	subq	$3264, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3232(%rbp), %rdx
	movl	$0, %eax
	movl	$75, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-3248(%rbp), %rdx
	leaq	-3252(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3244(%rbp)
	jmp	.L2
.L3:
	leaq	-2624(%rbp), %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3244(%rbp)
.L2:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L3
	movl	$0, -3244(%rbp)
	jmp	.L4
.L11:
	movl	$0, -3240(%rbp)
	jmp	.L5
.L9:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	je	.L6
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L6
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%ecx, (%rax)
.L6:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	je	.L7
	cmpl	$0, -3244(%rbp)
	jle	.L7
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L7
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%ecx, (%rax)
.L7:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	je	.L8
	cmpl	$1, -3244(%rbp)
	jle	.L8
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%ecx, (%rax)
.L8:
	addl	$1, -3240(%rbp)
.L5:
	movl	-3248(%rbp), %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L9
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L10
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%edx, (%rax)
.L10:
	addl	$1, -3244(%rbp)
.L4:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L11
	movl	$2500, -3236(%rbp)
	movl	$0, -3244(%rbp)
	jmp	.L12
.L16:
	movl	-3244(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -3240(%rbp)
	jmp	.L13
.L15:
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	cmpl	%eax, -3236(%rbp)
	jle	.L14
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -3236(%rbp)
.L14:
	addl	$1, -3240(%rbp)
.L13:
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L15
	addl	$1, -3244(%rbp)
.L12:
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L16
	movl	-3236(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.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"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$75, %ecx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$3256, %rsp
	.cfi_def_cfa_offset 3312
	movq	%fs:40, %rax
	movq	%rax, 3240(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	leaq	12(%rsp), %rdx
	movq	%rbx, %rdi
	leaq	8(%rsp), %rsi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L150
	leaq	624(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	movq	%r12, %r13
	movq	%r12, %r15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r11d
	addq	$51, %r15
	cmpl	%ebp, %r11d
	jg	.L3
	testl	%r11d, %r11d
	jle	.L150
	movl	%r11d, %r9d
	movl	12(%rsp), %r8d
	subl	$1, %r9d
	jne	.L4
	xorl	%edx, %edx
	leal	-2(%r11), %ebp
.L5:
	movslq	%edx, %rax
	leaq	(%rax,%rax,2), %rcx
	movq	%rcx, %rsi
	leaq	(%rbx,%rcx,4), %rax
	salq	$4, %rsi
	addq	%rsi, %rcx
	movslq	%r8d, %rsi
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L88:
	testl	%r8d, %r8d
	jle	.L44
	cmpl	$1, %edx
	jle	.L146
	xorl	%edi, %edi
	cmpl	%edx, %ebp
	jle	.L47
	cmpl	%edx, %r9d
	jg	.L58
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L49:
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L51
	cmpb	$82, %r10b
	jne	.L51
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	je	.L44
.L52:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	jne	.L49
.L51:
	addq	$1, %rdi
	addl	$1, 8(%rax)
	cmpq	%rdi, %rsi
	jne	.L52
	.p2align 4,,10
	.p2align 3
.L44:
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %rcx
	cmpl	%edx, %r11d
	jg	.L88
.L2:
	testl	%ebp, %ebp
	jle	.L97
	subl	$1, %r11d
	movq	%rbx, %rdi
	xorl	%r12d, %r12d
	movl	$2500, %r8d
	movslq	%r11d, %rax
	xorl	%ebx, %ebx
	leaq	28(%rsp), %r13
	leaq	(%rax,%rax,2), %rax
	leaq	3248(%rsp,%rax,4), %r14
	.p2align 4,,10
	.p2align 3
.L95:
	addl	$1, %ebx
	cmpl	%r11d, %ebx
	jge	.L93
	movl	%ebp, %eax
	movl	(%rdi), %r10d
	movl	4(%rdi), %r9d
	movq	%rdi, %rdx
	subl	%ebx, %eax
	movl	-3224(%r14), %esi
	addq	%r12, %rax
	leaq	(%rax,%rax,2), %rax
	leaq	0(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L94:
	movl	16(%rdx), %eax
	addl	%r10d, %eax
	subl	%r9d, %eax
	addl	%esi, %eax
	subl	20(%rdx), %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addq	$12, %rdx
	cmpq	%rcx, %rdx
	jne	.L94
.L93:
	addq	$1, %r12
	addq	$12, %rdi
	cmpl	%ebx, %ebp
	jne	.L95
.L92:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	3240(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L152
	addq	$3256, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L55:
	.cfi_restore_state
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L60
	addl	$1, 4(%rax)
	cmpb	$82, %r10b
	jne	.L60
.L57:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	je	.L44
.L58:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	jne	.L55
	addl	$1, 4(%rax)
.L60:
	addl	$1, 8(%rax)
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L146:
	cmpl	%edx, %r9d
	jle	.L69
	testl	%edx, %edx
	je	.L70
	xorl	%edi, %edi
	cmpl	$1, %ebp
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L76:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	je	.L75
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L77
.L75:
	addl	$1, 4(%rax)
.L77:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	jne	.L76
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L73:
	cmpb	$66, (%rcx,%rdi)
	je	.L72
	addl	$1, 4(%rax)
.L72:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L73
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%edx, %r9d
	jg	.L68
	.p2align 4,,10
	.p2align 3
.L64:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$66, %r10b
	je	.L62
	cmpb	$82, %r10b
	je	.L63
.L62:
	addl	$1, 8(%rax)
.L63:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	jne	.L64
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %rcx
	cmpl	%edx, %r11d
	jg	.L88
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L65:
	addl	$1, 4(%rax)
	cmpb	$82, %r10b
	je	.L66
.L67:
	addl	$1, 8(%rax)
.L66:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	je	.L44
.L68:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$66, %r10b
	je	.L67
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L69:
	cmpl	%edx, %ebp
	jle	.L44
	xorl	%edi, %edi
	testl	%edx, %edx
	je	.L83
	.p2align 4,,10
	.p2align 3
.L86:
	cmpb	$87, (%rcx,%rdi)
	je	.L87
	addl	$1, (%rax)
.L87:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L86
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L83:
	cmpb	$87, (%rcx,%rdi)
	je	.L84
	addl	$1, (%rax)
.L84:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L83
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rax
	xorl	%edx, %edx
	leal	-2(%r11), %ebp
	movslq	%r8d, %rcx
	.p2align 4,,10
	.p2align 3
.L42:
	testl	%r8d, %r8d
	jle	.L91
	cmpl	$1, %edx
	jle	.L153
	xorl	%esi, %esi
	cmpl	%edx, %ebp
	jg	.L22
	cmpl	%edx, %r9d
	jg	.L30
	.p2align 4,,10
	.p2align 3
.L26:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$66, %dil
	je	.L24
	cmpb	$82, %dil
	je	.L25
.L24:
	addl	$1, 8(%rax)
.L25:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L26
	.p2align 4,,10
	.p2align 3
.L91:
	movq	(%rax), %rsi
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %r13
	movq	%rsi, (%rax)
	movl	-4(%rax), %esi
	movl	%esi, 8(%rax)
	cmpl	%edx, %r9d
	jg	.L42
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4(%rax)
	cmpb	$82, %dil
	je	.L28
.L29:
	addl	$1, 8(%rax)
.L28:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L30:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$66, %dil
	je	.L29
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L153:
	cmpl	%edx, %r9d
	jg	.L7
	cmpl	$1, %ebp
	jle	.L8
	movslq	%r8d, %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$87, 0(%r13,%rdx)
	je	.L9
	addl	$1, (%rax)
.L9:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	jne	.L10
.L8:
	movq	(%rax), %rdx
	movq	%rdx, 12(%rax)
	movl	8(%rax), %edx
	movl	%edx, 20(%rax)
	movl	$2, %edx
.L43:
	cmpl	%edx, %r11d
	jg	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%edx, %r9d
	jg	.L41
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L34
	cmpb	$82, %dil
	jne	.L34
.L33:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L35:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	jne	.L32
.L34:
	addl	$1, 8(%rax)
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L36:
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L38
	addl	$1, 4(%rax)
	cmpb	$82, %dil
	jne	.L38
.L39:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L41:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	jne	.L36
	addl	$1, 4(%rax)
.L38:
	addl	$1, 8(%rax)
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	je	.L154
	xorl	%esi, %esi
	cmpl	$1, %ebp
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L20:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	je	.L19
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L21
.L19:
	addl	$1, 4(%rax)
.L21:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L20
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$66, 0(%r13,%rsi)
	je	.L16
	addl	$1, 4(%rax)
.L16:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L17
	jmp	.L91
.L70:
	testl	%ebp, %ebp
	jle	.L44
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L79:
	cmpb	$87, (%rcx,%rdi)
	je	.L80
	addl	$1, (%rax)
.L80:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L79
	jmp	.L44
.L154:
	testl	%ebp, %ebp
	jle	.L91
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	cmpb	$87, 0(%r13,%rsi)
	je	.L13
	addl	$1, (%rax)
.L13:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L14
	jmp	.L91
.L97:
	movl	$2500, %r8d
	jmp	.L92
.L150:
	leal	-2(%r11), %ebp
	jmp	.L2
.L152:
	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	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$75, %ecx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$3256, %rsp
	.cfi_def_cfa_offset 3312
	movq	%fs:40, %rax
	movq	%rax, 3240(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	leaq	12(%rsp), %rdx
	movq	%rbx, %rdi
	leaq	8(%rsp), %rsi
	rep stosq
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L150
	leaq	624(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	movq	%r12, %r13
	movq	%r12, %r15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r11d
	addq	$51, %r15
	cmpl	%ebp, %r11d
	jg	.L3
	testl	%r11d, %r11d
	jle	.L150
	movl	%r11d, %r9d
	movl	12(%rsp), %r8d
	subl	$1, %r9d
	jne	.L4
	xorl	%edx, %edx
	leal	-2(%r11), %ebp
.L5:
	movslq	%edx, %rax
	leaq	(%rax,%rax,2), %rcx
	movq	%rcx, %rsi
	leaq	(%rbx,%rcx,4), %rax
	salq	$4, %rsi
	addq	%rsi, %rcx
	movslq	%r8d, %rsi
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L88:
	testl	%r8d, %r8d
	jle	.L44
	cmpl	$1, %edx
	jle	.L146
	xorl	%edi, %edi
	cmpl	%edx, %ebp
	jle	.L47
	cmpl	%edx, %r9d
	jg	.L58
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L49:
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L51
	cmpb	$82, %r10b
	jne	.L51
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	je	.L44
.L52:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	jne	.L49
.L51:
	addq	$1, %rdi
	addl	$1, 8(%rax)
	cmpq	%rdi, %rsi
	jne	.L52
	.p2align 4,,10
	.p2align 3
.L44:
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %rcx
	cmpl	%edx, %r11d
	jg	.L88
.L2:
	testl	%ebp, %ebp
	jle	.L97
	subl	$1, %r11d
	movq	%rbx, %rdi
	xorl	%r12d, %r12d
	movl	$2500, %r8d
	movslq	%r11d, %rax
	xorl	%ebx, %ebx
	leaq	28(%rsp), %r13
	leaq	(%rax,%rax,2), %rax
	leaq	3248(%rsp,%rax,4), %r14
	.p2align 4,,10
	.p2align 3
.L95:
	addl	$1, %ebx
	cmpl	%r11d, %ebx
	jge	.L93
	movl	%ebp, %eax
	movl	(%rdi), %r10d
	movl	4(%rdi), %r9d
	movq	%rdi, %rdx
	subl	%ebx, %eax
	movl	-3224(%r14), %esi
	addq	%r12, %rax
	leaq	(%rax,%rax,2), %rax
	leaq	0(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L94:
	movl	16(%rdx), %eax
	addl	%r10d, %eax
	subl	%r9d, %eax
	addl	%esi, %eax
	subl	20(%rdx), %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addq	$12, %rdx
	cmpq	%rcx, %rdx
	jne	.L94
.L93:
	addq	$1, %r12
	addq	$12, %rdi
	cmpl	%ebx, %ebp
	jne	.L95
.L92:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	3240(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L152
	addq	$3256, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L55:
	.cfi_restore_state
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L60
	addl	$1, 4(%rax)
	cmpb	$82, %r10b
	jne	.L60
.L57:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	je	.L44
.L58:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	jne	.L55
	addl	$1, 4(%rax)
.L60:
	addl	$1, 8(%rax)
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L146:
	cmpl	%edx, %r9d
	jle	.L69
	testl	%edx, %edx
	je	.L70
	xorl	%edi, %edi
	cmpl	$1, %ebp
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L76:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$87, %r10b
	je	.L75
	addl	$1, (%rax)
	cmpb	$66, %r10b
	je	.L77
.L75:
	addl	$1, 4(%rax)
.L77:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	jne	.L76
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L73:
	cmpb	$66, (%rcx,%rdi)
	je	.L72
	addl	$1, 4(%rax)
.L72:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L73
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%edx, %r9d
	jg	.L68
	.p2align 4,,10
	.p2align 3
.L64:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$66, %r10b
	je	.L62
	cmpb	$82, %r10b
	je	.L63
.L62:
	addl	$1, 8(%rax)
.L63:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	jne	.L64
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %rcx
	cmpl	%edx, %r11d
	jg	.L88
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L65:
	addl	$1, 4(%rax)
	cmpb	$82, %r10b
	je	.L66
.L67:
	addl	$1, 8(%rax)
.L66:
	addq	$1, %rdi
	cmpq	%rsi, %rdi
	je	.L44
.L68:
	movzbl	(%rcx,%rdi), %r10d
	cmpb	$66, %r10b
	je	.L67
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L69:
	cmpl	%edx, %ebp
	jle	.L44
	xorl	%edi, %edi
	testl	%edx, %edx
	je	.L83
	.p2align 4,,10
	.p2align 3
.L86:
	cmpb	$87, (%rcx,%rdi)
	je	.L87
	addl	$1, (%rax)
.L87:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L86
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L83:
	cmpb	$87, (%rcx,%rdi)
	je	.L84
	addl	$1, (%rax)
.L84:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L83
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rax
	xorl	%edx, %edx
	leal	-2(%r11), %ebp
	movslq	%r8d, %rcx
	.p2align 4,,10
	.p2align 3
.L42:
	testl	%r8d, %r8d
	jle	.L91
	cmpl	$1, %edx
	jle	.L153
	xorl	%esi, %esi
	cmpl	%edx, %ebp
	jg	.L22
	cmpl	%edx, %r9d
	jg	.L30
	.p2align 4,,10
	.p2align 3
.L26:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$66, %dil
	je	.L24
	cmpb	$82, %dil
	je	.L25
.L24:
	addl	$1, 8(%rax)
.L25:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L26
	.p2align 4,,10
	.p2align 3
.L91:
	movq	(%rax), %rsi
	addl	$1, %edx
	addq	$12, %rax
	addq	$51, %r13
	movq	%rsi, (%rax)
	movl	-4(%rax), %esi
	movl	%esi, 8(%rax)
	cmpl	%edx, %r9d
	jg	.L42
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4(%rax)
	cmpb	$82, %dil
	je	.L28
.L29:
	addl	$1, 8(%rax)
.L28:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L30:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$66, %dil
	je	.L29
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L153:
	cmpl	%edx, %r9d
	jg	.L7
	cmpl	$1, %ebp
	jle	.L8
	movslq	%r8d, %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$87, 0(%r13,%rdx)
	je	.L9
	addl	$1, (%rax)
.L9:
	addq	$1, %rdx
	cmpq	%rcx, %rdx
	jne	.L10
.L8:
	movq	(%rax), %rdx
	movq	%rdx, 12(%rax)
	movl	8(%rax), %edx
	movl	%edx, 20(%rax)
	movl	$2, %edx
.L43:
	cmpl	%edx, %r11d
	jg	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%edx, %r9d
	jg	.L41
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L34
	cmpb	$82, %dil
	jne	.L34
.L33:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L35:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	jne	.L32
.L34:
	addl	$1, 8(%rax)
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L36:
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L38
	addl	$1, 4(%rax)
	cmpb	$82, %dil
	jne	.L38
.L39:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	je	.L91
.L41:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	jne	.L36
	addl	$1, 4(%rax)
.L38:
	addl	$1, 8(%rax)
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	je	.L154
	xorl	%esi, %esi
	cmpl	$1, %ebp
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L20:
	movzbl	0(%r13,%rsi), %edi
	cmpb	$87, %dil
	je	.L19
	addl	$1, (%rax)
	cmpb	$66, %dil
	je	.L21
.L19:
	addl	$1, 4(%rax)
.L21:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L20
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$66, 0(%r13,%rsi)
	je	.L16
	addl	$1, 4(%rax)
.L16:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L17
	jmp	.L91
.L70:
	testl	%ebp, %ebp
	jle	.L44
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L79:
	cmpb	$87, (%rcx,%rdi)
	je	.L80
	addl	$1, (%rax)
.L80:
	addq	$1, %rdi
	cmpq	%rdi, %rsi
	jne	.L79
	jmp	.L44
.L154:
	testl	%ebp, %ebp
	jle	.L91
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L14:
	cmpb	$87, 0(%r13,%rsi)
	je	.L13
	addl	$1, (%rax)
.L13:
	addq	$1, %rsi
	cmpq	%rcx, %rsi
	jne	.L14
	jmp	.L91
.L97:
	movl	$2500, %r8d
	jmp	.L92
.L150:
	leal	-2(%r11), %ebp
	jmp	.L2
.L152:
	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(){
	
	int N,M,S[50][3]={0};
	int i,j;
	char H[51][51];
	
	scanf("%d%d",&N,&M);
	for(i=0;i<N;i++) scanf("%s",H[i]);
	
	for(i=0;i<N;i++){
		for(j=0;j<M;j++){
			if(H[i][j]!='W'&&i<N-2) S[i][0]++;
			if(H[i][j]!='B'&&i>0&&i<N-1) S[i][1]++;
			if(H[i][j]!='R'&&i>1) S[i][2]++;
		}
		if(i<N-1){
			S[i+1][0]=S[i][0];
			S[i+1][1]=S[i][1];
			S[i+1][2]=S[i][2];
		}
	}
	
	int min=2500;
	for(i=0;i<N-2;i++){
		for(j=i+1;j<N-1;j++){
			if(min>S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2]){
				min=S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2];
			}
		}
	}
	
	printf("%d\n",min);
	
	return 0;
}


4 5
WRWRW
BRWWB
WRWRW
RWBWR
 4 5
WRWRW
BWRWB
WRWRW
RWBWQ
 4 5
WQWRW
BWRXB
RVWRW
WQBWQ
 4 3
WQWRW
BWRXB
RVWRW
RWBWQ
 4 5
WQWRW
BWRXC
RVWRW
WQBWQ
 4 10
WRWQW
BWRXB
RVWRW
RWBWQ
 4 0
WQXRW
BWRXB
VRWRW
RWBWQ
 4 16
WRWQW
BWRXB
RVWRW
RWBWQ
 4 1
WRWRW
BWRWB
VRWRW
QWBWR
 5 1
WRWRW
BWRWB
VRWRW
QWBWR

11
 12
 13
 7
 14
 32
 0
 56
 2
 3

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,M,S[50][3]={0};
	int i,j;
	char H[51][51];
	
	scanf("%d%d",&N,&M);
	for(i=0;i<N;i++) scanf("%s",H[i]);
	
	for(i=0;i<N;i++){
		for(j=0;j<M;j++){
			if(H[i][j]!='W'&&i<N-2) S[i][0]++;
			if(H[i][j]!='B'&&i>0&&i<N-1) S[i][1]++;
			if(H[i][j]!='R'&&i>1) S[i][2]++;
		}
		if(i<N-1){
			S[i+1][0]=S[i][0];
			S[i+1][1]=S[i][1];
			S[i+1][2]=S[i][2];
		}
	}
	
	int min=2500;
	for(i=0;i<N-2;i++){
		for(j=i+1;j<N-1;j++){
			if(min>S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2]){
				min=S[i][0]+S[j][1]-S[i][1]+S[N-1][2]-S[j][2];
			}
		}
	}
	
	printf("%d\n",min);
	
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\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
	subq	$3264, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3232(%rbp), %rdx
	movl	$0, %eax
	movl	$75, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-3248(%rbp), %rdx
	leaq	-3252(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3244(%rbp)
	jmp	.L2
.L3:
	leaq	-2624(%rbp), %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3244(%rbp)
.L2:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L3
	movl	$0, -3244(%rbp)
	jmp	.L4
.L11:
	movl	$0, -3240(%rbp)
	jmp	.L5
.L9:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	je	.L6
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L6
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%ecx, (%rax)
.L6:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	je	.L7
	cmpl	$0, -3244(%rbp)
	jle	.L7
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L7
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%ecx, (%rax)
.L7:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	je	.L8
	cmpl	$1, -3244(%rbp)
	jle	.L8
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%ecx, (%rax)
.L8:
	addl	$1, -3240(%rbp)
.L5:
	movl	-3248(%rbp), %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L9
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L10
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%edx, (%rax)
.L10:
	addl	$1, -3244(%rbp)
.L4:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L11
	movl	$2500, -3236(%rbp)
	movl	$0, -3244(%rbp)
	jmp	.L12
.L16:
	movl	-3244(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -3240(%rbp)
	jmp	.L13
.L15:
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	cmpl	%eax, -3236(%rbp)
	jle	.L14
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -3236(%rbp)
.L14:
	addl	$1, -3240(%rbp)
.L13:
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L15
	addl	$1, -3244(%rbp)
.L12:
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L16
	movl	-3236(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.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\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
	subq	$3264, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3232(%rbp), %rdx
	movl	$0, %eax
	movl	$75, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-3248(%rbp), %rdx
	leaq	-3252(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3244(%rbp)
	jmp	.L2
.L3:
	leaq	-2624(%rbp), %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3244(%rbp)
.L2:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L3
	movl	$0, -3244(%rbp)
	jmp	.L4
.L11:
	movl	$0, -3240(%rbp)
	jmp	.L5
.L9:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	je	.L6
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L6
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%ecx, (%rax)
.L6:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	je	.L7
	cmpl	$0, -3244(%rbp)
	jle	.L7
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L7
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%ecx, (%rax)
.L7:
	movl	-3240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$2624, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	je	.L8
	cmpl	$1, -3244(%rbp)
	jle	.L8
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%ecx, (%rax)
.L8:
	addl	$1, -3240(%rbp)
.L5:
	movl	-3248(%rbp), %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L9
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3244(%rbp)
	jge	.L10
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	%edx, (%rax)
	movl	-3244(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	%edx, (%rax)
.L10:
	addl	$1, -3244(%rbp)
.L4:
	movl	-3252(%rbp), %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L11
	movl	$2500, -3236(%rbp)
	movl	$0, -3244(%rbp)
	jmp	.L12
.L16:
	movl	-3244(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -3240(%rbp)
	jmp	.L13
.L15:
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	cmpl	%eax, -3236(%rbp)
	jle	.L14
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3232, %rax
	movl	(%rax), %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3244(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3228, %rax
	movl	(%rax), %eax
	subl	%eax, %ecx
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %eax
	addl	%eax, %ecx
	movl	-3240(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$3224, %rax
	movl	(%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -3236(%rbp)
.L14:
	addl	$1, -3240(%rbp)
.L13:
	movl	-3252(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -3240(%rbp)
	jl	.L15
	addl	$1, -3244(%rbp)
.L12:
	movl	-3252(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -3244(%rbp)
	jl	.L16
	movl	-3236(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.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:
