	.file	"86075509.c"
	.intel_syntax noprefix
	.text
	.globl	N
	.bss
	.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	stack
	.align 32
	.type	stack, @object
	.size	stack, 8008
stack:
	.zero	8008
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 1002001
map:
	.zero	1002001
	.globl	visit
	.align 32
	.type	visit, @object
	.size	visit, 1001
visit:
	.zero	1001
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -20[rbp], edi
	mov	DWORD PTR -24[rbp], esi
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, visit[rip]
	mov	BYTE PTR [rax+rdx], 1
	mov	DWORD PTR -8[rbp], 1
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L5:
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	lea	rdx, visit[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	xor	eax, 1
	test	al, al
	je	.L3
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	imul	rax, rax, 1001
	add	rdx, rax
	lea	rax, map[rip]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	je	.L3
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	lea	rdx, visit[rip]
	mov	BYTE PTR [rax+rdx], 1
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rdx, stack[rip]
	mov	eax, DWORD PTR -24[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -8[rbp]
	lea	ecx, 1[rax]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, stack[rip+4]
	mov	DWORD PTR [rdx+rax], ecx
	add	DWORD PTR -4[rbp], 1
	mov	eax, DWORD PTR -8[rbp]
	mov	DWORD PTR -24[rbp], eax
	mov	DWORD PTR -8[rbp], 1
	jmp	.L4
.L3:
	add	DWORD PTR -8[rbp], 1
.L2:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -8[rbp], eax
	jle	.L5
.L4:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -8[rbp], eax
	jle	.L2
	sub	DWORD PTR -4[rbp], 1
	cmp	DWORD PTR -4[rbp], 0
	js	.L11
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, stack[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -24[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, stack[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -8[rbp], eax
	jmp	.L2
.L11:
	nop
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d"
.LC3:
	.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, 32
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	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 -24[rbp], 0
	jmp	.L13
.L14:
	lea	rdx, -28[rbp]
	lea	rax, -32[rbp]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	eax, DWORD PTR -28[rbp]
	mov	edx, DWORD PTR -32[rbp]
	movsx	rsi, edx
	movsx	rcx, eax
	imul	rcx, rcx, 1001
	add	rsi, rcx
	lea	rcx, map[rip]
	add	rcx, rsi
	mov	BYTE PTR [rcx], 1
	mov	ecx, DWORD PTR -32[rbp]
	mov	esi, DWORD PTR -28[rbp]
	movsx	rdx, edx
	cdqe
	imul	rax, rax, 1001
	add	rdx, rax
	lea	rax, map[rip]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	rsi, esi
	movsx	rdx, ecx
	imul	rdx, rdx, 1001
	lea	rcx, [rdx+rsi]
	lea	rdx, map[rip]
	add	rdx, rcx
	mov	BYTE PTR [rdx], al
	add	DWORD PTR -24[rbp], 1
.L13:
	mov	eax, DWORD PTR M[rip]
	cmp	DWORD PTR -24[rbp], eax
	jl	.L14
	mov	DWORD PTR -20[rbp], 0
	jmp	.L15
.L19:
	mov	edx, 1001
	mov	esi, 0
	lea	rdi, visit[rip]
	call	memset@PLT
	lea	rax, -32[rbp]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -16[rbp], 0
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	lea	rdx, visit[rip]
	mov	BYTE PTR [rax+rdx], 1
	mov	DWORD PTR -12[rbp], 1
	jmp	.L16
.L18:
	mov	eax, DWORD PTR -12[rbp]
	cdqe
	lea	rdx, visit[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	xor	eax, 1
	test	al, al
	je	.L17
	mov	eax, DWORD PTR -32[rbp]
	mov	edx, DWORD PTR -12[rbp]
	mov	esi, edx
	mov	edi, eax
	call	dfs
	add	DWORD PTR -16[rbp], 1
.L17:
	add	DWORD PTR -12[rbp], 1
.L16:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -12[rbp], eax
	jle	.L18
	mov	eax, DWORD PTR -16[rbp]
	sub	eax, 1
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -20[rbp], 1
.L15:
	mov	eax, DWORD PTR K[rip]
	cmp	DWORD PTR -20[rbp], eax
	jl	.L19
	mov	eax, 0
	mov	rdi, QWORD PTR -8[rbp]
	sub	rdi, QWORD PTR fs:40
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	"86075509.c"
	.text
	.comm	N,4,4
	.comm	M,4,4
	.comm	K,4,4
	.comm	stack,8008,4
	.comm	map,1002001,4
	.comm	visit,1001,4
	.align	2
	.global	dfs
	.syntax unified
	.arm
	.fpu softvfp
	.type	dfs, %function
dfs:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #20
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r2, .L12
	ldr	r3, [fp, #-20]
	add	r3, r2, r3
	mov	r2, #1
	strb	r2, [r3]
	mov	r3, #1
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L5:
	ldr	r2, .L12
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L3
	ldr	r1, .L12+4
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #3
	add	r3, r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r2, r3, #3
	sub	r2, r2, r3
	add	r2, r1, r2
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L3
	ldr	r2, .L12
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	mov	r2, #1
	strb	r2, [r3]
	ldr	r1, .L12+8
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-20]
	str	r2, [r1, r3, lsl #3]
	ldr	r3, [fp, #-12]
	add	r2, r3, #1
	ldr	r1, .L12+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #3
	add	r3, r1, r3
	str	r2, [r3, #4]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-12]
	str	r3, [fp, #-20]
	mov	r3, #1
	str	r3, [fp, #-12]
	b	.L4
.L3:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L2:
	ldr	r3, .L12+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	ble	.L5
.L4:
	ldr	r3, .L12+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	ble	.L2
	ldr	r3, [fp, #-8]
	sub	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	blt	.L11
	ldr	r2, .L12+8
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #3]
	str	r3, [fp, #-20]
	ldr	r2, .L12+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #3
	add	r3, r2, r3
	ldr	r3, [r3, #4]
	str	r3, [fp, #-12]
	b	.L2
.L11:
	nop
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L13:
	.align	2
.L12:
	.word	visit
	.word	map
	.word	stack
	.word	N
	.size	dfs, .-dfs
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d %d %d\000"
	.align	2
.LC1:
	.ascii	"%d %d\000"
	.align	2
.LC2:
	.ascii	"%d\000"
	.align	2
.LC3:
	.ascii	"%d\012\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L24+4
	ldr	r2, .L24+8
	ldr	r1, .L24+12
	ldr	r0, .L24+16
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L15
.L16:
	sub	r2, fp, #28
	sub	r3, fp, #32
	mov	r1, r3
	ldr	r0, .L24+20
	bl	__isoc99_scanf
	ldr	r2, [fp, #-28]
	ldr	r0, [fp, #-32]
	ldr	ip, .L24+24
	mov	r3, r2
	lsl	r3, r3, #3
	add	r3, r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r1, r3, #3
	sub	r1, r1, r3
	add	r3, ip, r1
	add	r3, r3, r0
	mov	r1, #1
	strb	r1, [r3]
	ldr	r1, [fp, #-32]
	ldr	ip, [fp, #-28]
	ldr	lr, .L24+24
	mov	r3, r2
	lsl	r3, r3, #3
	add	r3, r3, r2
	lsl	r3, r3, #4
	sub	r3, r3, r2
	lsl	r2, r3, #3
	sub	r2, r2, r3
	add	r3, lr, r2
	add	r3, r3, r0
	ldrb	lr, [r3]	@ zero_extendqisi2
	ldr	r0, .L24+24
	mov	r3, r1
	lsl	r3, r3, #3
	add	r3, r3, r1
	lsl	r3, r3, #4
	sub	r3, r3, r1
	lsl	r2, r3, #3
	sub	r2, r2, r3
	add	r3, r0, r2
	add	r3, r3, ip
	mov	r2, lr
	strb	r2, [r3]
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L15:
	ldr	r3, .L24+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L16
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L17
.L21:
	ldr	r2, .L24+28
	mov	r1, #0
	ldr	r0, .L24+32
	bl	memset
	sub	r3, fp, #32
	mov	r1, r3
	ldr	r0, .L24+36
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-32]
	ldr	r2, .L24+32
	mov	r1, #1
	strb	r1, [r2, r3]
	mov	r3, #1
	str	r3, [fp, #-12]
	b	.L18
.L20:
	ldr	r2, .L24+32
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L19
	ldr	r3, [fp, #-32]
	ldr	r1, [fp, #-12]
	mov	r0, r3
	bl	dfs
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L19:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L18:
	ldr	r3, .L24+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	ble	.L20
	ldr	r3, [fp, #-16]
	sub	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L24+40
	bl	printf
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L17:
	ldr	r3, .L24+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	blt	.L21
	mov	r3, #0
	ldr	r2, .L24
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L23
	bl	__stack_chk_fail
.L23:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC4
	.word	K
	.word	M
	.word	N
	.word	.LC0
	.word	.LC1
	.word	map
	.word	1001
	.word	visit
	.word	.LC2
	.word	.LC3
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
