	.file	"97012350.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	G
	.align 32
	.type	G, @object
	.size	G, 44100
G:
	.zero	44100
	.globl	queue
	.align 32
	.type	queue, @object
	.size	queue, 40020
queue:
	.zero	40020
	.globl	front
	.align 4
	.type	front, @object
	.size	front, 4
front:
	.zero	4
	.globl	rear
	.align 4
	.type	rear, @object
	.size	rear, 4
rear:
	.zero	4
	.globl	vis
	.align 32
	.type	vis, @object
	.size	vis, 420
vis:
	.zero	420
	.section	.rodata
.LC0:
	.string	"%d "
	.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, 16
	mov	edx, 420
	mov	esi, 0
	lea	rdi, vis[rip]
	call	memset@PLT
	mov	eax, DWORD PTR rear[rip]
	add	eax, 1
	mov	DWORD PTR rear[rip], eax
	mov	eax, DWORD PTR rear[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, queue[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	DWORD PTR vis[rip], 1
	jmp	.L2
.L6:
	mov	eax, DWORD PTR front[rip]
	add	eax, 1
	mov	DWORD PTR front[rip], eax
	mov	eax, DWORD PTR front[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, queue[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -8[rbp], 0
	jmp	.L3
.L5:
	mov	eax, DWORD PTR -8[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L4
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, vis[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jne	.L4
	mov	eax, DWORD PTR rear[rip]
	add	eax, 1
	mov	DWORD PTR rear[rip], eax
	mov	eax, DWORD PTR rear[rip]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rdx, queue[rip]
	mov	eax, DWORD PTR -8[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, vis[rip]
	mov	DWORD PTR [rdx+rax], 1
.L4:
	add	DWORD PTR -8[rbp], 1
.L3:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -8[rbp], eax
	jl	.L5
.L2:
	mov	edx, DWORD PTR front[rip]
	mov	eax, DWORD PTR rear[rip]
	cmp	edx, eax
	jl	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	bfs, .-bfs
	.globl	dfs
	.type	dfs, @function
dfs:
.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	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, vis[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jne	.L13
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, vis[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -4[rbp], 0
	jmp	.L10
.L12:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	je	.L11
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	dfs
.L11:
	add	DWORD PTR -4[rbp], 1
.L10:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -4[rbp], eax
	jl	.L12
	jmp	.L7
.L13:
	nop
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dfs, .-dfs
	.globl	u
	.bss
	.align 4
	.type	u, @object
	.size	u, 4
u:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.section	.rodata
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	rdx, m[rip]
	lea	rsi, n[rip]
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -16[rbp], 0
	jmp	.L15
.L16:
	lea	rdx, v[rip]
	lea	rsi, u[rip]
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	ecx, DWORD PTR v[rip]
	mov	esi, DWORD PTR u[rip]
	movsx	rdi, esi
	movsx	rdx, ecx
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rdi
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	edi, DWORD PTR u[rip]
	mov	r8d, DWORD PTR v[rip]
	movsx	rsi, esi
	movsx	rdx, ecx
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	ecx, DWORD PTR [rdx+rax]
	movsx	rsi, r8d
	movsx	rdx, edi
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rsi
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	DWORD PTR [rdx+rax], ecx
	add	DWORD PTR -16[rbp], 1
.L15:
	mov	eax, DWORD PTR m[rip]
	cmp	DWORD PTR -16[rbp], eax
	jl	.L16
	lea	rax, -20[rbp]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	edx, 420
	mov	esi, 0
	lea	rdi, vis[rip]
	call	memset@PLT
	mov	edi, 0
	call	dfs
	mov	edi, 10
	call	putchar@PLT
	mov	eax, 0
	call	bfs
	mov	edi, 10
	call	putchar@PLT
	mov	DWORD PTR -16[rbp], 0
	jmp	.L17
.L22:
	mov	DWORD PTR -12[rbp], 0
	jmp	.L18
.L21:
	mov	eax, DWORD PTR -20[rbp]
	cmp	DWORD PTR -16[rbp], eax
	je	.L19
	mov	eax, DWORD PTR -20[rbp]
	cmp	DWORD PTR -12[rbp], eax
	jne	.L20
.L19:
	mov	eax, DWORD PTR -12[rbp]
	movsx	rcx, eax
	mov	eax, DWORD PTR -16[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	add	rax, rdx
	add	rax, rcx
	lea	rdx, 0[0+rax*4]
	lea	rax, G[rip]
	mov	DWORD PTR [rdx+rax], 0
.L20:
	add	DWORD PTR -12[rbp], 1
.L18:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -12[rbp], eax
	jl	.L21
	add	DWORD PTR -16[rbp], 1
.L17:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -16[rbp], eax
	jl	.L22
	mov	edx, 420
	mov	esi, 0
	lea	rdi, vis[rip]
	call	memset@PLT
	mov	edi, 0
	call	dfs
	mov	edi, 10
	call	putchar@PLT
	mov	eax, 0
	call	bfs
	mov	edi, 10
	call	putchar@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	"97012350.c"
	.text
	.comm	n,4,4
	.comm	m,4,4
	.comm	G,44100,4
	.comm	queue,40020,4
	.global	front
	.bss
	.align	2
	.type	front, %object
	.size	front, 4
front:
	.space	4
	.global	rear
	.align	2
	.type	rear, %object
	.size	rear, 4
rear:
	.space	4
	.comm	vis,420,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d \000"
	.text
	.align	2
	.global	bfs
	.syntax unified
	.arm
	.fpu softvfp
	.type	bfs, %function
bfs:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r2, #420
	mov	r1, #0
	ldr	r0, .L7
	bl	memset
	ldr	r3, .L7+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L7+4
	str	r3, [r2]
	ldr	r3, .L7+4
	ldr	r3, [r3]
	ldr	r2, .L7+8
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r3, .L7
	mov	r2, #1
	str	r2, [r3]
	b	.L2
.L6:
	ldr	r3, .L7+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L7+12
	str	r3, [r2]
	ldr	r3, .L7+12
	ldr	r3, [r3]
	ldr	r2, .L7+8
	ldr	r3, [r2, r3, lsl #2]
	str	r3, [fp, #-8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L7+16
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L3
.L5:
	ldr	r1, .L7+20
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #3
	sub	r3, r3, r2
	lsl	r2, r3, #4
	sub	r2, r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	ldr	r3, [r1, r3, lsl #2]
	cmp	r3, #0
	beq	.L4
	ldr	r2, .L7
	ldr	r3, [fp, #-12]
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #0
	bne	.L4
	ldr	r3, .L7+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L7+4
	str	r3, [r2]
	ldr	r3, .L7+4
	ldr	r3, [r3]
	ldr	r1, .L7+8
	ldr	r2, [fp, #-12]
	str	r2, [r1, r3, lsl #2]
	ldr	r2, .L7
	ldr	r3, [fp, #-12]
	mov	r1, #1
	str	r1, [r2, r3, lsl #2]
.L4:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L3:
	ldr	r3, .L7+24
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	blt	.L5
.L2:
	ldr	r3, .L7+12
	ldr	r2, [r3]
	ldr	r3, .L7+4
	ldr	r3, [r3]
	cmp	r2, r3
	blt	.L6
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	vis
	.word	rear
	.word	queue
	.word	front
	.word	.LC0
	.word	G
	.word	n
	.size	bfs, .-bfs
	.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
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	ldr	r2, .L16
	ldr	r3, [fp, #-16]
	ldr	r3, [r2, r3, lsl #2]
	cmp	r3, #0
	bne	.L15
	ldr	r2, .L16
	ldr	r3, [fp, #-16]
	mov	r1, #1
	str	r1, [r2, r3, lsl #2]
	ldr	r1, [fp, #-16]
	ldr	r0, .L16+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L12
.L14:
	ldr	r1, .L16+8
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #3
	sub	r3, r3, r2
	lsl	r2, r3, #4
	sub	r2, r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	ldr	r3, [r1, r3, lsl #2]
	cmp	r3, #0
	beq	.L13
	ldr	r0, [fp, #-8]
	bl	dfs
.L13:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L12:
	ldr	r3, .L16+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	blt	.L14
	b	.L9
.L15:
	nop
.L9:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	vis
	.word	.LC0
	.word	G
	.word	n
	.size	dfs, .-dfs
	.comm	u,4,4
	.comm	v,4,4
	.section	.rodata
	.align	2
.LC1:
	.ascii	"%d%d\000"
	.align	2
.LC2:
	.ascii	"%d\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #20
	ldr	r3, .L29
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r2, .L29+4
	ldr	r1, .L29+8
	ldr	r0, .L29+12
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L19
.L20:
	ldr	r2, .L29+16
	ldr	r1, .L29+20
	ldr	r0, .L29+12
	bl	__isoc99_scanf
	ldr	r3, .L29+16
	ldr	r1, [r3]
	ldr	r3, .L29+20
	ldr	r0, [r3]
	ldr	ip, .L29+24
	mov	r3, r1
	lsl	r3, r3, #3
	sub	r3, r3, r1
	lsl	r2, r3, #4
	sub	r2, r2, r3
	add	r3, r2, r0
	mov	r2, #1
	str	r2, [ip, r3, lsl #2]
	ldr	r3, .L29+20
	ldr	ip, [r3]
	ldr	r3, .L29+16
	ldr	lr, [r3]
	ldr	r4, .L29+24
	mov	r3, r1
	lsl	r3, r3, #3
	sub	r3, r3, r1
	lsl	r2, r3, #4
	sub	r2, r2, r3
	add	r3, r2, r0
	ldr	r1, [r4, r3, lsl #2]
	ldr	r0, .L29+24
	mov	r3, ip
	lsl	r3, r3, #3
	sub	r3, r3, ip
	lsl	r2, r3, #4
	sub	r2, r2, r3
	add	r3, r2, lr
	str	r1, [r0, r3, lsl #2]
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L19:
	ldr	r3, .L29+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L20
	sub	r3, fp, #28
	mov	r1, r3
	ldr	r0, .L29+28
	bl	__isoc99_scanf
	mov	r2, #420
	mov	r1, #0
	ldr	r0, .L29+32
	bl	memset
	mov	r0, #0
	bl	dfs
	mov	r0, #10
	bl	putchar
	bl	bfs
	mov	r0, #10
	bl	putchar
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L21
.L26:
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L22
.L25:
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	beq	.L23
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	bne	.L24
.L23:
	ldr	r1, .L29+24
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #3
	sub	r3, r3, r2
	lsl	r2, r3, #4
	sub	r2, r2, r3
	ldr	r3, [fp, #-20]
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r1, r3, lsl #2]
.L24:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L22:
	ldr	r3, .L29+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	blt	.L25
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L21:
	ldr	r3, .L29+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L26
	mov	r2, #420
	mov	r1, #0
	ldr	r0, .L29+32
	bl	memset
	mov	r0, #0
	bl	dfs
	mov	r0, #10
	bl	putchar
	bl	bfs
	mov	r0, #10
	bl	putchar
	mov	r3, #0
	ldr	r2, .L29
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L28
	bl	__stack_chk_fail
.L28:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L30:
	.align	2
.L29:
	.word	.LC3
	.word	m
	.word	n
	.word	.LC1
	.word	v
	.word	u
	.word	G
	.word	.LC2
	.word	vis
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
