	.file	"293134.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"wb"
.LC1:
	.string	"P5\n%d %d\n255\n"
	.text
	.globl	writePGM
	.type	writePGM, @function
writePGM:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	QWORD PTR -32[rbp], rsi
	mov	rax, QWORD PTR -24[rbp]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	je	.L3
	mov	rax, QWORD PTR -8[rbp]
	mov	ecx, 512
	mov	edx, 512
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rdx, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR -32[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	esi, 262144
	mov	rdi, rax
	call	fwrite@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	fclose@PLT
.L3:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	writePGM, .-writePGM
	.section	.rodata
.LC2:
	.string	"rb+"
	.align 8
.LC3:
	.string	"Unable to open %s. Make sure the path is correct\n"
.LC4:
	.string	"P5\n"
	.align 8
.LC5:
	.string	"%s is not a valid input PGM file.\n"
.LC6:
	.string	"%d %d\n"
	.align 8
.LC7:
	.string	"PGM image does not match expected size."
	.text
	.globl	readPGM
	.type	readPGM, @function
readPGM:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 1072
	mov	QWORD PTR -1064[rbp], rdi
	mov	QWORD PTR -1072[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -1064[rbp]
	lea	rsi, .LC2[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -1048[rbp], rax
	cmp	QWORD PTR -1048[rbp], 0
	jne	.L5
	mov	rax, QWORD PTR -1064[rbp]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	mov	rdx, QWORD PTR -1048[rbp]
	lea	rax, -1040[rbp]
	mov	esi, 1024
	mov	rdi, rax
	call	fgets@PLT
	lea	rax, -1040[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	je	.L6
	mov	rax, QWORD PTR -1064[rbp]
	mov	rsi, rax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -1048[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	rdx, QWORD PTR -1048[rbp]
	lea	rax, -1040[rbp]
	mov	esi, 1024
	mov	rdi, rax
	call	fgets@PLT
	movzx	eax, BYTE PTR -1040[rbp]
	cmp	al, 35
	je	.L6
	lea	rcx, -1052[rbp]
	lea	rdx, -1056[rbp]
	lea	rax, -1040[rbp]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	mov	eax, DWORD PTR -1056[rbp]
	cmp	eax, 512
	jne	.L7
	mov	eax, DWORD PTR -1052[rbp]
	cmp	eax, 512
	je	.L8
.L7:
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -1048[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	mov	rdx, QWORD PTR -1048[rbp]
	lea	rax, -1040[rbp]
	mov	esi, 1024
	mov	rdi, rax
	call	fgets@PLT
	mov	edx, DWORD PTR -1056[rbp]
	mov	eax, DWORD PTR -1052[rbp]
	imul	eax, edx
	movsx	rsi, eax
	mov	rdx, QWORD PTR -1048[rbp]
	mov	rax, QWORD PTR -1072[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rdi, rax
	call	fread@PLT
	mov	rax, QWORD PTR -1048[rbp]
	mov	rdi, rax
	call	fclose@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	readPGM, .-readPGM
	.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	"293134.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"wb\000"
	.align	2
.LC1:
	.ascii	"P5\012%d %d\012255\012\000"
	.text
	.align	2
	.global	writePGM
	.syntax unified
	.arm
	.fpu softvfp
	.type	writePGM, %function
writePGM:
	@ 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]
	str	r1, [fp, #-20]
	ldr	r1, .L4
	ldr	r0, [fp, #-16]
	bl	fopen
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L3
	mov	r3, #512
	mov	r2, #512
	ldr	r1, .L4+4
	ldr	r0, [fp, #-8]
	bl	fprintf
	ldr	r3, [fp, #-8]
	mov	r2, #1
	mov	r1, #262144
	ldr	r0, [fp, #-20]
	bl	fwrite
	ldr	r0, [fp, #-8]
	bl	fclose
.L3:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	.LC0
	.word	.LC1
	.size	writePGM, .-writePGM
	.section	.rodata
	.align	2
.LC2:
	.ascii	"rb+\000"
	.align	2
.LC3:
	.ascii	"Unable to open %s. Make sure the path is correct\012"
	.ascii	"\000"
	.align	2
.LC4:
	.ascii	"P5\012\000"
	.align	2
.LC5:
	.ascii	"%s is not a valid input PGM file.\012\000"
	.align	2
.LC6:
	.ascii	"%d %d\012\000"
	.align	2
.LC7:
	.ascii	"PGM image does not match expected size.\000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	readPGM
	.syntax unified
	.arm
	.fpu softvfp
	.type	readPGM, %function
readPGM:
	@ args = 0, pretend = 0, frame = 1048
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #1040
	sub	sp, sp, #8
	str	r0, [fp, #-1048]
	str	r1, [fp, #-1052]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r1, .L13+4
	ldr	r0, [fp, #-1048]
	bl	fopen
	str	r0, [fp, #-1036]
	ldr	r3, [fp, #-1036]
	cmp	r3, #0
	bne	.L7
	ldr	r1, [fp, #-1048]
	ldr	r0, .L13+8
	bl	printf
	mov	r0, #1
	bl	exit
.L7:
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	ldr	r2, [fp, #-1036]
	mov	r1, #1024
	mov	r0, r3
	bl	fgets
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	ldr	r1, .L13+12
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L8
	ldr	r1, [fp, #-1048]
	ldr	r0, .L13+16
	bl	printf
	ldr	r0, [fp, #-1036]
	bl	fclose
	mov	r0, #1
	bl	exit
.L8:
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	ldr	r2, [fp, #-1036]
	mov	r1, #1024
	mov	r0, r3
	bl	fgets
	ldrb	r3, [fp, #-1032]	@ zero_extendqisi2
	cmp	r3, #35
	beq	.L8
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #12
	sub	r2, fp, #1040
	sub	r2, r2, #4
	sub	r0, fp, #1024
	sub	r0, r0, #4
	sub	r0, r0, #4
	ldr	r1, .L13+20
	bl	__isoc99_sscanf
	ldr	r3, [fp, #-1044]
	cmp	r3, #512
	bne	.L9
	ldr	r3, [fp, #-1040]
	cmp	r3, #512
	beq	.L10
.L9:
	ldr	r0, .L13+24
	bl	puts
	ldr	r0, [fp, #-1036]
	bl	fclose
	mov	r0, #1
	bl	exit
.L10:
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	ldr	r2, [fp, #-1036]
	mov	r1, #1024
	mov	r0, r3
	bl	fgets
	ldr	r3, [fp, #-1044]
	ldr	r2, [fp, #-1040]
	mul	r3, r2, r3
	mov	r1, r3
	ldr	r3, [fp, #-1036]
	mov	r2, #1
	ldr	r0, [fp, #-1052]
	bl	fread
	ldr	r0, [fp, #-1036]
	bl	fclose
	nop
	ldr	r3, .L13
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC8
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	readPGM, .-readPGM
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
