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>

int **can_num;

void set(int x1, int y1, int x2, int y2){
	can_num[x1][y1]++;
	can_num[x1][y2 + 1]--;
	can_num[x2 + 1][y1]--;
	can_num[x2 + 1][y2 + 1]++;
}

int max(int a, int b){
	return a >= b ? a : b;
}

int main(){
	int N, K, i, j, X, Y, ans = 0;
	scanf("%d%d", &N, &K);
	int *x = (int *)malloc(sizeof(int) * N);
	int *y = (int *)malloc(sizeof(int) * N);
	char *c = (char *)malloc(sizeof(char) * N);
	for(i = 0; i < N; i++){
//		printf("i = %d\n", i);
		scanf("%d %d %c", &x[i], &y[i], &c[i]);
	}
	can_num = (int **)malloc(sizeof(int *) * (2 * K + 1));
	for(i = 0; i <= 2 * K; i++){
		can_num[i] = (int *)malloc(sizeof(int) * (K + 1));
		for(j = 0; j <= K; j++){
			can_num[i][j] = 0;
		}
	}
	for(i = 0; i < N; i++){
		X = x[i] % K;
		Y = y[i] % K;
		if((x[i] / K + y[i] / K) % 2 == 1){
			if(c[i] == 'B'){
				c[i] = 'W';
			}
			else{
				c[i] = 'B';
			}
		}
		if(c[i] == 'B'){
			set(0, 0, X, Y);
			set(X + 1, Y + 1, X + K, K - 1);
			set(X + K + 1, 0, 2 * K - 1, Y);
		}
		else{
			set(0, Y + 1, X, K - 1);
			set(X + 1, 0, X + K, Y);
			set(X + K + 1, Y + 1, 2 * K - 1, K - 1);
		}
	}
	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			if(i == 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1];
			}
			else if(i > 0 && j == 0){
				can_num[i][j] += can_num[i - 1][j];
			}
			else if(i > 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1] + can_num[i - 1][j] - can_num[i - 1][j - 1];
			}
			ans = max(ans, can_num[i][j]);
		}
	}
