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>

#define rep(i, n) for(i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(i = f; i < (int)l; ++i)

char fld[1001][1001];
int J[1001][1001];
int O[1001][1001];
int I[1001][1001];

int main(void){
    int m, n, k;
    register int i, j;
    scanf("%d%d%d", &m, &n, &k);
    getchar();
    rep(i, m){
        rep(j, n) fld[i][j] = getchar();
        getchar();
    }

#define FOR_EACH(F) {F(J, 'J'); F(O, 'O');} // F(I, 'I');}
#define PSUM(ARR, SYM)                        \
    repf(i, 1, m + 1){                        \
        int __c = 0;                          \
        repf(j, 1, n + 1){                    \
            __c += (fld[i-1][j-1] == SYM);    \
            ARR[i][j] = ARR[i - 1][j] + __c;  \
        }                                     \
    }                                         
    FOR_EACH(PSUM);

    /*
    rep(i, m + 1){
        rep(j, n + 1)
            printf("%3d", J[i][j]);
        printf("\n");
    }
    */

    while(k --> 0){
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        a--; b--;
        int jsum, osum;
        jsum = osum = 0;
        jsum = J[c][d] - J[c][b] - J[a][d] + J[a][b];
        osum = O[c][d] - O[c][b] - O[a][d] + O[a][b];
        printf("%d %d %d\n", jsum, osum, (c - a) * (d - b) - jsum - osum);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	fld
	.bss
	.align 32
	.type	fld, @object
	.size	fld, 1002001
fld:
	.zero	1002001
	.globl	J
	.align 32
	.type	J, @object
	.size	J, 4008004
J:
	.zero	4008004
	.globl	O
	.align 32
	.type	O, @object
	.size	O, 4008004
O:
	.zero	4008004
	.globl	I
	.align 32
	.type	I, @object
	.size	I, 4008004
I:
	.zero	4008004
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d %d %d\n"
	.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
	pushq	%r12
	pushq	%rbx
	subq	$64, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rcx
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$0, %ebx
	jmp	.L2
.L5:
	movl	$0, %r12d
	jmp	.L3
.L4:
	call	getchar@PLT
	movl	%eax, %edx
	movslq	%r12d, %rcx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rax, %rcx
	leaq	fld(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, %r12d
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jl	.L4
	call	getchar@PLT
	addl	$1, %ebx
.L2:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jl	.L5
	movl	$1, %ebx
	jmp	.L6
.L9:
	movl	$0, -40(%rbp)
	movl	$1, %r12d
	jmp	.L7
.L8:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$74, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -40(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L7:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L8
	addl	$1, %ebx
.L6:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L9
	movl	$1, %ebx
	jmp	.L10
.L13:
	movl	$0, -36(%rbp)
	movl	$1, %r12d
	jmp	.L11
.L12:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -36(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L11:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L12
	addl	$1, %ebx
.L10:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L13
	jmp	.L14
.L15:
	leaq	-44(%rbp), %rsi
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	$0, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	J(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	O(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	-56(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movl	-52(%rbp), %ecx
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	-28(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jg	.L15
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$64, %rsp
	popq	%rbx
	popq	%r12
	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"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d %d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	20(%rsp), %rcx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L14
	leaq	fld(%rip), %rbp
	xorl	%r13d, %r13d
	movq	%rbp, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movl	16(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, (%r12,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, 16(%rsp)
	jg	.L4
.L6:
	movq	stdin(%rip), %rdi
	addl	$1, %r13d
	addq	$1001, %r12
	call	getc@PLT
	movl	12(%rsp), %eax
	cmpl	%r13d, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L14
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L14
	leal	-1(%rax), %ebx
	leaq	J(%rip), %rsi
	movq	%rbx, %r11
	imulq	$4004, %rbx, %rbx
	leaq	4004(%rsi), %rdi
	leal	1(%rdx), %r10d
	leaq	fld(%rip), %r8
	movq	%r10, %r9
	addq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movl	$1, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%ecx, %ecx
	cmpb	$74, -1(%r8,%rax)
	sete	%cl
	addl	%ecx, %edx
	movl	(%rsi,%rax,4), %ecx
	addl	%edx, %ecx
	movl	%ecx, (%rdi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r10
	jne	.L8
	addq	$4004, %rsi
	addq	$1001, %r8
	addq	$4004, %rdi
	cmpq	%rbx, %rsi
	jne	.L9
	movl	%r11d, %r10d
	leaq	O(%rip), %rsi
	movl	%r9d, %r8d
	imulq	$4004, %r10, %r10
	leaq	4004(%rsi), %rdi
	addq	%rdi, %r10
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$1, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%ecx, %ecx
	cmpb	$79, -1(%rbp,%rax)
	sete	%cl
	addl	%ecx, %edx
	movl	(%rsi,%rax,4), %ecx
	addl	%edx, %ecx
	movl	%ecx, (%rdi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L12
	addq	$4004, %rsi
	addq	$1001, %rbp
	addq	$4004, %rdi
	cmpq	%rsi, %r10
	jne	.L13
.L14:
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jle	.L16
	leaq	24(%rsp), %rax
	leaq	J(%rip), %r14
	leaq	36(%rsp), %r12
	leaq	32(%rsp), %rbp
	movq	%rax, %r15
	leaq	28(%rsp), %rbx
	leaq	O(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r12, %r8
	movq	%rbp, %rcx
	movq	%rbx, %rdx
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movslq	32(%rsp), %rcx
	movslq	36(%rsp), %r9
	leal	-1(%rax), %edi
	movl	28(%rsp), %eax
	movq	%rcx, %r8
	imulq	$1001, %rcx, %rcx
	subl	%edi, %r8d
	movl	%edi, 24(%rsp)
	leal	-1(%rax), %esi
	movslq	%edi, %rax
	movl	$1, %edi
	imulq	$1001, %rax, %rax
	movslq	%esi, %r11
	movl	%esi, 28(%rsp)
	leaq	(%rcx,%r9), %r10
	addq	%r11, %rcx
	movl	(%r14,%r10,4), %edx
	movl	0(%r13,%r10,4), %r10d
	addq	%rax, %r9
	subl	0(%r13,%rcx,4), %r10d
	addq	%r11, %rax
	subl	(%r14,%rcx,4), %edx
	movl	%r10d, %ecx
	subl	(%r14,%r9,4), %edx
	subl	0(%r13,%r9,4), %ecx
	addl	(%r14,%rax,4), %edx
	addl	0(%r13,%rax,4), %ecx
	movl	36(%rsp), %eax
	subl	%esi, %eax
	leaq	.LC2(%rip), %rsi
	imull	%eax, %r8d
	xorl	%eax, %eax
	subl	%edx, %r8d
	subl	%ecx, %r8d
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jg	.L15
.L16:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L31:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	I
	.bss
	.align 32
	.type	I, @object
	.size	I, 4008004
I:
	.zero	4008004
	.globl	O
	.align 32
	.type	O, @object
	.size	O, 4008004
O:
	.zero	4008004
	.globl	J
	.align 32
	.type	J, @object
	.size	J, 4008004
J:
	.zero	4008004
	.globl	fld
	.align 32
	.type	fld, @object
	.size	fld, 1002001
fld:
	.zero	1002001
	.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"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d %d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	20(%rsp), %rcx
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L14
	leaq	fld(%rip), %rbp
	xorl	%r13d, %r13d
	movq	%rbp, %r12
	.p2align 4,,10
	.p2align 3
.L3:
	movl	16(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, (%r12,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, 16(%rsp)
	jg	.L4
.L6:
	movq	stdin(%rip), %rdi
	addl	$1, %r13d
	addq	$1001, %r12
	call	getc@PLT
	movl	12(%rsp), %eax
	cmpl	%r13d, %eax
	jg	.L3
	testl	%eax, %eax
	jle	.L14
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L14
	leal	-1(%rax), %ebx
	leaq	J(%rip), %rsi
	movq	%rbx, %r11
	imulq	$4004, %rbx, %rbx
	leaq	4004(%rsi), %rdi
	leal	1(%rdx), %r10d
	leaq	fld(%rip), %r8
	movq	%r10, %r9
	addq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movl	$1, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%ecx, %ecx
	cmpb	$74, -1(%r8,%rax)
	sete	%cl
	addl	%ecx, %edx
	movl	(%rsi,%rax,4), %ecx
	addl	%edx, %ecx
	movl	%ecx, (%rdi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r10
	jne	.L8
	addq	$4004, %rsi
	addq	$1001, %r8
	addq	$4004, %rdi
	cmpq	%rbx, %rsi
	jne	.L9
	movl	%r11d, %r10d
	leaq	O(%rip), %rsi
	movl	%r9d, %r8d
	imulq	$4004, %r10, %r10
	leaq	4004(%rsi), %rdi
	addq	%rdi, %r10
	.p2align 4,,10
	.p2align 3
.L13:
	movl	$1, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%ecx, %ecx
	cmpb	$79, -1(%rbp,%rax)
	sete	%cl
	addl	%ecx, %edx
	movl	(%rsi,%rax,4), %ecx
	addl	%edx, %ecx
	movl	%ecx, (%rdi,%rax,4)
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L12
	addq	$4004, %rsi
	addq	$1001, %rbp
	addq	$4004, %rdi
	cmpq	%rsi, %r10
	jne	.L13
.L14:
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jle	.L16
	leaq	24(%rsp), %rax
	leaq	J(%rip), %r14
	leaq	36(%rsp), %r12
	leaq	32(%rsp), %rbp
	movq	%rax, %r15
	leaq	28(%rsp), %rbx
	leaq	O(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r12, %r8
	movq	%rbp, %rcx
	movq	%rbx, %rdx
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movslq	32(%rsp), %rcx
	movslq	36(%rsp), %r9
	leal	-1(%rax), %edi
	movl	28(%rsp), %eax
	movq	%rcx, %r8
	imulq	$1001, %rcx, %rcx
	subl	%edi, %r8d
	movl	%edi, 24(%rsp)
	leal	-1(%rax), %esi
	movslq	%edi, %rax
	movl	$1, %edi
	imulq	$1001, %rax, %rax
	movslq	%esi, %r11
	movl	%esi, 28(%rsp)
	leaq	(%rcx,%r9), %r10
	addq	%r11, %rcx
	movl	(%r14,%r10,4), %edx
	movl	0(%r13,%r10,4), %r10d
	addq	%rax, %r9
	subl	0(%r13,%rcx,4), %r10d
	addq	%r11, %rax
	subl	(%r14,%rcx,4), %edx
	movl	%r10d, %ecx
	subl	(%r14,%r9,4), %edx
	subl	0(%r13,%r9,4), %ecx
	addl	(%r14,%rax,4), %edx
	addl	0(%r13,%rax,4), %ecx
	movl	36(%rsp), %eax
	subl	%esi, %eax
	leaq	.LC2(%rip), %rsi
	imull	%eax, %r8d
	xorl	%eax, %eax
	subl	%edx, %r8d
	subl	%ecx, %r8d
	call	__printf_chk@PLT
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jg	.L15
.L16:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$56, %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
.L31:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	I
	.bss
	.align 32
	.type	I, @object
	.size	I, 4008004
I:
	.zero	4008004
	.globl	O
	.align 32
	.type	O, @object
	.size	O, 4008004
O:
	.zero	4008004
	.globl	J
	.align 32
	.type	J, @object
	.size	J, 4008004
J:
	.zero	4008004
	.globl	fld
	.align 32
	.type	fld, @object
	.size	fld, 1002001
fld:
	.zero	1002001
	.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>

#define rep(i, n) for(i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(i = f; i < (int)l; ++i)

char fld[1001][1001];
int J[1001][1001];
int O[1001][1001];
int I[1001][1001];

int main(void){
    int m, n, k;
    register int i, j;
    scanf("%d%d%d", &m, &n, &k);
    getchar();
    rep(i, m){
        rep(j, n) fld[i][j] = getchar();
        getchar();
    }

#define FOR_EACH(F) {F(J, 'J'); F(O, 'O');} // F(I, 'I');}
#define PSUM(ARR, SYM)                        \
    repf(i, 1, m + 1){                        \
        int __c = 0;                          \
        repf(j, 1, n + 1){                    \
            __c += (fld[i-1][j-1] == SYM);    \
            ARR[i][j] = ARR[i - 1][j] + __c;  \
        }                                     \
    }                                         
    FOR_EACH(PSUM);

    /*
    rep(i, m + 1){
        rep(j, n + 1)
            printf("%3d", J[i][j]);
        printf("\n");
    }
    */

    while(k --> 0){
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        a--; b--;
        int jsum, osum;
        jsum = osum = 0;
        jsum = J[c][d] - J[c][b] - J[a][d] + J[a][b];
        osum = O[c][d] - O[c][b] - O[a][d] + O[a][b];
        printf("%d %d %d\n", jsum, osum, (c - a) * (d - b) - jsum - osum);
    }

    return 0;
}
4 7
4
JIOJOIJ
IOJOIJO
JOIJOOI
OOJJIJO
5 5 4 7
2 2 3 6
2 2 2 2
1 1 4 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
5 5 4 7
2 2 3 6
2 2 2 2
1 1 4 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
5 7 4 7
2 2 3 6
2 2 2 2
1 1 1 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
5 7 4 7
2 2 3 6
2 3 2 2
1 1 1 7
 4 7
4
JIOJOIJ
IOJOIJO
JOIJOOI
OOJJIJO
3 5 4 6
2 2 3 6
2 2 2 2
1 1 4 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
5 5 4 7
2 2 3 6
2 2 2 2
1 1 3 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
5 7 4 7
2 2 3 6
2 2 2 1
1 1 4 7
 4 7
4
JIOJOIJ
OIJOJOI
JOIJOOI
OOJJIJO
5 7 4 7
2 2 3 6
2 2 2 2
1 1 1 7
 4 7
4
JIOJOIJ
OJIOJOI
JOIJOOI
OOJJIJO
2 5 4 7
2 2 3 6
2 2 2 2
1 1 3 7
 4 7
4
JIOJOIJ
JIJOOOI
JOIJOOI
OOJJIJO
5 7 4 7
2 2 3 6
2 2 2 2
1 1 1 7

0 0 0
3 5 2
0 1 0
10 11 7
 0 0 0
3 5 2
1 0 0
10 11 7
 0 0 0
3 5 2
1 0 0
3 2 2
 0 0 0
3 5 2
0 0 0
3 2 2
 1 2 1
3 5 2
0 1 0
10 11 7
 0 0 0
3 5 2
1 0 0
7 8 6
 0 0 0
3 5 2
0 0 0
10 11 7
 0 0 0
3 5 2
0 0 1
3 2 2
 2 4 3
3 5 2
1 0 0
7 8 6
 0 0 0
2 6 2
0 0 1
3 2 2

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>

#define rep(i, n) for(i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(i = f; i < (int)l; ++i)

char fld[1001][1001];
int J[1001][1001];
int O[1001][1001];
int I[1001][1001];

int main(void){
    int m, n, k;
    register int i, j;
    scanf("%d%d%d", &m, &n, &k);
    getchar();
    rep(i, m){
        rep(j, n) fld[i][j] = getchar();
        getchar();
    }

#define FOR_EACH(F) {F(J, 'J'); F(O, 'O');} // F(I, 'I');}
#define PSUM(ARR, SYM)                        \
    repf(i, 1, m + 1){                        \
        int __c = 0;                          \
        repf(j, 1, n + 1){                    \
            __c += (fld[i-1][j-1] == SYM);    \
            ARR[i][j] = ARR[i - 1][j] + __c;  \
        }                                     \
    }                                         
    FOR_EACH(PSUM);

    /*
    rep(i, m + 1){
        rep(j, n + 1)
            printf("%3d", J[i][j]);
        printf("\n");
    }
    */

    while(k --> 0){
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        a--; b--;
        int jsum, osum;
        jsum = osum = 0;
        jsum = J[c][d] - J[c][b] - J[a][d] + J[a][b];
        osum = O[c][d] - O[c][b] - O[a][d] + O[a][b];
        printf("%d %d %d\n", jsum, osum, (c - a) * (d - b) - jsum - osum);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	fld
	.bss
	.align 32
	.type	fld, @object
	.size	fld, 1002001
fld:
	.zero	1002001
	.globl	J
	.align 32
	.type	J, @object
	.size	J, 4008004
J:
	.zero	4008004
	.globl	O
	.align 32
	.type	O, @object
	.size	O, 4008004
O:
	.zero	4008004
	.globl	I
	.align 32
	.type	I, @object
	.size	I, 4008004
I:
	.zero	4008004
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d %d %d\n"
	.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
	pushq	%r12
	pushq	%rbx
	subq	$64, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rcx
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$0, %ebx
	jmp	.L2
.L5:
	movl	$0, %r12d
	jmp	.L3
.L4:
	call	getchar@PLT
	movl	%eax, %edx
	movslq	%r12d, %rcx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rax, %rcx
	leaq	fld(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, %r12d
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jl	.L4
	call	getchar@PLT
	addl	$1, %ebx
.L2:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jl	.L5
	movl	$1, %ebx
	jmp	.L6
.L9:
	movl	$0, -40(%rbp)
	movl	$1, %r12d
	jmp	.L7
.L8:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$74, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -40(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L7:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L8
	addl	$1, %ebx
.L6:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L9
	movl	$1, %ebx
	jmp	.L10
.L13:
	movl	$0, -36(%rbp)
	movl	$1, %r12d
	jmp	.L11
.L12:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -36(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L11:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L12
	addl	$1, %ebx
.L10:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L13
	jmp	.L14
.L15:
	leaq	-44(%rbp), %rsi
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	$0, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	J(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	O(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	-56(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movl	-52(%rbp), %ecx
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	-28(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jg	.L15
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$64, %rsp
	popq	%rbx
	popq	%r12
	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	fld
	.bss
	.align 32
	.type	fld, @object
	.size	fld, 1002001
fld:
	.zero	1002001
	.globl	J
	.align 32
	.type	J, @object
	.size	J, 4008004
J:
	.zero	4008004
	.globl	O
	.align 32
	.type	O, @object
	.size	O, 4008004
O:
	.zero	4008004
	.globl	I
	.align 32
	.type	I, @object
	.size	I, 4008004
I:
	.zero	4008004
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%d %d %d\n"
	.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
	pushq	%r12
	pushq	%rbx
	subq	$64, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rcx
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	call	getchar@PLT
	movl	$0, %ebx
	jmp	.L2
.L5:
	movl	$0, %r12d
	jmp	.L3
.L4:
	call	getchar@PLT
	movl	%eax, %edx
	movslq	%r12d, %rcx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rax, %rcx
	leaq	fld(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, %r12d
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jl	.L4
	call	getchar@PLT
	addl	$1, %ebx
.L2:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jl	.L5
	movl	$1, %ebx
	jmp	.L6
.L9:
	movl	$0, -40(%rbp)
	movl	$1, %r12d
	jmp	.L7
.L8:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$74, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -40(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L7:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L8
	addl	$1, %ebx
.L6:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L9
	movl	$1, %ebx
	jmp	.L10
.L13:
	movl	$0, -36(%rbp)
	movl	$1, %r12d
	jmp	.L11
.L12:
	leal	-1(%rbx), %eax
	leal	-1(%r12), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	fld(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$79, %al
	sete	%al
	movzbl	%al, %eax
	addl	%eax, -36(%rbp)
	leal	-1(%rbx), %eax
	movslq	%r12d, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movslq	%r12d, %rdx
	movslq	%ebx, %rax
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, %r12d
.L11:
	movl	-64(%rbp), %eax
	cmpl	%eax, %r12d
	jle	.L12
	addl	$1, %ebx
.L10:
	movl	-68(%rbp), %eax
	cmpl	%eax, %ebx
	jle	.L13
	jmp	.L14
.L15:
	leaq	-44(%rbp), %rsi
	leaq	-48(%rbp), %rcx
	leaq	-52(%rbp), %rdx
	leaq	-56(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -56(%rbp)
	movl	-52(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -52(%rbp)
	movl	$0, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	J(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	J(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-48(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	O(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movl	-52(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	O(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -32(%rbp)
	movl	-48(%rbp), %eax
	movl	-56(%rbp), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movl	-52(%rbp), %ecx
	subl	%ecx, %eax
	imull	%edx, %eax
	subl	-28(%rbp), %eax
	subl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L14:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jg	.L15
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	addq	$64, %rsp
	popq	%rbx
	popq	%r12
	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:
