	.file	"904002.c"
	.intel_syntax noprefix
	.text
	.globl	que
	.bss
	.align 32
	.type	que, @object
	.size	que, 120000
que:
	.zero	120000
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	K
	.align 4
	.type	K, @object
	.size	K, 4
K:
	.zero	4
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 40000000
map:
	.zero	40000000
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 4000000
m:
	.zero	4000000
	.text
	.globl	BFS
	.type	BFS, @function
BFS:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -48[rbp], 0
	mov	DWORD PTR -44[rbp], 1
	mov	DWORD PTR -40[rbp], 0
	mov	DWORD PTR -36[rbp], -1
	mov	DWORD PTR -32[rbp], 1
	mov	DWORD PTR -28[rbp], 0
	mov	DWORD PTR -24[rbp], -1
	mov	DWORD PTR -20[rbp], 0
	mov	DWORD PTR -80[rbp], 1
	mov	DWORD PTR -72[rbp], 0
	mov	eax, DWORD PTR -72[rbp]
	mov	DWORD PTR -76[rbp], eax
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR -84[rbp], eax
	mov	eax, DWORD PTR map[rip]
	add	eax, 1
	mov	DWORD PTR map[rip], eax
	mov	DWORD PTR que[rip], 0
	mov	DWORD PTR que[rip+4], 0
	mov	DWORD PTR que[rip+8], 0
	jmp	.L2
.L17:
	mov	eax, DWORD PTR -84[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, que[rip]
	mov	rcx, QWORD PTR [rdx+rax]
	mov	QWORD PTR -60[rbp], rcx
	mov	eax, DWORD PTR 8[rdx+rax]
	mov	DWORD PTR -52[rbp], eax
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR N[rip]
	sub	edx, 1
	cmp	eax, edx
	jne	.L3
	mov	eax, DWORD PTR -56[rbp]
	mov	edx, DWORD PTR M[rip]
	sub	edx, 1
	cmp	eax, edx
	jne	.L3
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR -56[rbp]
	mov	ecx, DWORD PTR -52[rbp]
	movsx	rcx, ecx
	cdqe
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	jmp	.L18
.L3:
	mov	DWORD PTR -88[rbp], 0
	jmp	.L5
.L16:
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	mov	edx, DWORD PTR -48[rbp+rax*4]
	mov	eax, DWORD PTR -60[rbp]
	add	eax, edx
	mov	DWORD PTR -68[rbp], eax
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	mov	edx, DWORD PTR -32[rbp+rax*4]
	mov	eax, DWORD PTR -56[rbp]
	add	eax, edx
	mov	DWORD PTR -64[rbp], eax
	cmp	DWORD PTR -68[rbp], 0
	js	.L20
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -68[rbp], eax
	jge	.L20
	cmp	DWORD PTR -64[rbp], 0
	js	.L21
	mov	eax, DWORD PTR M[rip]
	cmp	DWORD PTR -64[rbp], eax
	jge	.L21
	mov	eax, DWORD PTR -64[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	imul	rax, rax, 1000
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, m[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L11
	mov	edx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR K[rip]
	cmp	edx, eax
	je	.L8
	mov	eax, DWORD PTR -52[rbp]
	add	eax, 1
	movsx	rcx, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L12
	mov	eax, DWORD PTR -52[rbp]
	add	eax, 1
	movsx	rcx, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	ecx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR -56[rbp]
	mov	esi, DWORD PTR -52[rbp]
	movsx	rsi, esi
	cdqe
	movsx	rdx, edx
	imul	rdi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rdi
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, 1
	cmp	ecx, eax
	jle	.L8
.L12:
	mov	eax, DWORD PTR -52[rbp]
	lea	ecx, 1[rax]
	mov	eax, DWORD PTR -80[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rsi, rax
	lea	rdx, que[rip]
	mov	eax, DWORD PTR -68[rbp]
	mov	DWORD PTR [rsi+rdx], eax
	mov	eax, DWORD PTR -80[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rsi, rax
	lea	rdx, que[rip+4]
	mov	eax, DWORD PTR -64[rbp]
	mov	DWORD PTR [rsi+rdx], eax
	mov	eax, DWORD PTR -80[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, que[rip+8]
	mov	DWORD PTR [rdx+rax], ecx
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR -56[rbp]
	mov	ecx, DWORD PTR -52[rbp]
	movsx	rcx, ecx
	cdqe
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -52[rbp]
	add	edx, 1
	lea	ecx, 1[rax]
	movsx	rsi, edx
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rdi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rdi
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	DWORD PTR [rdx+rax], ecx
	add	DWORD PTR -80[rbp], 1
	cmp	DWORD PTR -80[rbp], 10000
	jne	.L8
	add	DWORD PTR -72[rbp], 1
	mov	DWORD PTR -80[rbp], 0
	jmp	.L8
.L11:
	mov	eax, DWORD PTR -52[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L14
	mov	eax, DWORD PTR -52[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	ecx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR -56[rbp]
	mov	esi, DWORD PTR -52[rbp]
	movsx	rsi, esi
	cdqe
	movsx	rdx, edx
	imul	rdi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rdi
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, 1
	cmp	ecx, eax
	jle	.L8
.L14:
	mov	edx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR -80[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 2
	mov	rsi, rax
	lea	rcx, que[rip]
	mov	eax, DWORD PTR -68[rbp]
	mov	DWORD PTR [rsi+rcx], eax
	mov	eax, DWORD PTR -80[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 2
	mov	rsi, rax
	lea	rcx, que[rip+4]
	mov	eax, DWORD PTR -64[rbp]
	mov	DWORD PTR [rsi+rcx], eax
	mov	eax, DWORD PTR -80[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 2
	mov	rcx, rax
	lea	rax, que[rip+8]
	mov	DWORD PTR [rcx+rax], edx
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, DWORD PTR -56[rbp]
	mov	ecx, DWORD PTR -52[rbp]
	movsx	rcx, ecx
	cdqe
	movsx	rdx, edx
	imul	rsi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rsi
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -52[rbp]
	lea	ecx, 1[rdx]
	movsx	rsi, eax
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	edx, DWORD PTR -64[rbp]
	movsx	rdx, edx
	imul	rdi, rax, 10000
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	add	rax, rax
	add	rax, rdi
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, map[rip]
	mov	DWORD PTR [rdx+rax], ecx
	add	DWORD PTR -80[rbp], 1
	cmp	DWORD PTR -80[rbp], 10000
	jne	.L8
	add	DWORD PTR -72[rbp], 1
	mov	DWORD PTR -80[rbp], 0
	jmp	.L8
.L20:
	nop
	jmp	.L8
.L21:
	nop
.L8:
	add	DWORD PTR -88[rbp], 1
.L5:
	cmp	DWORD PTR -88[rbp], 3
	jle	.L16
	add	DWORD PTR -84[rbp], 1
	cmp	DWORD PTR -84[rbp], 10000
	jne	.L2
	add	DWORD PTR -76[rbp], 1
	mov	DWORD PTR -84[rbp], 0
.L2:
	mov	eax, DWORD PTR -84[rbp]
	cmp	eax, DWORD PTR -80[rbp]
	jl	.L17
	mov	eax, DWORD PTR -76[rbp]
	cmp	eax, DWORD PTR -72[rbp]
	jle	.L17
	mov	eax, -1
.L18:
	mov	rdi, QWORD PTR -8[rbp]
	sub	rdi, QWORD PTR fs:40
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	BFS, .-BFS
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%1d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	lea	rcx, K[rip]
	lea	rdx, M[rip]
	lea	rsi, N[rip]
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -8[rbp], 0
	jmp	.L23
.L26:
	mov	DWORD PTR -4[rbp], 0
	jmp	.L24
.L25:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	imul	rax, rax, 1000
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, m[rip]
	add	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	add	DWORD PTR -4[rbp], 1
.L24:
	mov	eax, DWORD PTR M[rip]
	cmp	DWORD PTR -4[rbp], eax
	jl	.L25
	add	DWORD PTR -8[rbp], 1
.L23:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -8[rbp], eax
	jl	.L26
	call	BFS
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"904002.c"
	.text
	.comm	que,120000,4
	.comm	N,4,4
	.comm	M,4,4
	.comm	K,4,4
	.comm	map,40000000,4
	.comm	m,4000000,4
	.section	.rodata
	.align	2
.LC0:
	.word	0
	.word	1
	.word	0
	.word	-1
	.align	2
.LC1:
	.word	1
	.word	0
	.word	-1
	.word	0
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	BFS
	.syntax unified
	.arm
	.fpu softvfp
	.type	BFS, %function
BFS:
	@ args = 0, pretend = 0, frame = 80
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #80
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L22+4
	sub	ip, fp, #40
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	ldr	r3, .L22+8
	sub	ip, fp, #24
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	mov	r3, #1
	str	r3, [fp, #-72]
	mov	r3, #0
	str	r3, [fp, #-64]
	ldr	r3, [fp, #-64]
	str	r3, [fp, #-68]
	ldr	r3, [fp, #-68]
	str	r3, [fp, #-76]
	ldr	r3, .L22+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L22+12
	str	r3, [r2]
	ldr	r3, .L22+16
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L22+16
	mov	r2, #0
	str	r2, [r3, #4]
	ldr	r3, .L22+16
	mov	r2, #0
	str	r2, [r3, #8]
	b	.L2
.L17:
	ldr	r1, .L22+16
	ldr	r2, [fp, #-76]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r2, r1, r3
	sub	r3, fp, #52
	ldm	r2, {r0, r1, r2}
	stm	r3, {r0, r1, r2}
	ldr	r2, [fp, #-52]
	ldr	r3, .L22+20
	ldr	r3, [r3]
	sub	r3, r3, #1
	cmp	r2, r3
	bne	.L3
	ldr	r2, [fp, #-48]
	ldr	r3, .L22+24
	ldr	r3, [r3]
	sub	r3, r3, #1
	cmp	r2, r3
	bne	.L3
	ldr	r1, [fp, #-52]
	ldr	r3, [fp, #-48]
	ldr	r0, [fp, #-44]
	ldr	ip, .L22+12
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r3, [ip, r3, lsl #2]
	b	.L18
.L3:
	mov	r3, #0
	str	r3, [fp, #-80]
	b	.L5
.L16:
	ldr	r3, [fp, #-80]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [r3, #-36]
	ldr	r3, [fp, #-52]
	add	r3, r2, r3
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-80]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [r3, #-20]
	ldr	r3, [fp, #-48]
	add	r3, r2, r3
	str	r3, [fp, #-56]
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	blt	.L20
	ldr	r3, .L22+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-60]
	cmp	r2, r3
	bge	.L20
	ldr	r3, [fp, #-56]
	cmp	r3, #0
	blt	.L21
	ldr	r3, .L22+24
	ldr	r3, [r3]
	ldr	r2, [fp, #-56]
	cmp	r2, r3
	bge	.L21
	ldr	r1, .L22+28
	ldr	r2, [fp, #-60]
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, [fp, #-56]
	add	r3, r3, r2
	ldr	r3, [r1, r3, lsl #2]
	cmp	r3, #0
	beq	.L11
	ldr	r2, [fp, #-44]
	ldr	r3, .L22+32
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L8
	ldr	r3, [fp, #-44]
	add	r0, r3, #1
	ldr	ip, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r3, [ip, r3, lsl #2]
	cmp	r3, #0
	beq	.L12
	ldr	r3, [fp, #-44]
	add	r0, r3, #1
	ldr	ip, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r0, [ip, r3, lsl #2]
	ldr	r1, [fp, #-52]
	ldr	r3, [fp, #-48]
	ldr	ip, [fp, #-44]
	ldr	lr, .L22+12
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, ip
	ldr	r3, [lr, r3, lsl #2]
	add	r3, r3, #1
	cmp	r0, r3
	ble	.L8
.L12:
	ldr	r3, [fp, #-44]
	add	r1, r3, #1
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	ldr	r2, [fp, #-60]
	str	r2, [r3]
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #4
	ldr	r2, [fp, #-56]
	str	r2, [r3]
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #8
	str	r1, [r3]
	ldr	r1, [fp, #-52]
	ldr	r3, [fp, #-48]
	ldr	r0, [fp, #-44]
	ldr	ip, .L22+12
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r3, [ip, r3, lsl #2]
	ldr	r2, [fp, #-44]
	add	ip, r2, #1
	add	r0, r3, #1
	ldr	lr, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, ip
	str	r0, [lr, r3, lsl #2]
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
	ldr	r3, [fp, #-72]
	ldr	r2, .L22+36
	cmp	r3, r2
	bne	.L8
	ldr	r3, [fp, #-64]
	add	r3, r3, #1
	str	r3, [fp, #-64]
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L8
.L11:
	ldr	r0, [fp, #-44]
	ldr	ip, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r3, [ip, r3, lsl #2]
	cmp	r3, #0
	beq	.L14
	ldr	r0, [fp, #-44]
	ldr	ip, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r0, [ip, r3, lsl #2]
	ldr	r1, [fp, #-52]
	ldr	r3, [fp, #-48]
	ldr	ip, [fp, #-44]
	ldr	lr, .L22+12
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, ip
	ldr	r3, [lr, r3, lsl #2]
	add	r3, r3, #1
	cmp	r0, r3
	ble	.L8
.L14:
	ldr	r1, [fp, #-44]
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	ldr	r2, [fp, #-60]
	str	r2, [r3]
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #4
	ldr	r2, [fp, #-56]
	str	r2, [r3]
	ldr	r0, .L22+16
	ldr	r2, [fp, #-72]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #8
	str	r1, [r3]
	ldr	r1, [fp, #-52]
	ldr	r3, [fp, #-48]
	ldr	r0, [fp, #-44]
	ldr	ip, .L22+12
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, r0
	ldr	r3, [ip, r3, lsl #2]
	ldr	ip, [fp, #-44]
	add	r0, r3, #1
	ldr	lr, .L22+12
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	mov	r2, r3
	lsl	r2, r2, #2
	add	r2, r2, r3
	lsl	r3, r2, #1
	mov	r2, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #4
	add	r3, r2, r3
	add	r3, r3, ip
	str	r0, [lr, r3, lsl #2]
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
	ldr	r3, [fp, #-72]
	ldr	r2, .L22+36
	cmp	r3, r2
	bne	.L8
	ldr	r3, [fp, #-64]
	add	r3, r3, #1
	str	r3, [fp, #-64]
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L8
.L20:
	nop
	b	.L8
.L21:
	nop
.L8:
	ldr	r3, [fp, #-80]
	add	r3, r3, #1
	str	r3, [fp, #-80]
.L5:
	ldr	r3, [fp, #-80]
	cmp	r3, #3
	ble	.L16
	ldr	r3, [fp, #-76]
	add	r3, r3, #1
	str	r3, [fp, #-76]
	ldr	r3, [fp, #-76]
	ldr	r2, .L22+36
	cmp	r3, r2
	bne	.L2
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
	mov	r3, #0
	str	r3, [fp, #-76]
.L2:
	ldr	r2, [fp, #-76]
	ldr	r3, [fp, #-72]
	cmp	r2, r3
	blt	.L17
	ldr	r2, [fp, #-68]
	ldr	r3, [fp, #-64]
	cmp	r2, r3
	ble	.L17
	mvn	r3, #0
.L18:
	ldr	r2, .L22
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	.LC2
	.word	.LC0
	.word	.LC1
	.word	map
	.word	que
	.word	N
	.word	M
	.word	m
	.word	K
	.word	10000
	.size	BFS, .-BFS
	.section	.rodata
	.align	2
.LC3:
	.ascii	"%d %d %d\000"
	.align	2
.LC4:
	.ascii	"%1d\000"
	.align	2
.LC5:
	.ascii	"%d\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r3, .L30
	ldr	r2, .L30+4
	ldr	r1, .L30+8
	ldr	r0, .L30+12
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L25
.L28:
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L26
.L27:
	ldr	r2, [fp, #-12]
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	ldr	r2, [fp, #-8]
	add	r3, r3, r2
	lsl	r3, r3, #2
	ldr	r2, .L30+16
	add	r3, r3, r2
	mov	r1, r3
	ldr	r0, .L30+20
	bl	__isoc99_scanf
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L26:
	ldr	r3, .L30+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	blt	.L27
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L25:
	ldr	r3, .L30+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	blt	.L28
	bl	BFS
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L30+24
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L31:
	.align	2
.L30:
	.word	K
	.word	M
	.word	N
	.word	.LC3
	.word	m
	.word	.LC4
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