/*	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			printf("can_num[%d][%d] = %d  ", i, j, can_num[i][j]);
		}
		printf("\n");
	}
*/	printf("%d\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	can_num
	.bss
	.align 8
	.type	can_num, @object
	.size	can_num, 8
can_num:
	.zero	8
	.text
	.globl	set
	.type	set, @function
set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	set, .-set
	.globl	max
	.type	max, @function
max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -60(%rbp)
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-76(%rbp), %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L5
.L6:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -68(%rbp)
.L5:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L6
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, can_num(%rip)
	movl	$0, -68(%rbp)
	jmp	.L7
.L10:
	movl	-72(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	can_num(%rip), %rcx
	movl	-68(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -64(%rbp)
	jmp	.L8
.L9:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -64(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L9
	addl	$1, -68(%rbp)
.L7:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L10
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -56(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -52(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	movl	%eax, %esi
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	addl	%esi, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L13
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$87, (%rax)
	jmp	.L12
.L13:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$66, (%rax)
.L12:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L14
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-72(%rbp), %ecx
	movl	-56(%rbp), %eax
	addl	%ecx, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	jmp	.L15
.L14:
	movl	-72(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-72(%rbp), %edi
	movl	-56(%rbp), %eax
	addl	%edi, %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
.L15:
	addl	$1, -68(%rbp)
.L11:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	$0, -68(%rbp)
	jmp	.L17
.L23:
	movl	$0, -64(%rbp)
	jmp	.L18
.L22:
	cmpl	$0, -68(%rbp)
	jne	.L19
	cmpl	$0, -64(%rbp)
	jle	.L19
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L19:
	cmpl	$0, -68(%rbp)
	jle	.L21
	cmpl	$0, -64(%rbp)
	jne	.L21
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L21:
	cmpl	$0, -68(%rbp)
	jle	.L20
	cmpl	$0, -64(%rbp)
	jle	.L20
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	(%rcx,%rsi), %edx
	movl	%edx, (%rax)
.L20:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -60(%rbp)
	addl	$1, -64(%rbp)
.L18:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L22
	addl	$1, -68(%rbp)
.L17:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L23
	movl	-60(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.p2align 4
	.globl	set
	.type	set, @function
set:
.LFB39:
	.cfi_startproc
	endbr64
	movq	can_num(%rip), %r9
	movslq	%edi, %rdi
	movslq	%edx, %r8
	movslq	%esi, %rsi
	movslq	%ecx, %rcx
	salq	$2, %rsi
	movq	(%r9,%rdi,8), %rdx
	leaq	4(,%rcx,4), %rax
	addl	$1, (%rdx,%rsi)
	subl	$1, (%rdx,%rax)
	movq	8(%r9,%r8,8), %rdx
	subl	$1, (%rdx,%rsi)
	addl	$1, (%rdx,%rax)
	ret
	.cfi_endproc
.LFE39:
	.size	set, .-set
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	48(%rsp), %r12
	leaq	0(,%r12,4), %r14
	movq	%r14, %rdi
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%r12d, %r12d
	jle	.L63
	movq	%r14, %r15
	xorl	%r12d, %r12d
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rbx,%r12), %rcx
	movq	%r15, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	addq	$1, %r12
	addq	$4, %rbp
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %eax
	cmpl	%r12d, %eax
	jg	.L6
	movl	%eax, %ebp
.L5:
	movslq	52(%rsp), %r12
	leal	(%r12,%r12), %edx
	leal	1(%rdx), %edi
	movl	%edx, 8(%rsp)
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movl	8(%rsp), %edx
	movq	%rax, can_num(%rip)
	movq	%rax, %r15
	testl	%edx, %edx
	js	.L12
	leal	1(%r12), %esi
	movl	%ebp, 12(%rsp)
	movslq	%esi, %rax
	movl	%esi, 8(%rsp)
	leaq	0(,%rax,4), %rdi
	movslq	%edx, %rax
	movq	%r15, 16(%rsp)
	leaq	8(%r15,%rax,8), %rdx
	movl	%esi, %eax
	andl	$-4, %esi
	movq	%r13, 24(%rsp)
	shrl	$2, %eax
	movq	%r14, 32(%rsp)
	movq	%rdi, %r13
	movl	%r12d, %r14d
	subl	$1, %eax
	movq	%rbx, 40(%rsp)
	movq	%r15, %r12
	movl	%esi, %ebp
	addq	$1, %rax
	movq	%rdx, %r15
	salq	$4, %rax
	movq	%rax, %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r13, %rdi
	call	malloc@PLT
	testl	%r14d, %r14d
	pxor	%xmm0, %xmm0
	movq	%rax, (%r12)
	movq	%rax, %rdx
	js	.L16
	cmpl	$2, %r14d
	jbe	.L35
	leaq	(%rbx,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L14:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L14
	movl	%ebp, %eax
	cmpl	8(%rsp), %ebp
	je	.L16
.L13:
	movslq	%eax, %rcx
	movl	$0, (%rdx,%rcx,4)
	leaq	0(,%rcx,4), %rdi
	leal	1(%rax), %ecx
	cmpl	%ecx, %r14d
	jl	.L16
	addl	$2, %eax
	movl	$0, 4(%rdx,%rdi)
	cmpl	%eax, %r14d
	jl	.L16
	movl	$0, 8(%rdx,%rdi)
.L16:
	addq	$8, %r12
	cmpq	%r15, %r12
	jne	.L11
	movslq	%r14d, %r12
	movl	12(%rsp), %ebp
	movq	16(%rsp), %r15
	movq	24(%rsp), %r13
	movq	40(%rsp), %rbx
	movq	32(%rsp), %r14
.L12:
	movl	52(%rsp), %edi
	testl	%ebp, %ebp
	jle	.L9
	movq	(%r15), %r10
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L20:
	cmpb	$66, %dil
	je	.L23
.L22:
	leal	1(%rdx), %eax
	movslq	%esi, %rdx
	salq	$2, %r12
	movq	8(%r15,%rdx,8), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	addl	$1, (%r10,%rax)
	subl	$1, (%r10,%r12)
	subl	$1, (%rcx)
	addl	$1, (%rdx,%r12)
	movl	52(%rsp), %edi
	addl	$1, (%rdx)
	addl	%esi, %edi
	subl	$1, (%rcx)
	movslq	%edi, %rdx
	movq	8(%r15,%rdx,8), %rdx
	subl	$1, (%rdx)
	addl	$1, (%rdx,%rax)
	movl	52(%rsp), %edx
	leal	1(%rdx,%rsi), %ecx
	movslq	%ecx, %rcx
	movq	(%r15,%rcx,8), %rsi
	movslq	%edx, %rcx
	addl	%edx, %edx
	movslq	%edx, %rdx
	salq	$2, %rcx
	movq	(%r15,%rdx,8), %rdx
	addl	$1, (%rsi,%rax)
	subl	$1, (%rsi,%rcx)
	subl	$1, (%rdx,%rax)
	addl	$1, (%rdx,%rcx)
.L24:
	movl	52(%rsp), %edi
	addq	$1, %r9
	movslq	%edi, %r12
	cmpl	%r9d, 48(%rsp)
	jle	.L9
.L25:
	movl	0(%r13,%r9,4), %eax
	movzbl	(%rbx,%r9), %edi
	cltd
	idivl	%r12d
	movl	%eax, %ecx
	movl	(%r14,%r9,4), %eax
	movl	%edx, %esi
	cltd
	idivl	%r12d
	addl	%ecx, %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	andl	$1, %eax
	subl	%ecx, %eax
	cmpl	$1, %eax
	jne	.L20
	cmpb	$66, %dil
	je	.L65
	movb	$66, (%rbx,%r9)
.L23:
	movslq	%edx, %rdx
	addl	$1, (%r10)
	leaq	4(,%rdx,4), %rax
	movslq	%esi, %rdx
	movq	8(%r15,%rdx,8), %rdi
	subl	$1, (%r10,%rax)
	leaq	(%rdi,%rax), %r8
	subl	$1, (%rdi)
	movl	(%r8), %edx
	leal	1(%rdx), %ecx
	addl	$2, %edx
	movl	%ecx, (%r8)
	movl	52(%rsp), %ecx
	movl	%edx, (%r8)
	movslq	%ecx, %rdx
	addl	%esi, %ecx
	movslq	%ecx, %rcx
	salq	$2, %rdx
	movq	8(%r15,%rcx,8), %rcx
	subl	$1, (%rdi,%rdx)
	subl	$1, (%rcx,%rax)
	addl	$1, (%rcx,%rdx)
	movl	52(%rsp), %edx
	leal	1(%rdx,%rsi), %ecx
	addl	%edx, %edx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	movq	(%r15,%rcx,8), %rcx
	movq	(%r15,%rdx,8), %rdx
	addl	$1, (%rcx)
	subl	$1, (%rcx,%rax)
	subl	$1, (%rdx)
	addl	$1, (%rdx,%rax)
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	-8(%r15), %r12
	xorl	%r8d, %r8d
	xorl	%ebx, %ebx
	testl	%edi, %edi
	js	.L19
	.p2align 4,,10
	.p2align 3
.L31:
	testl	%ebx, %ebx
	movq	8(%r12), %rsi
	sete	%r11b
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L67:
	movq	(%r15), %rcx
	movl	-4(%rcx,%rax), %edi
	addl	%edi, (%rcx,%rax)
	movl	(%rsi,%rax), %ecx
	movl	52(%rsp), %edi
.L27:
	cmpl	%ecx, %r8d
	cmovl	%ecx, %r8d
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edi, %edx
	jg	.L66
.L29:
	testl	%edx, %edx
	setg	%r9b
	jle	.L26
	testb	%r11b, %r11b
	jne	.L67
.L26:
	testl	%ebx, %ebx
	setg	%r10b
	testl	%edx, %edx
	jne	.L28
	testb	%r10b, %r10b
	je	.L28
	movq	(%r12), %rcx
	movl	(%rcx), %ecx
	addl	%ecx, (%rsi)
	movl	(%rsi,%rax), %ecx
	movl	52(%rsp), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%rsi,%rax), %ecx
	testb	%r9b, %r9b
	je	.L27
	testb	%r10b, %r10b
	je	.L27
	movq	(%r12), %r9
	movl	-4(%rsi,%rax), %edi
	addl	(%r9,%rax), %edi
	subl	-4(%r9,%rax), %edi
	addl	%edi, %ecx
	movl	%ecx, (%rsi,%rax)
	movl	52(%rsp), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L66:
	addl	$1, %ebx
	leal	(%rdi,%rdi), %eax
	cmpl	%eax, %ebx
	jg	.L19
	addq	$8, %r12
	testl	%edi, %edi
	jns	.L31
.L19:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L68
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L65:
	.cfi_restore_state
	movb	$87, (%rbx,%r9)
	jmp	.L22
.L35:
	xorl	%eax, %eax
	jmp	.L13
.L63:
	movq	%r12, %rbp
	jmp	.L5
.L68:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	can_num
	.bss
	.align 8
	.type	can_num, @object
	.size	can_num, 8
can_num:
	.zero	8
	.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
	.p2align 4
	.globl	set
	.type	set, @function
set:
.LFB39:
	.cfi_startproc
	endbr64
	movq	can_num(%rip), %r9
	movslq	%edi, %rdi
	movslq	%edx, %r8
	movslq	%esi, %rsi
	movslq	%ecx, %rcx
	salq	$2, %rsi
	movq	(%r9,%rdi,8), %rdx
	leaq	4(,%rcx,4), %rax
	addl	$1, (%rdx,%rsi)
	subl	$1, (%rdx,%rax)
	movq	8(%r9,%r8,8), %rdx
	subl	$1, (%rdx,%rsi)
	addl	$1, (%rdx,%rax)
	ret
	.cfi_endproc
.LFE39:
	.size	set, .-set
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rdx
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	48(%rsp), %r12
	leaq	0(,%r12,4), %r14
	movq	%r14, %rdi
	call	malloc@PLT
	movq	%r14, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r14
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%r12d, %r12d
	jle	.L63
	movq	%r14, %r15
	xorl	%r12d, %r12d
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rbx,%r12), %rcx
	movq	%r15, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	addq	$1, %r12
	addq	$4, %rbp
	addq	$4, %r15
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %eax
	cmpl	%r12d, %eax
	jg	.L6
	movl	%eax, %ebp
.L5:
	movslq	52(%rsp), %r12
	leal	(%r12,%r12), %edx
	leal	1(%rdx), %edi
	movl	%edx, 8(%rsp)
	movslq	%edi, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movl	8(%rsp), %edx
	movq	%rax, can_num(%rip)
	movq	%rax, %r15
	testl	%edx, %edx
	js	.L12
	leal	1(%r12), %esi
	movl	%ebp, 12(%rsp)
	movslq	%esi, %rax
	movl	%esi, 8(%rsp)
	leaq	0(,%rax,4), %rdi
	movslq	%edx, %rax
	movq	%r15, 16(%rsp)
	leaq	8(%r15,%rax,8), %rdx
	movl	%esi, %eax
	andl	$-4, %esi
	movq	%r13, 24(%rsp)
	shrl	$2, %eax
	movq	%r14, 32(%rsp)
	movq	%rdi, %r13
	movl	%r12d, %r14d
	subl	$1, %eax
	movq	%rbx, 40(%rsp)
	movq	%r15, %r12
	movl	%esi, %ebp
	addq	$1, %rax
	movq	%rdx, %r15
	salq	$4, %rax
	movq	%rax, %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r13, %rdi
	call	malloc@PLT
	testl	%r14d, %r14d
	pxor	%xmm0, %xmm0
	movq	%rax, (%r12)
	movq	%rax, %rdx
	js	.L16
	cmpl	$2, %r14d
	jbe	.L35
	leaq	(%rbx,%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L14:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L14
	movl	%ebp, %eax
	cmpl	8(%rsp), %ebp
	je	.L16
.L13:
	movslq	%eax, %rcx
	movl	$0, (%rdx,%rcx,4)
	leaq	0(,%rcx,4), %rdi
	leal	1(%rax), %ecx
	cmpl	%ecx, %r14d
	jl	.L16
	addl	$2, %eax
	movl	$0, 4(%rdx,%rdi)
	cmpl	%eax, %r14d
	jl	.L16
	movl	$0, 8(%rdx,%rdi)
.L16:
	addq	$8, %r12
	cmpq	%r15, %r12
	jne	.L11
	movslq	%r14d, %r12
	movl	12(%rsp), %ebp
	movq	16(%rsp), %r15
	movq	24(%rsp), %r13
	movq	40(%rsp), %rbx
	movq	32(%rsp), %r14
.L12:
	movl	52(%rsp), %edi
	testl	%ebp, %ebp
	jle	.L9
	movq	(%r15), %r10
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L20:
	cmpb	$66, %dil
	je	.L23
.L22:
	leal	1(%rdx), %eax
	movslq	%esi, %rdx
	salq	$2, %r12
	movq	8(%r15,%rdx,8), %rdx
	cltq
	salq	$2, %rax
	leaq	(%rdx,%rax), %rcx
	addl	$1, (%r10,%rax)
	subl	$1, (%r10,%r12)
	subl	$1, (%rcx)
	addl	$1, (%rdx,%r12)
	movl	52(%rsp), %edi
	addl	$1, (%rdx)
	addl	%esi, %edi
	subl	$1, (%rcx)
	movslq	%edi, %rdx
	movq	8(%r15,%rdx,8), %rdx
	subl	$1, (%rdx)
	addl	$1, (%rdx,%rax)
	movl	52(%rsp), %edx
	leal	1(%rdx,%rsi), %ecx
	movslq	%ecx, %rcx
	movq	(%r15,%rcx,8), %rsi
	movslq	%edx, %rcx
	addl	%edx, %edx
	movslq	%edx, %rdx
	salq	$2, %rcx
	movq	(%r15,%rdx,8), %rdx
	addl	$1, (%rsi,%rax)
	subl	$1, (%rsi,%rcx)
	subl	$1, (%rdx,%rax)
	addl	$1, (%rdx,%rcx)
.L24:
	movl	52(%rsp), %edi
	addq	$1, %r9
	movslq	%edi, %r12
	cmpl	%r9d, 48(%rsp)
	jle	.L9
.L25:
	movl	0(%r13,%r9,4), %eax
	movzbl	(%rbx,%r9), %edi
	cltd
	idivl	%r12d
	movl	%eax, %ecx
	movl	(%r14,%r9,4), %eax
	movl	%edx, %esi
	cltd
	idivl	%r12d
	addl	%ecx, %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	andl	$1, %eax
	subl	%ecx, %eax
	cmpl	$1, %eax
	jne	.L20
	cmpb	$66, %dil
	je	.L65
	movb	$66, (%rbx,%r9)
.L23:
	movslq	%edx, %rdx
	addl	$1, (%r10)
	leaq	4(,%rdx,4), %rax
	movslq	%esi, %rdx
	movq	8(%r15,%rdx,8), %rdi
	subl	$1, (%r10,%rax)
	leaq	(%rdi,%rax), %r8
	subl	$1, (%rdi)
	movl	(%r8), %edx
	leal	1(%rdx), %ecx
	addl	$2, %edx
	movl	%ecx, (%r8)
	movl	52(%rsp), %ecx
	movl	%edx, (%r8)
	movslq	%ecx, %rdx
	addl	%esi, %ecx
	movslq	%ecx, %rcx
	salq	$2, %rdx
	movq	8(%r15,%rcx,8), %rcx
	subl	$1, (%rdi,%rdx)
	subl	$1, (%rcx,%rax)
	addl	$1, (%rcx,%rdx)
	movl	52(%rsp), %edx
	leal	1(%rdx,%rsi), %ecx
	addl	%edx, %edx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	movq	(%r15,%rcx,8), %rcx
	movq	(%r15,%rdx,8), %rdx
	addl	$1, (%rcx)
	subl	$1, (%rcx,%rax)
	subl	$1, (%rdx)
	addl	$1, (%rdx,%rax)
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	-8(%r15), %r12
	xorl	%r8d, %r8d
	xorl	%ebx, %ebx
	testl	%edi, %edi
	js	.L19
	.p2align 4,,10
	.p2align 3
.L31:
	testl	%ebx, %ebx
	movq	8(%r12), %rsi
	sete	%r11b
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L67:
	movq	(%r15), %rcx
	movl	-4(%rcx,%rax), %edi
	addl	%edi, (%rcx,%rax)
	movl	(%rsi,%rax), %ecx
	movl	52(%rsp), %edi
.L27:
	cmpl	%ecx, %r8d
	cmovl	%ecx, %r8d
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edi, %edx
	jg	.L66
.L29:
	testl	%edx, %edx
	setg	%r9b
	jle	.L26
	testb	%r11b, %r11b
	jne	.L67
.L26:
	testl	%ebx, %ebx
	setg	%r10b
	testl	%edx, %edx
	jne	.L28
	testb	%r10b, %r10b
	je	.L28
	movq	(%r12), %rcx
	movl	(%rcx), %ecx
	addl	%ecx, (%rsi)
	movl	(%rsi,%rax), %ecx
	movl	52(%rsp), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L28:
	movl	(%rsi,%rax), %ecx
	testb	%r9b, %r9b
	je	.L27
	testb	%r10b, %r10b
	je	.L27
	movq	(%r12), %r9
	movl	-4(%rsi,%rax), %edi
	addl	(%r9,%rax), %edi
	subl	-4(%r9,%rax), %edi
	addl	%edi, %ecx
	movl	%ecx, (%rsi,%rax)
	movl	52(%rsp), %edi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L66:
	addl	$1, %ebx
	leal	(%rdi,%rdi), %eax
	cmpl	%eax, %ebx
	jg	.L19
	addq	$8, %r12
	testl	%edi, %edi
	jns	.L31
.L19:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L68
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L65:
	.cfi_restore_state
	movb	$87, (%rbx,%r9)
	jmp	.L22
.L35:
	xorl	%eax, %eax
	jmp	.L13
.L63:
	movq	%r12, %rbp
	jmp	.L5
.L68:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	can_num
	.bss
	.align 8
	.type	can_num, @object
	.size	can_num, 8
can_num:
	.zero	8
	.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>

int **can_num;

void set(int x1, int y1, int x2, int y2){
	can_num[x1][y1]++;
	can_num[x1][y2 + 1]--;
	can_num[x2 + 1][y1]--;
	can_num[x2 + 1][y2 + 1]++;
}

int max(int a, int b){
	return a >= b ? a : b;
}

int main(){
	int N, K, i, j, X, Y, ans = 0;
	scanf("%d%d", &N, &K);
	int *x = (int *)malloc(sizeof(int) * N);
	int *y = (int *)malloc(sizeof(int) * N);
	char *c = (char *)malloc(sizeof(char) * N);
	for(i = 0; i < N; i++){
//		printf("i = %d\n", i);
		scanf("%d %d %c", &x[i], &y[i], &c[i]);
	}
	can_num = (int **)malloc(sizeof(int *) * (2 * K + 1));
	for(i = 0; i <= 2 * K; i++){
		can_num[i] = (int *)malloc(sizeof(int) * (K + 1));
		for(j = 0; j <= K; j++){
			can_num[i][j] = 0;
		}
	}
	for(i = 0; i < N; i++){
		X = x[i] % K;
		Y = y[i] % K;
		if((x[i] / K + y[i] / K) % 2 == 1){
			if(c[i] == 'B'){
				c[i] = 'W';
			}
			else{
				c[i] = 'B';
			}
		}
		if(c[i] == 'B'){
			set(0, 0, X, Y);
			set(X + 1, Y + 1, X + K, K - 1);
			set(X + K + 1, 0, 2 * K - 1, Y);
		}
		else{
			set(0, Y + 1, X, K - 1);
			set(X + 1, 0, X + K, Y);
			set(X + K + 1, Y + 1, 2 * K - 1, K - 1);
		}
	}
	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			if(i == 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1];
			}
			else if(i > 0 && j == 0){
				can_num[i][j] += can_num[i - 1][j];
			}
			else if(i > 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1] + can_num[i - 1][j] - can_num[i - 1][j - 1];
			}
			ans = max(ans, can_num[i][j]);
		}
	}
/*	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			printf("can_num[%d][%d] = %d  ", i, j, can_num[i][j]);
		}
		printf("\n");
	}
*/	printf("%d\n", ans);
	return 0;
}
4 3
0 1 W
1 2 W
5 3 B
5 4 B

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

int **can_num;

void set(int x1, int y1, int x2, int y2){
	can_num[x1][y1]++;
	can_num[x1][y2 + 1]--;
	can_num[x2 + 1][y1]--;
	can_num[x2 + 1][y2 + 1]++;
}

int max(int a, int b){
	return a >= b ? a : b;
}

int main(){
	int N, K, i, j, X, Y, ans = 0;
	scanf("%d%d", &N, &K);
	int *x = (int *)malloc(sizeof(int) * N);
	int *y = (int *)malloc(sizeof(int) * N);
	char *c = (char *)malloc(sizeof(char) * N);
	for(i = 0; i < N; i++){
//		printf("i = %d\n", i);
		scanf("%d %d %c", &x[i], &y[i], &c[i]);
	}
	can_num = (int **)malloc(sizeof(int *) * (2 * K + 1));
	for(i = 0; i <= 2 * K; i++){
		can_num[i] = (int *)malloc(sizeof(int) * (K + 1));
		for(j = 0; j <= K; j++){
			can_num[i][j] = 0;
		}
	}
	for(i = 0; i < N; i++){
		X = x[i] % K;
		Y = y[i] % K;
		if((x[i] / K + y[i] / K) % 2 == 1){
			if(c[i] == 'B'){
				c[i] = 'W';
			}
			else{
				c[i] = 'B';
			}
		}
		if(c[i] == 'B'){
			set(0, 0, X, Y);
			set(X + 1, Y + 1, X + K, K - 1);
			set(X + K + 1, 0, 2 * K - 1, Y);
		}
		else{
			set(0, Y + 1, X, K - 1);
			set(X + 1, 0, X + K, Y);
			set(X + K + 1, Y + 1, 2 * K - 1, K - 1);
		}
	}
	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			if(i == 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1];
			}
			else if(i > 0 && j == 0){
				can_num[i][j] += can_num[i - 1][j];
			}
			else if(i > 0 && j > 0){
				can_num[i][j] += can_num[i][j - 1] + can_num[i - 1][j] - can_num[i - 1][j - 1];
			}
			ans = max(ans, can_num[i][j]);
		}
	}
/*	for(i = 0; i <= 2 * K; i++){
		for(j = 0; j <= K; j++){
			printf("can_num[%d][%d] = %d  ", i, j, can_num[i][j]);
		}
		printf("\n");
	}
*/	printf("%d\n", ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	can_num
	.bss
	.align 8
	.type	can_num, @object
	.size	can_num, 8
can_num:
	.zero	8
	.text
	.globl	set
	.type	set, @function
set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	set, .-set
	.globl	max
	.type	max, @function
max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -60(%rbp)
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-76(%rbp), %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L5
.L6:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -68(%rbp)
.L5:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L6
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, can_num(%rip)
	movl	$0, -68(%rbp)
	jmp	.L7
.L10:
	movl	-72(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	can_num(%rip), %rcx
	movl	-68(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -64(%rbp)
	jmp	.L8
.L9:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -64(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L9
	addl	$1, -68(%rbp)
.L7:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L10
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -56(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -52(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	movl	%eax, %esi
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	addl	%esi, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L13
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$87, (%rax)
	jmp	.L12
.L13:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$66, (%rax)
.L12:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L14
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-72(%rbp), %ecx
	movl	-56(%rbp), %eax
	addl	%ecx, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	jmp	.L15
.L14:
	movl	-72(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-72(%rbp), %edi
	movl	-56(%rbp), %eax
	addl	%edi, %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
.L15:
	addl	$1, -68(%rbp)
.L11:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	$0, -68(%rbp)
	jmp	.L17
.L23:
	movl	$0, -64(%rbp)
	jmp	.L18
.L22:
	cmpl	$0, -68(%rbp)
	jne	.L19
	cmpl	$0, -64(%rbp)
	jle	.L19
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L19:
	cmpl	$0, -68(%rbp)
	jle	.L21
	cmpl	$0, -64(%rbp)
	jne	.L21
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L21:
	cmpl	$0, -68(%rbp)
	jle	.L20
	cmpl	$0, -64(%rbp)
	jle	.L20
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	(%rcx,%rsi), %edx
	movl	%edx, (%rax)
.L20:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -60(%rbp)
	addl	$1, -64(%rbp)
.L18:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L22
	addl	$1, -68(%rbp)
.L17:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L23
	movl	-60(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.globl	can_num
	.bss
	.align 8
	.type	can_num, @object
	.size	can_num, 8
can_num:
	.zero	8
	.text
	.globl	set
	.type	set, @function
set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	%ecx, -16(%rbp)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movq	can_num(%rip), %rdx
	movl	-12(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-16(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	set, .-set
	.globl	max
	.type	max, @function
max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d %d %c"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$72, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -60(%rbp)
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-76(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-76(%rbp), %eax
	cltq
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L5
.L6:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-48(%rbp), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -68(%rbp)
.L5:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L6
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, can_num(%rip)
	movl	$0, -68(%rbp)
	jmp	.L7
.L10:
	movl	-72(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	can_num(%rip), %rcx
	movl	-68(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	movl	$0, -64(%rbp)
	jmp	.L8
.L9:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -64(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L9
	addl	$1, -68(%rbp)
.L7:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L10
	movl	$0, -68(%rbp)
	jmp	.L11
.L16:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -56(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ecx
	cltd
	idivl	%ecx
	movl	%edx, -52(%rbp)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	movl	%eax, %esi
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-72(%rbp), %ebx
	cltd
	idivl	%ebx
	addl	%esi, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L13
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$87, (%rax)
	jmp	.L12
.L13:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movb	$66, (%rax)
.L12:
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$66, %al
	jne	.L14
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %esi
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-72(%rbp), %ecx
	movl	-56(%rbp), %eax
	addl	%ecx, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	jmp	.L15
.L14:
	movl	-72(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-56(%rbp), %eax
	movl	%edx, %ecx
	movl	%eax, %edx
	movl	$0, %edi
	call	set
	movl	-72(%rbp), %edx
	movl	-56(%rbp), %eax
	addl	%eax, %edx
	movl	-56(%rbp), %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %eax
	movl	%eax, %ecx
	movl	$0, %esi
	call	set
	movl	-72(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	leal	-1(%rax), %edx
	movl	-52(%rbp), %eax
	leal	1(%rax), %esi
	movl	-72(%rbp), %edi
	movl	-56(%rbp), %eax
	addl	%edi, %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	set
.L15:
	addl	$1, -68(%rbp)
.L11:
	movl	-76(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L16
	movl	$0, -68(%rbp)
	jmp	.L17
.L23:
	movl	$0, -64(%rbp)
	jmp	.L18
.L22:
	cmpl	$0, -68(%rbp)
	jne	.L19
	cmpl	$0, -64(%rbp)
	jle	.L19
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L19:
	cmpl	$0, -68(%rbp)
	jle	.L21
	cmpl	$0, -64(%rbp)
	jne	.L21
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	jmp	.L20
.L21:
	cmpl	$0, -68(%rbp)
	jle	.L20
	cmpl	$0, -64(%rbp)
	jle	.L20
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movq	can_num(%rip), %rsi
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rsi, %rax
	movq	(%rax), %rsi
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	leal	(%rcx,%rsi), %edx
	movl	%edx, (%rax)
.L20:
	movq	can_num(%rip), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -60(%rbp)
	addl	$1, -64(%rbp)
.L18:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jle	.L22
	addl	$1, -68(%rbp)
.L17:
	movl	-72(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -68(%rbp)
	jle	.L23
	movl	-60(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
