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>

int field[100][100][3];

int main(void)
{
    int N, M, D;
    char in_str[101];
    int n;
    int i, j;
    
    scanf("%d%d%d", &N, &M, &D);
    
    for (i = 0; i < N; i++){
        scanf("%s", in_str);
        for (j = 0; j < M; j++){
            if (in_str[j] == '#'){
                field[i][j][0] = 1;
            }
        }
    }
    
    for (i = 0; i < N; i++){
        n = 0;
        for (j = M - 1; j >= 0; j--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][1] = n;
            }
            else {
                n = 0;
            }
        }
    }
    
    for (j = 0; j < M; j++){
        n = 0;
        for (i = N - 1; i >= 0; i--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][2] = n;
            }
            else {
                n = 0;
            }
        }
    }
#if 0
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            printf("[%d,%d]", field[i][j][1], field[i][j][2]);
        }
        printf("\n");
    }
#endif
    n = 0;
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            if (field[i][j][1] >= D){
                n++;
            }
            if (field[i][j][2] >= D){
                n++;
            }
        }
    }

    printf("%d\n", n);
    
    return (0);
}






```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	field
	.bss
	.align 32
	.type	field, @object
	.size	field, 120000
field:
	.zero	120000
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%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
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -120(%rbp)
	jmp	.L2
.L6:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L3
.L5:
	movl	-116(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$35, %al
	jne	.L4
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L4:
	addl	$1, -116(%rbp)
.L3:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L5
	addl	$1, -120(%rbp)
.L2:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L6
	movl	$0, -120(%rbp)
	jmp	.L7
.L12:
	movl	$0, -124(%rbp)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -116(%rbp)
	jmp	.L8
.L11:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L9
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L10
.L9:
	movl	$0, -124(%rbp)
.L10:
	subl	$1, -116(%rbp)
.L8:
	cmpl	$0, -116(%rbp)
	jns	.L11
	addl	$1, -120(%rbp)
.L7:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L12
	movl	$0, -116(%rbp)
	jmp	.L13
.L18:
	movl	$0, -124(%rbp)
	movl	-136(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -120(%rbp)
	jmp	.L14
.L17:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L15
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L16
.L15:
	movl	$0, -124(%rbp)
.L16:
	subl	$1, -120(%rbp)
.L14:
	cmpl	$0, -120(%rbp)
	jns	.L17
	addl	$1, -116(%rbp)
.L13:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L18
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L19
.L24:
	movl	$0, -116(%rbp)
	jmp	.L20
.L23:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L21
	addl	$1, -124(%rbp)
.L21:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	addl	$1, -124(%rbp)
.L22:
	addl	$1, -116(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L23
	addl	$1, -120(%rbp)
.L19:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.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	"%s"
.LC2:
	.string	"%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	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L30
	leaq	field(%rip), %rbx
	xorl	%r13d, %r13d
	leaq	16(%rsp), %r15
	movq	%rbx, %r14
	leaq	.LC1(%rip), %rbp
	leaq	17(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdi
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L8
	leal	-1(%rdi), %ecx
	movq	%r15, %rax
	movq	%r14, %rdx
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$35, (%rax)
	jne	.L6
	movl	$1, (%rdx)
.L6:
	addq	$1, %rax
	addq	$12, %rdx
	cmpq	%rcx, %rax
	jne	.L7
.L8:
	movl	4(%rsp), %r8d
	addl	$1, %r13d
	addq	$1200, %r14
	cmpl	%r13d, %r8d
	jg	.L4
	testl	%r8d, %r8d
	jle	.L30
	movl	%edi, %r9d
	leal	-1(%r8), %r10d
	subl	$1, %r9d
	js	.L10
	movslq	%edi, %rax
	leaq	1200+field(%rip), %r11
	leaq	(%rax,%rax,2), %rax
	salq	$2, %rax
	addq	%rax, %r11
	leaq	(%rbx,%rax), %rsi
	leal	-1(%r8), %eax
	movq	%rax, %r10
	imulq	$1200, %rax, %rax
	addq	%rax, %r11
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rsi, %rax
	movl	%r9d, %edx
	xorl	%ecx, %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, %ecx
	subl	$1, %edx
	subq	$12, %rax
	movl	%ecx, 4(%rax)
	cmpl	$-1, %edx
	je	.L45
.L11:
	movl	-12(%rax), %ebp
	testl	%ebp, %ebp
	je	.L46
	subl	$1, %edx
	xorl	%ecx, %ecx
	subq	$12, %rax
	cmpl	$-1, %edx
	jne	.L11
.L45:
	addq	$1200, %rsi
	cmpq	%r11, %rsi
	jne	.L15
.L10:
	testl	%edi, %edi
	jle	.L13
	movslq	%r8d, %rax
	leaq	12+field(%rip), %rdx
	imulq	$1200, %rax, %rax
	addq	%rax, %rbx
	addq	%rdx, %rax
	movl	%r9d, %edx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rax,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rax
	movl	%r10d, %edx
	xorl	%ecx, %ecx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L48:
	addl	$1, %ecx
	subl	$1, %edx
	subq	$1200, %rax
	movl	%ecx, 8(%rax)
	cmpl	$-1, %edx
	je	.L47
.L19:
	movl	-1200(%rax), %r8d
	testl	%r8d, %r8d
	je	.L48
	subl	$1, %edx
	xorl	%ecx, %ecx
	subq	$1200, %rax
	cmpl	$-1, %edx
	jne	.L19
.L47:
	addq	$12, %rbx
	cmpq	%rsi, %rbx
	jne	.L20
.L13:
	movl	%r9d, %r9d
	imulq	$1200, %r10, %r10
	leaq	16+field(%rip), %rax
	movl	12(%rsp), %ecx
	leaq	(%r9,%r9,2), %rdx
	leaq	-12(%rax), %r9
	leaq	(%rax,%rdx,4), %r8
	addq	$1188, %rax
	xorl	%edx, %edx
	addq	%rax, %r10
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r9, %rax
	testl	%edi, %edi
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	xorl	%esi, %esi
	cmpl	%ecx, (%rax)
	setge	%sil
	addl	%esi, %edx
	xorl	%esi, %esi
	cmpl	4(%rax), %ecx
	setle	%sil
	addq	$12, %rax
	addl	%esi, %edx
	cmpq	%rax, %r8
	jne	.L24
.L25:
	addq	$1200, %r9
	addq	$1200, %r8
	cmpq	%r10, %r9
	jne	.L21
.L17:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$136, %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
.L30:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L17
.L49:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	field
	.bss
	.align 32
	.type	field, @object
	.size	field, 120000
field:
	.zero	120000
	.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	"%s"
.LC2:
	.string	"%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	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rcx
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r12d
	testl	%r12d, %r12d
	jle	.L30
	leaq	field(%rip), %rbx
	xorl	%r13d, %r13d
	leaq	16(%rsp), %r15
	movq	%rbx, %r14
	leaq	.LC1(%rip), %rbp
	leaq	17(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdi
	movq	%r15, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %edi
	testl	%edi, %edi
	jle	.L8
	leal	-1(%rdi), %ecx
	movq	%r15, %rax
	movq	%r14, %rdx
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$35, (%rax)
	jne	.L6
	movl	$1, (%rdx)
.L6:
	addq	$1, %rax
	addq	$12, %rdx
	cmpq	%rcx, %rax
	jne	.L7
.L8:
	movl	4(%rsp), %r8d
	addl	$1, %r13d
	addq	$1200, %r14
	cmpl	%r13d, %r8d
	jg	.L4
	testl	%r8d, %r8d
	jle	.L30
	movl	%edi, %r9d
	leal	-1(%r8), %r10d
	subl	$1, %r9d
	js	.L10
	movslq	%edi, %rax
	leaq	1200+field(%rip), %r11
	leaq	(%rax,%rax,2), %rax
	salq	$2, %rax
	addq	%rax, %r11
	leaq	(%rbx,%rax), %rsi
	leal	-1(%r8), %eax
	movq	%rax, %r10
	imulq	$1200, %rax, %rax
	addq	%rax, %r11
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rsi, %rax
	movl	%r9d, %edx
	xorl	%ecx, %ecx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, %ecx
	subl	$1, %edx
	subq	$12, %rax
	movl	%ecx, 4(%rax)
	cmpl	$-1, %edx
	je	.L45
.L11:
	movl	-12(%rax), %ebp
	testl	%ebp, %ebp
	je	.L46
	subl	$1, %edx
	xorl	%ecx, %ecx
	subq	$12, %rax
	cmpl	$-1, %edx
	jne	.L11
.L45:
	addq	$1200, %rsi
	cmpq	%r11, %rsi
	jne	.L15
.L10:
	testl	%edi, %edi
	jle	.L13
	movslq	%r8d, %rax
	leaq	12+field(%rip), %rdx
	imulq	$1200, %rax, %rax
	addq	%rax, %rbx
	addq	%rdx, %rax
	movl	%r9d, %edx
	leaq	(%rdx,%rdx,2), %rdx
	leaq	(%rax,%rdx,4), %rsi
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rbx, %rax
	movl	%r10d, %edx
	xorl	%ecx, %ecx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L48:
	addl	$1, %ecx
	subl	$1, %edx
	subq	$1200, %rax
	movl	%ecx, 8(%rax)
	cmpl	$-1, %edx
	je	.L47
.L19:
	movl	-1200(%rax), %r8d
	testl	%r8d, %r8d
	je	.L48
	subl	$1, %edx
	xorl	%ecx, %ecx
	subq	$1200, %rax
	cmpl	$-1, %edx
	jne	.L19
.L47:
	addq	$12, %rbx
	cmpq	%rsi, %rbx
	jne	.L20
.L13:
	movl	%r9d, %r9d
	imulq	$1200, %r10, %r10
	leaq	16+field(%rip), %rax
	movl	12(%rsp), %ecx
	leaq	(%r9,%r9,2), %rdx
	leaq	-12(%rax), %r9
	leaq	(%rax,%rdx,4), %r8
	addq	$1188, %rax
	xorl	%edx, %edx
	addq	%rax, %r10
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r9, %rax
	testl	%edi, %edi
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L24:
	xorl	%esi, %esi
	cmpl	%ecx, (%rax)
	setge	%sil
	addl	%esi, %edx
	xorl	%esi, %esi
	cmpl	4(%rax), %ecx
	setle	%sil
	addq	$12, %rax
	addl	%esi, %edx
	cmpq	%rax, %r8
	jne	.L24
.L25:
	addq	$1200, %r9
	addq	$1200, %r8
	cmpq	%r10, %r9
	jne	.L21
.L17:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$136, %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
.L30:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L17
.L49:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	field
	.bss
	.align 32
	.type	field, @object
	.size	field, 120000
field:
	.zero	120000
	.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>

int field[100][100][3];

int main(void)
{
    int N, M, D;
    char in_str[101];
    int n;
    int i, j;
    
    scanf("%d%d%d", &N, &M, &D);
    
    for (i = 0; i < N; i++){
        scanf("%s", in_str);
        for (j = 0; j < M; j++){
            if (in_str[j] == '#'){
                field[i][j][0] = 1;
            }
        }
    }
    
    for (i = 0; i < N; i++){
        n = 0;
        for (j = M - 1; j >= 0; j--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][1] = n;
            }
            else {
                n = 0;
            }
        }
    }
    
    for (j = 0; j < M; j++){
        n = 0;
        for (i = N - 1; i >= 0; i--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][2] = n;
            }
            else {
                n = 0;
            }
        }
    }
#if 0
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            printf("[%d,%d]", field[i][j][1], field[i][j][2]);
        }
        printf("\n");
    }
#endif
    n = 0;
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            if (field[i][j][1] >= D){
                n++;
            }
            if (field[i][j][2] >= D){
                n++;
            }
        }
    }

    printf("%d\n", n);
    
    return (0);
}







3 5 2
...#.
#...#
....#

12

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>

int field[100][100][3];

int main(void)
{
    int N, M, D;
    char in_str[101];
    int n;
    int i, j;
    
    scanf("%d%d%d", &N, &M, &D);
    
    for (i = 0; i < N; i++){
        scanf("%s", in_str);
        for (j = 0; j < M; j++){
            if (in_str[j] == '#'){
                field[i][j][0] = 1;
            }
        }
    }
    
    for (i = 0; i < N; i++){
        n = 0;
        for (j = M - 1; j >= 0; j--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][1] = n;
            }
            else {
                n = 0;
            }
        }
    }
    
    for (j = 0; j < M; j++){
        n = 0;
        for (i = N - 1; i >= 0; i--){
            if (field[i][j][0] == 0){
                n++;
                field[i][j][2] = n;
            }
            else {
                n = 0;
            }
        }
    }
#if 0
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            printf("[%d,%d]", field[i][j][1], field[i][j][2]);
        }
        printf("\n");
    }
#endif
    n = 0;
    for (i = 0; i < N; i++){
        for (j = 0; j < M; j++){
            if (field[i][j][1] >= D){
                n++;
            }
            if (field[i][j][2] >= D){
                n++;
            }
        }
    }

    printf("%d\n", n);
    
    return (0);
}






```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	field
	.bss
	.align 32
	.type	field, @object
	.size	field, 120000
