Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// AOJ 1249: Make a Sequence
// 2017.10.16 bal4u@uu

#include <stdio.h>
#include <string.h>

typedef struct { int x, y; } T;
T a[350];

int n, m;
char peg[8][8][8]; char hi[8][8];

int dx[13] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 };
int dy[13] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1 };
int dz[13] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1 };

int check(int x, int y, int z, int color)
{
	int xx, yy, zz, i, cnt1, cnt2;

	for (i = 0; i < 13; i++) {
		xx = x, yy = y, zz = z, cnt1 = 0;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx += dx[i], yy += dy[i], zz += dz[i];
			if(++cnt1 >= m) return 1;
		}
		xx = x, yy = y, zz = z, cnt2 = -1;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx -= dx[i], yy -= dy[i], zz -= dz[i];
			if(++cnt2 >= m) return 1;
		}
		if (cnt1 + cnt2 >= m) return 1;
	}
	return 0;
}

int main()
{
	int p, i, x, y, z, color;

	while (scanf("%d%d%d", &n, &m, &p) && n > 0) {
		memset(peg, -1, sizeof(peg)); memset(hi, 0, sizeof(hi));
		for (i = 0; i < p; i++) scanf("%d%d", &a[i].x, &a[i].y);
		for (color = 1,i = 0; i < p; i++, color = !color) {
			x = a[i].x-1, y = a[i].y-1, z = hi[x][y]++;
			peg[x][y][z] = color;
			if (check(x, y, z, color)) break;
		}
		if (i == p) puts("Draw");
		else printf("%s %d\n", color ? "Black" : "White", i+1);
    }
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 2800
a:
	.zero	2800
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	peg
	.align 32
	.type	peg, @object
	.size	peg, 512
peg:
	.zero	512
	.globl	hi
	.align 32
	.type	hi, @object
	.size	hi, 64
hi:
	.zero	64
	.globl	dx
	.data
	.align 32
	.type	dx, @object
	.size	dx, 52
dx:
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.globl	dy
	.align 32
	.type	dy, @object
	.size	dy, 52
dy:
	.long	0
	.long	1
	.long	0
	.long	1
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	-1
	.long	-1
	.globl	dz
	.align 32
	.type	dz, @object
	.size	dz, 52
dz:
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.text
	.globl	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L11:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	cmpl	$0, -24(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	cmpl	$0, -20(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	cmpl	$0, -16(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L5
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L6
.L5:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$-1, -4(%rbp)
	jmp	.L7
.L9:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -16(%rbp)
	addl	$1, -4(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L7
	movl	$1, %eax
	jmp	.L4
.L7:
	cmpl	$0, -24(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L8
	cmpl	$0, -20(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L8
	cmpl	$0, -16(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L8
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L9
.L8:
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	$1, %eax
	jmp	.L4
.L10:
	addl	$1, -12(%rbp)
.L2:
	cmpl	$12, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Draw"
.LC2:
	.string	"Black"
.LC3:
	.string	"White"
.LC4:
	.string	"%s %d\n"
.LC5:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L13
.L24:
	movl	$512, %edx
	movl	$-1, %esi
	leaq	peg(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$64, %edx
	movl	$0, %esi
	leaq	hi(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L14
.L15:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L15
	movl	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L16
.L19:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	leaq	hi(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	addl	$1, %edx
	movl	%edx, %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rsi
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	addq	%rdx, %rsi
	leaq	hi(%rip), %rdx
	addq	%rsi, %rdx
	movb	%cl, (%rdx)
	movsbl	%al, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	cltq
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-24(%rbp), %ecx
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	jne	.L27
	addl	$1, -28(%rbp)
	cmpl	$0, -24(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -24(%rbp)
.L16:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L19
	jmp	.L18
.L27:
	nop
.L18:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L20
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L20:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	cmpl	$0, -24(%rbp)
	je	.L21
	leaq	.LC2(%rip), %rax
	jmp	.L22
.L21:
	leaq	.LC3(%rip), %rax
.L22:
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	-32(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L23
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L24
.L23:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	check
	.type	check, @function
check:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	dx(%rip), %r10
	leaq	dz(%rip), %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	peg(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	m(%rip), %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%ecx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	n(%rip), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	dy(%rip), %rbx
	movl	%edi, -12(%rsp)
	movl	%esi, -8(%rsp)
	movl	%edx, -4(%rsp)
.L2:
	movl	-4(%rsp), %ecx
	movl	-8(%rsp), %edx
	xorl	%r8d, %r8d
	movl	-12(%rsp), %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %rdi
	movslq	%edx, %r9
	movslq	%ecx, %rsi
	leaq	(%r9,%rdi,8), %rdi
	leaq	(%r14,%rdi,8), %rdi
	movsbl	(%rdi,%rsi), %esi
	cmpl	%r12d, %esi
	jne	.L11
	addl	$1, %r8d
	addl	(%r10), %eax
	addl	(%rbx), %edx
	addl	(%r11), %ecx
	cmpl	%r8d, %r13d
	jle	.L13
.L8:
	movl	%eax, %esi
	orl	%edx, %esi
	orl	%ecx, %esi
	js	.L11
	cmpl	%edx, %eax
	movl	%edx, %esi
	cmovge	%eax, %esi
	cmpl	%ecx, %esi
	cmovl	%ecx, %esi
	cmpl	%esi, %ebp
	jg	.L18
.L11:
	movl	-4(%rsp), %ecx
	movl	-8(%rsp), %edx
	movl	$-1, %r9d
	movl	-12(%rsp), %eax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	%eax, %rdi
	movslq	%edx, %r15
	movslq	%ecx, %rsi
	leaq	(%r15,%rdi,8), %rdi
	leaq	(%r14,%rdi,8), %rdi
	movsbl	(%rdi,%rsi), %esi
	cmpl	%r12d, %esi
	jne	.L6
	addl	$1, %r9d
	subl	(%r10), %eax
	subl	(%rbx), %edx
	subl	(%r11), %ecx
	cmpl	%r9d, %r13d
	jle	.L13
.L15:
	movl	%eax, %esi
	orl	%edx, %esi
	orl	%ecx, %esi
	js	.L6
	cmpl	%edx, %eax
	movl	%edx, %esi
	cmovge	%eax, %esi
	cmpl	%ecx, %esi
	cmovl	%ecx, %esi
	cmpl	%esi, %ebp
	jg	.L19
.L6:
	addl	%r8d, %r9d
	cmpl	%r13d, %r9d
	jge	.L13
	addq	$4, %r10
	leaq	52+dx(%rip), %rax
	addq	$4, %rbx
	addq	$4, %r11
	cmpq	%rax, %r10
	jne	.L2
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	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
.L13:
	.cfi_restore_state
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %eax
	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
	.cfi_endproc
.LFE35:
	.size	check, .-check
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Black"
.LC1:
	.string	"White"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"Draw"
.LC4:
	.string	"%s %d\n"
.LC5:
	.string	"%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	peg(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rcx
	xorl	%eax, %eax
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L29
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L29
	movl	20(%rsp), %r15d
	pxor	%xmm0, %xmm0
	movl	$64, %ecx
	movq	%rbx, %rdi
	movq	$-1, %rax
	movaps	%xmm0, hi(%rip)
	rep stosq
	movaps	%xmm0, 16+hi(%rip)
	movaps	%xmm0, 32+hi(%rip)
	movaps	%xmm0, 48+hi(%rip)
	testl	%r15d, %r15d
	jle	.L22
	leaq	a(%rip), %r13
	xorl	%r12d, %r12d
	leaq	.LC2(%rip), %r14
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L23:
	leaq	4(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %r15d
	addl	$1, %r12d
	addq	$8, %rbp
	cmpl	%r12d, %r15d
	jg	.L23
	testl	%r15d, %r15d
	jle	.L22
	movl	$1, %r12d
	xorl	%r14d, %r14d
	leaq	hi(%rip), %rbp
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L40:
	xorl	$1, %r12d
	addq	$8, %r13
	cmpl	%r14d, %r15d
	je	.L26
.L25:
	movl	0(%r13), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edi
	movl	4(%r13), %eax
	leal	-1(%rax), %esi
	movslq	%edi, %rax
	salq	$3, %rax
	movslq	%esi, %r8
	leaq	0(%rbp,%rax), %rcx
	addq	%r8, %rax
	addq	%r8, %rcx
	leaq	(%rbx,%rax,8), %rax
	movsbq	(%rcx), %rdx
	leal	1(%rdx), %r9d
	movb	%r12b, (%rax,%rdx)
	movb	%r9b, (%rcx)
	movsbl	%dl, %r9d
	movl	%r12d, %ecx
	movl	%r9d, %edx
	call	check
	testl	%eax, %eax
	je	.L40
	testl	%r12d, %r12d
	leaq	.LC1(%rip), %rdx
	leaq	.LC0(%rip), %rax
	cmovne	%rax, %rdx
.L27:
	movl	%r14d, %ecx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L21
.L22:
	movl	$1, %r14d
	leaq	.LC0(%rip), %rdx
	testl	%r15d, %r15d
	jne	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L29:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$40, %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
.L41:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	dz
	.data
	.align 32
	.type	dz, @object
	.size	dz, 52
dz:
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.globl	dy
	.align 32
	.type	dy, @object
	.size	dy, 52
dy:
	.long	0
	.long	1
	.long	0
	.long	1
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	-1
	.long	-1
	.globl	dx
	.align 32
	.type	dx, @object
	.size	dx, 52
dx:
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.globl	hi
	.bss
	.align 32
	.type	hi, @object
	.size	hi, 64
hi:
	.zero	64
	.globl	peg
	.align 32
	.type	peg, @object
	.size	peg, 512
peg:
	.zero	512
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 2800
a:
	.zero	2800
	.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	check
	.type	check, @function
check:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	dx(%rip), %r10
	leaq	dz(%rip), %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	peg(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	m(%rip), %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%ecx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	n(%rip), %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	dy(%rip), %rbx
	movl	%edi, -12(%rsp)
	movl	%esi, -8(%rsp)
	movl	%edx, -4(%rsp)
.L2:
	movl	-4(%rsp), %ecx
	movl	-8(%rsp), %edx
	xorl	%r8d, %r8d
	movl	-12(%rsp), %eax
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %rdi
	movslq	%edx, %r9
	movslq	%ecx, %rsi
	leaq	(%r9,%rdi,8), %rdi
	leaq	(%r14,%rdi,8), %rdi
	movsbl	(%rdi,%rsi), %esi
	cmpl	%r12d, %esi
	jne	.L11
	addl	$1, %r8d
	addl	(%r10), %eax
	addl	(%rbx), %edx
	addl	(%r11), %ecx
	cmpl	%r8d, %r13d
	jle	.L13
.L8:
	movl	%eax, %esi
	orl	%edx, %esi
	orl	%ecx, %esi
	js	.L11
	cmpl	%edx, %eax
	movl	%edx, %esi
	cmovge	%eax, %esi
	cmpl	%ecx, %esi
	cmovl	%ecx, %esi
	cmpl	%esi, %ebp
	jg	.L18
.L11:
	movl	-4(%rsp), %ecx
	movl	-8(%rsp), %edx
	movl	$-1, %r9d
	movl	-12(%rsp), %eax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	%eax, %rdi
	movslq	%edx, %r15
	movslq	%ecx, %rsi
	leaq	(%r15,%rdi,8), %rdi
	leaq	(%r14,%rdi,8), %rdi
	movsbl	(%rdi,%rsi), %esi
	cmpl	%r12d, %esi
	jne	.L6
	addl	$1, %r9d
	subl	(%r10), %eax
	subl	(%rbx), %edx
	subl	(%r11), %ecx
	cmpl	%r9d, %r13d
	jle	.L13
.L15:
	movl	%eax, %esi
	orl	%edx, %esi
	orl	%ecx, %esi
	js	.L6
	cmpl	%edx, %eax
	movl	%edx, %esi
	cmovge	%eax, %esi
	cmpl	%ecx, %esi
	cmovl	%ecx, %esi
	cmpl	%esi, %ebp
	jg	.L19
.L6:
	addl	%r8d, %r9d
	cmpl	%r13d, %r9d
	jge	.L13
	addq	$4, %r10
	leaq	52+dx(%rip), %rax
	addq	$4, %rbx
	addq	$4, %r11
	cmpq	%rax, %r10
	jne	.L2
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	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
.L13:
	.cfi_restore_state
	popq	%rbx
	.cfi_def_cfa_offset 48
	movl	$1, %eax
	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
	.cfi_endproc
.LFE35:
	.size	check, .-check
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Black"
.LC1:
	.string	"White"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"Draw"
.LC4:
	.string	"%s %d\n"
.LC5:
	.string	"%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	peg(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rcx
	xorl	%eax, %eax
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L29
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L29
	movl	20(%rsp), %r15d
	pxor	%xmm0, %xmm0
	movl	$64, %ecx
	movq	%rbx, %rdi
	movq	$-1, %rax
	movaps	%xmm0, hi(%rip)
	rep stosq
	movaps	%xmm0, 16+hi(%rip)
	movaps	%xmm0, 32+hi(%rip)
	movaps	%xmm0, 48+hi(%rip)
	testl	%r15d, %r15d
	jle	.L22
	leaq	a(%rip), %r13
	xorl	%r12d, %r12d
	leaq	.LC2(%rip), %r14
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L23:
	leaq	4(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %r15d
	addl	$1, %r12d
	addq	$8, %rbp
	cmpl	%r12d, %r15d
	jg	.L23
	testl	%r15d, %r15d
	jle	.L22
	movl	$1, %r12d
	xorl	%r14d, %r14d
	leaq	hi(%rip), %rbp
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L40:
	xorl	$1, %r12d
	addq	$8, %r13
	cmpl	%r14d, %r15d
	je	.L26
.L25:
	movl	0(%r13), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edi
	movl	4(%r13), %eax
	leal	-1(%rax), %esi
	movslq	%edi, %rax
	salq	$3, %rax
	movslq	%esi, %r8
	leaq	0(%rbp,%rax), %rcx
	addq	%r8, %rax
	addq	%r8, %rcx
	leaq	(%rbx,%rax,8), %rax
	movsbq	(%rcx), %rdx
	leal	1(%rdx), %r9d
	movb	%r12b, (%rax,%rdx)
	movb	%r9b, (%rcx)
	movsbl	%dl, %r9d
	movl	%r12d, %ecx
	movl	%r9d, %edx
	call	check
	testl	%eax, %eax
	je	.L40
	testl	%r12d, %r12d
	leaq	.LC1(%rip), %rdx
	leaq	.LC0(%rip), %rax
	cmovne	%rax, %rdx
.L27:
	movl	%r14d, %ecx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L21
.L22:
	movl	$1, %r14d
	leaq	.LC0(%rip), %rdx
	testl	%r15d, %r15d
	jne	.L27
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L29:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$40, %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
.L41:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	dz
	.data
	.align 32
	.type	dz, @object
	.size	dz, 52
dz:
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.globl	dy
	.align 32
	.type	dy, @object
	.size	dy, 52
dy:
	.long	0
	.long	1
	.long	0
	.long	1
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	-1
	.long	-1
	.globl	dx
	.align 32
	.type	dx, @object
	.size	dx, 52
dx:
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.globl	hi
	.bss
	.align 32
	.type	hi, @object
	.size	hi, 64
hi:
	.zero	64
	.globl	peg
	.align 32
	.type	peg, @object
	.size	peg, 512
peg:
	.zero	512
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 2800
a:
	.zero	2800
	.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:

// AOJ 1249: Make a Sequence
// 2017.10.16 bal4u@uu

#include <stdio.h>
#include <string.h>

typedef struct { int x, y; } T;
T a[350];

int n, m;
char peg[8][8][8]; char hi[8][8];

int dx[13] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 };
int dy[13] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1 };
int dz[13] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1 };

int check(int x, int y, int z, int color)
{
	int xx, yy, zz, i, cnt1, cnt2;

	for (i = 0; i < 13; i++) {
		xx = x, yy = y, zz = z, cnt1 = 0;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx += dx[i], yy += dy[i], zz += dz[i];
			if(++cnt1 >= m) return 1;
		}
		xx = x, yy = y, zz = z, cnt2 = -1;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx -= dx[i], yy -= dy[i], zz -= dz[i];
			if(++cnt2 >= m) return 1;
		}
		if (cnt1 + cnt2 >= m) return 1;
	}
	return 0;
}

int main()
{
	int p, i, x, y, z, color;

	while (scanf("%d%d%d", &n, &m, &p) && n > 0) {
		memset(peg, -1, sizeof(peg)); memset(hi, 0, sizeof(hi));
		for (i = 0; i < p; i++) scanf("%d%d", &a[i].x, &a[i].y);
		for (color = 1,i = 0; i < p; i++, color = !color) {
			x = a[i].x-1, y = a[i].y-1, z = hi[x][y]++;
			peg[x][y][z] = color;
			if (check(x, y, z, color)) break;
		}
		if (i == p) puts("Draw");
		else printf("%s %d\n", color ? "Black" : "White", i+1);
    }
	return 0;
}
3 3 3
1 1
1 1
1 1
3 3 7
2 2
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
1 1
0 2
1 1
3 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 2
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
1 1
2 2
1 1
3 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 3
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
1 1
2 2
1 1
3 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 3
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
1 1
0 2
1 1
3 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 3
1 3
2 1
2 3
2 1
3 3
3 1
4 3 15
1 1
0 2
1 1
3 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 3
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
2 1
0 1
1 1
1 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 4
4 4
1 1
4 2
0 0 0
 3 3 3
1 1
1 1
1 1
3 3 7
3 3
1 3
1 1
2 1
2 1
3 3
3 1
4 3 15
1 1
2 2
1 1
3 3
3 3
1 1
3 3
3 3
4 2
1 1
4 4
4 4
4 4
4 1
2 2
0 0 0
 3 3 3
1 1
1 0
1 1
3 3 7
3 3
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
2 1
0 1
1 2
1 3
3 3
1 1
3 3
3 3
4 4
1 1
4 4
4 1
4 4
4 1
4 2
0 0 0
 3 3 3
1 0
1 1
1 1
3 3 7
2 1
1 3
1 1
2 3
2 1
3 3
3 1
4 3 15
1 0
0 2
1 1
3 3
1 3
1 1
3 1
3 3
4 4
1 1
4 4
1 4
4 4
3 1
2 2
0 0 0
 3 3 3
1 0
1 1
1 1
3 3 7
2 1
1 3
2 1
2 3
2 1
3 3
3 1
4 3 15
1 0
0 2
1 1
3 3
1 3
1 1
3 1
3 3
4 4
1 1
4 4
1 4
4 4
3 1
2 2
0 0 0

Draw
White 6
Draw
 Draw
White 6
Black 15
 Draw
Black 7
Black 15
 Draw
Black 7
Draw
 Draw
Draw
Draw
 Draw
Black 7
White 14
 Draw
Draw
Black 15
 Draw
Black 7
Black 13
 Draw
White 6
Draw
 Draw
Black 5
Draw

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// AOJ 1249: Make a Sequence
// 2017.10.16 bal4u@uu

#include <stdio.h>
#include <string.h>

typedef struct { int x, y; } T;
T a[350];

int n, m;
char peg[8][8][8]; char hi[8][8];

int dx[13] = { 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 };
int dy[13] = { 0, 1, 0, 1,-1, 0, 0, 1, 1, 1, 1,-1,-1 };
int dz[13] = { 0, 0, 1, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1 };

int check(int x, int y, int z, int color)
{
	int xx, yy, zz, i, cnt1, cnt2;

	for (i = 0; i < 13; i++) {
		xx = x, yy = y, zz = z, cnt1 = 0;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx += dx[i], yy += dy[i], zz += dz[i];
			if(++cnt1 >= m) return 1;
		}
		xx = x, yy = y, zz = z, cnt2 = -1;
		while (0 <= xx && xx < n && 0 <= yy && yy < n &&
			   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
			xx -= dx[i], yy -= dy[i], zz -= dz[i];
			if(++cnt2 >= m) return 1;
		}
		if (cnt1 + cnt2 >= m) return 1;
	}
	return 0;
}

int main()
{
	int p, i, x, y, z, color;

	while (scanf("%d%d%d", &n, &m, &p) && n > 0) {
		memset(peg, -1, sizeof(peg)); memset(hi, 0, sizeof(hi));
		for (i = 0; i < p; i++) scanf("%d%d", &a[i].x, &a[i].y);
		for (color = 1,i = 0; i < p; i++, color = !color) {
			x = a[i].x-1, y = a[i].y-1, z = hi[x][y]++;
			peg[x][y][z] = color;
			if (check(x, y, z, color)) break;
		}
		if (i == p) puts("Draw");
		else printf("%s %d\n", color ? "Black" : "White", i+1);
    }
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 2800
a:
	.zero	2800
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	peg
	.align 32
	.type	peg, @object
	.size	peg, 512
peg:
	.zero	512
	.globl	hi
	.align 32
	.type	hi, @object
	.size	hi, 64
hi:
	.zero	64
	.globl	dx
	.data
	.align 32
	.type	dx, @object
	.size	dx, 52
dx:
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.globl	dy
	.align 32
	.type	dy, @object
	.size	dy, 52
dy:
	.long	0
	.long	1
	.long	0
	.long	1
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	-1
	.long	-1
	.globl	dz
	.align 32
	.type	dz, @object
	.size	dz, 52
dz:
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.text
	.globl	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L11:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	cmpl	$0, -24(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	cmpl	$0, -20(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	cmpl	$0, -16(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L5
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L6
.L5:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$-1, -4(%rbp)
	jmp	.L7
.L9:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -16(%rbp)
	addl	$1, -4(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L7
	movl	$1, %eax
	jmp	.L4
.L7:
	cmpl	$0, -24(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L8
	cmpl	$0, -20(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L8
	cmpl	$0, -16(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L8
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L9
.L8:
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	$1, %eax
	jmp	.L4
.L10:
	addl	$1, -12(%rbp)
.L2:
	cmpl	$12, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Draw"
.LC2:
	.string	"Black"
.LC3:
	.string	"White"
.LC4:
	.string	"%s %d\n"
.LC5:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L13
.L24:
	movl	$512, %edx
	movl	$-1, %esi
	leaq	peg(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$64, %edx
	movl	$0, %esi
	leaq	hi(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L14
.L15:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L15
	movl	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L16
.L19:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	leaq	hi(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	addl	$1, %edx
	movl	%edx, %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rsi
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	addq	%rdx, %rsi
	leaq	hi(%rip), %rdx
	addq	%rsi, %rdx
	movb	%cl, (%rdx)
	movsbl	%al, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	cltq
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-24(%rbp), %ecx
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	jne	.L27
	addl	$1, -28(%rbp)
	cmpl	$0, -24(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -24(%rbp)
.L16:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L19
	jmp	.L18
.L27:
	nop
.L18:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L20
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L20:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	cmpl	$0, -24(%rbp)
	je	.L21
	leaq	.LC2(%rip), %rax
	jmp	.L22
.L21:
	leaq	.LC3(%rip), %rax
.L22:
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	-32(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L23
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L24
.L23:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 2800
a:
	.zero	2800
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	peg
	.align 32
	.type	peg, @object
	.size	peg, 512
peg:
	.zero	512
	.globl	hi
	.align 32
	.type	hi, @object
	.size	hi, 64
hi:
	.zero	64
	.globl	dx
	.data
	.align 32
	.type	dx, @object
	.size	dx, 52
dx:
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.globl	dy
	.align 32
	.type	dy, @object
	.size	dy, 52
dy:
	.long	0
	.long	1
	.long	0
	.long	1
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	-1
	.long	-1
	.globl	dz
	.align 32
	.type	dz, @object
	.size	dz, 52
dz:
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.long	1
	.long	-1
	.text
	.globl	check
	.type	check, @function
check:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L11:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -16(%rbp)
	addl	$1, -8(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L3
	movl	$1, %eax
	jmp	.L4
.L3:
	cmpl	$0, -24(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	cmpl	$0, -20(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L5
	cmpl	$0, -16(%rbp)
	js	.L5
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L5
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L6
.L5:
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	$-1, -4(%rbp)
	jmp	.L7
.L9:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -24(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -20(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, -16(%rbp)
	addl	$1, -4(%rbp)
	movl	m(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L7
	movl	$1, %eax
	jmp	.L4
.L7:
	cmpl	$0, -24(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L8
	cmpl	$0, -20(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L8
	cmpl	$0, -16(%rbp)
	js	.L8
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L8
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	cltq
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	%eax, -48(%rbp)
	je	.L9
.L8:
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L10
	movl	$1, %eax
	jmp	.L4
.L10:
	addl	$1, -12(%rbp)
.L2:
	cmpl	$12, -12(%rbp)
	jle	.L11
	movl	$0, %eax
.L4:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	check, .-check
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Draw"
.LC2:
	.string	"Black"
.LC3:
	.string	"White"
.LC4:
	.string	"%s %d\n"
.LC5:
	.string	"%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L13
.L24:
	movl	$512, %edx
	movl	$-1, %esi
	leaq	peg(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$64, %edx
	movl	$0, %esi
	leaq	hi(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L14
.L15:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L15
	movl	$1, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L16
.L19:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rax, %rdx
	leaq	hi(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	addl	$1, %edx
	movl	%edx, %ecx
	movl	-16(%rbp), %edx
	movslq	%edx, %rsi
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rdx
	addq	%rdx, %rsi
	leaq	hi(%rip), %rdx
	addq	%rsi, %rdx
	movb	%cl, (%rdx)
	movsbl	%al, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	cltq
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	salq	$3, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	peg(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-24(%rbp), %ecx
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	jne	.L27
	addl	$1, -28(%rbp)
	cmpl	$0, -24(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -24(%rbp)
.L16:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L19
	jmp	.L18
.L27:
	nop
.L18:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L20
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L20:
	movl	-28(%rbp), %eax
	leal	1(%rax), %edx
	cmpl	$0, -24(%rbp)
	je	.L21
	leaq	.LC2(%rip), %rax
	jmp	.L22
.L21:
	leaq	.LC3(%rip), %rax
.L22:
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	leaq	-32(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L23
	movl	n(%rip), %eax
	testl	%eax, %eax
	jg	.L24
.L23:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
