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>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#define max(x,y)(x>y?x:y)

typedef struct{
    int x;
    int y;
}data_t;

typedef struct{
    int head;
    int tail;
    data_t data[200000];
}queue_t;

queue_t queue;
int h,w;
char map[20][21];
int dist[20][20];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void init_queue() {queue.head = queue.tail = 0;}
void enqueue(data_t data) {queue.data[queue.tail++]=data;}
data_t dequeue() {return queue.data[queue.head++];}

int bfs(data_t start,data_t end)
{
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dist[i][j]=-1;
        }
    }
    /*syokika*/
    init_queue();
    dist[start.y][start.x]=0;
    enqueue(start);

    /*queue ni atai ga aru aida kurikaesu*/
    while(queue.head!=queue.tail){
        data_t now=dequeue();
        data_t move;

        for(int i=0;i<4;i++){
            /*idousaki ga hannigai ka douka*/
            move.x=now.x+dx[i];
            move.y=now.y+dy[i];
            if(move.y<0||move.x<0||move.y>=h||move.x>=w)continue;
            if(dist[move.y][move.x]!=-1||map[move.y][move.x]=='#')continue;

            /*idousaki tosite mitomeru*/
            enqueue(move);
            /*dist ni kakikomu*/
            dist[move.y][move.x]=dist[now.y][now.x]+1;
        }
        /*end ni atai ga attara kaesu*/
        if(dist[end.y][end.x]!=-1) return dist[end.y][end.x];
    }
    return -1;
}


int main(void)
{
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++){
        scanf("%s",map[i]);
    }
    int max=INT_MIN;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(map[i][j]=='#')continue;
            for(int ii=0;ii<h;ii++){
                for(int jj=0;jj<w;jj++){
                    if(map[ii][jj]=='#') continue;
                    if(i==ii&&j==jj)continue;
                    data_t start,end;
                    start.y=i;
                    start.x=j;
                    end.y=ii;
                    end.x=jj;
                   
                    max=max(bfs(start,end),max);
                }
            }
        }
    }
    printf("%d\n",max);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 1600008
queue:
	.zero	1600008
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 1600
dist:
	.zero	1600
	.globl	dx
	.data
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	0
	.long	-1
	.long	0
	.globl	dy
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	1
	.long	0
	.long	-1
	.text
	.globl	init_queue
	.type	init_queue, @function