field:
	.zero	120000
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%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
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -120(%rbp)
	jmp	.L2
.L6:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L3
.L5:
	movl	-116(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$35, %al
	jne	.L4
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L4:
	addl	$1, -116(%rbp)
.L3:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L5
	addl	$1, -120(%rbp)
.L2:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L6
	movl	$0, -120(%rbp)
	jmp	.L7
.L12:
	movl	$0, -124(%rbp)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -116(%rbp)
	jmp	.L8
.L11:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L9
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L10
.L9:
	movl	$0, -124(%rbp)
.L10:
	subl	$1, -116(%rbp)
.L8:
	cmpl	$0, -116(%rbp)
	jns	.L11
	addl	$1, -120(%rbp)
.L7:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L12
	movl	$0, -116(%rbp)
	jmp	.L13
.L18:
	movl	$0, -124(%rbp)
	movl	-136(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -120(%rbp)
	jmp	.L14
.L17:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L15
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L16
.L15:
	movl	$0, -124(%rbp)
.L16:
	subl	$1, -120(%rbp)
.L14:
	cmpl	$0, -120(%rbp)
	jns	.L17
	addl	$1, -116(%rbp)
.L13:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L18
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L19
.L24:
	movl	$0, -116(%rbp)
	jmp	.L20
.L23:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L21
	addl	$1, -124(%rbp)
.L21:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	addl	$1, -124(%rbp)
.L22:
	addl	$1, -116(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L23
	addl	$1, -120(%rbp)
.L19:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.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	field
	.bss
	.align 32
	.type	field, @object
	.size	field, 120000
field:
	.zero	120000
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%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
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-128(%rbp), %rcx
	leaq	-132(%rbp), %rdx
	leaq	-136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -120(%rbp)
	jmp	.L2
.L6:
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L3
.L5:
	movl	-116(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$35, %al
	jne	.L4
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L4:
	addl	$1, -116(%rbp)
.L3:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L5
	addl	$1, -120(%rbp)
.L2:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L6
	movl	$0, -120(%rbp)
	jmp	.L7
.L12:
	movl	$0, -124(%rbp)
	movl	-132(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -116(%rbp)
	jmp	.L8
.L11:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L9
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L10
.L9:
	movl	$0, -124(%rbp)
.L10:
	subl	$1, -116(%rbp)
.L8:
	cmpl	$0, -116(%rbp)
	jns	.L11
	addl	$1, -120(%rbp)
.L7:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L12
	movl	$0, -116(%rbp)
	jmp	.L13
.L18:
	movl	$0, -124(%rbp)
	movl	-136(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -120(%rbp)
	jmp	.L14
.L17:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L15
	addl	$1, -124(%rbp)
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rax, %rdx
	movl	-124(%rbp), %eax
	movl	%eax, (%rdx)
	jmp	.L16
.L15:
	movl	$0, -124(%rbp)
.L16:
	subl	$1, -120(%rbp)
.L14:
	cmpl	$0, -120(%rbp)
	jns	.L17
	addl	$1, -116(%rbp)
.L13:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L18
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L19
.L24:
	movl	$0, -116(%rbp)
	jmp	.L20
.L23:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	4+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L21
	addl	$1, -124(%rbp)
.L21:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	imulq	$1200, %rcx, %rdx
	addq	%rax, %rdx
	leaq	8+field(%rip), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-128(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	addl	$1, -124(%rbp)
.L22:
	addl	$1, -116(%rbp)
.L20:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L23
	addl	$1, -120(%rbp)
.L19:
	movl	-136(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	movl	-124(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.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:
