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 main(void)
{
  int h, w;
  scanf("%d%d", &h, &w);
  int grid[h][w];

  for (int y = 0; y < h; y++) {
    char s[w + 1];
    scanf("%s", s);
    for (int x = 0; x < w; x++) {
      grid[y][x] = s[x] == '#' ? 0 : 10000;
    }
  }

  for (int y = 0; y < h; y++) {
    for (int x = 1; x < w; x++) {
      if (grid[y][x] > grid[y][x - 1] + 1) {
        grid[y][x] = grid[y][x - 1] + 1;
      }
      int xx = w - 1 - x;
      if (grid[y][xx] > grid[y][xx + 1] + 1) {
        grid[y][xx] = grid[y][xx + 1] + 1;
      }
    }
  }

  for (int x = 0; x < w; x++) {
    for (int y = 1; y < h; y++) {
      if (grid[y][x] > grid[y - 1][x] + 1) {
        grid[y][x] = grid[y - 1][x] + 1;
      }
      int yy = h - 1 - y;
      if (grid[yy][x] > grid[yy + 1][x] + 1) {
        grid[yy][x] = grid[yy + 1][x] + 1;
      }
    }
  }

  int ans = 0;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (ans < grid[y][x]) {
        ans = grid[y][x];
      }
    }
  }
  printf("%d\n", ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$216, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -248(%rbp)
	leaq	-144(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-144(%rbp), %esi
	movl	-148(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-192(%rbp), %r9
	movq	-184(%rbp), %r10
	movq	%r10, %rdx
	imulq	-176(%rbp), %rdx
	movq	-168(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-176(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L5
.L13:
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	-144(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -136(%rbp)
	jmp	.L9
.L12:
	movq	-64(%rbp), %rdx
	movl	-136(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$0, %esi
	jmp	.L11
.L10:
	movl	$10000, %esi
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-136(%rbp), %edx
	movslq	%edx, %rdi
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	%esi, (%rax,%rdx,4)
	addl	$1, -136(%rbp)
.L9:
	movl	-144(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L12
	movq	%r12, %rsp
	addl	$1, -140(%rbp)
.L5:
	movl	-148(%rbp), %eax
	cmpl	%eax, -140(%rbp)
	jl	.L13
	movl	$0, -132(%rbp)
	jmp	.L14
.L19:
	movl	$1, -128(%rbp)
	jmp	.L15
.L18:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-128(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L16
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L16:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	subl	-128(%rbp), %eax
	movl	%eax, -100(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-100(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L17
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L17:
	addl	$1, -128(%rbp)
.L15:
	movl	-144(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L18
	addl	$1, -132(%rbp)
.L14:
	movl	-148(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L19
	movl	$0, -124(%rbp)
	jmp	.L20
.L25:
	movl	$1, -120(%rbp)
	jmp	.L21
.L24:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L22
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-120(%rbp), %eax
	leal	-1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L22:
	movl	-148(%rbp), %eax
	subl	$1, %eax
	subl	-120(%rbp), %eax
	movl	%eax, -104(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-104(%rbp), %eax
	leal	1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L23
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-104(%rbp), %eax
	leal	1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L23:
	addl	$1, -120(%rbp)
.L21:
	movl	-148(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	addl	$1, -124(%rbp)
.L20:
	movl	-144(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L25
	movl	$0, -116(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L26
.L30:
	movl	$0, -108(%rbp)
	jmp	.L27
.L29:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -116(%rbp)
	jge	.L28
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -116(%rbp)
.L28:
	addl	$1, -108(%rbp)
.L27:
	movl	-144(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L29
	addl	$1, -112(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L30
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-248(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rsi
	movslq	-64(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %rcx
	imulq	%rsi, %rax
	movq	%rsi, %rdx
	leaq	0(,%rsi,4), %r8
	leaq	15(,%rax,4), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L3
.L92:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L92
.L3:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L93
.L4:
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L5
	movq	%r8, %rax
	movq	%rbx, %r9
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	shrq	$2, %rax
	movl	$10000, %r13d
	movq	%rax, -72(%rbp)
	movl	%edx, %eax
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, %eax
	movq	%rsp, %rcx
	movq	%rsp, %r10
	cltq
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L7
.L94:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L94
.L7:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L8
	orq	$0, -8(%rsp,%rdx)
.L8:
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	movq	%r9, -96(%rbp)
	movq	%r8, -88(%rbp)
	movq	%rsp, %r12
	movq	%r10, -80(%rbp)
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	movq	-80(%rbp), %r10
	movdqa	.LC2(%rip), %xmm8
	movdqa	.LC3(%rip), %xmm4
	testl	%eax, %eax
	movq	-88(%rbp), %r8
	movq	-96(%rbp), %r9
	jle	.L15
	leal	-1(%rax), %edx
	cmpl	$14, %edx
	jbe	.L53
	movl	%eax, %esi
	movq	%rsp, %rcx
	pxor	%xmm7, %xmm7
	movq	%r9, %rdx
	shrl	$4, %esi
	pxor	%xmm6, %xmm6
	salq	$4, %rsi
	addq	%rsp, %rsi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rcx), %xmm0
	movdqa	%xmm7, %xmm2
	movdqa	%xmm6, %xmm5
	addq	$16, %rcx
	addq	$64, %rdx
	pcmpeqb	%xmm8, %xmm0
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm6, %xmm2
	pcmpgtw	%xmm1, %xmm2
	pcmpgtw	%xmm0, %xmm5
	movdqa	%xmm1, %xmm3
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	punpcklwd	%xmm5, %xmm2
	punpckhwd	%xmm5, %xmm0
	pandn	%xmm4, %xmm3
	pandn	%xmm4, %xmm1
	pandn	%xmm4, %xmm2
	pandn	%xmm4, %xmm0
	movups	%xmm3, -64(%rdx)
	movups	%xmm1, -48(%rdx)
	movups	%xmm2, -32(%rdx)
	movups	%xmm0, -16(%rdx)
	cmpq	%rsi, %rcx
	jne	.L13
	movl	%eax, %edx
	andl	$-16, %edx
	testb	$15, %al
	je	.L15
.L12:
	movslq	%edx, %rcx
	movq	-72(%rbp), %rsi
	movl	%r13d, %r11d
	movslq	%r15d, %rdi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	imulq	%rdi, %rsi
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	1(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	2(%rdx), %ecx
	cmpl	%eax, %ecx
	jge	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	3(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	4(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	5(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	6(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	7(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	8(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	9(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	10(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	imulq	-72(%rbp), %rdi
	addq	%rdi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	11(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	movl	%esi, (%rbx,%rcx,4)
	leal	12(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	movl	%esi, (%rbx,%rcx,4)
	leal	13(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	addl	$14, %edx
	movl	%esi, (%rbx,%rcx,4)
	cmpl	%edx, %eax
	jle	.L15
	movslq	%edx, %rdx
	movl	%r13d, %eax
	cmpb	$35, (%r12,%rdx)
	cmove	%r14d, %eax
	addq	%rdi, %rdx
	movl	%eax, (%rbx,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L15:
	movl	-64(%rbp), %ecx
	addl	$1, %r15d
	movq	%r10, %rsp
	addq	%r8, %r9
	cmpl	%r15d, %ecx
	jle	.L95
	movl	-60(%rbp), %eax
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L95:
	movl	-60(%rbp), %edx
	testl	%ecx, %ecx
	jle	.L5
	cmpl	$1, %edx
	jle	.L33
	leal	-2(%rdx), %eax
	movslq	%edx, %rsi
	movq	$-4, %r11
	xorl	%r10d, %r10d
	salq	$2, %rax
	salq	$2, %rsi
	subq	%rax, %rsi
	leaq	8(%rbx,%rax), %r9
	subq	%rax, %r11
	leaq	-8(%rsi), %r12
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	(%r12,%r9), %rsi
	leaq	(%r11,%r9), %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movl	-4(%rax), %edi
	addl	$1, %edi
	cmpl	%edi, (%rax)
	jle	.L35
	movl	%edi, (%rax)
.L35:
	movl	-4(%rsi), %edi
	addl	$1, %edi
	cmpl	%edi, -8(%rsi)
	jle	.L36
	movl	%edi, -8(%rsi)
.L36:
	addq	$4, %rax
	subq	$4, %rsi
	cmpq	%r9, %rax
	jne	.L37
	addl	$1, %r10d
	addq	%r8, %r9
	cmpl	%r10d, %ecx
	jne	.L34
.L38:
	movq	%r8, %r10
	shrq	$2, %r10
	cmpl	$1, %ecx
	jle	.L41
	xorl	%r12d, %r12d
	leal	-1(%rcx), %r11d
	.p2align 4,,10
	.p2align 3
.L40:
	movl	$1, %edi
	movslq	%r12d, %r9
	.p2align 4,,10
	.p2align 3
.L44:
	leal	-1(%rdi), %eax
	cltq
	imulq	%r10, %rax
	addq	%r9, %rax
	movl	(%rbx,%rax,4), %esi
	movslq	%edi, %rax
	imulq	%r10, %rax
	addl	$1, %esi
	addq	%r9, %rax
	cmpl	%esi, (%rbx,%rax,4)
	jle	.L42
	movl	%esi, (%rbx,%rax,4)
.L42:
	movl	%ecx, %esi
	movl	%r11d, %eax
	subl	%edi, %esi
	subl	%edi, %eax
	movslq	%esi, %rsi
	cltq
	imulq	%r10, %rsi
	imulq	%r10, %rax
	addq	%r9, %rsi
	movl	(%rbx,%rsi,4), %esi
	addq	%r9, %rax
	addl	$1, %esi
	cmpl	%esi, (%rbx,%rax,4)
	jle	.L43
	movl	%esi, (%rbx,%rax,4)
.L43:
	addl	$1, %edi
	cmpl	%edi, %ecx
	jne	.L44
	addl	$1, %r12d
	cmpl	%r12d, %edx
	jne	.L40
.L39:
	movl	%edx, %eax
	movq	%r8, %r13
	movl	%edx, %r10d
	movq	%rbx, %rdi
	shrl	$2, %eax
	shrq	$2, %r13
	leal	-1(%rdx), %r12d
	andl	$-4, %r10d
	leal	-1(%rax), %r11d
	xorl	%esi, %esi
	xorl	%r9d, %r9d
	addq	$1, %r11
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L46:
	testl	%edx, %edx
	jle	.L51
	cmpl	$2, %r12d
	jbe	.L70
	movd	%r9d, %xmm7
	movq	%rdi, %rax
	leaq	(%r11,%rdi), %r9
	pshufd	$0, %xmm7, %xmm2
	.p2align 4,,10
	.p2align 3
.L48:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	cmpq	%r9, %rax
	jne	.L48
	psrldq	$8, %xmm1
	movl	%r10d, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %r9d
	cmpl	%edx, %r10d
	je	.L51
.L47:
	movslq	%esi, %r14
	movslq	%eax, %r15
	imulq	%r13, %r14
	addq	%r14, %r15
	movl	(%rbx,%r15,4), %r15d
	cmpl	%r15d, %r9d
	cmovl	%r15d, %r9d
	leal	1(%rax), %r15d
	cmpl	%edx, %r15d
	jge	.L51
	movslq	%r15d, %r15
	addq	%r14, %r15
	movl	(%rbx,%r15,4), %r15d
	cmpl	%r15d, %r9d
	cmovl	%r15d, %r9d
	addl	$2, %eax
	cmpl	%edx, %eax
	jge	.L51
	cltq
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %r9d
	cmovl	%eax, %r9d
.L51:
	addl	$1, %esi
	addq	%r8, %rdi
	cmpl	%ecx, %esi
	jne	.L46
.L45:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L96
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L70:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L47
.L53:
	xorl	%edx, %edx
	jmp	.L12
.L93:
	orq	$0, -8(%rsp,%rsi)
	jmp	.L4
.L5:
	testl	%edx, %edx
	jle	.L90
.L41:
	cmpl	$1, %ecx
	je	.L39
.L90:
	xorl	%r9d, %r9d
	jmp	.L45
.L33:
	testl	%edx, %edx
	jle	.L39
	jmp	.L38
.L96:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.align 16
.LC3:
	.long	10000
	.long	10000
	.long	10000
	.long	10000
	.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"
.LC1:
	.string	"%s"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rsi
	movslq	-64(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %rcx
	imulq	%rsi, %rax
	movq	%rsi, %rdx
	leaq	0(,%rsi,4), %r8
	leaq	15(,%rax,4), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L3
.L92:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L92
.L3:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	jne	.L93
.L4:
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L5
	movq	%r8, %rax
	movq	%rbx, %r9
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	shrq	$2, %rax
	movl	$10000, %r13d
	movq	%rax, -72(%rbp)
	movl	%edx, %eax
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, %eax
	movq	%rsp, %rcx
	movq	%rsp, %r10
	cltq
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L7
.L94:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L94
.L7:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L8
	orq	$0, -8(%rsp,%rdx)
.L8:
	xorl	%eax, %eax
	movq	%rsp, %rsi
	leaq	.LC1(%rip), %rdi
	movq	%r9, -96(%rbp)
	movq	%r8, -88(%rbp)
	movq	%rsp, %r12
	movq	%r10, -80(%rbp)
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	movq	-80(%rbp), %r10
	movdqa	.LC2(%rip), %xmm8
	movdqa	.LC3(%rip), %xmm4
	testl	%eax, %eax
	movq	-88(%rbp), %r8
	movq	-96(%rbp), %r9
	jle	.L15
	leal	-1(%rax), %edx
	cmpl	$14, %edx
	jbe	.L53
	movl	%eax, %esi
	movq	%rsp, %rcx
	pxor	%xmm7, %xmm7
	movq	%r9, %rdx
	shrl	$4, %esi
	pxor	%xmm6, %xmm6
	salq	$4, %rsi
	addq	%rsp, %rsi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rcx), %xmm0
	movdqa	%xmm7, %xmm2
	movdqa	%xmm6, %xmm5
	addq	$16, %rcx
	addq	$64, %rdx
	pcmpeqb	%xmm8, %xmm0
	pcmpgtb	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm2, %xmm1
	punpckhbw	%xmm2, %xmm0
	movdqa	%xmm6, %xmm2
	pcmpgtw	%xmm1, %xmm2
	pcmpgtw	%xmm0, %xmm5
	movdqa	%xmm1, %xmm3
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	punpcklwd	%xmm5, %xmm2
	punpckhwd	%xmm5, %xmm0
	pandn	%xmm4, %xmm3
	pandn	%xmm4, %xmm1
	pandn	%xmm4, %xmm2
	pandn	%xmm4, %xmm0
	movups	%xmm3, -64(%rdx)
	movups	%xmm1, -48(%rdx)
	movups	%xmm2, -32(%rdx)
	movups	%xmm0, -16(%rdx)
	cmpq	%rsi, %rcx
	jne	.L13
	movl	%eax, %edx
	andl	$-16, %edx
	testb	$15, %al
	je	.L15
.L12:
	movslq	%edx, %rcx
	movq	-72(%rbp), %rsi
	movl	%r13d, %r11d
	movslq	%r15d, %rdi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	imulq	%rdi, %rsi
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	1(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	2(%rdx), %ecx
	cmpl	%eax, %ecx
	jge	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	3(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	4(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	5(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	6(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	7(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	8(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	9(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	addq	%rsi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	10(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %r11d
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %r11d
	imulq	-72(%rbp), %rdi
	addq	%rdi, %rcx
	movl	%r11d, (%rbx,%rcx,4)
	leal	11(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	movl	%esi, (%rbx,%rcx,4)
	leal	12(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	movl	%esi, (%rbx,%rcx,4)
	leal	13(%rdx), %ecx
	cmpl	%ecx, %eax
	jle	.L15
	movslq	%ecx, %rcx
	movl	%r13d, %esi
	cmpb	$35, (%r12,%rcx)
	cmove	%r14d, %esi
	addq	%rdi, %rcx
	addl	$14, %edx
	movl	%esi, (%rbx,%rcx,4)
	cmpl	%edx, %eax
	jle	.L15
	movslq	%edx, %rdx
	movl	%r13d, %eax
	cmpb	$35, (%r12,%rdx)
	cmove	%r14d, %eax
	addq	%rdi, %rdx
	movl	%eax, (%rbx,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L15:
	movl	-64(%rbp), %ecx
	addl	$1, %r15d
	movq	%r10, %rsp
	addq	%r8, %r9
	cmpl	%r15d, %ecx
	jle	.L95
	movl	-60(%rbp), %eax
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L95:
	movl	-60(%rbp), %edx
	testl	%ecx, %ecx
	jle	.L5
	cmpl	$1, %edx
	jle	.L33
	leal	-2(%rdx), %eax
	movslq	%edx, %rsi
	movq	$-4, %r11
	xorl	%r10d, %r10d
	salq	$2, %rax
	salq	$2, %rsi
	subq	%rax, %rsi
	leaq	8(%rbx,%rax), %r9
	subq	%rax, %r11
	leaq	-8(%rsi), %r12
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	(%r12,%r9), %rsi
	leaq	(%r11,%r9), %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movl	-4(%rax), %edi
	addl	$1, %edi
	cmpl	%edi, (%rax)
	jle	.L35
	movl	%edi, (%rax)
.L35:
	movl	-4(%rsi), %edi
	addl	$1, %edi
	cmpl	%edi, -8(%rsi)
	jle	.L36
	movl	%edi, -8(%rsi)
.L36:
	addq	$4, %rax
	subq	$4, %rsi
	cmpq	%r9, %rax
	jne	.L37
	addl	$1, %r10d
	addq	%r8, %r9
	cmpl	%r10d, %ecx
	jne	.L34
.L38:
	movq	%r8, %r10
	shrq	$2, %r10
	cmpl	$1, %ecx
	jle	.L41
	xorl	%r12d, %r12d
	leal	-1(%rcx), %r11d
	.p2align 4,,10
	.p2align 3
.L40:
	movl	$1, %edi
	movslq	%r12d, %r9
	.p2align 4,,10
	.p2align 3
.L44:
	leal	-1(%rdi), %eax
	cltq
	imulq	%r10, %rax
	addq	%r9, %rax
	movl	(%rbx,%rax,4), %esi
	movslq	%edi, %rax
	imulq	%r10, %rax
	addl	$1, %esi
	addq	%r9, %rax
	cmpl	%esi, (%rbx,%rax,4)
	jle	.L42
	movl	%esi, (%rbx,%rax,4)
.L42:
	movl	%ecx, %esi
	movl	%r11d, %eax
	subl	%edi, %esi
	subl	%edi, %eax
	movslq	%esi, %rsi
	cltq
	imulq	%r10, %rsi
	imulq	%r10, %rax
	addq	%r9, %rsi
	movl	(%rbx,%rsi,4), %esi
	addq	%r9, %rax
	addl	$1, %esi
	cmpl	%esi, (%rbx,%rax,4)
	jle	.L43
	movl	%esi, (%rbx,%rax,4)
.L43:
	addl	$1, %edi
	cmpl	%edi, %ecx
	jne	.L44
	addl	$1, %r12d
	cmpl	%r12d, %edx
	jne	.L40
.L39:
	movl	%edx, %eax
	movq	%r8, %r13
	movl	%edx, %r10d
	movq	%rbx, %rdi
	shrl	$2, %eax
	shrq	$2, %r13
	leal	-1(%rdx), %r12d
	andl	$-4, %r10d
	leal	-1(%rax), %r11d
	xorl	%esi, %esi
	xorl	%r9d, %r9d
	addq	$1, %r11
	salq	$4, %r11
	.p2align 4,,10
	.p2align 3
.L46:
	testl	%edx, %edx
	jle	.L51
	cmpl	$2, %r12d
	jbe	.L70
	movd	%r9d, %xmm7
	movq	%rdi, %rax
	leaq	(%r11,%rdi), %r9
	pshufd	$0, %xmm7, %xmm2
	.p2align 4,,10
	.p2align 3
.L48:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	cmpq	%r9, %rax
	jne	.L48
	psrldq	$8, %xmm1
	movl	%r10d, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %r9d
	cmpl	%edx, %r10d
	je	.L51
.L47:
	movslq	%esi, %r14
	movslq	%eax, %r15
	imulq	%r13, %r14
	addq	%r14, %r15
	movl	(%rbx,%r15,4), %r15d
	cmpl	%r15d, %r9d
	cmovl	%r15d, %r9d
	leal	1(%rax), %r15d
	cmpl	%edx, %r15d
	jge	.L51
	movslq	%r15d, %r15
	addq	%r14, %r15
	movl	(%rbx,%r15,4), %r15d
	cmpl	%r15d, %r9d
	cmovl	%r15d, %r9d
	addl	$2, %eax
	cmpl	%edx, %eax
	jge	.L51
	cltq
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %r9d
	cmovl	%eax, %r9d
.L51:
	addl	$1, %esi
	addq	%r8, %rdi
	cmpl	%ecx, %esi
	jne	.L46
.L45:
	xorl	%eax, %eax
	movl	%r9d, %edx
	movl	$1, %edi
	leaq	.LC4(%rip), %rsi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L96
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L70:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L47
.L53:
	xorl	%edx, %edx
	jmp	.L12
.L93:
	orq	$0, -8(%rsp,%rsi)
	jmp	.L4
.L5:
	testl	%edx, %edx
	jle	.L90
.L41:
	cmpl	$1, %ecx
	je	.L39
.L90:
	xorl	%r9d, %r9d
	jmp	.L45
.L33:
	testl	%edx, %edx
	jle	.L39
	jmp	.L38
.L96:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.byte	35
	.align 16
.LC3:
	.long	10000
	.long	10000
	.long	10000
	.long	10000
	.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 main(void)
{
  int h, w;
  scanf("%d%d", &h, &w);
  int grid[h][w];

  for (int y = 0; y < h; y++) {
    char s[w + 1];
    scanf("%s", s);
    for (int x = 0; x < w; x++) {
      grid[y][x] = s[x] == '#' ? 0 : 10000;
    }
  }

  for (int y = 0; y < h; y++) {
    for (int x = 1; x < w; x++) {
      if (grid[y][x] > grid[y][x - 1] + 1) {
        grid[y][x] = grid[y][x - 1] + 1;
      }
      int xx = w - 1 - x;
      if (grid[y][xx] > grid[y][xx + 1] + 1) {
        grid[y][xx] = grid[y][xx + 1] + 1;
      }
    }
  }

  for (int x = 0; x < w; x++) {
    for (int y = 1; y < h; y++) {
      if (grid[y][x] > grid[y - 1][x] + 1) {
        grid[y][x] = grid[y - 1][x] + 1;
      }
      int yy = h - 1 - y;
      if (grid[yy][x] > grid[yy + 1][x] + 1) {
        grid[yy][x] = grid[yy + 1][x] + 1;
      }
    }
  }

  int ans = 0;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (ans < grid[y][x]) {
        ans = grid[y][x];
      }
    }
  }
  printf("%d\n", ans);
}

2 3
...
.#.
...
 6 6
..#..#
......
..#..
......
.#....
-...#.
 2 6
#.#...
......
..#0.
......
.#.-..
--..#-
 2 3
...
.#.
..-
 2 3
/..
.#.
..-
 2 3
/..
.#.
..,
 3 3
...
/#.
...
 2 3
...
.#.
..,
 3 3
../
/#.
...
 3 3
-..
.#.
...

2
 3
 4
 2
 2
 2
 2
 2
 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>

int main(void)
{
  int h, w;
  scanf("%d%d", &h, &w);
  int grid[h][w];

  for (int y = 0; y < h; y++) {
    char s[w + 1];
    scanf("%s", s);
    for (int x = 0; x < w; x++) {
      grid[y][x] = s[x] == '#' ? 0 : 10000;
    }
  }

  for (int y = 0; y < h; y++) {
    for (int x = 1; x < w; x++) {
      if (grid[y][x] > grid[y][x - 1] + 1) {
        grid[y][x] = grid[y][x - 1] + 1;
      }
      int xx = w - 1 - x;
      if (grid[y][xx] > grid[y][xx + 1] + 1) {
        grid[y][xx] = grid[y][xx + 1] + 1;
      }
    }
  }

  for (int x = 0; x < w; x++) {
    for (int y = 1; y < h; y++) {
      if (grid[y][x] > grid[y - 1][x] + 1) {
        grid[y][x] = grid[y - 1][x] + 1;
      }
      int yy = h - 1 - y;
      if (grid[yy][x] > grid[yy + 1][x] + 1) {
        grid[yy][x] = grid[yy + 1][x] + 1;
      }
    }
  }

  int ans = 0;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (ans < grid[y][x]) {
        ans = grid[y][x];
      }
    }
  }
  printf("%d\n", ans);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$216, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -248(%rbp)
	leaq	-144(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-144(%rbp), %esi
	movl	-148(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-192(%rbp), %r9
	movq	-184(%rbp), %r10
	movq	%r10, %rdx
	imulq	-176(%rbp), %rdx
	movq	-168(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-176(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L5
.L13:
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	-144(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -136(%rbp)
	jmp	.L9
.L12:
	movq	-64(%rbp), %rdx
	movl	-136(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$0, %esi
	jmp	.L11
.L10:
	movl	$10000, %esi
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-136(%rbp), %edx
	movslq	%edx, %rdi
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	%esi, (%rax,%rdx,4)
	addl	$1, -136(%rbp)
.L9:
	movl	-144(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L12
	movq	%r12, %rsp
	addl	$1, -140(%rbp)
.L5:
	movl	-148(%rbp), %eax
	cmpl	%eax, -140(%rbp)
	jl	.L13
	movl	$0, -132(%rbp)
	jmp	.L14
.L19:
	movl	$1, -128(%rbp)
	jmp	.L15
.L18:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-128(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L16
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L16:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	subl	-128(%rbp), %eax
	movl	%eax, -100(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-100(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L17
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L17:
	addl	$1, -128(%rbp)
.L15:
	movl	-144(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L18
	addl	$1, -132(%rbp)
.L14:
	movl	-148(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L19
	movl	$0, -124(%rbp)
	jmp	.L20
.L25:
	movl	$1, -120(%rbp)
	jmp	.L21
.L24:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L22
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-120(%rbp), %eax
	leal	-1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L22:
	movl	-148(%rbp), %eax
	subl	$1, %eax
	subl	-120(%rbp), %eax
	movl	%eax, -104(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-104(%rbp), %eax
	leal	1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L23
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-104(%rbp), %eax
	leal	1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L23:
	addl	$1, -120(%rbp)
.L21:
	movl	-148(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	addl	$1, -124(%rbp)
.L20:
	movl	-144(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L25
	movl	$0, -116(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L26
.L30:
	movl	$0, -108(%rbp)
	jmp	.L27
.L29:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -116(%rbp)
	jge	.L28
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -116(%rbp)
.L28:
	addl	$1, -108(%rbp)
.L27:
	movl	-144(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L29
	addl	$1, -112(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L30
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-248(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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
	.section	.rodata
.LC0:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$216, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -248(%rbp)
	leaq	-144(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-144(%rbp), %esi
	movl	-148(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%esi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movq	-192(%rbp), %r9
	movq	-184(%rbp), %r10
	movq	%r10, %rdx
	imulq	-176(%rbp), %rdx
	movq	-168(%rbp), %rax
	imulq	%r9, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r9, %rax
	mulq	-176(%rbp)
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -140(%rbp)
	jmp	.L5
.L13:
	movq	%rsp, %rax
	movq	%rax, %r12
	movl	-144(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -136(%rbp)
	jmp	.L9
.L12:
	movq	-64(%rbp), %rdx
	movl	-136(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$0, %esi
	jmp	.L11
.L10:
	movl	$10000, %esi
.L11:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-136(%rbp), %edx
	movslq	%edx, %rdi
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	%esi, (%rax,%rdx,4)
	addl	$1, -136(%rbp)
.L9:
	movl	-144(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L12
	movq	%r12, %rsp
	addl	$1, -140(%rbp)
.L5:
	movl	-148(%rbp), %eax
	cmpl	%eax, -140(%rbp)
	jl	.L13
	movl	$0, -132(%rbp)
	jmp	.L14
.L19:
	movl	$1, -128(%rbp)
	jmp	.L15
.L18:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-128(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L16
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L16:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	subl	-128(%rbp), %eax
	movl	%eax, -100(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-100(%rbp), %eax
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movslq	%ecx, %rdi
	movl	-132(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L17
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movq	-80(%rbp), %rax
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L17:
	addl	$1, -128(%rbp)
.L15:
	movl	-144(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L18
	addl	$1, -132(%rbp)
.L14:
	movl	-148(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L19
	movl	$0, -124(%rbp)
	jmp	.L20
.L25:
	movl	$1, -120(%rbp)
	jmp	.L21
.L24:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-120(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L22
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-120(%rbp), %eax
	leal	-1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L22:
	movl	-148(%rbp), %eax
	subl	$1, %eax
	subl	-120(%rbp), %eax
	movl	%eax, -104(%rbp)
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rsi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	%rbx, %rsi
	shrq	$2, %rsi
	movl	-104(%rbp), %eax
	leal	1(%rax), %edi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %eax
	addl	$1, %eax
	cmpl	%eax, %edx
	jle	.L23
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movl	-104(%rbp), %eax
	leal	1(%rax), %esi
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movslq	%esi, %rdx
	imulq	%rcx, %rdx
	addq	%rdi, %rdx
	movl	(%rax,%rdx,4), %eax
	movq	%rbx, %rsi
	shrq	$2, %rsi
	leal	1(%rax), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdi
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rdi, %rdx
	movl	%ecx, (%rax,%rdx,4)
.L23:
	addl	$1, -120(%rbp)
.L21:
	movl	-148(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L24
	addl	$1, -124(%rbp)
.L20:
	movl	-144(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L25
	movl	$0, -116(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L26
.L30:
	movl	$0, -108(%rbp)
	jmp	.L27
.L29:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -116(%rbp)
	jge	.L28
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rsi
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -116(%rbp)
.L28:
	addl	$1, -108(%rbp)
.L27:
	movl	-144(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L29
	addl	$1, -112(%rbp)
.L26:
	movl	-148(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L30
	movl	-116(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-248(%rbp), %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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:
