	.file	"372524.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"#%d @ %d,%d: %dx%d\n"
.LC1:
	.string	"-> part1: %ld\n"
.LC2:
	.string	"--> part2: %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 160
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 4000000
	call	malloc@PLT
	mov	QWORD PTR -8288[rbp], rax
	mov	rax, QWORD PTR -8288[rbp]
	mov	edx, 4000000
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	lea	rax, -8272[rbp]
	mov	edx, 8000
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	jmp	.L2
.L9:
	lea	r8, -8332[rbp]
	lea	rdi, -8336[rbp]
	lea	rcx, -8340[rbp]
	lea	rdx, -8344[rbp]
	lea	rax, -272[rbp]
	sub	rsp, 8
	lea	rsi, -8328[rbp]
	push	rsi
	mov	r9, r8
	mov	r8, rdi
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	add	rsp, 16
	mov	eax, DWORD PTR -8344[rbp]
	cdqe
	mov	DWORD PTR -8272[rbp+rax*4], 1
	mov	eax, DWORD PTR -8336[rbp]
	mov	DWORD PTR -8324[rbp], eax
	jmp	.L3
.L8:
	mov	eax, DWORD PTR -8340[rbp]
	mov	DWORD PTR -8320[rbp], eax
	jmp	.L4
.L7:
	mov	eax, DWORD PTR -8320[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -8324[rbp]
	cdqe
	imul	rax, rax, 1000
	add	rax, rdx
	mov	QWORD PTR -8280[rbp], rax
	mov	rax, QWORD PTR -8280[rbp]
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	jle	.L5
	mov	rax, QWORD PTR -8280[rbp]
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	cdqe
	mov	DWORD PTR -8272[rbp+rax*4], 2
	mov	eax, DWORD PTR -8344[rbp]
	cdqe
	mov	DWORD PTR -8272[rbp+rax*4], 2
	mov	rax, QWORD PTR -8280[rbp]
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rax, rdx
	mov	DWORD PTR [rax], -1
	jmp	.L6
.L5:
	mov	rax, QWORD PTR -8280[rbp]
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	jne	.L6
	mov	rax, QWORD PTR -8280[rbp]
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -8344[rbp]
	mov	DWORD PTR [rdx], eax
.L6:
	add	DWORD PTR -8320[rbp], 1
.L4:
	mov	edx, DWORD PTR -8340[rbp]
	mov	eax, DWORD PTR -8332[rbp]
	add	eax, edx
	cmp	DWORD PTR -8320[rbp], eax
	jl	.L7
	add	DWORD PTR -8324[rbp], 1
.L3:
	mov	edx, DWORD PTR -8336[rbp]
	mov	eax, DWORD PTR -8328[rbp]
	add	eax, edx
	cmp	DWORD PTR -8324[rbp], eax
	jl	.L8
.L2:
	mov	rdx, QWORD PTR stdin[rip]
	lea	rax, -272[rbp]
	mov	esi, 256
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L9
	mov	QWORD PTR -8304[rbp], 0
	mov	QWORD PTR -8296[rbp], 0
	mov	DWORD PTR -8316[rbp], 0
	jmp	.L10
.L14:
	mov	DWORD PTR -8312[rbp], 0
	jmp	.L11
.L13:
	mov	rax, QWORD PTR -8296[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -8296[rbp], rdx
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -8288[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	cmp	eax, -1
	jne	.L12
	add	QWORD PTR -8304[rbp], 1
.L12:
	add	DWORD PTR -8312[rbp], 1
.L11:
	cmp	DWORD PTR -8312[rbp], 999
	jle	.L13
	add	DWORD PTR -8316[rbp], 1
.L10:
	cmp	DWORD PTR -8316[rbp], 999
	jle	.L14
	mov	rax, QWORD PTR -8304[rbp]
	mov	rsi, rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -8308[rbp], 0
	jmp	.L15
.L17:
	mov	eax, DWORD PTR -8308[rbp]
	cdqe
	mov	eax, DWORD PTR -8272[rbp+rax*4]
	cmp	eax, 1
	jne	.L16
	mov	eax, DWORD PTR -8308[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
.L16:
	add	DWORD PTR -8308[rbp], 1
.L15:
	cmp	DWORD PTR -8308[rbp], 1999
	jle	.L17
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"372524.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"#%d @ %d,%d: %dx%d\012\000"
	.align	2
.LC1:
	.ascii	"-> part1: %ld\012\000"
	.align	2
.LC2:
	.ascii	"--> part2: %d\012\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 = 8320
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #8320
	sub	sp, sp, #20
	ldr	r3, .L20
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r4, r3
	ldr	r0, .L20+4
	bl	malloc
	mov	r3, r0
	str	r3, [r4, #-76]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, .L20+4
	mov	r1, #0
	ldr	r0, [r3, #-76]
	bl	memset
	sub	r3, fp, #8256
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r2, #8000
	mov	r1, #0
	mov	r0, r3
	bl	memset
	b	.L2
.L9:
	sub	r1, fp, #8256
	sub	r1, r1, #12
	sub	r1, r1, #56
	sub	r2, fp, #8256
	sub	r2, r2, #12
	sub	r2, r2, #60
	sub	r0, fp, #272
	sub	r3, fp, #8256
	sub	r3, r3, #12
	sub	r3, r3, #44
	str	r3, [sp, #8]
	sub	r3, fp, #8256
	sub	r3, r3, #12
	sub	r3, r3, #48
	str	r3, [sp, #4]
	sub	r3, fp, #8256
	sub	r3, r3, #12
	sub	r3, r3, #52
	str	r3, [sp]
	mov	r3, r1
	ldr	r1, .L20+8
	bl	__isoc99_sscanf
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-124]
	sub	r2, fp, #8192
	sub	r2, r2, #12
	lsl	r3, r3, #2
	add	r3, r2, r3
	mov	r2, #1
	str	r2, [r3, #-68]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-116]
	str	r3, [r2, #-104]
	b	.L3
.L8:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-120]
	str	r3, [r2, #-100]
	b	.L4
.L7:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r3, #-104]
	mov	r3, r2
	lsl	r3, r3, #5
	sub	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #3
	mov	r1, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-100]
	add	r3, r3, r1
	str	r3, [r2, #-72]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-72]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L5
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-72]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	ldr	r3, [r3]
	sub	r2, fp, #8192
	sub	r2, r2, #12
	lsl	r3, r3, #2
	add	r3, r2, r3
	mov	r2, #2
	str	r2, [r3, #-68]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-124]
	sub	r2, fp, #8192
	sub	r2, r2, #12
	lsl	r3, r3, #2
	add	r3, r2, r3
	mov	r2, #2
	str	r2, [r3, #-68]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-72]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	mvn	r2, #0
	str	r2, [r3]
	b	.L6
.L5:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-72]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L6
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-72]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-124]
	str	r2, [r3]
.L6:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-100]
	add	r3, r3, #1
	str	r3, [r2, #-100]
.L4:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r3, #-120]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-112]
	add	r3, r2, r3
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-100]
	cmp	r2, r3
	blt	.L7
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-104]
	add	r3, r3, #1
	str	r3, [r2, #-104]
.L3:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r3, #-116]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-108]
	add	r3, r2, r3
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-104]
	cmp	r2, r3
	blt	.L8
.L2:
	ldr	r3, .L20+12
	ldr	r2, [r3]
	sub	r3, fp, #272
	mov	r1, #256
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L9
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-96]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-92]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-88]
	b	.L10
.L14:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-84]
	b	.L11
.L13:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-92]
	sub	r2, fp, #8192
	sub	r2, r2, #12
	mov	r1, r2
	add	r2, r3, #1
	str	r2, [r1, #-92]
	lsl	r3, r3, #2
	sub	r2, fp, #8192
	sub	r2, r2, #12
	ldr	r2, [r2, #-76]
	add	r3, r2, r3
	ldr	r3, [r3]
	cmn	r3, #1
	bne	.L12
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-96]
	add	r3, r3, #1
	str	r3, [r2, #-96]
.L12:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-84]
	add	r3, r3, #1
	str	r3, [r2, #-84]
.L11:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-84]
	cmp	r3, #1000
	blt	.L13
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-88]
	add	r3, r3, #1
	str	r3, [r2, #-88]
.L10:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-88]
	cmp	r3, #1000
	blt	.L14
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r1, [r3, #-96]
	ldr	r0, .L20+16
	bl	printf
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-80]
	b	.L15
.L17:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-80]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r3, [r3, #-68]
	cmp	r3, #1
	bne	.L16
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r1, [r3, #-80]
	ldr	r0, .L20+20
	bl	printf
.L16:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-80]
	add	r3, r3, #1
	str	r3, [r2, #-80]
.L15:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-80]
	cmp	r3, #2000
	blt	.L17
	mov	r3, #0
	ldr	r2, .L20
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC3
	.word	4000000
	.word	.LC0
	.word	stdin
	.word	.LC1
	.word	.LC2
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