init_queue:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, 4+queue(%rip)
	movl	4+queue(%rip), %eax
	movl	%eax, queue(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init_queue, .-init_queue
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	4+queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, 4+queue(%rip)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	8+queue(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, queue(%rip)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	8+queue(%rip), %rax
	movq	(%rdx,%rax), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	dequeue, .-dequeue
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L6
.L9:
	movl	$0, -24(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L7:
	movl	w(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L8
	addl	$1, -28(%rbp)
.L6:
	movl	h(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, %eax
	call	init_queue
	movl	-36(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$0, (%rdx,%rax)
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	jmp	.L10
.L20:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L17:
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-4(%rbp), %edx
	movl	h(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-8(%rbp), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L22
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	movl	-12(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L21:
	nop
	jmp	.L14
.L22:
	nop
.L14:
	addl	$1, -20(%rbp)
.L11:
	cmpl	$3, -20(%rbp)
	jle	.L17
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L10
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L19
.L10:
	movl	queue(%rip), %edx
	movl	4+queue(%rip), %eax
	cmpl	%eax, %edx
	jne	.L20
	movl	$-1, %eax
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	bfs, .-bfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L24
.L25:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L24:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L25
	movl	$-2147483648, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L26
.L41:
	movl	$0, -28(%rbp)
	jmp	.L27
.L40:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L43
	movl	$0, -24(%rbp)
	jmp	.L30
.L39:
	movl	$0, -20(%rbp)
	jmp	.L31
.L38:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L44
	movl	-32(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L34
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L45
.L34:
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	cmpl	%eax, -36(%rbp)
	jge	.L35
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	jmp	.L36
.L35:
	movl	-36(%rbp), %eax
.L36:
	movl	%eax, -36(%rbp)
	jmp	.L37
.L44:
	nop
	jmp	.L37
.L45:
	nop
.L37:
	addl	$1, -20(%rbp)
.L31:
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L38
	addl	$1, -24(%rbp)
.L30:
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L39
	jmp	.L29
.L43:
	nop
.L29:
	addl	$1, -28(%rbp)
.L27:
	movl	w(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L40
	addl	$1, -32(%rbp)
.L26:
	movl	h(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L41
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	init_queue
	.type	init_queue, @function
init_queue:
.LFB51:
	.cfi_startproc
	endbr64
	movq	$0, queue(%rip)
	ret
	.cfi_endproc
.LFE51:
	.size	init_queue, .-init_queue
	.p2align 4
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB52:
	.cfi_startproc
	endbr64
	movslq	4+queue(%rip), %rax
	leal	1(%rax), %edx
	movl	%edx, 4+queue(%rip)
	leaq	queue(%rip), %rdx
	movq	%rdi, 8(%rdx,%rax,8)
	ret
	.cfi_endproc
.LFE52:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	queue(%rip), %rax
	leal	1(%rax), %edx
	movl	%edx, queue(%rip)
	leaq	queue(%rip), %rdx
	movq	8(%rdx,%rax,8), %rax
	ret
	.cfi_endproc
.LFE53:
	.size	dequeue, .-dequeue
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %xmm5
	leaq	dist(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pshufd	$0xe5, %xmm5, %xmm7
	movslq	%esi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movd	%xmm7, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	shrq	$32, %rbp
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	w(%rip), %edx
	movl	h(%rip), %r8d
	movq	%rdi, 16(%rsp)
	movl	%edi, 8(%rsp)
	movl	%edx, 4(%rsp)
	testl	%r8d, %r8d
	jle	.L6
	testl	%edx, %edx
	jle	.L6
	leal	-1(%r8), %eax
	movl	%r8d, 24(%rsp)
	movslq	%edx, %r12
	movq	%r15, %rcx
	leaq	(%rax,%rax,4), %rbx
	leaq	80(%r15), %rax
	salq	$2, %r12
	salq	$4, %rbx
	addq	%rax, %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rcx, %rdi
	movq	%r12, %rdx
	movl	$255, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$80, %rcx
	cmpq	%rcx, %rbx
	jne	.L7
	movl	24(%rsp), %r8d
.L6:
	movd	dy(%rip), %xmm7
	movslq	8(%rsp), %rdx
	movslq	%r13d, %r13
	movslq	%ebp, %rbp
	movd	dx(%rip), %xmm8
	movd	4+dy(%rip), %xmm6
	leaq	0(%r13,%r13,4), %rax
	movl	$1, %r12d
	leaq	(%rdx,%rax,4), %rax
	movd	8+dy(%rip), %xmm5
	leaq	0(%rbp,%rbp,4), %rdx
	movd	12+dy(%rip), %xmm1
	punpckldq	%xmm7, %xmm8
	movd	4+dx(%rip), %xmm7
	movl	$0, (%r15,%rax,4)
	leaq	(%r14,%rdx,4), %rdx
	movq	.LC0(%rip), %rax
	movq	%rdx, 8(%rsp)
	leaq	queue(%rip), %r9
	punpckldq	%xmm6, %xmm7
	movd	8+dx(%rip), %xmm6
	movq	%rax, queue(%rip)
	movq	16(%rsp), %rax
	punpckldq	%xmm5, %xmm6
	movd	12+dx(%rip), %xmm5
	movq	%rax, 8+queue(%rip)
	xorl	%eax, %eax
	punpckldq	%xmm1, %xmm5
	.p2align 4,,10
	.p2align 3
.L13:
	leal	1(%rax), %edx
	movdqa	%xmm5, %xmm1
	movl	%edx, (%r9)
	movq	8(%r9,%rax,8), %xmm0
	paddd	%xmm0, %xmm1
	pshufd	$0xe5, %xmm0, %xmm10
	movd	%xmm0, %eax
	movd	%xmm10, %r14d
	pshufd	$0xe5, %xmm1, %xmm2
	movd	%xmm2, %edx
	movdqa	%xmm6, %xmm2
	movd	%xmm1, %r10d
	paddd	%xmm0, %xmm2
	pshufd	$0xe5, %xmm2, %xmm3
	movd	%xmm3, %ecx
	movdqa	%xmm7, %xmm3
	movd	%xmm2, %r11d
	paddd	%xmm0, %xmm3
	pshufd	$0xe5, %xmm3, %xmm4
	movd	%xmm4, %esi
	movdqa	%xmm8, %xmm4
	movd	%xmm3, %ebx
	paddd	%xmm0, %xmm4
	pshufd	$0xe5, %xmm4, %xmm9
	movd	%xmm4, %ebp
	movd	%xmm9, %r13d
	movd	%xmm9, %edi
	orl	%ebp, %r13d
	js	.L8
	cmpl	%edi, %r8d
	jle	.L8
	cmpl	4(%rsp), %ebp
	jge	.L8
	movslq	%edi, %rdi
	movslq	%ebp, %rbp
	leaq	(%rdi,%rdi,4), %r13
	movq	%rbp, 16(%rsp)
	salq	$2, %r13
	addq	%r13, %rbp
	cmpl	$-1, (%r15,%rbp,4)
	movq	%rbp, 24(%rsp)
	jne	.L8
	addq	%r13, %rdi
	movq	16(%rsp), %rbp
	leaq	map(%rip), %r13
	addq	%r13, %rdi
	cmpb	$35, (%rdi,%rbp)
	je	.L8
	leal	1(%r12), %edi
	movslq	%r14d, %rbp
	movl	%edi, 4+queue(%rip)
	leaq	0(%rbp,%rbp,4), %rbp
	movslq	%eax, %rdi
	leaq	(%rdi,%rbp,4), %rdi
	movq	24(%rsp), %rbp
	movq	%xmm4, 8(%r9,%r12,8)
	movl	(%r15,%rdi,4), %edi
	addl	$1, %edi
	movl	%edi, (%r15,%rbp,4)
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, %edi
	orl	%ebx, %edi
	js	.L9
	cmpl	%esi, %r8d
	jle	.L9
	cmpl	4(%rsp), %ebx
	jge	.L9
	movslq	%esi, %rsi
	movslq	%ebx, %rbx
	leaq	(%rsi,%rsi,4), %rdi
	salq	$2, %rdi
	leaq	(%rdi,%rbx), %rbp
	cmpl	$-1, (%r15,%rbp,4)
	jne	.L9
	addq	%rdi, %rsi
	leaq	map(%rip), %rdi
	addq	%rdi, %rsi
	cmpb	$35, (%rsi,%rbx)
	je	.L9
	movslq	4+queue(%rip), %rsi
	leal	1(%rsi), %edi
	movl	%edi, 4+queue(%rip)
	movslq	%eax, %rdi
	movq	%xmm3, 8(%r9,%rsi,8)
	movslq	%r14d, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdi,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %esi
	addl	$1, %esi
	movl	%esi, (%r15,%rbp,4)
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%ecx, %ebx
	orl	%r11d, %ebx
	js	.L10
	cmpl	%ecx, %r8d
	jle	.L10
	cmpl	4(%rsp), %r11d
	jge	.L10
	movslq	%ecx, %rcx
	movslq	%r11d, %r11
	leaq	(%rcx,%rcx,4), %rsi
	salq	$2, %rsi
	leaq	(%rsi,%r11), %rdi
	cmpl	$-1, (%r15,%rdi,4)
	jne	.L10
	addq	%rsi, %rcx
	leaq	map(%rip), %rbx
	addq	%rbx, %rcx
	cmpb	$35, (%rcx,%r11)
	je	.L10
	movslq	4+queue(%rip), %rcx
	leal	1(%rcx), %esi
	movl	%esi, 4+queue(%rip)
	movslq	%eax, %rsi
	movq	%xmm2, 8(%r9,%rcx,8)
	movslq	%r14d, %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rsi,%rcx,4), %rcx
	movl	(%r15,%rcx,4), %ecx
	addl	$1, %ecx
	movl	%ecx, (%r15,%rdi,4)
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ebx
	orl	%r10d, %ebx
	js	.L11
	cmpl	%edx, %r8d
	jle	.L11
	cmpl	4(%rsp), %r10d
	jge	.L11
	movslq	%edx, %rdx
	movslq	%r10d, %r10
	leaq	(%rdx,%rdx,4), %rcx
	salq	$2, %rcx
	leaq	(%rcx,%r10), %rsi
	cmpl	$-1, (%r15,%rsi,4)
	jne	.L11
	addq	%rcx, %rdx
	leaq	map(%rip), %rbx
	addq	%rbx, %rdx
	cmpb	$35, (%rdx,%r10)
	je	.L11
	movslq	4+queue(%rip), %rdx
	cltq
	leal	1(%rdx), %ecx
	movl	%ecx, 4+queue(%rip)
	movq	%xmm1, 8(%r9,%rdx,8)
	movslq	%r14d, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	movl	(%r15,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%r15,%rsi,4)
	.p2align 4,,10
	.p2align 3
.L11:
	movq	8(%rsp), %rax
	movl	(%r15,%rax,4), %r10d
	cmpl	$-1, %r10d
	jne	.L5
	movslq	(%r9), %rax
	movslq	4+queue(%rip), %r12
	cmpl	%r12d, %eax
	jne	.L13
.L5:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movl	%r10d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE54:
	.size	bfs, .-bfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	w(%rip), %rdx
	leaq	h(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	__isoc99_scanf@PLT
	movl	h(%rip), %eax
	testl	%eax, %eax
	jle	.L20
	leaq	map(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	h(%rip), %edx
	addq	$21, %rbp
	cmpl	%ebx, %edx
	jg	.L21
	testl	%edx, %edx
	jle	.L20
	movl	$-2147483648, 24(%rsp)
	movl	w(%rip), %eax
	xorl	%ebp, %ebp
.L22:
	movl	%ebp, 28(%rsp)
	testl	%eax, %eax
	jle	.L34
	leaq	0(%rbp,%rbp,4), %rcx
	leaq	map(%rip), %rsi
	movq	$0, 8(%rsp)
	leaq	0(%rbp,%rcx,4), %r15
	addq	%r15, %rsi
	movq	%rsi, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L31:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	movd	28(%rsp), %xmm2
	movd	%esi, %xmm0
	cmpb	$35, (%rdi,%rsi)
	punpckldq	%xmm2, %xmm0
	je	.L23
	leaq	map(%rip), %r15
	xorl	%ebx, %ebx
	movq	%xmm0, %r14
	testl	%edx, %edx
	jle	.L23
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L36:
	xorl	%r12d, %r12d
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L25:
	addq	$1, %r12
	cmpl	%r12d, %eax
	jle	.L48
.L28:
	movd	%r12d, %xmm0
	movd	%ebx, %xmm1
	cmpb	$35, (%r15,%r12)
	punpckldq	%xmm1, %xmm0
	je	.L25
	cmpl	%ebp, %ebx
	jne	.L37
	cmpl	%r12d, 8(%rsp)
	je	.L25
.L37:
	movq	%xmm0, %rsi
	movq	%r14, %rdi
	movq	%xmm0, %r13
	call	bfs
	movl	%eax, %r8d
	movl	w(%rip), %eax
	cmpl	24(%rsp), %r8d
	jle	.L25
	movq	%r13, %rsi
	movq	%r14, %rdi
	addq	$1, %r12
	call	bfs
	movl	%eax, 24(%rsp)
	movl	w(%rip), %eax
	cmpl	%r12d, %eax
	jg	.L28
	.p2align 4,,10
	.p2align 3
.L48:
	movl	h(%rip), %edx
	addl	$1, %ebx
	cmpl	%ebx, %edx
	jle	.L23
	addq	$21, %r15
	testl	%eax, %eax
	jg	.L36
.L34:
	addq	$1, %rbp
	cmpl	%ebp, %edx
	jg	.L22
.L32:
	movl	24(%rsp), %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rdi
	cmpl	%edi, %eax
	jg	.L31
	jmp	.L34
.L20:
	movl	$-2147483648, 24(%rsp)
	jmp	.L32
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.globl	dy
	.data
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	1
	.long	0
	.long	-1
	.globl	dx
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	0
	.long	-1
	.long	0
	.globl	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 1600
dist:
	.zero	1600
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	queue
	.align 32
	.type	queue, @object
	.size	queue, 1600008
queue:
	.zero	1600008
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1
	.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	init_queue
	.type	init_queue, @function
init_queue:
.LFB51:
	.cfi_startproc
	endbr64
	movq	$0, queue(%rip)
	ret
	.cfi_endproc
.LFE51:
	.size	init_queue, .-init_queue
	.p2align 4
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB52:
	.cfi_startproc
	endbr64
	movslq	4+queue(%rip), %rax
	leal	1(%rax), %edx
	movl	%edx, 4+queue(%rip)
	leaq	queue(%rip), %rdx
	movq	%rdi, 8(%rdx,%rax,8)
	ret
	.cfi_endproc
.LFE52:
	.size	enqueue, .-enqueue
	.p2align 4
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB53:
	.cfi_startproc
	endbr64
	movslq	queue(%rip), %rax
	leal	1(%rax), %edx
	movl	%edx, queue(%rip)
	leaq	queue(%rip), %rdx
	movq	8(%rdx,%rax,8), %rax
	ret
	.cfi_endproc
.LFE53:
	.size	dequeue, .-dequeue
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rdi, %xmm5
	leaq	dist(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pshufd	$0xe5, %xmm5, %xmm7
	movslq	%esi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movd	%xmm7, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%rsi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	shrq	$32, %rbp
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movl	w(%rip), %edx
	movl	h(%rip), %r8d
	movq	%rdi, 16(%rsp)
	movl	%edi, 8(%rsp)
	movl	%edx, 4(%rsp)
	testl	%r8d, %r8d
	jle	.L6
	testl	%edx, %edx
	jle	.L6
	leal	-1(%r8), %eax
	movl	%r8d, 24(%rsp)
	movslq	%edx, %r12
	movq	%r15, %rcx
	leaq	(%rax,%rax,4), %rbx
	leaq	80(%r15), %rax
	salq	$2, %r12
	salq	$4, %rbx
	addq	%rax, %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rcx, %rdi
	movq	%r12, %rdx
	movl	$255, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$80, %rcx
	cmpq	%rcx, %rbx
	jne	.L7
	movl	24(%rsp), %r8d
.L6:
	movd	dy(%rip), %xmm7
	movslq	8(%rsp), %rdx
	movslq	%r13d, %r13
	movslq	%ebp, %rbp
	movd	dx(%rip), %xmm8
	movd	4+dy(%rip), %xmm6
	leaq	0(%r13,%r13,4), %rax
	movl	$1, %r12d
	leaq	(%rdx,%rax,4), %rax
	movd	8+dy(%rip), %xmm5
	leaq	0(%rbp,%rbp,4), %rdx
	movd	12+dy(%rip), %xmm1
	punpckldq	%xmm7, %xmm8
	movd	4+dx(%rip), %xmm7
	movl	$0, (%r15,%rax,4)
	leaq	(%r14,%rdx,4), %rdx
	movq	.LC0(%rip), %rax
	movq	%rdx, 8(%rsp)
	leaq	queue(%rip), %r9
	punpckldq	%xmm6, %xmm7
	movd	8+dx(%rip), %xmm6
	movq	%rax, queue(%rip)
	movq	16(%rsp), %rax
	punpckldq	%xmm5, %xmm6
	movd	12+dx(%rip), %xmm5
	movq	%rax, 8+queue(%rip)
	xorl	%eax, %eax
	punpckldq	%xmm1, %xmm5
	.p2align 4,,10
	.p2align 3
.L13:
	leal	1(%rax), %edx
	movdqa	%xmm5, %xmm1
	movl	%edx, (%r9)
	movq	8(%r9,%rax,8), %xmm0
	paddd	%xmm0, %xmm1
	pshufd	$0xe5, %xmm0, %xmm10
	movd	%xmm0, %eax
	movd	%xmm10, %r14d
	pshufd	$0xe5, %xmm1, %xmm2
	movd	%xmm2, %edx
	movdqa	%xmm6, %xmm2
	movd	%xmm1, %r10d
	paddd	%xmm0, %xmm2
	pshufd	$0xe5, %xmm2, %xmm3
	movd	%xmm3, %ecx
	movdqa	%xmm7, %xmm3
	movd	%xmm2, %r11d
	paddd	%xmm0, %xmm3
	pshufd	$0xe5, %xmm3, %xmm4
	movd	%xmm4, %esi
	movdqa	%xmm8, %xmm4
	movd	%xmm3, %ebx
	paddd	%xmm0, %xmm4
	pshufd	$0xe5, %xmm4, %xmm9
	movd	%xmm4, %ebp
	movd	%xmm9, %r13d
	movd	%xmm9, %edi
	orl	%ebp, %r13d
	js	.L8
	cmpl	%edi, %r8d
	jle	.L8
	cmpl	4(%rsp), %ebp
	jge	.L8
	movslq	%edi, %rdi
	movslq	%ebp, %rbp
	leaq	(%rdi,%rdi,4), %r13
	movq	%rbp, 16(%rsp)
	salq	$2, %r13
	addq	%r13, %rbp
	cmpl	$-1, (%r15,%rbp,4)
	movq	%rbp, 24(%rsp)
	jne	.L8
	addq	%r13, %rdi
	movq	16(%rsp), %rbp
	leaq	map(%rip), %r13
	addq	%r13, %rdi
	cmpb	$35, (%rdi,%rbp)
	je	.L8
	leal	1(%r12), %edi
	movslq	%r14d, %rbp
	movl	%edi, 4+queue(%rip)
	leaq	0(%rbp,%rbp,4), %rbp
	movslq	%eax, %rdi
	leaq	(%rdi,%rbp,4), %rdi
	movq	24(%rsp), %rbp
	movq	%xmm4, 8(%r9,%r12,8)
	movl	(%r15,%rdi,4), %edi
	addl	$1, %edi
	movl	%edi, (%r15,%rbp,4)
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, %edi
	orl	%ebx, %edi
	js	.L9
	cmpl	%esi, %r8d
	jle	.L9
	cmpl	4(%rsp), %ebx
	jge	.L9
	movslq	%esi, %rsi
	movslq	%ebx, %rbx
	leaq	(%rsi,%rsi,4), %rdi
	salq	$2, %rdi
	leaq	(%rdi,%rbx), %rbp
	cmpl	$-1, (%r15,%rbp,4)
	jne	.L9
	addq	%rdi, %rsi
	leaq	map(%rip), %rdi
	addq	%rdi, %rsi
	cmpb	$35, (%rsi,%rbx)
	je	.L9
	movslq	4+queue(%rip), %rsi
	leal	1(%rsi), %edi
	movl	%edi, 4+queue(%rip)
	movslq	%eax, %rdi
	movq	%xmm3, 8(%r9,%rsi,8)
	movslq	%r14d, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdi,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %esi
	addl	$1, %esi
	movl	%esi, (%r15,%rbp,4)
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%ecx, %ebx
	orl	%r11d, %ebx
	js	.L10
	cmpl	%ecx, %r8d
	jle	.L10
	cmpl	4(%rsp), %r11d
	jge	.L10
	movslq	%ecx, %rcx
	movslq	%r11d, %r11
	leaq	(%rcx,%rcx,4), %rsi
	salq	$2, %rsi
	leaq	(%rsi,%r11), %rdi
	cmpl	$-1, (%r15,%rdi,4)
	jne	.L10
	addq	%rsi, %rcx
	leaq	map(%rip), %rbx
	addq	%rbx, %rcx
	cmpb	$35, (%rcx,%r11)
	je	.L10
	movslq	4+queue(%rip), %rcx
	leal	1(%rcx), %esi
	movl	%esi, 4+queue(%rip)
	movslq	%eax, %rsi
	movq	%xmm2, 8(%r9,%rcx,8)
	movslq	%r14d, %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rsi,%rcx,4), %rcx
	movl	(%r15,%rcx,4), %ecx
	addl	$1, %ecx
	movl	%ecx, (%r15,%rdi,4)
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %ebx
	orl	%r10d, %ebx
	js	.L11
	cmpl	%edx, %r8d
	jle	.L11
	cmpl	4(%rsp), %r10d
	jge	.L11
	movslq	%edx, %rdx
	movslq	%r10d, %r10
	leaq	(%rdx,%rdx,4), %rcx
	salq	$2, %rcx
	leaq	(%rcx,%r10), %rsi
	cmpl	$-1, (%r15,%rsi,4)
	jne	.L11
	addq	%rcx, %rdx
	leaq	map(%rip), %rbx
	addq	%rbx, %rdx
	cmpb	$35, (%rdx,%r10)
	je	.L11
	movslq	4+queue(%rip), %rdx
	cltq
	leal	1(%rdx), %ecx
	movl	%ecx, 4+queue(%rip)
	movq	%xmm1, 8(%r9,%rdx,8)
	movslq	%r14d, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	movl	(%r15,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%r15,%rsi,4)
	.p2align 4,,10
	.p2align 3
.L11:
	movq	8(%rsp), %rax
	movl	(%r15,%rax,4), %r10d
	cmpl	$-1, %r10d
	jne	.L5
	movslq	(%r9), %rax
	movslq	4+queue(%rip), %r12
	cmpl	%r12d, %eax
	jne	.L13
.L5:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	movl	%r10d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE54:
	.size	bfs, .-bfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	w(%rip), %rdx
	leaq	h(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	__isoc99_scanf@PLT
	movl	h(%rip), %eax
	testl	%eax, %eax
	jle	.L20
	leaq	map(%rip), %rbp
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
.L21:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	h(%rip), %edx
	addq	$21, %rbp
	cmpl	%ebx, %edx
	jg	.L21
	testl	%edx, %edx
	jle	.L20
	movl	$-2147483648, 24(%rsp)
	movl	w(%rip), %eax
	xorl	%ebp, %ebp
.L22:
	movl	%ebp, 28(%rsp)
	testl	%eax, %eax
	jle	.L34
	leaq	0(%rbp,%rbp,4), %rcx
	leaq	map(%rip), %rsi
	movq	$0, 8(%rsp)
	leaq	0(%rbp,%rcx,4), %r15
	addq	%r15, %rsi
	movq	%rsi, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L31:
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	movd	28(%rsp), %xmm2
	movd	%esi, %xmm0
	cmpb	$35, (%rdi,%rsi)
	punpckldq	%xmm2, %xmm0
	je	.L23
	leaq	map(%rip), %r15
	xorl	%ebx, %ebx
	movq	%xmm0, %r14
	testl	%edx, %edx
	jle	.L23
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L36:
	xorl	%r12d, %r12d
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L25:
	addq	$1, %r12
	cmpl	%r12d, %eax
	jle	.L48
.L28:
	movd	%r12d, %xmm0
	movd	%ebx, %xmm1
	cmpb	$35, (%r15,%r12)
	punpckldq	%xmm1, %xmm0
	je	.L25
	cmpl	%ebp, %ebx
	jne	.L37
	cmpl	%r12d, 8(%rsp)
	je	.L25
.L37:
	movq	%xmm0, %rsi
	movq	%r14, %rdi
	movq	%xmm0, %r13
	call	bfs
	movl	%eax, %r8d
	movl	w(%rip), %eax
	cmpl	24(%rsp), %r8d
	jle	.L25
	movq	%r13, %rsi
	movq	%r14, %rdi
	addq	$1, %r12
	call	bfs
	movl	%eax, 24(%rsp)
	movl	w(%rip), %eax
	cmpl	%r12d, %eax
	jg	.L28
	.p2align 4,,10
	.p2align 3
.L48:
	movl	h(%rip), %edx
	addl	$1, %ebx
	cmpl	%ebx, %edx
	jle	.L23
	addq	$21, %r15
	testl	%eax, %eax
	jg	.L36
.L34:
	addq	$1, %rbp
	cmpl	%ebp, %edx
	jg	.L22
.L32:
	movl	24(%rsp), %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	addq	$1, 8(%rsp)
	movq	8(%rsp), %rdi
	cmpl	%edi, %eax
	jg	.L31
	jmp	.L34
.L20:
	movl	$-2147483648, 24(%rsp)
	jmp	.L32
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.globl	dy
	.data
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	1
	.long	0
	.long	-1
	.globl	dx
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	0
	.long	-1
	.long	0
	.globl	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 1600
dist:
	.zero	1600
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	queue
	.align 32
	.type	queue, @object
	.size	queue, 1600008
queue:
	.zero	1600008
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1
	.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>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#define max(x,y)(x>y?x:y)

typedef struct{
    int x;
    int y;
}data_t;

typedef struct{
    int head;
    int tail;
    data_t data[200000];
}queue_t;

queue_t queue;
int h,w;
char map[20][21];
int dist[20][20];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void init_queue() {queue.head = queue.tail = 0;}
void enqueue(data_t data) {queue.data[queue.tail++]=data;}
data_t dequeue() {return queue.data[queue.head++];}

int bfs(data_t start,data_t end)
{
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dist[i][j]=-1;
        }
    }
    /*syokika*/
    init_queue();
    dist[start.y][start.x]=0;
    enqueue(start);

    /*queue ni atai ga aru aida kurikaesu*/
    while(queue.head!=queue.tail){
        data_t now=dequeue();
        data_t move;

        for(int i=0;i<4;i++){
            /*idousaki ga hannigai ka douka*/
            move.x=now.x+dx[i];
            move.y=now.y+dy[i];
            if(move.y<0||move.x<0||move.y>=h||move.x>=w)continue;
            if(dist[move.y][move.x]!=-1||map[move.y][move.x]=='#')continue;

            /*idousaki tosite mitomeru*/
            enqueue(move);
            /*dist ni kakikomu*/
            dist[move.y][move.x]=dist[now.y][now.x]+1;
        }
        /*end ni atai ga attara kaesu*/
        if(dist[end.y][end.x]!=-1) return dist[end.y][end.x];
    }
    return -1;
}


int main(void)
{
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++){
        scanf("%s",map[i]);
    }
    int max=INT_MIN;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(map[i][j]=='#')continue;
            for(int ii=0;ii<h;ii++){
                for(int jj=0;jj<w;jj++){
                    if(map[ii][jj]=='#') continue;
                    if(i==ii&&j==jj)continue;
                    data_t start,end;
                    start.y=i;
                    start.x=j;
                    end.y=ii;
                    end.x=jj;
                   
                    max=max(bfs(start,end),max);
                }
            }
        }
    }
    printf("%d\n",max);
    return 0;
}
3 3
...
../
...
 0 5
...#.
.#.#.
.#...
 0 5
.#...
.#.#.
.#...
 0 5
.#...
.#.#.
.$...
 0 5
.#..-
.#.#.
.$...
 0 5
.#..-
.#.#.
.$..-
 -1 5
.#..-
.#.#.
.$..-
 0 6
.#..-
.#.#.
.$..-
 0 6
.#..-
.#.$.
.$..-
 0 6
.#..-
.#/$.
.$..-

4
 -2147483648
 -2147483648
 -2147483648
 -2147483648
 -2147483648
 -2147483648
 -2147483648
 -2147483648
 -2147483648

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>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#define max(x,y)(x>y?x:y)

typedef struct{
    int x;
    int y;
}data_t;

typedef struct{
    int head;
    int tail;
    data_t data[200000];
}queue_t;

queue_t queue;
int h,w;
char map[20][21];
int dist[20][20];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void init_queue() {queue.head = queue.tail = 0;}
void enqueue(data_t data) {queue.data[queue.tail++]=data;}
data_t dequeue() {return queue.data[queue.head++];}

int bfs(data_t start,data_t end)
{
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dist[i][j]=-1;
        }
    }
    /*syokika*/
    init_queue();
    dist[start.y][start.x]=0;
    enqueue(start);

    /*queue ni atai ga aru aida kurikaesu*/
    while(queue.head!=queue.tail){
        data_t now=dequeue();
        data_t move;

        for(int i=0;i<4;i++){
            /*idousaki ga hannigai ka douka*/
            move.x=now.x+dx[i];
            move.y=now.y+dy[i];
            if(move.y<0||move.x<0||move.y>=h||move.x>=w)continue;
            if(dist[move.y][move.x]!=-1||map[move.y][move.x]=='#')continue;

            /*idousaki tosite mitomeru*/
            enqueue(move);
            /*dist ni kakikomu*/
            dist[move.y][move.x]=dist[now.y][now.x]+1;
        }
        /*end ni atai ga attara kaesu*/
        if(dist[end.y][end.x]!=-1) return dist[end.y][end.x];
    }
    return -1;
}


int main(void)
{
    scanf("%d %d",&h,&w);
    for(int i=0;i<h;i++){
        scanf("%s",map[i]);
    }
    int max=INT_MIN;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(map[i][j]=='#')continue;
            for(int ii=0;ii<h;ii++){
                for(int jj=0;jj<w;jj++){
                    if(map[ii][jj]=='#') continue;
                    if(i==ii&&j==jj)continue;
                    data_t start,end;
                    start.y=i;
                    start.x=j;
                    end.y=ii;
                    end.x=jj;
                   
                    max=max(bfs(start,end),max);
                }
            }
        }
    }
    printf("%d\n",max);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 1600008
queue:
	.zero	1600008
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 1600
dist:
	.zero	1600
	.globl	dx
	.data
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	0
	.long	-1
	.long	0
	.globl	dy
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	1
	.long	0
	.long	-1
	.text
	.globl	init_queue
	.type	init_queue, @function
init_queue:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, 4+queue(%rip)
	movl	4+queue(%rip), %eax
	movl	%eax, queue(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init_queue, .-init_queue
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	4+queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, 4+queue(%rip)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	8+queue(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, queue(%rip)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	8+queue(%rip), %rax
	movq	(%rdx,%rax), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	dequeue, .-dequeue
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L6
.L9:
	movl	$0, -24(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L7:
	movl	w(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L8
	addl	$1, -28(%rbp)
.L6:
	movl	h(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, %eax
	call	init_queue
	movl	-36(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$0, (%rdx,%rax)
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	jmp	.L10
.L20:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L17:
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-4(%rbp), %edx
	movl	h(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-8(%rbp), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L22
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	movl	-12(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L21:
	nop
	jmp	.L14
.L22:
	nop
.L14:
	addl	$1, -20(%rbp)
.L11:
	cmpl	$3, -20(%rbp)
	jle	.L17
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L10
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L19
.L10:
	movl	queue(%rip), %edx
	movl	4+queue(%rip), %eax
	cmpl	%eax, %edx
	jne	.L20
	movl	$-1, %eax
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	bfs, .-bfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L24
.L25:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L24:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L25
	movl	$-2147483648, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L26
.L41:
	movl	$0, -28(%rbp)
	jmp	.L27
.L40:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L43
	movl	$0, -24(%rbp)
	jmp	.L30
.L39:
	movl	$0, -20(%rbp)
	jmp	.L31
.L38:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L44
	movl	-32(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L34
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L45
.L34:
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	cmpl	%eax, -36(%rbp)
	jge	.L35
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	jmp	.L36
.L35:
	movl	-36(%rbp), %eax
.L36:
	movl	%eax, -36(%rbp)
	jmp	.L37
.L44:
	nop
	jmp	.L37
.L45:
	nop
.L37:
	addl	$1, -20(%rbp)
.L31:
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L38
	addl	$1, -24(%rbp)
.L30:
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L39
	jmp	.L29
.L43:
	nop
.L29:
	addl	$1, -28(%rbp)
.L27:
	movl	w(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L40
	addl	$1, -32(%rbp)
.L26:
	movl	h(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L41
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	queue
	.bss
	.align 32
	.type	queue, @object
	.size	queue, 1600008
queue:
	.zero	1600008
	.globl	h
	.align 4
	.type	h, @object
	.size	h, 4
h:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 1600
dist:
	.zero	1600
	.globl	dx
	.data
	.align 16
	.type	dx, @object
	.size	dx, 16
dx:
	.long	1
	.long	0
	.long	-1
	.long	0
	.globl	dy
	.align 16
	.type	dy, @object
	.size	dy, 16
dy:
	.long	0
	.long	1
	.long	0
	.long	-1
	.text
	.globl	init_queue
	.type	init_queue, @function
init_queue:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, 4+queue(%rip)
	movl	4+queue(%rip), %eax
	movl	%eax, queue(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init_queue, .-init_queue
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movl	4+queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, 4+queue(%rip)
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	8+queue(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	queue(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, queue(%rip)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	8+queue(%rip), %rax
	movq	(%rdx,%rax), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	dequeue, .-dequeue
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%rsi, -48(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L6
.L9:
	movl	$0, -24(%rbp)
	jmp	.L7
.L8:
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -24(%rbp)
.L7:
	movl	w(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L8
	addl	$1, -28(%rbp)
.L6:
	movl	h(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L9
	movl	$0, %eax
	call	init_queue
	movl	-36(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$0, (%rdx,%rax)
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	jmp	.L10
.L20:
	movl	$0, %eax
	call	dequeue
	movq	%rax, -16(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L17:
	movl	-16(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dy(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-8(%rbp), %eax
	testl	%eax, %eax
	js	.L21
	movl	-4(%rbp), %edx
	movl	h(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-8(%rbp), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jge	.L21
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L22
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	enqueue
	movl	-12(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-4(%rbp), %eax
	movl	-8(%rbp), %edx
	addl	$1, %ecx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L14
.L21:
	nop
	jmp	.L14
.L22:
	nop
.L14:
	addl	$1, -20(%rbp)
.L11:
	cmpl	$3, -20(%rbp)
	jle	.L17
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L10
	movl	-44(%rbp), %eax
	movl	-48(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L19
.L10:
	movl	queue(%rip), %edx
	movl	4+queue(%rip), %eax
	cmpl	%eax, %edx
	jne	.L20
	movl	$-1, %eax
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	bfs, .-bfs
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L24
.L25:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40(%rbp)
.L24:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L25
	movl	$-2147483648, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L26
.L41:
	movl	$0, -28(%rbp)
	jmp	.L27
.L40:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L43
	movl	$0, -24(%rbp)
	jmp	.L30
.L39:
	movl	$0, -20(%rbp)
	jmp	.L31
.L38:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L44
	movl	-32(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L34
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L45
.L34:
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	cmpl	%eax, -36(%rbp)
	jge	.L35
	movq	-8(%rbp), %rdx
	movq	-16(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	bfs
	jmp	.L36
.L35:
	movl	-36(%rbp), %eax
.L36:
	movl	%eax, -36(%rbp)
	jmp	.L37
.L44:
	nop
	jmp	.L37
.L45:
	nop
.L37:
	addl	$1, -20(%rbp)
.L31:
	movl	w(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L38
	addl	$1, -24(%rbp)
.L30:
	movl	h(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L39
	jmp	.L29
.L43:
	nop
.L29:
	addl	$1, -28(%rbp)
.L27:
	movl	w(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L40
	addl	$1, -32(%rbp)
.L26:
	movl	h(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L41
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
