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 MIN(int a,int b){return a<b?a:b;}
int main(){
  int h,w,i,j,k,c,ny,nx,d[110][110]={};
  int Y[]={1,0};
  int X[]={0,1};
  char s[110][110]={};
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)scanf("%s",s[i]);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++)d[i][j]=1e9;
  }
  if(s[0][0]=='#')d[0][0]=1;
  else            d[0][0]=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      for(k=0;k<2;k++){
		ny=i+Y[k];
		nx=j+X[k];
		if(s[ny][nx]==0)continue;
		c=0;
		if(s[i][j]=='.'&&s[ny][nx]=='#')c=1;
		d[ny][nx]=MIN(d[ny][nx],d[i][j]+c);
      }
    }
  }
  printf("%d\n",d[h-1][w-1]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-57344(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48416(%rbp), %rax
	movl	$48400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -60544(%rbp)
	movl	$0, -60540(%rbp)
	movl	$0, -60536(%rbp)
	movl	$1, -60532(%rbp)
	leaq	-60528(%rbp), %rax
	movl	$12100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-60572(%rbp), %rdx
	leaq	-60576(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -60568(%rbp)
	jmp	.L4
.L5:
	leaq	-60528(%rbp), %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -60568(%rbp)
.L4:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L5
	movl	$0, -60568(%rbp)
	jmp	.L6
.L9:
	movl	$0, -60564(%rbp)
	jmp	.L7
.L8:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	$1000000000, -48416(%rbp,%rax,4)
	addl	$1, -60564(%rbp)
.L7:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L8
	addl	$1, -60568(%rbp)
.L6:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L9
	movzbl	-60528(%rbp), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$1, -48416(%rbp)
	jmp	.L11
.L10:
	movl	$0, -48416(%rbp)
.L11:
	movl	$0, -60568(%rbp)
	jmp	.L12
.L20:
	movl	$0, -60564(%rbp)
	jmp	.L13
.L19:
	movl	$0, -60560(%rbp)
	jmp	.L14
.L18:
	movl	-60560(%rbp), %eax
	cltq
	movl	-60544(%rbp,%rax,4), %edx
	movl	-60568(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60552(%rbp)
	movl	-60560(%rbp), %eax
	cltq
	movl	-60536(%rbp,%rax,4), %edx
	movl	-60564(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60548(%rbp)
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L23
	movl	$0, -60556(%rbp)
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L17
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L17
	movl	$1, -60556(%rbp)
.L17:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	-48416(%rbp,%rax,4), %edx
	movl	-60556(%rbp), %eax
	addl	%eax, %edx
	movl	-60548(%rbp), %eax
	movslq	%eax, %rcx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MIN
	movl	-60548(%rbp), %edx
	movslq	%edx, %rcx
	movl	-60552(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -48416(%rbp,%rdx,4)
	jmp	.L16
.L23:
	nop
.L16:
	addl	$1, -60560(%rbp)
.L14:
	cmpl	$1, -60560(%rbp)
	jle	.L18
	addl	$1, -60564(%rbp)
.L13:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L19
	addl	$1, -60568(%rbp)
.L12:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L20
	movl	-60576(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-60572(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	MIN, .-MIN
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-57344(%rsp), %r11
	.cfi_def_cfa 11, 57392
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3200, %rsp
	.cfi_def_cfa_offset 60592
	movl	$48400, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 60536(%rsp)
	xorl	%eax, %eax
	leaq	12128(%rsp), %r12
	leaq	16(%rsp), %rbx
	movq	%r12, %rdi
	call	memset@PLT
	movl	$12100, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	.LC0(%rip), %rdi
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r10d
	movl	12(%rsp), %edi
	testl	%r10d, %r10d
	jle	.L6
	movq	%rbx, %r13
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r10d
	addq	$110, %r13
	cmpl	%ebp, %r10d
	jg	.L5
	movl	12(%rsp), %edi
	testl	%r10d, %r10d
	jle	.L6
	testl	%edi, %edi
	jle	.L6
	movl	%edi, %eax
	movl	%edi, %r8d
	movdqa	.LC2(%rip), %xmm0
	movq	%r12, %rcx
	shrl	$2, %eax
	leal	-1(%rdi), %ebp
	andl	$-4, %r8d
	xorl	%esi, %esi
	leal	-1(%rax), %r9d
	addq	$1, %r9
	salq	$4, %r9
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%r9,%rcx), %rdx
	movq	%rcx, %rax
	cmpl	$2, %ebp
	jbe	.L35
	.p2align 4,,10
	.p2align 3
.L8:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %eax
	cmpl	%edi, %r8d
	je	.L9
.L11:
	movslq	%esi, %rdx
	movslq	%eax, %r11
	imulq	$110, %rdx, %rdx
	addq	%rdx, %r11
	movl	$1000000000, 12128(%rsp,%r11,4)
	leal	1(%rax), %r11d
	cmpl	%r11d, %edi
	jle	.L9
	movslq	%r11d, %r11
	addl	$2, %eax
	addq	%rdx, %r11
	movl	$1000000000, 12128(%rsp,%r11,4)
	cmpl	%edi, %eax
	jge	.L9
	cltq
	addq	%rax, %rdx
	movl	$1000000000, 12128(%rsp,%rdx,4)
.L9:
	addl	$1, %esi
	addq	$440, %rcx
	cmpl	%esi, %r10d
	jne	.L7
	xorl	%eax, %eax
	cmpb	$35, 16(%rsp)
	movq	%r12, %r11
	movl	$110, %edi
	sete	%al
	subl	$1, %r10d
	xorl	%r8d, %r8d
	movl	%r10d, %r12d
	movl	%eax, 12128(%rsp)
	movl	%ebp, %eax
	imulq	$110, %r12, %r12
	leaq	1(%rbx,%rax), %r9
	subq	$110, %rbx
	addq	$220, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r11, %rcx
	addq	$440, %r11
	leaq	(%rbx,%rdi), %rax
	movq	%r11, %rsi
	.p2align 4,,10
	.p2align 3
.L17:
	leaq	(%rax,%r8), %rdx
	movzbl	(%rdx,%rdi), %edx
	testb	%dl, %dl
	je	.L14
	cmpb	$46, (%rax)
	sete	%r13b
	cmpb	$35, %dl
	sete	%dl
	movzbl	%dl, %edx
	andl	%r13d, %edx
	movl	(%rsi), %r13d
	addl	(%rcx), %edx
	cmpl	%r13d, %edx
	cmovg	%r13d, %edx
	movl	%edx, (%rsi)
.L14:
	movzbl	1(%rax), %edx
	testb	%dl, %dl
	je	.L15
	cmpb	$46, (%rax)
	sete	%r13b
	cmpb	$35, %dl
	sete	%dl
	movzbl	%dl, %edx
	andl	%r13d, %edx
	movl	4(%rcx), %r13d
	addl	(%rcx), %edx
	cmpl	%r13d, %edx
	cmovg	%r13d, %edx
	movl	%edx, 4(%rcx)
.L15:
	addq	$1, %rax
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r9, %rax
	jne	.L17
	addq	$110, %rdi
	addq	$110, %r9
	subq	$110, %r8
	cmpq	%r12, %rdi
	jne	.L19
.L18:
	movslq	%r10d, %rax
	movslq	%ebp, %rbp
	movl	$1, %edi
	imulq	$110, %rax, %rax
	leaq	.LC3(%rip), %rsi
	addq	%rbp, %rax
	movl	12128(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	60536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$60544, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L11
.L6:
	xorl	%eax, %eax
	cmpb	$35, 16(%rsp)
	leal	-1(%rdi), %ebp
	sete	%al
	subl	$1, %r10d
	movl	%eax, 12128(%rsp)
	jmp	.L18
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovle	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	MIN, .-MIN
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-57344(%rsp), %r11
	.cfi_def_cfa 11, 57392
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3200, %rsp
	.cfi_def_cfa_offset 60592
	movl	$48400, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 60536(%rsp)
	xorl	%eax, %eax
	leaq	12128(%rsp), %r12
	leaq	16(%rsp), %rbx
	movq	%r12, %rdi
	call	memset@PLT
	movl	$12100, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	.LC0(%rip), %rdi
	leaq	12(%rsp), %rdx
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r10d
	movl	12(%rsp), %edi
	testl	%r10d, %r10d
	jle	.L6
	movq	%rbx, %r13
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %r10d
	addq	$110, %r13
	cmpl	%ebp, %r10d
	jg	.L5
	movl	12(%rsp), %edi
	testl	%r10d, %r10d
	jle	.L6
	testl	%edi, %edi
	jle	.L6
	movl	%edi, %eax
	movl	%edi, %r8d
	movdqa	.LC2(%rip), %xmm0
	movq	%r12, %rcx
	shrl	$2, %eax
	leal	-1(%rdi), %ebp
	andl	$-4, %r8d
	xorl	%esi, %esi
	leal	-1(%rax), %r9d
	addq	$1, %r9
	salq	$4, %r9
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	(%r9,%rcx), %rdx
	movq	%rcx, %rax
	cmpl	$2, %ebp
	jbe	.L35
	.p2align 4,,10
	.p2align 3
.L8:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L8
	movl	%r8d, %eax
	cmpl	%edi, %r8d
	je	.L9
.L11:
	movslq	%esi, %rdx
	movslq	%eax, %r11
	imulq	$110, %rdx, %rdx
	addq	%rdx, %r11
	movl	$1000000000, 12128(%rsp,%r11,4)
	leal	1(%rax), %r11d
	cmpl	%r11d, %edi
	jle	.L9
	movslq	%r11d, %r11
	addl	$2, %eax
	addq	%rdx, %r11
	movl	$1000000000, 12128(%rsp,%r11,4)
	cmpl	%edi, %eax
	jge	.L9
	cltq
	addq	%rax, %rdx
	movl	$1000000000, 12128(%rsp,%rdx,4)
.L9:
	addl	$1, %esi
	addq	$440, %rcx
	cmpl	%esi, %r10d
	jne	.L7
	xorl	%eax, %eax
	cmpb	$35, 16(%rsp)
	movq	%r12, %r11
	movl	$110, %edi
	sete	%al
	subl	$1, %r10d
	xorl	%r8d, %r8d
	movl	%r10d, %r12d
	movl	%eax, 12128(%rsp)
	movl	%ebp, %eax
	imulq	$110, %r12, %r12
	leaq	1(%rbx,%rax), %r9
	subq	$110, %rbx
	addq	$220, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r11, %rcx
	addq	$440, %r11
	leaq	(%rbx,%rdi), %rax
	movq	%r11, %rsi
	.p2align 4,,10
	.p2align 3
.L17:
	leaq	(%rax,%r8), %rdx
	movzbl	(%rdx,%rdi), %edx
	testb	%dl, %dl
	je	.L14
	cmpb	$46, (%rax)
	sete	%r13b
	cmpb	$35, %dl
	sete	%dl
	movzbl	%dl, %edx
	andl	%r13d, %edx
	movl	(%rsi), %r13d
	addl	(%rcx), %edx
	cmpl	%r13d, %edx
	cmovg	%r13d, %edx
	movl	%edx, (%rsi)
.L14:
	movzbl	1(%rax), %edx
	testb	%dl, %dl
	je	.L15
	cmpb	$46, (%rax)
	sete	%r13b
	cmpb	$35, %dl
	sete	%dl
	movzbl	%dl, %edx
	andl	%r13d, %edx
	movl	4(%rcx), %r13d
	addl	(%rcx), %edx
	cmpl	%r13d, %edx
	cmovg	%r13d, %edx
	movl	%edx, 4(%rcx)
.L15:
	addq	$1, %rax
	addq	$4, %rcx
	addq	$4, %rsi
	cmpq	%r9, %rax
	jne	.L17
	addq	$110, %rdi
	addq	$110, %r9
	subq	$110, %r8
	cmpq	%r12, %rdi
	jne	.L19
.L18:
	movslq	%r10d, %rax
	movslq	%ebp, %rbp
	movl	$1, %edi
	imulq	$110, %rax, %rax
	leaq	.LC3(%rip), %rsi
	addq	%rbp, %rax
	movl	12128(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	60536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$60544, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L11
.L6:
	xorl	%eax, %eax
	cmpb	$35, 16(%rsp)
	leal	-1(%rdi), %ebp
	sete	%al
	subl	$1, %r10d
	movl	%eax, 12128(%rsp)
	jmp	.L18
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.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 MIN(int a,int b){return a<b?a:b;}
int main(){
  int h,w,i,j,k,c,ny,nx,d[110][110]={};
  int Y[]={1,0};
  int X[]={0,1};
  char s[110][110]={};
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)scanf("%s",s[i]);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++)d[i][j]=1e9;
  }
  if(s[0][0]=='#')d[0][0]=1;
  else            d[0][0]=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      for(k=0;k<2;k++){
		ny=i+Y[k];
		nx=j+X[k];
		if(s[ny][nx]==0)continue;
		c=0;
		if(s[i][j]=='.'&&s[ny][nx]=='#')c=1;
		d[ny][nx]=MIN(d[ny][nx],d[i][j]+c);
      }
    }
  }
  printf("%d\n",d[h-1][w-1]);
  return 0;
}

2 2
.
#.
 4 4
##..
...
.
.
 1 7
#.#/
-..
0
,
 3 3
.##
.#-
.
 2 2
.
$.
 4 4
##..
...
-
.
 2 3
.##
.#-
.
 2 2
.
/#
 7 4
..##
...
.
.
 3 3
.##
.#.
##-

1
 1000000000
 1000000000
 1000000000
 0
 1000000000
 1
 0
 1000000000
 1

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 MIN(int a,int b){return a<b?a:b;}
int main(){
  int h,w,i,j,k,c,ny,nx,d[110][110]={};
  int Y[]={1,0};
  int X[]={0,1};
  char s[110][110]={};
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++)scanf("%s",s[i]);
  for(i=0;i<h;i++){
    for(j=0;j<w;j++)d[i][j]=1e9;
  }
  if(s[0][0]=='#')d[0][0]=1;
  else            d[0][0]=0;
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      for(k=0;k<2;k++){
		ny=i+Y[k];
		nx=j+X[k];
		if(s[ny][nx]==0)continue;
		c=0;
		if(s[i][j]=='.'&&s[ny][nx]=='#')c=1;
		d[ny][nx]=MIN(d[ny][nx],d[i][j]+c);
      }
    }
  }
  printf("%d\n",d[h-1][w-1]);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-57344(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48416(%rbp), %rax
	movl	$48400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -60544(%rbp)
	movl	$0, -60540(%rbp)
	movl	$0, -60536(%rbp)
	movl	$1, -60532(%rbp)
	leaq	-60528(%rbp), %rax
	movl	$12100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-60572(%rbp), %rdx
	leaq	-60576(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -60568(%rbp)
	jmp	.L4
.L5:
	leaq	-60528(%rbp), %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -60568(%rbp)
.L4:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L5
	movl	$0, -60568(%rbp)
	jmp	.L6
.L9:
	movl	$0, -60564(%rbp)
	jmp	.L7
.L8:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	$1000000000, -48416(%rbp,%rax,4)
	addl	$1, -60564(%rbp)
.L7:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L8
	addl	$1, -60568(%rbp)
.L6:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L9
	movzbl	-60528(%rbp), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$1, -48416(%rbp)
	jmp	.L11
.L10:
	movl	$0, -48416(%rbp)
.L11:
	movl	$0, -60568(%rbp)
	jmp	.L12
.L20:
	movl	$0, -60564(%rbp)
	jmp	.L13
.L19:
	movl	$0, -60560(%rbp)
	jmp	.L14
.L18:
	movl	-60560(%rbp), %eax
	cltq
	movl	-60544(%rbp,%rax,4), %edx
	movl	-60568(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60552(%rbp)
	movl	-60560(%rbp), %eax
	cltq
	movl	-60536(%rbp,%rax,4), %edx
	movl	-60564(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60548(%rbp)
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L23
	movl	$0, -60556(%rbp)
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L17
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L17
	movl	$1, -60556(%rbp)
.L17:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	-48416(%rbp,%rax,4), %edx
	movl	-60556(%rbp), %eax
	addl	%eax, %edx
	movl	-60548(%rbp), %eax
	movslq	%eax, %rcx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MIN
	movl	-60548(%rbp), %edx
	movslq	%edx, %rcx
	movl	-60552(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -48416(%rbp,%rdx,4)
	jmp	.L16
.L23:
	nop
.L16:
	addl	$1, -60560(%rbp)
.L14:
	cmpl	$1, -60560(%rbp)
	jle	.L18
	addl	$1, -60564(%rbp)
.L13:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L19
	addl	$1, -60568(%rbp)
.L12:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L20
	movl	-60576(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-60572(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	MIN
	.type	MIN, @function
MIN:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	MIN, .-MIN
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-57344(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3232, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48416(%rbp), %rax
	movl	$48400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -60544(%rbp)
	movl	$0, -60540(%rbp)
	movl	$0, -60536(%rbp)
	movl	$1, -60532(%rbp)
	leaq	-60528(%rbp), %rax
	movl	$12100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-60572(%rbp), %rdx
	leaq	-60576(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -60568(%rbp)
	jmp	.L4
.L5:
	leaq	-60528(%rbp), %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -60568(%rbp)
.L4:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L5
	movl	$0, -60568(%rbp)
	jmp	.L6
.L9:
	movl	$0, -60564(%rbp)
	jmp	.L7
.L8:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	$1000000000, -48416(%rbp,%rax,4)
	addl	$1, -60564(%rbp)
.L7:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L8
	addl	$1, -60568(%rbp)
.L6:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L9
	movzbl	-60528(%rbp), %eax
	cmpb	$35, %al
	jne	.L10
	movl	$1, -48416(%rbp)
	jmp	.L11
.L10:
	movl	$0, -48416(%rbp)
.L11:
	movl	$0, -60568(%rbp)
	jmp	.L12
.L20:
	movl	$0, -60564(%rbp)
	jmp	.L13
.L19:
	movl	$0, -60560(%rbp)
	jmp	.L14
.L18:
	movl	-60560(%rbp), %eax
	cltq
	movl	-60544(%rbp,%rax,4), %edx
	movl	-60568(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60552(%rbp)
	movl	-60560(%rbp), %eax
	cltq
	movl	-60536(%rbp,%rax,4), %edx
	movl	-60564(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -60548(%rbp)
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L23
	movl	$0, -60556(%rbp)
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L17
	movl	-60548(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$60528, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L17
	movl	$1, -60556(%rbp)
.L17:
	movl	-60564(%rbp), %eax
	movslq	%eax, %rdx
	movl	-60568(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rdx, %rax
	movl	-48416(%rbp,%rax,4), %edx
	movl	-60556(%rbp), %eax
	addl	%eax, %edx
	movl	-60548(%rbp), %eax
	movslq	%eax, %rcx
	movl	-60552(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	MIN
	movl	-60548(%rbp), %edx
	movslq	%edx, %rcx
	movl	-60552(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$110, %rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -48416(%rbp,%rdx,4)
	jmp	.L16
.L23:
	nop
.L16:
	addl	$1, -60560(%rbp)
.L14:
	cmpl	$1, -60560(%rbp)
	jle	.L18
	addl	$1, -60564(%rbp)
.L13:
	movl	-60572(%rbp), %eax
	cmpl	%eax, -60564(%rbp)
	jl	.L19
	addl	$1, -60568(%rbp)
.L12:
	movl	-60576(%rbp), %eax
	cmpl	%eax, -60568(%rbp)
	jl	.L20
	movl	-60576(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-60572(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$110, %rax, %rax
	addq	%rcx, %rax
	movl	-48416(%rbp,%rax,4), %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	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
