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

```c
H,W,Q,y,x,y1,x1,
A[2001][2001],
B[2001][2001],
C[2001][2001];
char S[2001][2001];
main(){
	scanf("%d%d%d%*c",&H,&W,&Q);
	for(y=0;y++<H;){
		gets(S[y]+1);
	}
	for(y=0;y++<H;){
		for(x=0;x++<W;){
			A[y][x]=A[y][x-1]+A[y-1][x]-A[y-1][x-1]+S[y][x]%2;
			B[y][x]=B[y][x-1]+B[y-1][x]-B[y-1][x-1]+S[y-1][x]*S[y][x]%2;
			C[y][x]=C[y][x-1]+C[y-1][x]-C[y-1][x-1]+S[y][x-1]*S[y][x]%2;
		}
	}
	for(;~scanf("%d%d%d%d",&y1,&x1,&y,&x);){
		printf("%d\n",
			A[y][x]-A[y1-1][x]-A[y][x1-1]+A[y1-1][x1-1]
			-(B[y][x]-B[y1][x]-B[y][x1-1]+B[y1][x1-1])
			-(C[y][x]-C[y1-1][x]-C[y][x1]+C[y1-1][x1])
		);
	}
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y1
	.align 4
	.type	y1, @object
	.size	y1, 4
y1:
	.zero	4
	.globl	x1
	.align 4
	.type	x1, @object
	.size	x1, 4
x1:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 16016004
A:
	.zero	16016004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 16016004
B:
	.zero	16016004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 16016004
C:
	.zero	16016004
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 4004001
S:
	.zero	4004001
	.section	.rodata
.LC0:
	.string	"%d%d%d%*c"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	Q(%rip), %rax
	movq	%rax, %rcx
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, y(%rip)
	jmp	.L2
.L3:
	movl	y(%rip), %eax
	cltq
	imulq	$2001, %rax, %rax
	leaq	S(%rip), %rdx
	addq	%rdx, %rax
	addq	$1, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
.L2:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L3
	movl	$0, y(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
	jmp	.L5
.L6:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	sarb	$7, %dl
	shrb	$7, %dl
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movsbl	%al, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	W(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
.L4:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L7
	jmp	.L8
.L9:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	y1(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rdi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rdi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rdi,%rax), %edx
	movl	%esi, %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	x(%rip), %r8
	leaq	y(%rip), %rax
	movq	%rax, %rcx
	leaq	x1(%rip), %rax
	movq	%rax, %rdx
	leaq	y1(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d%*c"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	W(%rip), %rdx
	xorl	%eax, %eax
	leaq	Q(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	H(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	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	$88, %rsp
	.cfi_def_cfa_offset 144
	call	scanf@PLT
	movl	H(%rip), %edx
	movl	$1, y(%rip)
	testl	%edx, %edx
	jle	.L3
	movl	$1, %eax
	leaq	S(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	imulq	$2001, %rax, %rax
	leaq	1(%rbx,%rax), %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movl	y(%rip), %edx
	movl	H(%rip), %ecx
	leal	1(%rdx), %eax
	movl	%eax, y(%rip)
	cmpl	%ecx, %edx
	jl	.L2
	movl	%ecx, 72(%rsp)
	movl	$1, y(%rip)
	testl	%ecx, %ecx
	jle	.L3
	leaq	2002+S(%rip), %rax
	movl	W(%rip), %ebx
	movq	$-2001, 8(%rsp)
	movq	%rax, 48(%rsp)
	leaq	4+A(%rip), %rax
	movq	%rax, 40(%rsp)
	leaq	4+B(%rip), %rax
	leal	-1(%rbx), %edx
	movq	%rax, 32(%rsp)
	leaq	4+C(%rip), %rax
	movq	%rax, 24(%rsp)
	leaq	8+A(%rip), %rax
	leaq	(%rax,%rdx,4), %rax
	leal	1(%rbx), %edx
	movl	%ebx, 60(%rsp)
	movq	%rax, 16(%rsp)
	leal	-1(%rcx), %eax
	imulq	$8004, %rax, %rax
	addq	$16008, %rax
	testl	%ebx, %ebx
	movl	$8004, %ebx
	movq	%rax, 64(%rsp)
	movl	$1, %eax
	cmovg	%edx, %eax
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
	movl	%eax, 76(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	movl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movq	32(%rsp), %r8
	movq	40(%rsp), %rdi
	movq	24(%rsp), %r9
	movq	48(%rsp), %r11
	movl	8000(%r8), %eax
	movl	8000(%rdi), %esi
	movl	8000(%r9), %ecx
	movzbl	-1(%r11), %r10d
	movl	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	movsbl	%r10b, %r12d
	movzbl	(%r11), %r10d
	addl	(%rdi), %esi
	subl	-4(%rdi), %esi
	addl	(%r8), %edx
	movl	%r10d, %eax
	addl	(%r9), %ecx
	subl	-4(%r9), %ecx
	shrb	$7, %al
	leal	(%r10,%rax), %r13d
	andl	$1, %r13d
	subl	%eax, %r13d
	leaq	0(%rbp,%rdi), %rax
	addq	$4, %rdi
	movsbl	%r13b, %r13d
	addl	%r13d, %esi
	movsbl	%r10b, %r13d
	movl	%esi, (%rax,%rbx)
	movl	%edx, %eax
	movq	8(%rsp), %rdx
	imull	%r13d, %r12d
	subl	-4(%r8), %eax
	addq	%r11, %rdx
	addq	$1, %r11
	movsbl	(%rdx,%r15), %edx
	imull	%r13d, %edx
	movl	%edx, %r14d
	shrl	$31, %r14d
	addl	%r14d, %edx
	andl	$1, %edx
	subl	%r14d, %edx
	addl	%eax, %edx
	leaq	0(%rbp,%r8), %rax
	addq	$4, %r8
	movl	%edx, (%rax,%rbx)
	movl	%r12d, %eax
	shrl	$31, %eax
	addl	%eax, %r12d
	andl	$1, %r12d
	subl	%eax, %r12d
	leaq	0(%rbp,%r9), %rax
	addq	$4, %r9
	addl	%r12d, %ecx
	movl	%ecx, (%rax,%rbx)
	cmpq	%rdi, 16(%rsp)
	jne	.L6
.L5:
	addq	$2001, 48(%rsp)
	subq	$8004, %rbp
	addq	$8004, %rbx
	addq	$2001, %r15
	addq	$8004, 40(%rsp)
	addq	$8004, 32(%rsp)
	addq	$8004, 24(%rsp)
	subq	$2001, 8(%rsp)
	addq	$8004, 16(%rsp)
	cmpq	64(%rsp), %rbx
	jne	.L7
	movl	76(%rsp), %eax
	movl	%eax, x(%rip)
	movl	72(%rsp), %eax
	addl	$1, %eax
	movl	%eax, y(%rip)
.L3:
	leaq	y(%rip), %rbp
	leaq	A(%rip), %r13
	leaq	B(%rip), %r12
	leaq	C(%rip), %rbx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	y1(%rip), %rdx
	movslq	y(%rip), %rcx
	movslq	x1(%rip), %r8
	movslq	x(%rip), %rdi
	imulq	$2001, %rcx, %rcx
	leal	-1(%rdx), %eax
	cltq
	imulq	$2001, %rdx, %rdx
	leal	-1(%r8), %r11d
	imulq	$2001, %rax, %rax
	movslq	%r11d, %r11
	leaq	(%rcx,%rdi), %r10
	leaq	(%rcx,%r11), %r14
	addq	%r8, %rcx
	movl	0(%r13,%r10,4), %esi
	leaq	(%rax,%rdi), %r9
	leaq	(%rax,%r11), %r15
	addq	%r8, %rax
	subl	0(%r13,%r9,4), %esi
	subl	0(%r13,%r14,4), %esi
	addl	0(%r13,%r15,4), %esi
	leaq	(%rdx,%rdi), %r15
	addq	%r11, %rdx
	movl	(%r12,%r10,4), %edi
	subl	(%r12,%r15,4), %edi
	subl	(%r12,%r14,4), %edi
	addl	(%r12,%rdx,4), %edi
	movl	(%rbx,%r10,4), %edx
	subl	%edi, %esi
	subl	(%rbx,%r9,4), %edx
	leaq	.LC1(%rip), %rdi
	subl	(%rbx,%rcx,4), %edx
	addl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	subl	%edx, %esi
	call	printf@PLT
.L8:
	xorl	%eax, %eax
	leaq	x(%rip), %r8
	movq	%rbp, %rcx
	leaq	x1(%rip), %rdx
	leaq	y1(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	addq	$88, %rsp
	.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
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 4004001
S:
	.zero	4004001
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 16016004
C:
	.zero	16016004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 16016004
B:
	.zero	16016004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 16016004
A:
	.zero	16016004
	.globl	x1
	.align 4
	.type	x1, @object
	.size	x1, 4
x1:
	.zero	4
	.globl	y1
	.align 4
	.type	y1, @object
	.size	y1, 4
y1:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.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%d%*c"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	W(%rip), %rdx
	xorl	%eax, %eax
	leaq	Q(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	H(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	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	$88, %rsp
	.cfi_def_cfa_offset 144
	call	scanf@PLT
	movl	H(%rip), %edx
	movl	$1, y(%rip)
	testl	%edx, %edx
	jle	.L3
	movl	$1, %eax
	leaq	S(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	imulq	$2001, %rax, %rax
	leaq	1(%rbx,%rax), %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movl	y(%rip), %edx
	movl	H(%rip), %ecx
	leal	1(%rdx), %eax
	movl	%eax, y(%rip)
	cmpl	%ecx, %edx
	jl	.L2
	movl	%ecx, 72(%rsp)
	movl	$1, y(%rip)
	testl	%ecx, %ecx
	jle	.L3
	leaq	2002+S(%rip), %rax
	movl	W(%rip), %ebx
	movq	$-2001, 8(%rsp)
	movq	%rax, 48(%rsp)
	leaq	4+A(%rip), %rax
	movq	%rax, 40(%rsp)
	leaq	4+B(%rip), %rax
	leal	-1(%rbx), %edx
	movq	%rax, 32(%rsp)
	leaq	4+C(%rip), %rax
	movq	%rax, 24(%rsp)
	leaq	8+A(%rip), %rax
	leaq	(%rax,%rdx,4), %rax
	leal	1(%rbx), %edx
	movl	%ebx, 60(%rsp)
	movq	%rax, 16(%rsp)
	leal	-1(%rcx), %eax
	imulq	$8004, %rax, %rax
	addq	$16008, %rax
	testl	%ebx, %ebx
	movl	$8004, %ebx
	movq	%rax, 64(%rsp)
	movl	$1, %eax
	cmovg	%edx, %eax
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
	movl	%eax, 76(%rsp)
	.p2align 4,,10
	.p2align 3
.L7:
	movl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movq	32(%rsp), %r8
	movq	40(%rsp), %rdi
	movq	24(%rsp), %r9
	movq	48(%rsp), %r11
	movl	8000(%r8), %eax
	movl	8000(%rdi), %esi
	movl	8000(%r9), %ecx
	movzbl	-1(%r11), %r10d
	movl	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	movsbl	%r10b, %r12d
	movzbl	(%r11), %r10d
	addl	(%rdi), %esi
	subl	-4(%rdi), %esi
	addl	(%r8), %edx
	movl	%r10d, %eax
	addl	(%r9), %ecx
	subl	-4(%r9), %ecx
	shrb	$7, %al
	leal	(%r10,%rax), %r13d
	andl	$1, %r13d
	subl	%eax, %r13d
	leaq	0(%rbp,%rdi), %rax
	addq	$4, %rdi
	movsbl	%r13b, %r13d
	addl	%r13d, %esi
	movsbl	%r10b, %r13d
	movl	%esi, (%rax,%rbx)
	movl	%edx, %eax
	movq	8(%rsp), %rdx
	imull	%r13d, %r12d
	subl	-4(%r8), %eax
	addq	%r11, %rdx
	addq	$1, %r11
	movsbl	(%rdx,%r15), %edx
	imull	%r13d, %edx
	movl	%edx, %r14d
	shrl	$31, %r14d
	addl	%r14d, %edx
	andl	$1, %edx
	subl	%r14d, %edx
	addl	%eax, %edx
	leaq	0(%rbp,%r8), %rax
	addq	$4, %r8
	movl	%edx, (%rax,%rbx)
	movl	%r12d, %eax
	shrl	$31, %eax
	addl	%eax, %r12d
	andl	$1, %r12d
	subl	%eax, %r12d
	leaq	0(%rbp,%r9), %rax
	addq	$4, %r9
	addl	%r12d, %ecx
	movl	%ecx, (%rax,%rbx)
	cmpq	%rdi, 16(%rsp)
	jne	.L6
.L5:
	addq	$2001, 48(%rsp)
	subq	$8004, %rbp
	addq	$8004, %rbx
	addq	$2001, %r15
	addq	$8004, 40(%rsp)
	addq	$8004, 32(%rsp)
	addq	$8004, 24(%rsp)
	subq	$2001, 8(%rsp)
	addq	$8004, 16(%rsp)
	cmpq	64(%rsp), %rbx
	jne	.L7
	movl	76(%rsp), %eax
	movl	%eax, x(%rip)
	movl	72(%rsp), %eax
	addl	$1, %eax
	movl	%eax, y(%rip)
.L3:
	leaq	y(%rip), %rbp
	leaq	A(%rip), %r13
	leaq	B(%rip), %r12
	leaq	C(%rip), %rbx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	y1(%rip), %rdx
	movslq	y(%rip), %rcx
	movslq	x1(%rip), %r8
	movslq	x(%rip), %rdi
	imulq	$2001, %rcx, %rcx
	leal	-1(%rdx), %eax
	cltq
	imulq	$2001, %rdx, %rdx
	leal	-1(%r8), %r11d
	imulq	$2001, %rax, %rax
	movslq	%r11d, %r11
	leaq	(%rcx,%rdi), %r10
	leaq	(%rcx,%r11), %r14
	addq	%r8, %rcx
	movl	0(%r13,%r10,4), %esi
	leaq	(%rax,%rdi), %r9
	leaq	(%rax,%r11), %r15
	addq	%r8, %rax
	subl	0(%r13,%r9,4), %esi
	subl	0(%r13,%r14,4), %esi
	addl	0(%r13,%r15,4), %esi
	leaq	(%rdx,%rdi), %r15
	addq	%r11, %rdx
	movl	(%r12,%r10,4), %edi
	subl	(%r12,%r15,4), %edi
	subl	(%r12,%r14,4), %edi
	addl	(%r12,%rdx,4), %edi
	movl	(%rbx,%r10,4), %edx
	subl	%edi, %esi
	subl	(%rbx,%r9,4), %edx
	leaq	.LC1(%rip), %rdi
	subl	(%rbx,%rcx,4), %edx
	addl	(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	subl	%edx, %esi
	call	printf@PLT
.L8:
	xorl	%eax, %eax
	leaq	x(%rip), %r8
	movq	%rbp, %rcx
	leaq	x1(%rip), %rdx
	leaq	y1(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	addq	$88, %rsp
	.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
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 4004001
S:
	.zero	4004001
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 16016004
C:
	.zero	16016004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 16016004
B:
	.zero	16016004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 16016004
A:
	.zero	16016004
	.globl	x1
	.align 4
	.type	x1, @object
	.size	x1, 4
x1:
	.zero	4
	.globl	y1
	.align 4
	.type	y1, @object
	.size	y1, 4
y1:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.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:

H,W,Q,y,x,y1,x1,
A[2001][2001],
B[2001][2001],
C[2001][2001];
char S[2001][2001];
main(){
	scanf("%d%d%d%*c",&H,&W,&Q);
	for(y=0;y++<H;){
		gets(S[y]+1);
	}
	for(y=0;y++<H;){
		for(x=0;x++<W;){
			A[y][x]=A[y][x-1]+A[y-1][x]-A[y-1][x-1]+S[y][x]%2;
			B[y][x]=B[y][x-1]+B[y-1][x]-B[y-1][x-1]+S[y-1][x]*S[y][x]%2;
			C[y][x]=C[y][x-1]+C[y-1][x]-C[y-1][x-1]+S[y][x-1]*S[y][x]%2;
		}
	}
	for(;~scanf("%d%d%d%d",&y1,&x1,&y,&x);){
		printf("%d\n",
			A[y][x]-A[y1-1][x]-A[y][x1-1]+A[y1-1][x1-1]
			-(B[y][x]-B[y1][x]-B[y][x1-1]+B[y1][x1-1])
			-(C[y][x]-C[y1-1][x]-C[y][x1]+C[y1-1][x1])
		);
	}
}

3 4 4
1101
0110
1101
1 1 3 4
1 1 3 1
2 2 3 4
1 2 3 4
 5 5 6
11010
01110
10101
11101
01010
1 1 5 5
1 2 4 5
2 3 3 5
3 3 3 3
3 1 3 5
1 1 3 4
 5 5 6
11010
01110
10101
11101
01010
1 1 5 5
1 2 4 5
2 3 3 5
5 3 3 3
3 1 3 5
1 1 3 4
 3 4 4
1101
0110
1101
1 1 3 4
2 1 3 1
2 2 3 4
1 2 2 4
 3 4 4
1101
0110
1101
1 1 3 4
1 1 3 1
2 2 3 4
2 2 3 4
 5 5 6
11010
01110
10101
10101
01010
1 1 5 5
1 2 4 5
2 3 3 5
3 3 3 2
3 1 3 5
1 1 3 4
 5 5 6
11010
01110
10101
11001
01010
1 1 5 5
2 2 4 5
2 4 3 5
5 3 3 3
3 1 3 5
1 1 3 4
 3 4 4
1101
0110
1101
2 1 3 4
2 1 3 1
2 2 3 4
1 2 2 4
 3 4 4
1101
1110
1101
1 1 3 4
1 1 3 1
2 2 3 4
2 2 3 4
 5 5 6
11010
01110
10101
11001
01010
1 1 5 5
2 4 4 5
2 4 3 5
5 3 3 3
3 1 3 5
1 1 3 4

3
2
2
3
 3
2
2
1
3
2
 3
2
2
0
3
2
 3
1
2
2
 3
2
2
2
 5
2
2
0
3
2
 4
3
2
0
3
2
 2
1
2
2
 1
1
2
2
 4
2
2
0
3
2

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

```c
H,W,Q,y,x,y1,x1,
A[2001][2001],
B[2001][2001],
C[2001][2001];
char S[2001][2001];
main(){
	scanf("%d%d%d%*c",&H,&W,&Q);
	for(y=0;y++<H;){
		gets(S[y]+1);
	}
	for(y=0;y++<H;){
		for(x=0;x++<W;){
			A[y][x]=A[y][x-1]+A[y-1][x]-A[y-1][x-1]+S[y][x]%2;
			B[y][x]=B[y][x-1]+B[y-1][x]-B[y-1][x-1]+S[y-1][x]*S[y][x]%2;
			C[y][x]=C[y][x-1]+C[y-1][x]-C[y-1][x-1]+S[y][x-1]*S[y][x]%2;
		}
	}
	for(;~scanf("%d%d%d%d",&y1,&x1,&y,&x);){
		printf("%d\n",
			A[y][x]-A[y1-1][x]-A[y][x1-1]+A[y1-1][x1-1]
			-(B[y][x]-B[y1][x]-B[y][x1-1]+B[y1][x1-1])
			-(C[y][x]-C[y1-1][x]-C[y][x1]+C[y1-1][x1])
		);
	}
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y1
	.align 4
	.type	y1, @object
	.size	y1, 4
y1:
	.zero	4
	.globl	x1
	.align 4
	.type	x1, @object
	.size	x1, 4
x1:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 16016004
A:
	.zero	16016004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 16016004
B:
	.zero	16016004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 16016004
C:
	.zero	16016004
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 4004001
S:
	.zero	4004001
	.section	.rodata
.LC0:
	.string	"%d%d%d%*c"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	Q(%rip), %rax
	movq	%rax, %rcx
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, y(%rip)
	jmp	.L2
.L3:
	movl	y(%rip), %eax
	cltq
	imulq	$2001, %rax, %rax
	leaq	S(%rip), %rdx
	addq	%rdx, %rax
	addq	$1, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
.L2:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L3
	movl	$0, y(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
	jmp	.L5
.L6:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	sarb	$7, %dl
	shrb	$7, %dl
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movsbl	%al, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	W(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
.L4:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L7
	jmp	.L8
.L9:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	y1(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rdi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rdi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rdi,%rax), %edx
	movl	%esi, %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	x(%rip), %r8
	leaq	y(%rip), %rax
	movq	%rax, %rcx
	leaq	x1(%rip), %rax
	movq	%rax, %rdx
	leaq	y1(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	y
	.align 4
	.type	y, @object
	.size	y, 4
y:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	y1
	.align 4
	.type	y1, @object
	.size	y1, 4
y1:
	.zero	4
	.globl	x1
	.align 4
	.type	x1, @object
	.size	x1, 4
x1:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 16016004
A:
	.zero	16016004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 16016004
B:
	.zero	16016004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 16016004
C:
	.zero	16016004
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 4004001
S:
	.zero	4004001
	.section	.rodata
.LC0:
	.string	"%d%d%d%*c"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d%d%d%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	Q(%rip), %rax
	movq	%rax, %rcx
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, y(%rip)
	jmp	.L2
.L3:
	movl	y(%rip), %eax
	cltq
	imulq	$2001, %rax, %rax
	leaq	S(%rip), %rdx
	addq	%rdx, %rax
	addq	$1, %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
.L2:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L3
	movl	$0, y(%rip)
	jmp	.L4
.L7:
	movl	$0, x(%rip)
	jmp	.L5
.L6:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movl	%eax, %edx
	sarb	$7, %dl
	shrb	$7, %dl
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movsbl	%al, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	y(%rip), %eax
	leal	-1(%rax), %edx
	movl	x(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rdx
	leaq	S(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	y(%rip), %eax
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rax, %rcx
	leaq	S(%rip), %rax
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	imull	%edx, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	W(%rip), %edx
	cmpl	%edx, %eax
	jl	.L6
.L4:
	movl	y(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, y(%rip)
	movl	H(%rip), %edx
	cmpl	%edx, %eax
	jl	.L7
	jmp	.L8
.L9:
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rsi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	subl	%eax, %esi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	movl	x(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	y1(%rip), %eax
	movl	x1(%rip), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	subl	%eax, %esi
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	y1(%rip), %edx
	leal	-1(%rdx), %ecx
	movl	x(%rip), %edx
	movslq	%edx, %rdi
	movslq	%ecx, %rdx
	imulq	$2001, %rdx, %rdx
	addq	%rdi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	y(%rip), %eax
	movl	x1(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %edi
	subl	%eax, %edi
	movl	y1(%rip), %eax
	leal	-1(%rax), %edx
	movl	x1(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$2001, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	(%rdi,%rax), %edx
	movl	%esi, %eax
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	x(%rip), %r8
	leaq	y(%rip), %rax
	movq	%rax, %rcx
	leaq	x1(%rip), %rax
	movq	%rax, %rdx
	leaq	y1(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
