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 <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))

int main(void)
{
	//変数の宣言
	int n,m;
	int x,y;
	char c;
	static int map[2010][2010];
	static int ruiseki[2010][2010];
	static int ruisekitemp[2010][2010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int sum=0;
	int temp,temp1,temp2;
	//int max,min;
	int len;
	//データの読み込み
	
	scanf("%d %d",&n,&m);
	
	for(i=0;i<=2000;i++){
		for(j=0;j<=2000;j++){
			map[i][j]=0;
		}
	}
	
	for(i=0;i<n;i++){
		scanf("%d %d %c",&x,&y,&c);
		if(c=='W') x=x+m;
		x=x%(2*m);
		y=y%(2*m);
		map[x][y]=map[x][y]+1;
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	//二次元累積和の計算
	
	for(i=0;i<2*m;i++){
		for(j=0;j<2*m;j++){
			if(j==0){
			ruisekitemp[i][0]=map[i][0];
			}else{
				ruisekitemp[i][j]=ruisekitemp[i][j-1]+map[i][j];
			}
		}
	}
	
	for(j=0;j<2*m;j++){
		for(i=0;i<2*m;i++){
			if(i==0){
				ruiseki[0][j]=ruisekitemp[0][j];
			}else{
				ruiseki[i][j]=ruiseki[i-1][j]+ruisekitemp[i][j];
			}
		}
	}
	
	for(i=0;i<m;i++){
		for(j=0;j<m;j++){
			temp=0;
			temp=temp+ruiseki[i+m][j+m]-ruiseki[i+m][j]-ruiseki[i][j+m]+ruiseki[i][j];
			temp=temp+ruiseki[i][j];
			temp=temp+ruiseki[2*m-1][2*m-1]-ruiseki[i+m][2*m-1]-ruiseki[2*m-1][j+m]+ruiseki[i+m][j+m];
			temp=temp+ruiseki[2*m-1][j]-ruiseki[i+m][j];
			temp=temp+ruiseki[i][2*m-1]-ruiseki[i][j+m];
			if(temp<n-temp) temp=n-temp;
			if(temp>ans) ans=temp;
		}
	}
	
	
	
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L5:
	movl	$0, -32(%rbp)
	jmp	.L3
.L4:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L3:
	cmpl	$2000, -32(%rbp)
	jle	.L4
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2000, -36(%rbp)
	jle	.L5
	movl	$0, -36(%rbp)
	jmp	.L6
.L8:
	leaq	-53(%rbp), %rcx
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-53(%rbp), %eax
	cmpb	$87, %al
	jne	.L7
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -44(%rbp)
.L7:
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -36(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L14:
	movl	$0, -32(%rbp)
	jmp	.L10
.L13:
	cmpl	$0, -32(%rbp)
	jne	.L11
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	map.2(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	ruisekitemp.1(%rip), %rcx
	movl	%edx, (%rax,%rcx)
	jmp	.L12
.L11:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L12:
	addl	$1, -32(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L13
	addl	$1, -36(%rbp)
.L9:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	movl	$0, -32(%rbp)
	jmp	.L15
.L20:
	movl	$0, -36(%rbp)
	jmp	.L16
.L19:
	cmpl	$0, -36(%rbp)
	jne	.L17
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ruiseki.0(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L18:
	addl	$1, -36(%rbp)
.L16:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L19
	addl	$1, -32(%rbp)
.L15:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L20
	movl	$0, -36(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	jmp	.L22
.L25:
	movl	$0, -24(%rbp)
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movl	-48(%rbp), %esi
	movl	-32(%rbp), %edx
	addl	%esi, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%esi, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L23
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, -24(%rbp)
.L23:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L24
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
.L24:
	addl	$1, -32(%rbp)
.L22:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L25
	addl	$1, -36(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L26
	movl	-28(%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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.local	map.2
	.comm	map.2,16160400,32
	.local	ruisekitemp.1
	.comm	ruisekitemp.1,16160400,32
	.local	ruiseki.0
	.comm	ruiseki.0,16160400,32
	.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	"%d %d %c"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	leaq	map.2(%rip), %rbx
	movq	%rbx, %rbp
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	92(%rsp), %rdx
	leaq	88(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16088040(%rbx), %rsi
	movq	%rbx, %rdx
	xorl	%eax, %eax
.L2:
	leaq	8(%rdx), %rdi
	movq	%rdx, %rcx
	movq	$0, (%rdx)
	addq	$8040, %rdx
	andq	$-8, %rdi
	movq	$0, -44(%rdx)
	subq	%rdi, %rcx
	addl	$8004, %ecx
	shrl	$3, %ecx
	rep stosq
	cmpq	%rsi, %rdx
	jne	.L2
	movl	88(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L39
	leaq	87(%rsp), %r8
	leaq	96(%rsp), %r14
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	leaq	100(%rsp), %r9
	movq	%r8, %rbx
	leaq	.LC1(%rip), %r13
	movq	%r14, %r8
	movq	%r9, %r14
.L3:
	movq	%r8, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r14, %rdx
	movq	%r8, (%rsp)
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %esi
	cmpb	$87, 87(%rsp)
	movq	(%rsp), %r8
	leal	(%rsi,%rsi), %edi
	je	.L6
	movl	96(%rsp), %eax
	addl	$1, %r12d
	cltd
	idivl	%edi
	movl	100(%rsp), %eax
	movl	%edx, %ecx
	movl	%edx, 96(%rsp)
	cltd
	idivl	%edi
	movslq	%ecx, %rax
	imulq	$2010, %rax, %rax
	movl	%edx, 100(%rsp)
	movslq	%edx, %rdx
	addq	%rdx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	88(%rsp), %eax
	cmpl	%eax, %r12d
	jl	.L3
.L37:
	movq	%r15, %rbx
	movl	%eax, %r15d
.L8:
	testl	%edi, %edi
	jle	.L19
	leal	-1(%rdi), %ebp
	leaq	ruisekitemp.1(%rip), %r9
	movl	%edi, %r8d
	imulq	$8040, %rbp, %r11
	leaq	8040+map.2(%rip), %rax
	movq	%r9, %r10
	addq	%rax, %r11
.L15:
	movq	%r10, %rdx
	xorl	%eax, %eax
	jmp	.L14
.L12:
	movl	(%rbx,%rax,4), %ecx
	addq	$1, %rax
	addl	-4(%rdx), %ecx
	addq	$4, %rdx
	movl	%ecx, -4(%rdx)
	cmpq	%r8, %rax
	je	.L40
.L14:
	testq	%rax, %rax
	jne	.L12
	movl	(%rbx), %ecx
	addq	$1, %rax
	addq	$4, %rdx
	movl	%ecx, (%r10)
	cmpq	%r8, %rax
	jne	.L14
.L40:
	addq	$8040, %rbx
	addq	$8040, %r10
	cmpq	%r11, %rbx
	jne	.L15
	leaq	4+ruisekitemp.1(%rip), %rax
	leaq	ruiseki.0(%rip), %r10
	leaq	(%rax,%rbp,4), %r11
.L18:
	movq	%r9, %rcx
	movq	%r10, %rax
	xorl	%edx, %edx
.L17:
	testl	%edx, %edx
	jne	.L16
	movl	(%r9), %edx
	addq	$8040, %rax
	addq	$8040, %rcx
	movl	%edx, (%r10)
	movl	$1, %edx
.L16:
	movl	(%rcx), %r8d
	addl	$1, %edx
	addl	-8040(%rax), %r8d
	addq	$8040, %rcx
	movl	%r8d, (%rax)
	addq	$8040, %rax
	cmpl	%edi, %edx
	jne	.L17
	addq	$4, %r9
	addq	$4, %r10
	cmpq	%r11, %r9
	jne	.L18
.L19:
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L11
	leal	-1(%rdi), %eax
	movslq	%esi, %rdx
	leaq	ruiseki.0(%rip), %rcx
	movslq	%edi, %rdi
	movslq	%eax, %r10
	movl	$0, (%rsp)
	movd	%r15d, %xmm5
	movq	%rcx, %r13
	imulq	$8044, %r10, %rax
	movq	%r10, 72(%rsp)
	movl	(%rcx,%rax), %r8d
	imulq	$8040, %rdx, %rax
	movl	%r8d, 20(%rsp)
	movd	%r8d, %xmm2
	leaq	(%rax,%rcx), %rbx
	leal	-1(%rsi), %eax
	pshufd	$0, %xmm2, %xmm3
	movl	%eax, 60(%rsp)
	leaq	0(,%rdx,4), %rax
	pshufd	$0, %xmm5, %xmm2
	movq	%rax, 64(%rsp)
	imulq	$2010, %rdi, %rax
	imulq	$8040, %rdi, %rdi
	addq	%rdx, %rax
	xorl	%edx, %edx
	leaq	-8040(%rcx,%rax,4), %r14
	movl	%esi, %eax
	leaq	-8040(%rcx,%rdi), %rbp
	shrl	$2, %eax
	movq	%rbp, 40(%rsp)
	subl	$1, %eax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 48(%rsp)
	movl	%esi, %eax
	andl	$-4, %eax
	movl	%eax, 56(%rsp)
	imulq	$2010, %r10, %rax
	movq	%rax, 8(%rsp)
.L23:
	movl	(%rsp), %eax
	cmpl	$2, 60(%rsp)
	leal	(%rax,%rsi), %edi
	movq	72(%rsp), %rax
	movl	(%rbx,%rax,4), %r10d
	movl	0(%r13,%rax,4), %eax
	movl	%eax, 24(%rsp)
	jbe	.L26
	movd	%edx, %xmm5
	movq	64(%rsp), %rdx
	movd	%eax, %xmm4
	movq	40(%rsp), %rbp
	pshufd	$0, %xmm5, %xmm1
	movq	48(%rsp), %r9
	movd	%r10d, %xmm5
	xorl	%eax, %eax
	leaq	(%rbx,%rdx), %r8
	pshufd	$0, %xmm5, %xmm5
	pshufd	$0, %xmm4, %xmm4
	addq	%r13, %rdx
.L21:
	movdqu	(%rbx,%rax), %xmm7
	movdqu	(%r8,%rax), %xmm0
	movdqu	0(%rbp,%rax), %xmm6
	psubd	%xmm7, %xmm0
	movdqu	(%rdx,%rax), %xmm7
	psubd	%xmm7, %xmm0
	movdqu	0(%r13,%rax), %xmm7
	paddd	%xmm7, %xmm0
	paddd	%xmm7, %xmm0
	movdqu	(%r14,%rax), %xmm7
	paddd	%xmm3, %xmm0
	psubd	%xmm5, %xmm0
	psubd	%xmm7, %xmm0
	movdqu	(%r8,%rax), %xmm7
	paddd	%xmm7, %xmm0
	movdqu	(%rbx,%rax), %xmm7
	paddd	%xmm6, %xmm0
	movdqu	(%rdx,%rax), %xmm6
	addq	$16, %rax
	psubd	%xmm7, %xmm0
	movdqa	%xmm2, %xmm7
	paddd	%xmm4, %xmm0
	psubd	%xmm6, %xmm0
	psubd	%xmm0, %xmm7
	movdqa	%xmm7, %xmm6
	pcmpgtd	%xmm0, %xmm6
	pand	%xmm6, %xmm7
	pandn	%xmm0, %xmm6
	por	%xmm7, %xmm6
	movdqa	%xmm6, %xmm0
	pcmpgtd	%xmm1, %xmm6
	pand	%xmm6, %xmm0
	pandn	%xmm1, %xmm6
	movdqa	%xmm6, %xmm1
	por	%xmm0, %xmm1
	cmpq	%rax, %r9
	jne	.L21
	movdqa	%xmm1, %xmm4
	movl	56(%rsp), %eax
	movq	%rbp, 40(%rsp)
	psrldq	$8, %xmm4
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm4
	pandn	%xmm1, %xmm0
	por	%xmm4, %xmm0
	movdqa	%xmm0, %xmm4
	psrldq	$4, %xmm4
	movdqa	%xmm4, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm4
	pandn	%xmm0, %xmm1
	por	%xmm4, %xmm1
	movd	%xmm1, %edx
	cmpl	%esi, %eax
	je	.L22
.L20:
	movslq	%edi, %rdi
	leal	(%rsi,%rax), %r9d
	movslq	%eax, %r12
	imulq	$2010, %rdi, %rdi
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r8
	movl	(%rcx,%r8,4), %r11d
	leaq	(%rdi,%r12), %r8
	movl	(%rcx,%r8,4), %r8d
	movl	%r11d, 28(%rsp)
	movl	%r8d, 32(%rsp)
	movslq	(%rsp), %r8
	imulq	$2010, %r8, %r8
	leaq	(%r8,%r9), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 36(%rsp)
	leaq	(%r8,%r12), %r11
	movl	(%rcx,%r11,4), %ebp
	movl	28(%rsp), %r11d
	subl	32(%rsp), %r11d
	subl	36(%rsp), %r11d
	leal	(%r11,%rbp,2), %r11d
	movq	8(%rsp), %rbp
	addl	20(%rsp), %r11d
	subl	%r10d, %r11d
	addq	%rbp, %r9
	subl	(%rcx,%r9,4), %r11d
	movq	%rbp, %r9
	addl	28(%rsp), %r11d
	addq	%r12, %r9
	addl	(%rcx,%r9,4), %r11d
	movl	%r11d, %r9d
	movl	%r15d, %r11d
	subl	32(%rsp), %r9d
	addl	24(%rsp), %r9d
	subl	36(%rsp), %r9d
	subl	%r9d, %r11d
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	cmpl	%r9d, %r11d
	movl	%r9d, %edx
	cmovge	%r11d, %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L22
	leal	(%r11,%rsi), %r9d
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r12
	movl	(%rcx,%r12,4), %r12d
	movl	%r12d, 36(%rsp)
	movslq	%r11d, %r12
	leaq	(%rdi,%r12), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 32(%rsp)
	leaq	(%r8,%r9), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 28(%rsp)
	leaq	(%r8,%r12), %r11
	movl	(%rcx,%r11,4), %ebp
	movl	36(%rsp), %r11d
	subl	32(%rsp), %r11d
	subl	28(%rsp), %r11d
	leal	(%r11,%rbp,2), %r11d
	movq	8(%rsp), %rbp
	addl	20(%rsp), %r11d
	subl	%r10d, %r11d
	addq	%rbp, %r9
	subl	(%rcx,%r9,4), %r11d
	movq	%rbp, %r9
	addl	36(%rsp), %r11d
	addq	%r12, %r9
	addl	(%rcx,%r9,4), %r11d
	movl	24(%rsp), %r9d
	movl	%r11d, %r12d
	subl	32(%rsp), %r12d
	movl	%r15d, %r11d
	addl	%r12d, %r9d
	subl	28(%rsp), %r9d
	subl	%r9d, %r11d
	cmpl	%r9d, %r11d
	cmovl	%r9d, %r11d
	cmpl	%r11d, %edx
	cmovl	%r11d, %edx
	addl	$2, %eax
	cmpl	%esi, %eax
	jge	.L22
	leal	(%rax,%rsi), %r9d
	cltq
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r11
	addq	%rax, %rdi
	movl	(%rcx,%r11,4), %ebp
	movl	(%rcx,%rdi,4), %r11d
	leaq	(%r8,%r9), %rdi
	addq	%rax, %r8
	movl	(%rcx,%rdi,4), %r12d
	movl	(%rcx,%r8,4), %r8d
	movl	%ebp, %edi
	subl	%r11d, %edi
	subl	%r12d, %edi
	leal	(%rdi,%r8,2), %edi
	addl	20(%rsp), %edi
	subl	%r10d, %edi
	movq	8(%rsp), %r10
	addq	%r10, %r9
	addq	%r10, %rax
	subl	(%rcx,%r9,4), %edi
	addl	%ebp, %edi
	addl	(%rcx,%rax,4), %edi
	movl	%edi, %eax
	movl	%r15d, %edi
	subl	%r11d, %eax
	addl	24(%rsp), %eax
	subl	%r12d, %eax
	subl	%eax, %edi
	cmpl	%eax, %edi
	cmovl	%eax, %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
.L22:
	addl	$1, (%rsp)
	movl	(%rsp), %eax
	addq	$8040, %rbx
	addq	$8040, %r13
	cmpl	%esi, %eax
	jne	.L23
.L11:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$120, %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
.L6:
	.cfi_restore_state
	movl	96(%rsp), %eax
	addl	$1, %r12d
	addl	%esi, %eax
	cltd
	idivl	%edi
	movl	100(%rsp), %eax
	movl	%edx, %ecx
	movl	%edx, 96(%rsp)
	cltd
	idivl	%edi
	movslq	%ecx, %rax
	imulq	$2010, %rax, %rax
	movl	%edx, 100(%rsp)
	movslq	%edx, %rdx
	addq	%rdx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	88(%rsp), %eax
	cmpl	%r12d, %eax
	jg	.L3
	jmp	.L37
.L26:
	xorl	%eax, %eax
	jmp	.L20
.L39:
	movl	92(%rsp), %esi
	leal	(%rsi,%rsi), %edi
	jmp	.L8
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.local	ruiseki.0
	.comm	ruiseki.0,16160400,32
	.local	ruisekitemp.1
	.comm	ruisekitemp.1,16160400,32
	.local	map.2
	.comm	map.2,16160400,32
	.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	"%d %d %c"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	leaq	map.2(%rip), %rbx
	movq	%rbx, %rbp
	subq	$120, %rsp
	.cfi_def_cfa_offset 176
	movq	%fs:40, %rax
	movq	%rax, 104(%rsp)
	xorl	%eax, %eax
	leaq	92(%rsp), %rdx
	leaq	88(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16088040(%rbx), %rsi
	movq	%rbx, %rdx
	xorl	%eax, %eax
.L2:
	leaq	8(%rdx), %rdi
	movq	%rdx, %rcx
	movq	$0, (%rdx)
	addq	$8040, %rdx
	andq	$-8, %rdi
	movq	$0, -44(%rdx)
	subq	%rdi, %rcx
	addl	$8004, %ecx
	shrl	$3, %ecx
	rep stosq
	cmpq	%rsi, %rdx
	jne	.L2
	movl	88(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L39
	leaq	87(%rsp), %r8
	leaq	96(%rsp), %r14
	movq	%rbx, %r15
	xorl	%r12d, %r12d
	leaq	100(%rsp), %r9
	movq	%r8, %rbx
	leaq	.LC1(%rip), %r13
	movq	%r14, %r8
	movq	%r9, %r14
.L3:
	movq	%r8, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	movq	%rbx, %rcx
	movq	%r14, %rdx
	movq	%r8, (%rsp)
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %esi
	cmpb	$87, 87(%rsp)
	movq	(%rsp), %r8
	leal	(%rsi,%rsi), %edi
	je	.L6
	movl	96(%rsp), %eax
	addl	$1, %r12d
	cltd
	idivl	%edi
	movl	100(%rsp), %eax
	movl	%edx, %ecx
	movl	%edx, 96(%rsp)
	cltd
	idivl	%edi
	movslq	%ecx, %rax
	imulq	$2010, %rax, %rax
	movl	%edx, 100(%rsp)
	movslq	%edx, %rdx
	addq	%rdx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	88(%rsp), %eax
	cmpl	%eax, %r12d
	jl	.L3
.L37:
	movq	%r15, %rbx
	movl	%eax, %r15d
.L8:
	testl	%edi, %edi
	jle	.L19
	leal	-1(%rdi), %ebp
	leaq	ruisekitemp.1(%rip), %r9
	movl	%edi, %r8d
	imulq	$8040, %rbp, %r11
	leaq	8040+map.2(%rip), %rax
	movq	%r9, %r10
	addq	%rax, %r11
.L15:
	movq	%r10, %rdx
	xorl	%eax, %eax
	jmp	.L14
.L12:
	movl	(%rbx,%rax,4), %ecx
	addq	$1, %rax
	addl	-4(%rdx), %ecx
	addq	$4, %rdx
	movl	%ecx, -4(%rdx)
	cmpq	%r8, %rax
	je	.L40
.L14:
	testq	%rax, %rax
	jne	.L12
	movl	(%rbx), %ecx
	addq	$1, %rax
	addq	$4, %rdx
	movl	%ecx, (%r10)
	cmpq	%r8, %rax
	jne	.L14
.L40:
	addq	$8040, %rbx
	addq	$8040, %r10
	cmpq	%r11, %rbx
	jne	.L15
	leaq	4+ruisekitemp.1(%rip), %rax
	leaq	ruiseki.0(%rip), %r10
	leaq	(%rax,%rbp,4), %r11
.L18:
	movq	%r9, %rcx
	movq	%r10, %rax
	xorl	%edx, %edx
.L17:
	testl	%edx, %edx
	jne	.L16
	movl	(%r9), %edx
	addq	$8040, %rax
	addq	$8040, %rcx
	movl	%edx, (%r10)
	movl	$1, %edx
.L16:
	movl	(%rcx), %r8d
	addl	$1, %edx
	addl	-8040(%rax), %r8d
	addq	$8040, %rcx
	movl	%r8d, (%rax)
	addq	$8040, %rax
	cmpl	%edi, %edx
	jne	.L17
	addq	$4, %r9
	addq	$4, %r10
	cmpq	%r11, %r9
	jne	.L18
.L19:
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L11
	leal	-1(%rdi), %eax
	movslq	%esi, %rdx
	leaq	ruiseki.0(%rip), %rcx
	movslq	%edi, %rdi
	movslq	%eax, %r10
	movl	$0, (%rsp)
	movd	%r15d, %xmm5
	movq	%rcx, %r13
	imulq	$8044, %r10, %rax
	movq	%r10, 72(%rsp)
	movl	(%rcx,%rax), %r8d
	imulq	$8040, %rdx, %rax
	movl	%r8d, 20(%rsp)
	movd	%r8d, %xmm2
	leaq	(%rax,%rcx), %rbx
	leal	-1(%rsi), %eax
	pshufd	$0, %xmm2, %xmm3
	movl	%eax, 60(%rsp)
	leaq	0(,%rdx,4), %rax
	pshufd	$0, %xmm5, %xmm2
	movq	%rax, 64(%rsp)
	imulq	$2010, %rdi, %rax
	imulq	$8040, %rdi, %rdi
	addq	%rdx, %rax
	xorl	%edx, %edx
	leaq	-8040(%rcx,%rax,4), %r14
	movl	%esi, %eax
	leaq	-8040(%rcx,%rdi), %rbp
	shrl	$2, %eax
	movq	%rbp, 40(%rsp)
	subl	$1, %eax
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 48(%rsp)
	movl	%esi, %eax
	andl	$-4, %eax
	movl	%eax, 56(%rsp)
	imulq	$2010, %r10, %rax
	movq	%rax, 8(%rsp)
.L23:
	movl	(%rsp), %eax
	cmpl	$2, 60(%rsp)
	leal	(%rax,%rsi), %edi
	movq	72(%rsp), %rax
	movl	(%rbx,%rax,4), %r10d
	movl	0(%r13,%rax,4), %eax
	movl	%eax, 24(%rsp)
	jbe	.L26
	movd	%edx, %xmm5
	movq	64(%rsp), %rdx
	movd	%eax, %xmm4
	movq	40(%rsp), %rbp
	pshufd	$0, %xmm5, %xmm1
	movq	48(%rsp), %r9
	movd	%r10d, %xmm5
	xorl	%eax, %eax
	leaq	(%rbx,%rdx), %r8
	pshufd	$0, %xmm5, %xmm5
	pshufd	$0, %xmm4, %xmm4
	addq	%r13, %rdx
.L21:
	movdqu	(%rbx,%rax), %xmm7
	movdqu	(%r8,%rax), %xmm0
	movdqu	0(%rbp,%rax), %xmm6
	psubd	%xmm7, %xmm0
	movdqu	(%rdx,%rax), %xmm7
	psubd	%xmm7, %xmm0
	movdqu	0(%r13,%rax), %xmm7
	paddd	%xmm7, %xmm0
	paddd	%xmm7, %xmm0
	movdqu	(%r14,%rax), %xmm7
	paddd	%xmm3, %xmm0
	psubd	%xmm5, %xmm0
	psubd	%xmm7, %xmm0
	movdqu	(%r8,%rax), %xmm7
	paddd	%xmm7, %xmm0
	movdqu	(%rbx,%rax), %xmm7
	paddd	%xmm6, %xmm0
	movdqu	(%rdx,%rax), %xmm6
	addq	$16, %rax
	psubd	%xmm7, %xmm0
	movdqa	%xmm2, %xmm7
	paddd	%xmm4, %xmm0
	psubd	%xmm6, %xmm0
	psubd	%xmm0, %xmm7
	movdqa	%xmm7, %xmm6
	pcmpgtd	%xmm0, %xmm6
	pand	%xmm6, %xmm7
	pandn	%xmm0, %xmm6
	por	%xmm7, %xmm6
	movdqa	%xmm6, %xmm0
	pcmpgtd	%xmm1, %xmm6
	pand	%xmm6, %xmm0
	pandn	%xmm1, %xmm6
	movdqa	%xmm6, %xmm1
	por	%xmm0, %xmm1
	cmpq	%rax, %r9
	jne	.L21
	movdqa	%xmm1, %xmm4
	movl	56(%rsp), %eax
	movq	%rbp, 40(%rsp)
	psrldq	$8, %xmm4
	movdqa	%xmm4, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm4
	pandn	%xmm1, %xmm0
	por	%xmm4, %xmm0
	movdqa	%xmm0, %xmm4
	psrldq	$4, %xmm4
	movdqa	%xmm4, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm4
	pandn	%xmm0, %xmm1
	por	%xmm4, %xmm1
	movd	%xmm1, %edx
	cmpl	%esi, %eax
	je	.L22
.L20:
	movslq	%edi, %rdi
	leal	(%rsi,%rax), %r9d
	movslq	%eax, %r12
	imulq	$2010, %rdi, %rdi
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r8
	movl	(%rcx,%r8,4), %r11d
	leaq	(%rdi,%r12), %r8
	movl	(%rcx,%r8,4), %r8d
	movl	%r11d, 28(%rsp)
	movl	%r8d, 32(%rsp)
	movslq	(%rsp), %r8
	imulq	$2010, %r8, %r8
	leaq	(%r8,%r9), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 36(%rsp)
	leaq	(%r8,%r12), %r11
	movl	(%rcx,%r11,4), %ebp
	movl	28(%rsp), %r11d
	subl	32(%rsp), %r11d
	subl	36(%rsp), %r11d
	leal	(%r11,%rbp,2), %r11d
	movq	8(%rsp), %rbp
	addl	20(%rsp), %r11d
	subl	%r10d, %r11d
	addq	%rbp, %r9
	subl	(%rcx,%r9,4), %r11d
	movq	%rbp, %r9
	addl	28(%rsp), %r11d
	addq	%r12, %r9
	addl	(%rcx,%r9,4), %r11d
	movl	%r11d, %r9d
	movl	%r15d, %r11d
	subl	32(%rsp), %r9d
	addl	24(%rsp), %r9d
	subl	36(%rsp), %r9d
	subl	%r9d, %r11d
	cmpl	%edx, %r9d
	cmovl	%edx, %r9d
	cmpl	%r9d, %r11d
	movl	%r9d, %edx
	cmovge	%r11d, %edx
	leal	1(%rax), %r11d
	cmpl	%esi, %r11d
	jge	.L22
	leal	(%r11,%rsi), %r9d
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r12
	movl	(%rcx,%r12,4), %r12d
	movl	%r12d, 36(%rsp)
	movslq	%r11d, %r12
	leaq	(%rdi,%r12), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 32(%rsp)
	leaq	(%r8,%r9), %r11
	movl	(%rcx,%r11,4), %r11d
	movl	%r11d, 28(%rsp)
	leaq	(%r8,%r12), %r11
	movl	(%rcx,%r11,4), %ebp
	movl	36(%rsp), %r11d
	subl	32(%rsp), %r11d
	subl	28(%rsp), %r11d
	leal	(%r11,%rbp,2), %r11d
	movq	8(%rsp), %rbp
	addl	20(%rsp), %r11d
	subl	%r10d, %r11d
	addq	%rbp, %r9
	subl	(%rcx,%r9,4), %r11d
	movq	%rbp, %r9
	addl	36(%rsp), %r11d
	addq	%r12, %r9
	addl	(%rcx,%r9,4), %r11d
	movl	24(%rsp), %r9d
	movl	%r11d, %r12d
	subl	32(%rsp), %r12d
	movl	%r15d, %r11d
	addl	%r12d, %r9d
	subl	28(%rsp), %r9d
	subl	%r9d, %r11d
	cmpl	%r9d, %r11d
	cmovl	%r9d, %r11d
	cmpl	%r11d, %edx
	cmovl	%r11d, %edx
	addl	$2, %eax
	cmpl	%esi, %eax
	jge	.L22
	leal	(%rax,%rsi), %r9d
	cltq
	movslq	%r9d, %r9
	leaq	(%rdi,%r9), %r11
	addq	%rax, %rdi
	movl	(%rcx,%r11,4), %ebp
	movl	(%rcx,%rdi,4), %r11d
	leaq	(%r8,%r9), %rdi
	addq	%rax, %r8
	movl	(%rcx,%rdi,4), %r12d
	movl	(%rcx,%r8,4), %r8d
	movl	%ebp, %edi
	subl	%r11d, %edi
	subl	%r12d, %edi
	leal	(%rdi,%r8,2), %edi
	addl	20(%rsp), %edi
	subl	%r10d, %edi
	movq	8(%rsp), %r10
	addq	%r10, %r9
	addq	%r10, %rax
	subl	(%rcx,%r9,4), %edi
	addl	%ebp, %edi
	addl	(%rcx,%rax,4), %edi
	movl	%edi, %eax
	movl	%r15d, %edi
	subl	%r11d, %eax
	addl	24(%rsp), %eax
	subl	%r12d, %eax
	subl	%eax, %edi
	cmpl	%eax, %edi
	cmovl	%eax, %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
.L22:
	addl	$1, (%rsp)
	movl	(%rsp), %eax
	addq	$8040, %rbx
	addq	$8040, %r13
	cmpl	%esi, %eax
	jne	.L23
.L11:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	104(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$120, %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
.L6:
	.cfi_restore_state
	movl	96(%rsp), %eax
	addl	$1, %r12d
	addl	%esi, %eax
	cltd
	idivl	%edi
	movl	100(%rsp), %eax
	movl	%edx, %ecx
	movl	%edx, 96(%rsp)
	cltd
	idivl	%edi
	movslq	%ecx, %rax
	imulq	$2010, %rax, %rax
	movl	%edx, 100(%rsp)
	movslq	%edx, %rdx
	addq	%rdx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	88(%rsp), %eax
	cmpl	%r12d, %eax
	jg	.L3
	jmp	.L37
.L26:
	xorl	%eax, %eax
	jmp	.L20
.L39:
	movl	92(%rsp), %esi
	leal	(%rsi,%rsi), %edi
	jmp	.L8
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.local	ruiseki.0
	.comm	ruiseki.0,16160400,32
	.local	ruisekitemp.1
	.comm	ruisekitemp.1,16160400,32
	.local	map.2
	.comm	map.2,16160400,32
	.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 <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))

int main(void)
{
	//変数の宣言
	int n,m;
	int x,y;
	char c;
	static int map[2010][2010];
	static int ruiseki[2010][2010];
	static int ruisekitemp[2010][2010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int sum=0;
	int temp,temp1,temp2;
	//int max,min;
	int len;
	//データの読み込み
	
	scanf("%d %d",&n,&m);
	
	for(i=0;i<=2000;i++){
		for(j=0;j<=2000;j++){
			map[i][j]=0;
		}
	}
	
	for(i=0;i<n;i++){
		scanf("%d %d %c",&x,&y,&c);
		if(c=='W') x=x+m;
		x=x%(2*m);
		y=y%(2*m);
		map[x][y]=map[x][y]+1;
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	//二次元累積和の計算
	
	for(i=0;i<2*m;i++){
		for(j=0;j<2*m;j++){
			if(j==0){
			ruisekitemp[i][0]=map[i][0];
			}else{
				ruisekitemp[i][j]=ruisekitemp[i][j-1]+map[i][j];
			}
		}
	}
	
	for(j=0;j<2*m;j++){
		for(i=0;i<2*m;i++){
			if(i==0){
				ruiseki[0][j]=ruisekitemp[0][j];
			}else{
				ruiseki[i][j]=ruiseki[i-1][j]+ruisekitemp[i][j];
			}
		}
	}
	
	for(i=0;i<m;i++){
		for(j=0;j<m;j++){
			temp=0;
			temp=temp+ruiseki[i+m][j+m]-ruiseki[i+m][j]-ruiseki[i][j+m]+ruiseki[i][j];
			temp=temp+ruiseki[i][j];
			temp=temp+ruiseki[2*m-1][2*m-1]-ruiseki[i+m][2*m-1]-ruiseki[2*m-1][j+m]+ruiseki[i+m][j+m];
			temp=temp+ruiseki[2*m-1][j]-ruiseki[i+m][j];
			temp=temp+ruiseki[i][2*m-1]-ruiseki[i][j+m];
			if(temp<n-temp) temp=n-temp;
			if(temp>ans) ans=temp;
		}
	}
	
	
	
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}


6 2
1 2 B
2 1 W
0 2 B
1 0 B
0 6 W
4 5 W
 4 3
0 1 W
1 0 W
5 3 B
5 4 B
 2 1000
1 0 B
0 1 W
 2 0001
1 -1 B
0 1 X
 0 0001
1 -1 B
-1 1 W
 6 2
1 0 B
2 1 W
2 2 B
1 0 B
0 6 W
4 5 W
 6 2
0 2 B
2 1 W
0 2 B
1 0 B
0 6 W
4 5 W
 4 3
0 1 W
2 0 W
5 3 B
5 4 B
 2 1000
1 0 B
0 1 X
 6 2
0 2 B
2 1 W
0 2 B
1 0 B
0 6 W
0 5 W

3 4 2 2 0 5 4 3 2 4
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 <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))

int main(void)
{
	//変数の宣言
	int n,m;
	int x,y;
	char c;
	static int map[2010][2010];
	static int ruiseki[2010][2010];
	static int ruisekitemp[2010][2010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	int sum=0;
	int temp,temp1,temp2;
	//int max,min;
	int len;
	//データの読み込み
	
	scanf("%d %d",&n,&m);
	
	for(i=0;i<=2000;i++){
		for(j=0;j<=2000;j++){
			map[i][j]=0;
		}
	}
	
	for(i=0;i<n;i++){
		scanf("%d %d %c",&x,&y,&c);
		if(c=='W') x=x+m;
		x=x%(2*m);
		y=y%(2*m);
		map[x][y]=map[x][y]+1;
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	//二次元累積和の計算
	
	for(i=0;i<2*m;i++){
		for(j=0;j<2*m;j++){
			if(j==0){
			ruisekitemp[i][0]=map[i][0];
			}else{
				ruisekitemp[i][j]=ruisekitemp[i][j-1]+map[i][j];
			}
		}
	}
	
	for(j=0;j<2*m;j++){
		for(i=0;i<2*m;i++){
			if(i==0){
				ruiseki[0][j]=ruisekitemp[0][j];
			}else{
				ruiseki[i][j]=ruiseki[i-1][j]+ruisekitemp[i][j];
			}
		}
	}
	
	for(i=0;i<m;i++){
		for(j=0;j<m;j++){
			temp=0;
			temp=temp+ruiseki[i+m][j+m]-ruiseki[i+m][j]-ruiseki[i][j+m]+ruiseki[i][j];
			temp=temp+ruiseki[i][j];
			temp=temp+ruiseki[2*m-1][2*m-1]-ruiseki[i+m][2*m-1]-ruiseki[2*m-1][j+m]+ruiseki[i+m][j+m];
			temp=temp+ruiseki[2*m-1][j]-ruiseki[i+m][j];
			temp=temp+ruiseki[i][2*m-1]-ruiseki[i][j+m];
			if(temp<n-temp) temp=n-temp;
			if(temp>ans) ans=temp;
		}
	}
	
	
	
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%d",ans);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L5:
	movl	$0, -32(%rbp)
	jmp	.L3
.L4:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L3:
	cmpl	$2000, -32(%rbp)
	jle	.L4
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2000, -36(%rbp)
	jle	.L5
	movl	$0, -36(%rbp)
	jmp	.L6
.L8:
	leaq	-53(%rbp), %rcx
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-53(%rbp), %eax
	cmpb	$87, %al
	jne	.L7
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -44(%rbp)
.L7:
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -36(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L14:
	movl	$0, -32(%rbp)
	jmp	.L10
.L13:
	cmpl	$0, -32(%rbp)
	jne	.L11
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	map.2(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	ruisekitemp.1(%rip), %rcx
	movl	%edx, (%rax,%rcx)
	jmp	.L12
.L11:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L12:
	addl	$1, -32(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L13
	addl	$1, -36(%rbp)
.L9:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	movl	$0, -32(%rbp)
	jmp	.L15
.L20:
	movl	$0, -36(%rbp)
	jmp	.L16
.L19:
	cmpl	$0, -36(%rbp)
	jne	.L17
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ruiseki.0(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L18:
	addl	$1, -36(%rbp)
.L16:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L19
	addl	$1, -32(%rbp)
.L15:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L20
	movl	$0, -36(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	jmp	.L22
.L25:
	movl	$0, -24(%rbp)
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movl	-48(%rbp), %esi
	movl	-32(%rbp), %edx
	addl	%esi, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%esi, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L23
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, -24(%rbp)
.L23:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L24
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
.L24:
	addl	$1, -32(%rbp)
.L22:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L25
	addl	$1, -36(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L26
	movl	-28(%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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.local	map.2
	.comm	map.2,16160400,32
	.local	ruisekitemp.1
	.comm	ruisekitemp.1,16160400,32
	.local	ruiseki.0
	.comm	ruiseki.0,16160400,32
	.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	"%d %d %c"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L5:
	movl	$0, -32(%rbp)
	jmp	.L3
.L4:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L3:
	cmpl	$2000, -32(%rbp)
	jle	.L4
	addl	$1, -36(%rbp)
.L2:
	cmpl	$2000, -36(%rbp)
	jle	.L5
	movl	$0, -36(%rbp)
	jmp	.L6
.L8:
	leaq	-53(%rbp), %rcx
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-53(%rbp), %eax
	cmpb	$87, %al
	jne	.L7
	movl	-44(%rbp), %edx
	movl	-48(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -44(%rbp)
.L7:
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	movl	-48(%rbp), %edx
	leal	(%rdx,%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -36(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, -36(%rbp)
	jmp	.L9
.L14:
	movl	$0, -32(%rbp)
	jmp	.L10
.L13:
	cmpl	$0, -32(%rbp)
	jne	.L11
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	map.2(%rip), %rdx
	movl	(%rax,%rdx), %edx
	movl	-36(%rbp), %eax
	cltq
	imulq	$8040, %rax, %rax
	leaq	ruisekitemp.1(%rip), %rcx
	movl	%edx, (%rax,%rcx)
	jmp	.L12
.L11:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	map.2(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L12:
	addl	$1, -32(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L13
	addl	$1, -36(%rbp)
.L9:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L14
	movl	$0, -32(%rbp)
	jmp	.L15
.L20:
	movl	$0, -36(%rbp)
	jmp	.L16
.L19:
	cmpl	$0, -36(%rbp)
	jne	.L17
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ruiseki.0(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	jmp	.L18
.L17:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruisekitemp.1(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L18:
	addl	$1, -36(%rbp)
.L16:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L19
	addl	$1, -32(%rbp)
.L15:
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L20
	movl	$0, -36(%rbp)
	jmp	.L21
.L26:
	movl	$0, -32(%rbp)
	jmp	.L22
.L25:
	movl	$0, -24(%rbp)
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -24(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movl	-48(%rbp), %esi
	movl	-32(%rbp), %edx
	addl	%esi, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%edx, %eax
	movl	-48(%rbp), %ecx
	movl	-32(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%esi, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-48(%rbp), %eax
	addl	%eax, %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-24(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$2010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	ruiseki.0(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	%ecx, %eax
	subl	%edx, %eax
	movl	%eax, -24(%rbp)
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L23
	movl	-52(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, -24(%rbp)
.L23:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L24
	movl	-24(%rbp), %eax
	movl	%eax, -28(%rbp)
.L24:
	addl	$1, -32(%rbp)
.L22:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L25
	addl	$1, -36(%rbp)
.L21:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L26
	movl	-28(%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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.local	map.2
	.comm	map.2,16160400,32
	.local	ruisekitemp.1
	.comm	ruisekitemp.1,16160400,32
	.local	ruiseki.0
	.comm	ruiseki.0,16160400,32
	.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:
