	.file	"5859.c"
	.intel_syntax noprefix
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	R
	.align 4
	.type	R, @object
	.size	R, 4
R:
	.zero	4
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 8000
C:
	.zero	8000
	.globl	material
	.align 32
	.type	material, @object
	.size	material, 24000
material:
	.zero	24000
	.section	.rodata
.LC0:
	.string	"r"
.LC1:
	.string	"sample_input.txt"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	"#%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 32
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR stdin[rip]
	mov	rdx, rax
	lea	rsi, .LC0[rip]
	lea	rdi, .LC1[rip]
	call	freopen@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	esi, 0
	mov	rdi, rax
	call	setbuf@PLT
	lea	rax, -32[rbp]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -28[rbp], 1
	jmp	.L2
.L14:
	lea	rdx, R[rip]
	lea	rsi, N[rip]
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	DWORD PTR -24[rbp], 0
	jmp	.L3
.L4:
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	add	rax, rdx
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rcx, rax
	lea	rdx, material[rip]
	mov	eax, DWORD PTR -24[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+4]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -24[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 2
	mov	rcx, rax
	lea	rax, material[rip+8]
	mov	DWORD PTR [rcx+rax], edx
	add	DWORD PTR -24[rbp], 1
.L3:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -24[rbp], eax
	jl	.L4
	mov	DWORD PTR -24[rbp], 0
	jmp	.L5
.L10:
	mov	eax, DWORD PTR -24[rbp]
	add	eax, 1
	mov	DWORD PTR -20[rbp], eax
	mov	DWORD PTR -16[rbp], 1
	jmp	.L6
.L9:
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR R[rip]
	imul	eax, DWORD PTR -16[rbp]
	lea	ecx, [rdx+rax]
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	ecx, eax
	jl	.L7
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR R[rip]
	imul	eax, DWORD PTR -16[rbp]
	lea	ecx, [rdx+rax]
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	ecx, eax
	jne	.L8
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	DWORD PTR -16[rbp], eax
	jle	.L8
.L7:
	mov	eax, DWORD PTR -24[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR R[rip]
	imul	eax, DWORD PTR -16[rbp]
	lea	ecx, [rdx+rax]
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+8]
	mov	DWORD PTR [rdx+rax], ecx
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rcx, rax
	lea	rdx, material[rip]
	mov	eax, DWORD PTR -24[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rcx, rax
	lea	rdx, material[rip+4]
	mov	eax, DWORD PTR -16[rbp]
	mov	DWORD PTR [rcx+rdx], eax
.L8:
	mov	eax, DWORD PTR -20[rbp]
	add	eax, 1
	mov	ecx, DWORD PTR N[rip]
	cdq
	idiv	ecx
	mov	DWORD PTR -20[rbp], edx
	add	DWORD PTR -16[rbp], 1
.L6:
	mov	eax, DWORD PTR -20[rbp]
	cmp	eax, DWORD PTR -24[rbp]
	jne	.L9
	add	DWORD PTR -24[rbp], 1
.L5:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -24[rbp], eax
	jl	.L10
	mov	DWORD PTR -24[rbp], 0
	mov	DWORD PTR -12[rbp], 0
	mov	DWORD PTR -20[rbp], 0
	jmp	.L11
.L13:
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, C[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	cmp	DWORD PTR -20[rbp], eax
	jge	.L12
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	mov	rdx, rax
	lea	rax, material[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -20[rbp], eax
.L12:
	add	DWORD PTR -24[rbp], 1
.L11:
	mov	eax, DWORD PTR N[rip]
	cmp	DWORD PTR -24[rbp], eax
	jl	.L13
	mov	eax, DWORD PTR R[rip]
	imul	eax, DWORD PTR -20[rbp]
	add	DWORD PTR -12[rbp], eax
	mov	edx, DWORD PTR -12[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -28[rbp], 1
.L2:
	mov	eax, DWORD PTR -32[rbp]
	cmp	DWORD PTR -28[rbp], eax
	jle	.L14
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	"5859.c"
	.text
	.comm	N,4,4
	.comm	R,4,4
	.comm	C,8000,4
	.comm	material,24000,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"r\000"
	.align	2
.LC1:
	.ascii	"sample_input.txt\000"
	.align	2
.LC2:
	.ascii	"%d\000"
	.align	2
.LC3:
	.ascii	"%d %d\012\000"
	.global	__aeabi_idivmod
	.align	2
.LC4:
	.ascii	"#%d %d\012\000"
	.align	2
.LC5:
	.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, .L17
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L17+4
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L17+8
	ldr	r0, .L17+12
	bl	freopen
	ldr	r3, .L17+16
	ldr	r3, [r3]
	mov	r1, #0
	mov	r0, r3
	bl	setbuf
	sub	r3, fp, #32
	mov	r1, r3
	ldr	r0, .L17+20
	bl	__isoc99_scanf
	mov	r3, #1
	str	r3, [fp, #-28]
	b	.L2
.L14:
	ldr	r2, .L17+24
	ldr	r1, .L17+28
	ldr	r0, .L17+32
	bl	__isoc99_scanf
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L3
.L4:
	ldr	r3, [fp, #-24]
	lsl	r3, r3, #2
	ldr	r2, .L17+36
	add	r3, r3, r2
	mov	r1, r3
	ldr	r0, .L17+20
	bl	__isoc99_scanf
	ldr	r1, .L17+40
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r2, [fp, #-24]
	str	r2, [r3]
	ldr	r1, .L17+40
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	add	r3, r3, #4
	mov	r2, #0
	str	r2, [r3]
	ldr	r2, .L17+36
	ldr	r3, [fp, #-24]
	ldr	r1, [r2, r3, lsl #2]
	ldr	r0, .L17+40
	ldr	r2, [fp, #-24]
	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	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L3:
	ldr	r3, .L17+28
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L4
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L5
.L10:
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-20]
	mov	r3, #1
	str	r3, [fp, #-16]
	b	.L6
.L9:
	ldr	r2, .L17+36
	ldr	r3, [fp, #-24]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L17+24
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	mul	r3, r1, r3
	add	r1, r2, r3
	ldr	r0, .L17+40
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #8
	ldr	r3, [r3]
	cmp	r1, r3
	blt	.L7
	ldr	r2, .L17+36
	ldr	r3, [fp, #-24]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L17+24
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	mul	r3, r1, r3
	add	r1, r2, r3
	ldr	r0, .L17+40
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r0, r3
	add	r3, r3, #8
	ldr	r3, [r3]
	cmp	r1, r3
	bne	.L8
	ldr	r1, .L17+40
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	ble	.L8
.L7:
	ldr	r2, .L17+36
	ldr	r3, [fp, #-24]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L17+24
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	mul	r3, r1, r3
	add	r1, r2, r3
	ldr	r0, .L17+40
	ldr	r2, [fp, #-20]
	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, .L17+40
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r2, [fp, #-24]
	str	r2, [r3]
	ldr	r1, .L17+40
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r2, [fp, #-16]
	str	r2, [r3]
.L8:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	ldr	r2, .L17+28
	ldr	r2, [r2]
	mov	r1, r2
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L6:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	bne	.L9
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L5:
	ldr	r3, .L17+28
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L10
	mov	r3, #0
	str	r3, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L11
.L13:
	ldr	r1, .L17+40
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r3, [r3]
	ldr	r2, .L17+36
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r1, .L17+40
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	bge	.L12
	ldr	r1, .L17+40
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r3, [r3]
	str	r3, [fp, #-20]
.L12:
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L11:
	ldr	r3, .L17+28
	ldr	r3, [r3]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L13
	ldr	r3, .L17+24
	ldr	r3, [r3]
	ldr	r2, [fp, #-20]
	mul	r3, r2, r3
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-28]
	ldr	r0, .L17+44
	bl	printf
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L2:
	ldr	r3, [fp, #-32]
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	ble	.L14
	mov	r3, #0
	ldr	r2, .L17
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L16
	bl	__stack_chk_fail
.L16:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	.LC5
	.word	stdin
	.word	.LC0
	.word	.LC1
	.word	stdout
	.word	.LC2
	.word	R
	.word	N
	.word	.LC3
	.word	C
	.word	material
	.word	.LC4
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
