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

```c
#include<stdio.h>

#define INF 1<<13
#define MIN(a,b) ((a)<(b)?(a):(b))

int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    char grid[h][w];
    char tmp[w+1];
    for(int i = 0;i < h;i++){
        scanf("%s",tmp);
        for(int cp = 0;cp < w;cp++)grid[i][cp] = tmp[cp];
    }
    int dp[h+1][w+1];
    for(int i = 0;i <= w;i++)dp[0][i] = INF;
    for(int i = 0;i <= h;i++)dp[i][0] = INF;
    dp[1][1] = 0;

    char cp_grid[h+1][w+1];
    for(int i = 0;i <= w;i++)cp_grid[0][i]='.';
    for(int i = 0;i <= h;i++)cp_grid[i][0]='.';
    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++)cp_grid[i][j]=grid[i-1][j-1];

    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++){
        if(i==1&&j==1){dp[i][j]=0;continue;}
        dp[i][j] = MIN(dp[i-1][j]+(cp_grid[i][j]=='#' && cp_grid[i-1][j]=='.'?1:0),dp[i][j-1]+(cp_grid[i][j]=='#' && cp_grid[i][j-1]=='.'?1:0));
    }
    printf("%d",dp[h][w]+(grid[0][0]=='#'?1:0));
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$408, %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, -440(%rbp)
	leaq	-188(%rbp), %rdx
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %esi
	movl	-192(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -144(%rbp)
	movslq	%esi, %rax
	movq	%rax, -368(%rbp)
	movq	$0, -360(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -136(%rbp)
	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, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movq	-208(%rbp), %r11
	movq	-200(%rbp), %r12
	movq	%r12, %rdx
	movq	-224(%rbp), %r8
	movq	-216(%rbp), %r9
	imulq	%r8, %rdx
	movq	%r9, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -128(%rbp)
	movl	-188(%rbp), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -384(%rbp)
	movq	$0, -376(%rbp)
	movslq	%edx, %rax
	movq	%rax, -400(%rbp)
	movq	$0, -392(%rbp)
	movslq	%edx, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L7
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	$0, -184(%rbp)
	jmp	.L8
.L11:
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -180(%rbp)
	jmp	.L9
.L10:
	movq	-112(%rbp), %rdx
	movl	-180(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %esi
	movq	-128(%rbp), %rdi
	movl	-180(%rbp), %eax
	movslq	%eax, %rcx
	movl	-184(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	leaq	(%rdi,%rcx), %rax
	addq	%rdx, %rax
	movb	%sil, (%rax)
	addl	$1, -180(%rbp)
.L9:
	movl	-188(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L10
	addl	$1, -184(%rbp)
.L8:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L11
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, -416(%rbp)
	movq	$0, -408(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %r10
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edi, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	-240(%rbp), %r8
	movq	-232(%rbp), %r9
	movq	%r9, %rdx
	movq	-256(%rbp), %r14
	movq	-248(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%edi, %rax
	movq	%rax, -288(%rbp)
	movq	$0, -280(%rbp)
	movq	-272(%rbp), %r14
	movq	-264(%rbp), %r15
	movq	%r15, %rdx
	movq	-288(%rbp), %r11
	movq	-280(%rbp), %r12
	imulq	%r11, %rdx
	movq	%r12, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r11
	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, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -176(%rbp)
	jmp	.L15
.L16:
	movq	-88(%rbp), %rdx
	movl	-176(%rbp), %eax
	cltq
	movl	$8192, (%rdx,%rax,4)
	addl	$1, -176(%rbp)
.L15:
	movl	-188(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L16
	movl	$0, -172(%rbp)
	jmp	.L17
.L18:
	movq	%r10, %rdx
	shrq	$2, %rdx
	movq	-88(%rbp), %rcx
	movl	-172(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$8192, (%rcx,%rax,4)
	addl	$1, -172(%rbp)
.L17:
	movl	-192(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jle	.L18
	movq	%r10, %rax
	shrq	$2, %rax
	movq	-88(%rbp), %rdx
	addq	$1, %rax
	movl	$0, (%rdx,%rax,4)
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%esi, %rax
	movq	%rax, -432(%rbp)
	movq	$0, -424(%rbp)
	movslq	%esi, %r9
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%esi, %rax
	movq	%rax, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%edi, %rax
	movq	%rax, -320(%rbp)
	movq	$0, -312(%rbp)
	movq	-304(%rbp), %r11
	movq	-296(%rbp), %r12
	movq	%r12, %rdx
	movq	-320(%rbp), %r14
	movq	-312(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -336(%rbp)
	movq	$0, -328(%rbp)
	movslq	%edi, %rax
	movq	%rax, -352(%rbp)
	movq	$0, -344(%rbp)
	movq	-336(%rbp), %r11
	movq	-328(%rbp), %r12
	movq	%r12, %rdx
	movq	-352(%rbp), %r14
	movq	-344(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	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
.L19:
	cmpq	%rdx, %rsp
	je	.L20
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L19
.L20:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L21
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L21:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-64(%rbp), %rdx
	movl	-168(%rbp), %eax
	cltq
	movb	$46, (%rdx,%rax)
	addl	$1, -168(%rbp)
.L22:
	movl	-188(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L23
	movl	$0, -164(%rbp)
	jmp	.L24
.L25:
	movq	-64(%rbp), %rdx
	movl	-164(%rbp), %eax
	cltq
	imulq	%r9, %rax
	movb	$46, (%rdx,%rax)
	addl	$1, -164(%rbp)
.L24:
	movl	-192(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jle	.L25
	movl	$1, -160(%rbp)
	jmp	.L26
.L29:
	movl	$1, -156(%rbp)
	jmp	.L27
.L28:
	movl	-160(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movq	-128(%rbp), %rsi
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	%rbx, %rax
	leaq	(%rsi,%rcx), %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movq	-64(%rbp), %rsi
	movl	-156(%rbp), %edx
	movslq	%edx, %rcx
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%r9, %rdx
	addq	%rsi, %rcx
	addq	%rcx, %rdx
	movb	%al, (%rdx)
	addl	$1, -156(%rbp)
.L27:
	movl	-188(%rbp), %eax
	cmpl	%eax, -156(%rbp)
	jle	.L28
	addl	$1, -160(%rbp)
.L26:
	movl	-192(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jle	.L29
	movl	$1, -152(%rbp)
	jmp	.L30
.L39:
	movl	$1, -148(%rbp)
	jmp	.L31
.L38:
	cmpl	$1, -152(%rbp)
	jne	.L32
	cmpl	$1, -148(%rbp)
	jne	.L32
	movq	%r10, %rcx
	shrq	$2, %rcx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	$0, (%rax,%rdx,4)
	jmp	.L33
.L32:
	movq	%r10, %rcx
	shrq	$2, %rcx
	movl	-148(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-88(%rbp), %rax
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rsi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L34
	movl	-148(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L34
	movl	$1, %eax
	jmp	.L35
.L34:
	movl	$0, %eax
.L35:
	addl	%eax, %edx
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-152(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %esi
	movq	-64(%rbp), %rdi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rdi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L36
	movl	-152(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %r8
	movl	-148(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rax
	imulq	%r9, %rax
	leaq	(%r8,%rdi), %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	movl	$1, %eax
	jmp	.L37
.L36:
	movl	$0, %eax
.L37:
	addl	%esi, %eax
	movq	%r10, %rsi
	shrq	$2, %rsi
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %rdi
	movl	-152(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	%edx, (%rax,%rcx,4)
.L33:
	addl	$1, -148(%rbp)
.L31:
	movl	-188(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jle	.L38
	addl	$1, -152(%rbp)
.L30:
	movl	-192(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jle	.L39
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-192(%rbp), %edx
	movl	-188(%rbp), %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-128(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	sete	%al
	movzbl	%al, %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-440(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	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"
.LC3:
	.string	"%d"
	.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	$120, %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), %rbx
	movslq	-64(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, -144(%rbp)
	movq	%rax, %rcx
	movq	%rbx, %r9
	movq	%rbx, %r13
	imulq	%rbx, %rax
	movq	%rbx, -128(%rbp)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L88:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L88
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L89
.L4:
	leal	1(%r9), %ebx
	movq	%rsp, -136(%rbp)
	movq	%rsp, %rsi
	movslq	%ebx, %rax
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L89:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L90
.L7:
	movq	%rsp, %r12
	testl	%ecx, %ecx
	jle	.L8
	movq	-136(%rbp), %r15
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r8d
	testl	%r8d, %r8d
	jle	.L91
	movslq	%r8d, %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%r8d, -80(%rbp)
	movq	%rdx, -72(%rbp)
	addl	$1, %r14d
	addq	%r13, %r15
	call	memcpy@PLT
	movl	-64(%rbp), %ecx
	movq	-72(%rbp), %rdx
	movl	-80(%rbp), %r8d
	cmpl	%ecx, %r14d
	jl	.L10
	leal	1(%r8), %ebx
	leal	1(%rcx), %r14d
	movq	%rdx, -128(%rbp)
	movq	%rsp, %rdi
	movslq	%ebx, %rax
	movl	%r8d, %r9d
	leaq	0(,%rax,4), %rsi
	movq	%rax, -72(%rbp)
	movq	%rsi, -104(%rbp)
	movslq	%r14d, %rsi
	imulq	%rax, %rsi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rdi
.L44:
	cmpq	%rdi, %rsp
	je	.L45
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L91:
	movl	-64(%rbp), %ecx
	addl	$1, %r14d
	addq	%r13, %r15
	cmpl	%r14d, %ecx
	jg	.L10
	movslq	%r8d, %rax
	movq	%rax, %r9
	movq	%rax, -128(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	leal	1(%r9), %ebx
.L8:
	movslq	%ebx, %rax
	leal	1(%rcx), %r14d
	movq	%rsp, %rdi
	leaq	0(,%rax,4), %rsi
	movq	%rax, -72(%rbp)
	movq	%rsi, -104(%rbp)
	movslq	%r14d, %rsi
	imulq	%rax, %rsi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rdi
.L13:
	cmpq	%rdi, %rsp
	je	.L14
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L13
.L45:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L46
	orq	$0, -8(%rsp,%rdx)
.L46:
	movq	-72(%rbp), %rax
	movq	%rsp, %r12
	movq	%rax, -96(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
.L16:
	cmpl	$2, %r9d
	jle	.L48
	movl	%ebx, %edx
	movdqa	.LC2(%rip), %xmm0
	movq	%r12, %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L20:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L20
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L23
.L19:
	movslq	%eax, %rdx
	leal	1(%rax), %edi
	leaq	(%r12,%rdx,4), %rdx
	movl	$8192, (%rdx)
	cmpl	%r9d, %edi
	jg	.L23
	addl	$2, %eax
	movl	$8192, 4(%rdx)
	cmpl	%r9d, %eax
	jg	.L23
	movl	$8192, 8(%rdx)
.L23:
	movq	-96(%rbp), %rdi
	xorl	%eax, %eax
	testl	%ecx, %ecx
	js	.L92
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%eax, %rdx
	addl	$1, %eax
	imulq	%rdi, %rdx
	movl	$8192, (%r12,%rdx,4)
	cmpl	%r14d, %eax
	jne	.L24
	movq	-96(%rbp), %rax
	addq	$15, %rsi
	movq	%rsp, %rdx
	addq	$1, %rax
	movq	%rax, -152(%rbp)
	movl	$0, (%r12,%rax,4)
	movq	%rsi, %rax
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rdx
.L38:
	cmpq	%rdx, %rsp
	je	.L39
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L38
.L39:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L40
	orq	$0, -8(%rsp,%rax)
.L40:
	movq	%rsp, -88(%rbp)
	testl	%r9d, %r9d
	js	.L42
	movq	-128(%rbp), %rax
	movl	$46, %esi
	movq	%rsp, %rdi
	movl	%r9d, -112(%rbp)
	movl	%ecx, -80(%rbp)
	leaq	1(%rax), %rdx
	call	memset@PLT
	movl	-80(%rbp), %ecx
	movl	-112(%rbp), %r9d
.L42:
	movq	-72(%rbp), %rsi
	movq	-88(%rbp), %rdi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%eax, %rdx
	addl	$1, %eax
	imulq	%rsi, %rdx
	movb	$46, (%rdi,%rdx)
	cmpl	%ecx, %eax
	jle	.L27
	testl	%ecx, %ecx
	jle	.L29
	testl	%r9d, %r9d
	jle	.L29
	movq	-72(%rbp), %rax
	movq	-88(%rbp), %rdi
	movl	%ebx, -112(%rbp)
	movl	%r14d, %ebx
	movq	-136(%rbp), %rsi
	movq	-128(%rbp), %r14
	movq	%r12, -80(%rbp)
	movl	$1, %r15d
	addq	$1, %rax
	movq	%rax, -120(%rbp)
	addq	%rax, %rdi
	movq	%rsi, %r12
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%r12, %rsi
	movq	%r14, %rdx
	addl	$1, %r15d
	addq	%r13, %r12
	call	memcpy@PLT
	movq	%rax, %rdi
	addq	-72(%rbp), %rdi
	cmpl	%ebx, %r15d
	jne	.L30
	movq	-80(%rbp), %r12
	movq	-104(%rbp), %rax
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	movl	-112(%rbp), %ebx
	movl	$1, %r13d
	leaq	4(%r12,%rax), %rax
	movq	%rax, -80(%rbp)
	movl	%r15d, %eax
	movq	-152(%rbp), %r15
	movq	%rax, -112(%rbp)
	movq	-88(%rbp), %rax
	addq	-120(%rbp), %rax
	movq	%r8, -88(%rbp)
	movq	%rax, -120(%rbp)
	.p2align 4,,10
	.p2align 3
.L43:
	movq	-120(%rbp), %rax
	movq	-88(%rbp), %r8
	cmpl	$1, %r13d
	movl	$1, %edx
	movq	-72(%rbp), %rdi
	sete	%r9b
	leaq	(%rax,%r11), %rsi
	subq	%r13, %r8
	movq	-80(%rbp), %rax
	imulq	-96(%rbp), %r8
	leaq	(%rdi,%r11), %r14
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L94:
	testb	%r9b, %r9b
	je	.L32
	addl	$1, %edx
	movl	$0, (%r12,%r15,4)
	addq	$4, %rax
	addq	$1, %rsi
	cmpl	%ebx, %edx
	je	.L93
.L36:
	cmpl	$1, %edx
	je	.L94
.L32:
	cmpb	$35, (%rsi)
	movl	-4(%rax), %ecx
	movl	(%rax,%r8,4), %edi
	jne	.L34
	xorl	%r10d, %r10d
	cmpb	$46, -1(%rsi)
	sete	%r10b
	addl	%r10d, %ecx
	movq	%rsi, %r10
	subq	%r14, %r10
	cmpb	$46, (%r10,%r11)
	sete	%r10b
	movzbl	%r10b, %r10d
	addl	%r10d, %edi
.L34:
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	addl	$1, %edx
	addq	$4, %rax
	addq	$1, %rsi
	movl	%ecx, -4(%rax)
	cmpl	%ebx, %edx
	jne	.L36
.L93:
	movq	-104(%rbp), %rdi
	addq	$1, -88(%rbp)
	movq	%r14, %r11
	addq	$1, %r13
	addq	%rdi, -80(%rbp)
	cmpq	-112(%rbp), %r13
	jne	.L43
.L29:
	movq	-136(%rbp), %rax
	xorl	%edx, %edx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	cmpb	$35, (%rax)
	movq	-144(%rbp), %rax
	sete	%dl
	imulq	-96(%rbp), %rax
	addq	-128(%rbp), %rax
	addl	(%r12,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L95
	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
.L92:
	.cfi_restore_state
	movq	-96(%rbp), %rax
	movl	$0, 4(%r12,%rax,4)
	jmp	.L29
.L48:
	xorl	%eax, %eax
	jmp	.L19
.L14:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L96
.L15:
	movq	-104(%rbp), %rax
	movq	%rsp, %r12
	shrq	$2, %rax
	movq	%rax, -96(%rbp)
	testl	%r9d, %r9d
	js	.L23
	jmp	.L16
.L90:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L96:
	orq	$0, -8(%rsp,%rax)
	jmp	.L15
.L95:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	8192
	.long	8192
	.long	8192
	.long	8192
	.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"
.LC3:
	.string	"%d"
	.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	$120, %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), %rbx
	movslq	-64(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, -144(%rbp)
	movq	%rax, %rcx
	movq	%rbx, %r9
	movq	%rbx, %r13
	imulq	%rbx, %rax
	movq	%rbx, -128(%rbp)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rsi
	andq	$-16, %rdx
	cmpq	%rsi, %rsp
	je	.L3
.L88:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L88
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L89
.L4:
	leal	1(%r9), %ebx
	movq	%rsp, -136(%rbp)
	movq	%rsp, %rsi
	movslq	%ebx, %rax
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L89:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L90
.L7:
	movq	%rsp, %r12
	testl	%ecx, %ecx
	jle	.L8
	movq	-136(%rbp), %r15
	xorl	%r14d, %r14d
	leaq	.LC1(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %r8d
	testl	%r8d, %r8d
	jle	.L91
	movslq	%r8d, %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%r8d, -80(%rbp)
	movq	%rdx, -72(%rbp)
	addl	$1, %r14d
	addq	%r13, %r15
	call	memcpy@PLT
	movl	-64(%rbp), %ecx
	movq	-72(%rbp), %rdx
	movl	-80(%rbp), %r8d
	cmpl	%ecx, %r14d
	jl	.L10
	leal	1(%r8), %ebx
	leal	1(%rcx), %r14d
	movq	%rdx, -128(%rbp)
	movq	%rsp, %rdi
	movslq	%ebx, %rax
	movl	%r8d, %r9d
	leaq	0(,%rax,4), %rsi
	movq	%rax, -72(%rbp)
	movq	%rsi, -104(%rbp)
	movslq	%r14d, %rsi
	imulq	%rax, %rsi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rdi
.L44:
	cmpq	%rdi, %rsp
	je	.L45
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L91:
	movl	-64(%rbp), %ecx
	addl	$1, %r14d
	addq	%r13, %r15
	cmpl	%r14d, %ecx
	jg	.L10
	movslq	%r8d, %rax
	movq	%rax, %r9
	movq	%rax, -128(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
	leal	1(%r9), %ebx
.L8:
	movslq	%ebx, %rax
	leal	1(%rcx), %r14d
	movq	%rsp, %rdi
	leaq	0(,%rax,4), %rsi
	movq	%rax, -72(%rbp)
	movq	%rsi, -104(%rbp)
	movslq	%r14d, %rsi
	imulq	%rax, %rsi
	leaq	15(,%rsi,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rdi
.L13:
	cmpq	%rdi, %rsp
	je	.L14
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L13
.L45:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L46
	orq	$0, -8(%rsp,%rdx)
.L46:
	movq	-72(%rbp), %rax
	movq	%rsp, %r12
	movq	%rax, -96(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -144(%rbp)
.L16:
	cmpl	$2, %r9d
	jle	.L48
	movl	%ebx, %edx
	movdqa	.LC2(%rip), %xmm0
	movq	%r12, %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%r12,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L20:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L20
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L23
.L19:
	movslq	%eax, %rdx
	leal	1(%rax), %edi
	leaq	(%r12,%rdx,4), %rdx
	movl	$8192, (%rdx)
	cmpl	%r9d, %edi
	jg	.L23
	addl	$2, %eax
	movl	$8192, 4(%rdx)
	cmpl	%r9d, %eax
	jg	.L23
	movl	$8192, 8(%rdx)
.L23:
	movq	-96(%rbp), %rdi
	xorl	%eax, %eax
	testl	%ecx, %ecx
	js	.L92
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%eax, %rdx
	addl	$1, %eax
	imulq	%rdi, %rdx
	movl	$8192, (%r12,%rdx,4)
	cmpl	%r14d, %eax
	jne	.L24
	movq	-96(%rbp), %rax
	addq	$15, %rsi
	movq	%rsp, %rdx
	addq	$1, %rax
	movq	%rax, -152(%rbp)
	movl	$0, (%r12,%rax,4)
	movq	%rsi, %rax
	andq	$-4096, %rsi
	andq	$-16, %rax
	subq	%rsi, %rdx
.L38:
	cmpq	%rdx, %rsp
	je	.L39
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L38
.L39:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L40
	orq	$0, -8(%rsp,%rax)
.L40:
	movq	%rsp, -88(%rbp)
	testl	%r9d, %r9d
	js	.L42
	movq	-128(%rbp), %rax
	movl	$46, %esi
	movq	%rsp, %rdi
	movl	%r9d, -112(%rbp)
	movl	%ecx, -80(%rbp)
	leaq	1(%rax), %rdx
	call	memset@PLT
	movl	-80(%rbp), %ecx
	movl	-112(%rbp), %r9d
.L42:
	movq	-72(%rbp), %rsi
	movq	-88(%rbp), %rdi
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%eax, %rdx
	addl	$1, %eax
	imulq	%rsi, %rdx
	movb	$46, (%rdi,%rdx)
	cmpl	%ecx, %eax
	jle	.L27
	testl	%ecx, %ecx
	jle	.L29
	testl	%r9d, %r9d
	jle	.L29
	movq	-72(%rbp), %rax
	movq	-88(%rbp), %rdi
	movl	%ebx, -112(%rbp)
	movl	%r14d, %ebx
	movq	-136(%rbp), %rsi
	movq	-128(%rbp), %r14
	movq	%r12, -80(%rbp)
	movl	$1, %r15d
	addq	$1, %rax
	movq	%rax, -120(%rbp)
	addq	%rax, %rdi
	movq	%rsi, %r12
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%r12, %rsi
	movq	%r14, %rdx
	addl	$1, %r15d
	addq	%r13, %r12
	call	memcpy@PLT
	movq	%rax, %rdi
	addq	-72(%rbp), %rdi
	cmpl	%ebx, %r15d
	jne	.L30
	movq	-80(%rbp), %r12
	movq	-104(%rbp), %rax
	xorl	%r8d, %r8d
	xorl	%r11d, %r11d
	movl	-112(%rbp), %ebx
	movl	$1, %r13d
	leaq	4(%r12,%rax), %rax
	movq	%rax, -80(%rbp)
	movl	%r15d, %eax
	movq	-152(%rbp), %r15
	movq	%rax, -112(%rbp)
	movq	-88(%rbp), %rax
	addq	-120(%rbp), %rax
	movq	%r8, -88(%rbp)
	movq	%rax, -120(%rbp)
	.p2align 4,,10
	.p2align 3
.L43:
	movq	-120(%rbp), %rax
	movq	-88(%rbp), %r8
	cmpl	$1, %r13d
	movl	$1, %edx
	movq	-72(%rbp), %rdi
	sete	%r9b
	leaq	(%rax,%r11), %rsi
	subq	%r13, %r8
	movq	-80(%rbp), %rax
	imulq	-96(%rbp), %r8
	leaq	(%rdi,%r11), %r14
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L94:
	testb	%r9b, %r9b
	je	.L32
	addl	$1, %edx
	movl	$0, (%r12,%r15,4)
	addq	$4, %rax
	addq	$1, %rsi
	cmpl	%ebx, %edx
	je	.L93
.L36:
	cmpl	$1, %edx
	je	.L94
.L32:
	cmpb	$35, (%rsi)
	movl	-4(%rax), %ecx
	movl	(%rax,%r8,4), %edi
	jne	.L34
	xorl	%r10d, %r10d
	cmpb	$46, -1(%rsi)
	sete	%r10b
	addl	%r10d, %ecx
	movq	%rsi, %r10
	subq	%r14, %r10
	cmpb	$46, (%r10,%r11)
	sete	%r10b
	movzbl	%r10b, %r10d
	addl	%r10d, %edi
.L34:
	cmpl	%edi, %ecx
	cmovg	%edi, %ecx
	addl	$1, %edx
	addq	$4, %rax
	addq	$1, %rsi
	movl	%ecx, -4(%rax)
	cmpl	%ebx, %edx
	jne	.L36
.L93:
	movq	-104(%rbp), %rdi
	addq	$1, -88(%rbp)
	movq	%r14, %r11
	addq	$1, %r13
	addq	%rdi, -80(%rbp)
	cmpq	-112(%rbp), %r13
	jne	.L43
.L29:
	movq	-136(%rbp), %rax
	xorl	%edx, %edx
	movl	$1, %edi
	leaq	.LC3(%rip), %rsi
	cmpb	$35, (%rax)
	movq	-144(%rbp), %rax
	sete	%dl
	imulq	-96(%rbp), %rax
	addq	-128(%rbp), %rax
	addl	(%r12,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L95
	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
.L92:
	.cfi_restore_state
	movq	-96(%rbp), %rax
	movl	$0, 4(%r12,%rax,4)
	jmp	.L29
.L48:
	xorl	%eax, %eax
	jmp	.L19
.L14:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L96
.L15:
	movq	-104(%rbp), %rax
	movq	%rsp, %r12
	shrq	$2, %rax
	movq	%rax, -96(%rbp)
	testl	%r9d, %r9d
	js	.L23
	jmp	.L16
.L90:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L96:
	orq	$0, -8(%rsp,%rax)
	jmp	.L15
.L95:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	8192
	.long	8192
	.long	8192
	.long	8192
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>

#define INF 1<<13
#define MIN(a,b) ((a)<(b)?(a):(b))

int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    char grid[h][w];
    char tmp[w+1];
    for(int i = 0;i < h;i++){
        scanf("%s",tmp);
        for(int cp = 0;cp < w;cp++)grid[i][cp] = tmp[cp];
    }
    int dp[h+1][w+1];
    for(int i = 0;i <= w;i++)dp[0][i] = INF;
    for(int i = 0;i <= h;i++)dp[i][0] = INF;
    dp[1][1] = 0;

    char cp_grid[h+1][w+1];
    for(int i = 0;i <= w;i++)cp_grid[0][i]='.';
    for(int i = 0;i <= h;i++)cp_grid[i][0]='.';
    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++)cp_grid[i][j]=grid[i-1][j-1];

    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++){
        if(i==1&&j==1){dp[i][j]=0;continue;}
        dp[i][j] = MIN(dp[i-1][j]+(cp_grid[i][j]=='#' && cp_grid[i-1][j]=='.'?1:0),dp[i][j-1]+(cp_grid[i][j]=='#' && cp_grid[i][j-1]=='.'?1:0));
    }
    printf("%d",dp[h][w]+(grid[0][0]=='#'?1:0));
    return 0;
}
2 2
.
#.
 4 4
##..
...
.
.
 1 7
#.#/
-..
0
,
 3 3
.##
.#-
.
 2 2
.
$.
 4 4
##..
...
-
.
 2 3
.##
.#-
.
 2 2
.
/#
 7 4
..##
...
.
.
 3 3
.##
.#.
##-

0 1 2 0 0 1 1 0 0 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>

#define INF 1<<13
#define MIN(a,b) ((a)<(b)?(a):(b))

int main(void){
    int h,w;
    scanf("%d %d",&h,&w);
    char grid[h][w];
    char tmp[w+1];
    for(int i = 0;i < h;i++){
        scanf("%s",tmp);
        for(int cp = 0;cp < w;cp++)grid[i][cp] = tmp[cp];
    }
    int dp[h+1][w+1];
    for(int i = 0;i <= w;i++)dp[0][i] = INF;
    for(int i = 0;i <= h;i++)dp[i][0] = INF;
    dp[1][1] = 0;

    char cp_grid[h+1][w+1];
    for(int i = 0;i <= w;i++)cp_grid[0][i]='.';
    for(int i = 0;i <= h;i++)cp_grid[i][0]='.';
    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++)cp_grid[i][j]=grid[i-1][j-1];

    for(int i = 1;i <= h;i++)for(int j = 1;j <= w;j++){
        if(i==1&&j==1){dp[i][j]=0;continue;}
        dp[i][j] = MIN(dp[i-1][j]+(cp_grid[i][j]=='#' && cp_grid[i-1][j]=='.'?1:0),dp[i][j-1]+(cp_grid[i][j]=='#' && cp_grid[i][j-1]=='.'?1:0));
    }
    printf("%d",dp[h][w]+(grid[0][0]=='#'?1:0));
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$408, %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, -440(%rbp)
	leaq	-188(%rbp), %rdx
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %esi
	movl	-192(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -144(%rbp)
	movslq	%esi, %rax
	movq	%rax, -368(%rbp)
	movq	$0, -360(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -136(%rbp)
	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, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movq	-208(%rbp), %r11
	movq	-200(%rbp), %r12
	movq	%r12, %rdx
	movq	-224(%rbp), %r8
	movq	-216(%rbp), %r9
	imulq	%r8, %rdx
	movq	%r9, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -128(%rbp)
	movl	-188(%rbp), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -384(%rbp)
	movq	$0, -376(%rbp)
	movslq	%edx, %rax
	movq	%rax, -400(%rbp)
	movq	$0, -392(%rbp)
	movslq	%edx, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L7
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	$0, -184(%rbp)
	jmp	.L8
.L11:
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -180(%rbp)
	jmp	.L9
.L10:
	movq	-112(%rbp), %rdx
	movl	-180(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %esi
	movq	-128(%rbp), %rdi
	movl	-180(%rbp), %eax
	movslq	%eax, %rcx
	movl	-184(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	leaq	(%rdi,%rcx), %rax
	addq	%rdx, %rax
	movb	%sil, (%rax)
	addl	$1, -180(%rbp)
.L9:
	movl	-188(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L10
	addl	$1, -184(%rbp)
.L8:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L11
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, -416(%rbp)
	movq	$0, -408(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %r10
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edi, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	-240(%rbp), %r8
	movq	-232(%rbp), %r9
	movq	%r9, %rdx
	movq	-256(%rbp), %r14
	movq	-248(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%edi, %rax
	movq	%rax, -288(%rbp)
	movq	$0, -280(%rbp)
	movq	-272(%rbp), %r14
	movq	-264(%rbp), %r15
	movq	%r15, %rdx
	movq	-288(%rbp), %r11
	movq	-280(%rbp), %r12
	imulq	%r11, %rdx
	movq	%r12, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r11
	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, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -176(%rbp)
	jmp	.L15
.L16:
	movq	-88(%rbp), %rdx
	movl	-176(%rbp), %eax
	cltq
	movl	$8192, (%rdx,%rax,4)
	addl	$1, -176(%rbp)
.L15:
	movl	-188(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L16
	movl	$0, -172(%rbp)
	jmp	.L17
.L18:
	movq	%r10, %rdx
	shrq	$2, %rdx
	movq	-88(%rbp), %rcx
	movl	-172(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$8192, (%rcx,%rax,4)
	addl	$1, -172(%rbp)
.L17:
	movl	-192(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jle	.L18
	movq	%r10, %rax
	shrq	$2, %rax
	movq	-88(%rbp), %rdx
	addq	$1, %rax
	movl	$0, (%rdx,%rax,4)
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%esi, %rax
	movq	%rax, -432(%rbp)
	movq	$0, -424(%rbp)
	movslq	%esi, %r9
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%esi, %rax
	movq	%rax, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%edi, %rax
	movq	%rax, -320(%rbp)
	movq	$0, -312(%rbp)
	movq	-304(%rbp), %r11
	movq	-296(%rbp), %r12
	movq	%r12, %rdx
	movq	-320(%rbp), %r14
	movq	-312(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -336(%rbp)
	movq	$0, -328(%rbp)
	movslq	%edi, %rax
	movq	%rax, -352(%rbp)
	movq	$0, -344(%rbp)
	movq	-336(%rbp), %r11
	movq	-328(%rbp), %r12
	movq	%r12, %rdx
	movq	-352(%rbp), %r14
	movq	-344(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	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
.L19:
	cmpq	%rdx, %rsp
	je	.L20
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L19
.L20:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L21
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L21:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-64(%rbp), %rdx
	movl	-168(%rbp), %eax
	cltq
	movb	$46, (%rdx,%rax)
	addl	$1, -168(%rbp)
.L22:
	movl	-188(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L23
	movl	$0, -164(%rbp)
	jmp	.L24
.L25:
	movq	-64(%rbp), %rdx
	movl	-164(%rbp), %eax
	cltq
	imulq	%r9, %rax
	movb	$46, (%rdx,%rax)
	addl	$1, -164(%rbp)
.L24:
	movl	-192(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jle	.L25
	movl	$1, -160(%rbp)
	jmp	.L26
.L29:
	movl	$1, -156(%rbp)
	jmp	.L27
.L28:
	movl	-160(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movq	-128(%rbp), %rsi
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	%rbx, %rax
	leaq	(%rsi,%rcx), %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movq	-64(%rbp), %rsi
	movl	-156(%rbp), %edx
	movslq	%edx, %rcx
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%r9, %rdx
	addq	%rsi, %rcx
	addq	%rcx, %rdx
	movb	%al, (%rdx)
	addl	$1, -156(%rbp)
.L27:
	movl	-188(%rbp), %eax
	cmpl	%eax, -156(%rbp)
	jle	.L28
	addl	$1, -160(%rbp)
.L26:
	movl	-192(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jle	.L29
	movl	$1, -152(%rbp)
	jmp	.L30
.L39:
	movl	$1, -148(%rbp)
	jmp	.L31
.L38:
	cmpl	$1, -152(%rbp)
	jne	.L32
	cmpl	$1, -148(%rbp)
	jne	.L32
	movq	%r10, %rcx
	shrq	$2, %rcx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	$0, (%rax,%rdx,4)
	jmp	.L33
.L32:
	movq	%r10, %rcx
	shrq	$2, %rcx
	movl	-148(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-88(%rbp), %rax
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rsi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L34
	movl	-148(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L34
	movl	$1, %eax
	jmp	.L35
.L34:
	movl	$0, %eax
.L35:
	addl	%eax, %edx
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-152(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %esi
	movq	-64(%rbp), %rdi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rdi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L36
	movl	-152(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %r8
	movl	-148(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rax
	imulq	%r9, %rax
	leaq	(%r8,%rdi), %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	movl	$1, %eax
	jmp	.L37
.L36:
	movl	$0, %eax
.L37:
	addl	%esi, %eax
	movq	%r10, %rsi
	shrq	$2, %rsi
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %rdi
	movl	-152(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	%edx, (%rax,%rcx,4)
.L33:
	addl	$1, -148(%rbp)
.L31:
	movl	-188(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jle	.L38
	addl	$1, -152(%rbp)
.L30:
	movl	-192(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jle	.L39
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-192(%rbp), %edx
	movl	-188(%rbp), %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-128(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	sete	%al
	movzbl	%al, %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-440(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	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"
	.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	$408, %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, -440(%rbp)
	leaq	-188(%rbp), %rdx
	leaq	-192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-188(%rbp), %esi
	movl	-192(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -144(%rbp)
	movslq	%esi, %rax
	movq	%rax, -368(%rbp)
	movq	$0, -360(%rbp)
	movslq	%esi, %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -136(%rbp)
	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, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edi, %rax
	movq	%rax, -224(%rbp)
	movq	$0, -216(%rbp)
	movq	-208(%rbp), %r11
	movq	-200(%rbp), %r12
	movq	%r12, %rdx
	movq	-224(%rbp), %r8
	movq	-216(%rbp), %r9
	imulq	%r8, %rdx
	movq	%r9, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r8
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rax, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -128(%rbp)
	movl	-188(%rbp), %eax
	leal	1(%rax), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	movslq	%edx, %rax
	movq	%rax, -384(%rbp)
	movq	$0, -376(%rbp)
	movslq	%edx, %rax
	movq	%rax, -400(%rbp)
	movq	$0, -392(%rbp)
	movslq	%edx, %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L5:
	cmpq	%rcx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L7
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -112(%rbp)
	movl	$0, -184(%rbp)
	jmp	.L8
.L11:
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -180(%rbp)
	jmp	.L9
.L10:
	movq	-112(%rbp), %rdx
	movl	-180(%rbp), %eax
	cltq
	movzbl	(%rdx,%rax), %esi
	movq	-128(%rbp), %rdi
	movl	-180(%rbp), %eax
	movslq	%eax, %rcx
	movl	-184(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	movq	%rax, %rdx
	leaq	(%rdi,%rcx), %rax
	addq	%rdx, %rax
	movb	%sil, (%rax)
	addl	$1, -180(%rbp)
.L9:
	movl	-188(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L10
	addl	$1, -184(%rbp)
.L8:
	movl	-192(%rbp), %eax
	cmpl	%eax, -184(%rbp)
	jl	.L11
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, -416(%rbp)
	movq	$0, -408(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %r10
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	movslq	%esi, %rax
	movq	%rax, -240(%rbp)
	movq	$0, -232(%rbp)
	movslq	%edi, %rax
	movq	%rax, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	-240(%rbp), %r8
	movq	-232(%rbp), %r9
	movq	%r9, %rdx
	movq	-256(%rbp), %r14
	movq	-248(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -272(%rbp)
	movq	$0, -264(%rbp)
	movslq	%edi, %rax
	movq	%rax, -288(%rbp)
	movq	$0, -280(%rbp)
	movq	-272(%rbp), %r14
	movq	-264(%rbp), %r15
	movq	%r15, %rdx
	movq	-288(%rbp), %r11
	movq	-280(%rbp), %r12
	imulq	%r11, %rdx
	movq	%r12, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r11
	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, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	$0, -176(%rbp)
	jmp	.L15
.L16:
	movq	-88(%rbp), %rdx
	movl	-176(%rbp), %eax
	cltq
	movl	$8192, (%rdx,%rax,4)
	addl	$1, -176(%rbp)
.L15:
	movl	-188(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L16
	movl	$0, -172(%rbp)
	jmp	.L17
.L18:
	movq	%r10, %rdx
	shrq	$2, %rdx
	movq	-88(%rbp), %rcx
	movl	-172(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movl	$8192, (%rcx,%rax,4)
	addl	$1, -172(%rbp)
.L17:
	movl	-192(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jle	.L18
	movq	%r10, %rax
	shrq	$2, %rax
	movq	-88(%rbp), %rdx
	addq	$1, %rax
	movl	$0, (%rdx,%rax,4)
	movl	-188(%rbp), %eax
	leal	1(%rax), %esi
	movl	-192(%rbp), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -80(%rbp)
	movslq	%esi, %rax
	movq	%rax, -432(%rbp)
	movq	$0, -424(%rbp)
	movslq	%esi, %r9
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%esi, %rax
	movq	%rax, -304(%rbp)
	movq	$0, -296(%rbp)
	movslq	%edi, %rax
	movq	%rax, -320(%rbp)
	movq	$0, -312(%rbp)
	movq	-304(%rbp), %r11
	movq	-296(%rbp), %r12
	movq	%r12, %rdx
	movq	-320(%rbp), %r14
	movq	-312(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -336(%rbp)
	movq	$0, -328(%rbp)
	movslq	%edi, %rax
	movq	%rax, -352(%rbp)
	movq	$0, -344(%rbp)
	movq	-336(%rbp), %r11
	movq	-328(%rbp), %r12
	movq	%r12, %rdx
	movq	-352(%rbp), %r14
	movq	-344(%rbp), %r15
	imulq	%r14, %rdx
	movq	%r15, %rax
	imulq	%r11, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r11, %rax
	mulq	%r14
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %rax
	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
.L19:
	cmpq	%rdx, %rsp
	je	.L20
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L19
.L20:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L21
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L21:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-64(%rbp), %rdx
	movl	-168(%rbp), %eax
	cltq
	movb	$46, (%rdx,%rax)
	addl	$1, -168(%rbp)
.L22:
	movl	-188(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L23
	movl	$0, -164(%rbp)
	jmp	.L24
.L25:
	movq	-64(%rbp), %rdx
	movl	-164(%rbp), %eax
	cltq
	imulq	%r9, %rax
	movb	$46, (%rdx,%rax)
	addl	$1, -164(%rbp)
.L24:
	movl	-192(%rbp), %eax
	cmpl	%eax, -164(%rbp)
	jle	.L25
	movl	$1, -160(%rbp)
	jmp	.L26
.L29:
	movl	$1, -156(%rbp)
	jmp	.L27
.L28:
	movl	-160(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-156(%rbp), %eax
	subl	$1, %eax
	movq	-128(%rbp), %rsi
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	%rbx, %rax
	leaq	(%rsi,%rcx), %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movq	-64(%rbp), %rsi
	movl	-156(%rbp), %edx
	movslq	%edx, %rcx
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%r9, %rdx
	addq	%rsi, %rcx
	addq	%rcx, %rdx
	movb	%al, (%rdx)
	addl	$1, -156(%rbp)
.L27:
	movl	-188(%rbp), %eax
	cmpl	%eax, -156(%rbp)
	jle	.L28
	addl	$1, -160(%rbp)
.L26:
	movl	-192(%rbp), %eax
	cmpl	%eax, -160(%rbp)
	jle	.L29
	movl	$1, -152(%rbp)
	jmp	.L30
.L39:
	movl	$1, -148(%rbp)
	jmp	.L31
.L38:
	cmpl	$1, -152(%rbp)
	jne	.L32
	cmpl	$1, -148(%rbp)
	jne	.L32
	movq	%r10, %rcx
	shrq	$2, %rcx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	$0, (%rax,%rdx,4)
	jmp	.L33
.L32:
	movq	%r10, %rcx
	shrq	$2, %rcx
	movl	-148(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-88(%rbp), %rax
	movslq	%edx, %rsi
	movl	-152(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rsi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L34
	movl	-148(%rbp), %eax
	subl	$1, %eax
	movq	-64(%rbp), %rsi
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rsi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L34
	movl	$1, %eax
	jmp	.L35
.L34:
	movl	$0, %eax
.L35:
	addl	%eax, %edx
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-152(%rbp), %eax
	leal	-1(%rax), %edi
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %r8
	movslq	%edi, %rcx
	imulq	%rsi, %rcx
	addq	%r8, %rcx
	movl	(%rax,%rcx,4), %esi
	movq	-64(%rbp), %rdi
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%r9, %rax
	addq	%rdi, %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L36
	movl	-152(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-64(%rbp), %r8
	movl	-148(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rax
	imulq	%r9, %rax
	leaq	(%r8,%rdi), %rcx
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	movl	$1, %eax
	jmp	.L37
.L36:
	movl	$0, %eax
.L37:
	addl	%esi, %eax
	movq	%r10, %rsi
	shrq	$2, %rsi
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-88(%rbp), %rax
	movl	-148(%rbp), %ecx
	movslq	%ecx, %rdi
	movl	-152(%rbp), %ecx
	movslq	%ecx, %rcx
	imulq	%rsi, %rcx
	addq	%rdi, %rcx
	movl	%edx, (%rax,%rcx,4)
.L33:
	addl	$1, -148(%rbp)
.L31:
	movl	-188(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jle	.L38
	addl	$1, -152(%rbp)
.L30:
	movl	-192(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jle	.L39
	movq	%r10, %rsi
	shrq	$2, %rsi
	movl	-192(%rbp), %edx
	movl	-188(%rbp), %ecx
	movq	-88(%rbp), %rax
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	%rsi, %rdx
	addq	%rcx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-128(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	sete	%al
	movzbl	%al, %eax
	addl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-440(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L41
	call	__stack_chk_fail@PLT
.L41:
	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:
