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>
int main(void)
{
  int N,M,i,j,k,l,w_change=0,b_change=0,r_change=0,min=2500,sum=0,loop=0,count=0;
  scanf("%d %d",&N,&M);
  char flag[N][M];
  int w_cost[N],b_cost[N],r_cost[N];
  for(i=0;i<N;i++)
  {
    scanf("%s",flag[i]);
    w_cost[i]=M;
    b_cost[i]=M;
    r_cost[i]=M;
  }
  for(i=0;i<N;i++)
  {
    for(j=0;j<M;j++)
    {
      if(flag[i][j]=='W') w_cost[i]--;
      if(flag[i][j]=='B') b_cost[i]--;
      if(flag[i][j]=='R') r_cost[i]--;
    }
    //printf("%d %d %d\n",w_cost[i],b_cost[i],r_cost[i]);
  }
  for(i=0;i<N-2;i++)
  {
    for(j=i+1;j<N-1;j++)
    {
      for(k=j+1;k<N;k++)
      {
      //  printf("i:%d j:%d k:%d ",i,j,k);
        while(count<j)
        {
          sum+=w_cost[count];
          count++;
        }
        count=0;
        while(j+count<k)
        {
          sum+=b_cost[j+count];
          count++;
        }

        count=0;
        while(k+count<N)
        {
          sum+=r_cost[k+count];
          count++;
        }
        count=0;
      //  printf("%d\n",sum);
        if(sum<min)
        {//printf("\n%d %d %d ",i,j,k);
          min=sum;
        }
        sum=0;
        //printf("\n");
      }
    }
  }
  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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$296, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -328(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$0, -136(%rbp)
	movl	$2500, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -132(%rbp)
	movl	$0, -148(%rbp)
	leaq	-172(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %esi
	movl	-176(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%esi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movq	-192(%rbp), %r8
	movq	-184(%rbp), %r9
	movq	%r9, %rdx
	movq	-208(%rbp), %r10
	movq	-200(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -288(%rbp)
	movq	$0, -280(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -320(%rbp)
	movq	$0, -312(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L14
.L15:
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -168(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L15
	movl	$0, -168(%rbp)
	jmp	.L16
.L22:
	movl	$0, -164(%rbp)
	jmp	.L17
.L21:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L18
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L18:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L19
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L19:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	jne	.L20
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L20:
	addl	$1, -164(%rbp)
.L17:
	movl	-172(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jl	.L21
	addl	$1, -168(%rbp)
.L16:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L22
	movl	$0, -168(%rbp)
	jmp	.L23
.L35:
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -164(%rbp)
	jmp	.L24
.L34:
	movl	-164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -160(%rbp)
	jmp	.L25
.L27:
	movq	-96(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	-164(%rbp), %eax
	jl	.L27
	movl	$0, -148(%rbp)
	jmp	.L28
.L29:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L28:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -160(%rbp)
	jg	.L29
	movl	$0, -148(%rbp)
	jmp	.L30
.L31:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L30:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movl	-176(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L31
	movl	$0, -148(%rbp)
	movl	-152(%rbp), %eax
	cmpl	-156(%rbp), %eax
	jge	.L32
	movl	-152(%rbp), %eax
	movl	%eax, -156(%rbp)
.L32:
	movl	$0, -152(%rbp)
	addl	$1, -160(%rbp)
.L25:
	movl	-176(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jl	.L26
	addl	$1, -164(%rbp)
.L24:
	movl	-176(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -164(%rbp)
	jl	.L34
	addl	$1, -168(%rbp)
.L23:
	movl	-176(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -168(%rbp)
	jl	.L35
	movl	-156(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-328(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rbx
	movslq	-64(%rbp), %rcx
	movq	%rsp, %rsi
	movq	%rbx, %rax
	movq	%rcx, %r12
	imulq	%rcx, %rax
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L74:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L74
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L75
.L4:
	leaq	15(,%rcx,4), %rax
	movq	%rsp, %rcx
	movq	%rsp, %r8
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L75:
	orq	$0, -8(%rsp,%rax)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L76
.L7:
	movq	%rax, %rsi
	movq	%rsp, -72(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L8:
	cmpq	%rcx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L76:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L10
	orq	$0, -8(%rsp,%rdx)
.L10:
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	movq	%rsp, %r13
	andq	$-16, %rdx
	subq	%rax, %rcx
.L11:
	cmpq	%rcx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L13
	orq	$0, -8(%rsp,%rax)
.L13:
	movq	%rsp, %r14
	testl	%r12d, %r12d
	jle	.L14
	xorl	%edx, %edx
	movq	%r14, %rcx
	leaq	.LC1(%rip), %r15
	movq	%r13, %r14
	movq	%r8, %r12
	movq	%rbx, %r13
	movq	%rdx, %rbx
.L15:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%rcx, -88(%rbp)
	movq	%r8, -80(%rbp)
	addq	%r13, %r12
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	movq	-72(%rbp), %rdi
	movq	-88(%rbp), %rcx
	movl	-64(%rbp), %edx
	movl	%eax, (%rdi,%rbx,4)
	movq	-80(%rbp), %r8
	movl	%eax, (%r14,%rbx,4)
	movl	%eax, (%rcx,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L15
	movq	%r13, %rbx
	movl	%edx, %r12d
	movq	%r14, %r13
	movq	%rcx, %r14
	testl	%edx, %edx
	jle	.L14
	testl	%eax, %eax
	jle	.L14
	leaq	(%r8,%rax), %rcx
	leal	-1(%rax), %r9d
	movl	%edx, %eax
	movq	%r14, %rsi
	movq	%r13, %r8
	leaq	(%r14,%rax,4), %r10
.L17:
	movq	%rcx, %rax
	subq	%r9, %rax
	subq	$1, %rax
	jmp	.L22
.L18:
	cmpb	$66, %dl
	je	.L20
	cmpb	$82, %dl
	jne	.L19
	subl	$1, (%rsi)
.L19:
	addq	$1, %rax
	cmpq	%rcx, %rax
	je	.L77
.L22:
	movzbl	(%rax), %edx
	cmpb	$87, %dl
	jne	.L18
	addq	$1, %rax
	subl	$1, (%rdi)
	cmpq	%rcx, %rax
	jne	.L22
.L77:
	addq	$4, %rsi
	addq	%rbx, %rcx
	addq	$4, %r8
	addq	$4, %rdi
	cmpq	%r10, %rsi
	jne	.L17
.L14:
	leal	-2(%r12), %eax
	movl	%eax, -132(%rbp)
	testl	%eax, %eax
	jle	.L45
	leal	-1(%r12), %eax
	movl	$0, -112(%rbp)
	movl	$2500, %r15d
	movl	%eax, -80(%rbp)
	leaq	4(%r13), %rax
	movq	%rax, -128(%rbp)
	movq	-72(%rbp), %rax
	addq	$16, %rax
	movq	%rax, -120(%rbp)
.L43:
	movl	-112(%rbp), %ebx
	movl	%ebx, %eax
	addl	$1, %ebx
	movl	%ebx, -112(%rbp)
	cmpl	%ebx, -80(%rbp)
	jle	.L24
	movl	%eax, -92(%rbp)
	movq	-128(%rbp), %rax
	movl	%ebx, %r10d
	movl	%ebx, -108(%rbp)
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L42:
	movl	-108(%rbp), %eax
	movl	%eax, %ebx
	addl	$1, %eax
	movl	%eax, -108(%rbp)
	cmpl	%eax, %r12d
	jle	.L26
	cltq
	movl	$1, %r8d
	movq	%rax, %rcx
	leaq	(%r14,%rax,4), %r11
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %r9d
	movl	%r10d, %eax
	andl	$-4, %eax
	salq	$4, %r9
	addq	-120(%rbp), %r9
	movl	%eax, -96(%rbp)
	movq	-88(%rbp), %rax
	addq	$16, %rax
	movq	%rax, -104(%rbp)
	.p2align 4,,10
	.p2align 3
.L38:
	xorl	%edx, %edx
	testl	%r10d, %r10d
	jle	.L41
	cmpl	$2, -92(%rbp)
	jbe	.L46
	movq	-72(%rbp), %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%r9, %rax
	jne	.L28
	movdqa	%xmm0, %xmm1
	movl	-96(%rbp), %eax
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%r10d, %eax
	je	.L41
.L27:
	movq	-72(%rbp), %rdi
	movslq	%eax, %rsi
	leaq	(%rdi,%rsi,4), %rsi
	leal	1(%rax), %edi
	addl	(%rsi), %edx
	cmpl	%r10d, %edi
	jge	.L41
	addl	$2, %eax
	addl	4(%rsi), %edx
	cmpl	%r10d, %eax
	jge	.L41
	addl	8(%rsi), %edx
.L41:
	cmpl	%r10d, %ecx
	jle	.L30
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L47
	movl	%r8d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %esi
	movq	-88(%rbp), %rax
	salq	$4, %rsi
	addq	-104(%rbp), %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movdqu	(%rax), %xmm4
	addq	$16, %rax
	paddd	%xmm4, %xmm0
	cmpq	%rsi, %rax
	jne	.L32
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	movl	%r8d, %eax
	andl	$-4, %eax
	leal	(%rbx,%rax), %esi
	cmpl	%r8d, %eax
	je	.L30
.L31:
	movslq	%esi, %rsi
	addl	0(%r13,%rsi,4), %edx
	leal	1(%rbx,%rax), %esi
	cmpl	%esi, %ecx
	jle	.L30
	movslq	%esi, %rsi
	leal	2(%rbx,%rax), %eax
	addl	0(%r13,%rsi,4), %edx
	cmpl	%eax, %ecx
	jle	.L30
	cltq
	addl	0(%r13,%rax,4), %edx
.L30:
	movl	%r12d, %edi
	movl	$1, %eax
	subl	%ecx, %edi
	cmpl	%ecx, %r12d
	cmovle	%eax, %edi
	movl	-80(%rbp), %eax
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L48
	cmpl	%ecx, %r12d
	jle	.L48
	movl	%edi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r11,%rax), %rsi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L36:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rsi, %rax
	jne	.L36
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	movl	%edi, %eax
	andl	$-4, %eax
	leal	(%rcx,%rax), %esi
	cmpl	%eax, %edi
	je	.L39
.L35:
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %edx
	leal	1(%rcx,%rax), %esi
	cmpl	%esi, %r12d
	jle	.L39
	movslq	%esi, %rsi
	leal	2(%rcx,%rax), %eax
	addl	(%r14,%rsi,4), %edx
	cmpl	%eax, %r12d
	jle	.L39
	cltq
	addl	(%r14,%rax,4), %edx
.L39:
	cmpl	%edx, %r15d
	cmovg	%edx, %r15d
	addl	$1, %ecx
	addl	$1, %r8d
	addq	$4, %r11
	cmpl	%ecx, %r12d
	jg	.L38
.L26:
	addl	$1, -92(%rbp)
	movl	-108(%rbp), %ebx
	addl	$1, %r10d
	addq	$4, -88(%rbp)
	cmpl	%ebx, -80(%rbp)
	jne	.L42
.L24:
	addq	$4, -128(%rbp)
	movl	-112(%rbp), %ebx
	cmpl	%ebx, -132(%rbp)
	jne	.L43
.L23:
	xorl	%eax, %eax
	movl	%r15d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L78
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L20:
	.cfi_restore_state
	subl	$1, (%r8)
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%ecx, %esi
	xorl	%eax, %eax
	jmp	.L35
.L46:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L27
.L47:
	movl	%ebx, %esi
	xorl	%eax, %eax
	jmp	.L31
.L45:
	movl	$2500, %r15d
	jmp	.L23
.L78:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rbx
	movslq	-64(%rbp), %rcx
	movq	%rsp, %rsi
	movq	%rbx, %rax
	movq	%rcx, %r12
	imulq	%rcx, %rax
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L74:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L74
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L75
.L4:
	leaq	15(,%rcx,4), %rax
	movq	%rsp, %rcx
	movq	%rsp, %r8
	movq	%rax, %rsi
	movq	%rax, %rdx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L75:
	orq	$0, -8(%rsp,%rax)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L76
.L7:
	movq	%rax, %rsi
	movq	%rsp, -72(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rsi
	andq	$-16, %rdx
	subq	%rsi, %rcx
.L8:
	cmpq	%rcx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L76:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L10
	orq	$0, -8(%rsp,%rdx)
.L10:
	movq	%rax, %rdx
	movq	%rsp, %rcx
	andq	$-4096, %rax
	movq	%rsp, %r13
	andq	$-16, %rdx
	subq	%rax, %rcx
.L11:
	cmpq	%rcx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L13
	orq	$0, -8(%rsp,%rax)
.L13:
	movq	%rsp, %r14
	testl	%r12d, %r12d
	jle	.L14
	xorl	%edx, %edx
	movq	%r14, %rcx
	leaq	.LC1(%rip), %r15
	movq	%r13, %r14
	movq	%r8, %r12
	movq	%rbx, %r13
	movq	%rdx, %rbx
.L15:
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%rcx, -88(%rbp)
	movq	%r8, -80(%rbp)
	addq	%r13, %r12
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	movq	-72(%rbp), %rdi
	movq	-88(%rbp), %rcx
	movl	-64(%rbp), %edx
	movl	%eax, (%rdi,%rbx,4)
	movq	-80(%rbp), %r8
	movl	%eax, (%r14,%rbx,4)
	movl	%eax, (%rcx,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L15
	movq	%r13, %rbx
	movl	%edx, %r12d
	movq	%r14, %r13
	movq	%rcx, %r14
	testl	%edx, %edx
	jle	.L14
	testl	%eax, %eax
	jle	.L14
	leaq	(%r8,%rax), %rcx
	leal	-1(%rax), %r9d
	movl	%edx, %eax
	movq	%r14, %rsi
	movq	%r13, %r8
	leaq	(%r14,%rax,4), %r10
.L17:
	movq	%rcx, %rax
	subq	%r9, %rax
	subq	$1, %rax
	jmp	.L22
.L18:
	cmpb	$66, %dl
	je	.L20
	cmpb	$82, %dl
	jne	.L19
	subl	$1, (%rsi)
.L19:
	addq	$1, %rax
	cmpq	%rcx, %rax
	je	.L77
.L22:
	movzbl	(%rax), %edx
	cmpb	$87, %dl
	jne	.L18
	addq	$1, %rax
	subl	$1, (%rdi)
	cmpq	%rcx, %rax
	jne	.L22
.L77:
	addq	$4, %rsi
	addq	%rbx, %rcx
	addq	$4, %r8
	addq	$4, %rdi
	cmpq	%r10, %rsi
	jne	.L17
.L14:
	leal	-2(%r12), %eax
	movl	%eax, -132(%rbp)
	testl	%eax, %eax
	jle	.L45
	leal	-1(%r12), %eax
	movl	$0, -112(%rbp)
	movl	$2500, %r15d
	movl	%eax, -80(%rbp)
	leaq	4(%r13), %rax
	movq	%rax, -128(%rbp)
	movq	-72(%rbp), %rax
	addq	$16, %rax
	movq	%rax, -120(%rbp)
.L43:
	movl	-112(%rbp), %ebx
	movl	%ebx, %eax
	addl	$1, %ebx
	movl	%ebx, -112(%rbp)
	cmpl	%ebx, -80(%rbp)
	jle	.L24
	movl	%eax, -92(%rbp)
	movq	-128(%rbp), %rax
	movl	%ebx, %r10d
	movl	%ebx, -108(%rbp)
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L42:
	movl	-108(%rbp), %eax
	movl	%eax, %ebx
	addl	$1, %eax
	movl	%eax, -108(%rbp)
	cmpl	%eax, %r12d
	jle	.L26
	cltq
	movl	$1, %r8d
	movq	%rax, %rcx
	leaq	(%r14,%rax,4), %r11
	movl	%r10d, %eax
	shrl	$2, %eax
	leal	-1(%rax), %r9d
	movl	%r10d, %eax
	andl	$-4, %eax
	salq	$4, %r9
	addq	-120(%rbp), %r9
	movl	%eax, -96(%rbp)
	movq	-88(%rbp), %rax
	addq	$16, %rax
	movq	%rax, -104(%rbp)
	.p2align 4,,10
	.p2align 3
.L38:
	xorl	%edx, %edx
	testl	%r10d, %r10d
	jle	.L41
	cmpl	$2, -92(%rbp)
	jbe	.L46
	movq	-72(%rbp), %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L28:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%r9, %rax
	jne	.L28
	movdqa	%xmm0, %xmm1
	movl	-96(%rbp), %eax
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%r10d, %eax
	je	.L41
.L27:
	movq	-72(%rbp), %rdi
	movslq	%eax, %rsi
	leaq	(%rdi,%rsi,4), %rsi
	leal	1(%rax), %edi
	addl	(%rsi), %edx
	cmpl	%r10d, %edi
	jge	.L41
	addl	$2, %eax
	addl	4(%rsi), %edx
	cmpl	%r10d, %eax
	jge	.L41
	addl	8(%rsi), %edx
.L41:
	cmpl	%r10d, %ecx
	jle	.L30
	leal	-1(%r8), %eax
	cmpl	$2, %eax
	jbe	.L47
	movl	%r8d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	leal	-1(%rax), %esi
	movq	-88(%rbp), %rax
	salq	$4, %rsi
	addq	-104(%rbp), %rsi
	.p2align 4,,10
	.p2align 3
.L32:
	movdqu	(%rax), %xmm4
	addq	$16, %rax
	paddd	%xmm4, %xmm0
	cmpq	%rsi, %rax
	jne	.L32
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	movl	%r8d, %eax
	andl	$-4, %eax
	leal	(%rbx,%rax), %esi
	cmpl	%r8d, %eax
	je	.L30
.L31:
	movslq	%esi, %rsi
	addl	0(%r13,%rsi,4), %edx
	leal	1(%rbx,%rax), %esi
	cmpl	%esi, %ecx
	jle	.L30
	movslq	%esi, %rsi
	leal	2(%rbx,%rax), %eax
	addl	0(%r13,%rsi,4), %edx
	cmpl	%eax, %ecx
	jle	.L30
	cltq
	addl	0(%r13,%rax,4), %edx
.L30:
	movl	%r12d, %edi
	movl	$1, %eax
	subl	%ecx, %edi
	cmpl	%ecx, %r12d
	cmovle	%eax, %edi
	movl	-80(%rbp), %eax
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L48
	cmpl	%ecx, %r12d
	jle	.L48
	movl	%edi, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r11,%rax), %rsi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L36:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rsi, %rax
	jne	.L36
	movdqa	%xmm0, %xmm1
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	addl	%eax, %edx
	movl	%edi, %eax
	andl	$-4, %eax
	leal	(%rcx,%rax), %esi
	cmpl	%eax, %edi
	je	.L39
.L35:
	movslq	%esi, %rsi
	addl	(%r14,%rsi,4), %edx
	leal	1(%rcx,%rax), %esi
	cmpl	%esi, %r12d
	jle	.L39
	movslq	%esi, %rsi
	leal	2(%rcx,%rax), %eax
	addl	(%r14,%rsi,4), %edx
	cmpl	%eax, %r12d
	jle	.L39
	cltq
	addl	(%r14,%rax,4), %edx
.L39:
	cmpl	%edx, %r15d
	cmovg	%edx, %r15d
	addl	$1, %ecx
	addl	$1, %r8d
	addq	$4, %r11
	cmpl	%ecx, %r12d
	jg	.L38
.L26:
	addl	$1, -92(%rbp)
	movl	-108(%rbp), %ebx
	addl	$1, %r10d
	addq	$4, -88(%rbp)
	cmpl	%ebx, -80(%rbp)
	jne	.L42
.L24:
	addq	$4, -128(%rbp)
	movl	-112(%rbp), %ebx
	cmpl	%ebx, -132(%rbp)
	jne	.L43
.L23:
	xorl	%eax, %eax
	movl	%r15d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L78
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L20:
	.cfi_restore_state
	subl	$1, (%r8)
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%ecx, %esi
	xorl	%eax, %eax
	jmp	.L35
.L46:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L27
.L47:
	movl	%ebx, %esi
	xorl	%eax, %eax
	jmp	.L31
.L45:
	movl	$2500, %r15d
	jmp	.L23
.L78:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>
#include<stdlib.h>
#include<string.h>
int main(void)
{
  int N,M,i,j,k,l,w_change=0,b_change=0,r_change=0,min=2500,sum=0,loop=0,count=0;
  scanf("%d %d",&N,&M);
  char flag[N][M];
  int w_cost[N],b_cost[N],r_cost[N];
  for(i=0;i<N;i++)
  {
    scanf("%s",flag[i]);
    w_cost[i]=M;
    b_cost[i]=M;
    r_cost[i]=M;
  }
  for(i=0;i<N;i++)
  {
    for(j=0;j<M;j++)
    {
      if(flag[i][j]=='W') w_cost[i]--;
      if(flag[i][j]=='B') b_cost[i]--;
      if(flag[i][j]=='R') r_cost[i]--;
    }
    //printf("%d %d %d\n",w_cost[i],b_cost[i],r_cost[i]);
  }
  for(i=0;i<N-2;i++)
  {
    for(j=i+1;j<N-1;j++)
    {
      for(k=j+1;k<N;k++)
      {
      //  printf("i:%d j:%d k:%d ",i,j,k);
        while(count<j)
        {
          sum+=w_cost[count];
          count++;
        }
        count=0;
        while(j+count<k)
        {
          sum+=b_cost[j+count];
          count++;
        }

        count=0;
        while(k+count<N)
        {
          sum+=r_cost[k+count];
          count++;
        }
        count=0;
      //  printf("%d\n",sum);
        if(sum<min)
        {//printf("\n%d %d %d ",i,j,k);
          min=sum;
        }
        sum=0;
        //printf("\n");
      }
    }
  }
  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>
#include<stdlib.h>
#include<string.h>
int main(void)
{
  int N,M,i,j,k,l,w_change=0,b_change=0,r_change=0,min=2500,sum=0,loop=0,count=0;
  scanf("%d %d",&N,&M);
  char flag[N][M];
  int w_cost[N],b_cost[N],r_cost[N];
  for(i=0;i<N;i++)
  {
    scanf("%s",flag[i]);
    w_cost[i]=M;
    b_cost[i]=M;
    r_cost[i]=M;
  }
  for(i=0;i<N;i++)
  {
    for(j=0;j<M;j++)
    {
      if(flag[i][j]=='W') w_cost[i]--;
      if(flag[i][j]=='B') b_cost[i]--;
      if(flag[i][j]=='R') r_cost[i]--;
    }
    //printf("%d %d %d\n",w_cost[i],b_cost[i],r_cost[i]);
  }
  for(i=0;i<N-2;i++)
  {
    for(j=i+1;j<N-1;j++)
    {
      for(k=j+1;k<N;k++)
      {
      //  printf("i:%d j:%d k:%d ",i,j,k);
        while(count<j)
        {
          sum+=w_cost[count];
          count++;
        }
        count=0;
        while(j+count<k)
        {
          sum+=b_cost[j+count];
          count++;
        }

        count=0;
        while(k+count<N)
        {
          sum+=r_cost[k+count];
          count++;
        }
        count=0;
      //  printf("%d\n",sum);
        if(sum<min)
        {//printf("\n%d %d %d ",i,j,k);
          min=sum;
        }
        sum=0;
        //printf("\n");
      }
    }
  }
  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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$296, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -328(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$0, -136(%rbp)
	movl	$2500, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -132(%rbp)
	movl	$0, -148(%rbp)
	leaq	-172(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %esi
	movl	-176(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%esi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movq	-192(%rbp), %r8
	movq	-184(%rbp), %r9
	movq	%r9, %rdx
	movq	-208(%rbp), %r10
	movq	-200(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -288(%rbp)
	movq	$0, -280(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -320(%rbp)
	movq	$0, -312(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L14
.L15:
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -168(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L15
	movl	$0, -168(%rbp)
	jmp	.L16
.L22:
	movl	$0, -164(%rbp)
	jmp	.L17
.L21:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L18
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L18:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L19
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L19:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	jne	.L20
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L20:
	addl	$1, -164(%rbp)
.L17:
	movl	-172(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jl	.L21
	addl	$1, -168(%rbp)
.L16:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L22
	movl	$0, -168(%rbp)
	jmp	.L23
.L35:
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -164(%rbp)
	jmp	.L24
.L34:
	movl	-164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -160(%rbp)
	jmp	.L25
.L27:
	movq	-96(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	-164(%rbp), %eax
	jl	.L27
	movl	$0, -148(%rbp)
	jmp	.L28
.L29:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L28:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -160(%rbp)
	jg	.L29
	movl	$0, -148(%rbp)
	jmp	.L30
.L31:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L30:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movl	-176(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L31
	movl	$0, -148(%rbp)
	movl	-152(%rbp), %eax
	cmpl	-156(%rbp), %eax
	jge	.L32
	movl	-152(%rbp), %eax
	movl	%eax, -156(%rbp)
.L32:
	movl	$0, -152(%rbp)
	addl	$1, -160(%rbp)
.L25:
	movl	-176(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jl	.L26
	addl	$1, -164(%rbp)
.L24:
	movl	-176(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -164(%rbp)
	jl	.L34
	addl	$1, -168(%rbp)
.L23:
	movl	-176(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -168(%rbp)
	jl	.L35
	movl	-156(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-328(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$296, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -328(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$0, -136(%rbp)
	movl	$2500, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -132(%rbp)
	movl	$0, -148(%rbp)
	leaq	-172(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %esi
	movl	-176(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%esi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movq	-192(%rbp), %r8
	movq	-184(%rbp), %r9
	movq	%r9, %rdx
	movq	-208(%rbp), %r10
	movq	-200(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edx, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -288(%rbp)
	movq	$0, -280(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -320(%rbp)
	movq	$0, -312(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L14
.L15:
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	movq	-112(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-172(%rbp), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movl	-172(%rbp), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -168(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L15
	movl	$0, -168(%rbp)
	jmp	.L16
.L22:
	movl	$0, -164(%rbp)
	jmp	.L17
.L21:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$87, %al
	jne	.L18
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-96(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L18:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L19
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L19:
	movq	-112(%rbp), %rcx
	movl	-164(%rbp), %eax
	movslq	%eax, %rdx
	movl	-168(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$82, %al
	jne	.L20
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L20:
	addl	$1, -164(%rbp)
.L17:
	movl	-172(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jl	.L21
	addl	$1, -168(%rbp)
.L16:
	movl	-176(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jl	.L22
	movl	$0, -168(%rbp)
	jmp	.L23
.L35:
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -164(%rbp)
	jmp	.L24
.L34:
	movl	-164(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -160(%rbp)
	jmp	.L25
.L27:
	movq	-96(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	-164(%rbp), %eax
	jl	.L27
	movl	$0, -148(%rbp)
	jmp	.L28
.L29:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L28:
	movl	-164(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -160(%rbp)
	jg	.L29
	movl	$0, -148(%rbp)
	jmp	.L30
.L31:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, -152(%rbp)
	addl	$1, -148(%rbp)
.L30:
	movl	-160(%rbp), %edx
	movl	-148(%rbp), %eax
	addl	%eax, %edx
	movl	-176(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L31
	movl	$0, -148(%rbp)
	movl	-152(%rbp), %eax
	cmpl	-156(%rbp), %eax
	jge	.L32
	movl	-152(%rbp), %eax
	movl	%eax, -156(%rbp)
.L32:
	movl	$0, -152(%rbp)
	addl	$1, -160(%rbp)
.L25:
	movl	-176(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jl	.L26
	addl	$1, -164(%rbp)
.L24:
	movl	-176(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -164(%rbp)
	jl	.L34
	addl	$1, -168(%rbp)
.L23:
	movl	-176(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -168(%rbp)
	jl	.L35
	movl	-156(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-328(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
