	.file	"63021.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"Program not run correctly. Should be recover name_of_file."
.LC1:
	.string	"r"
	.align 8
.LC2:
	.string	"File could not be opened. Please enter valid filename."
.LC3:
	.string	"%03i.jpg"
.LC4:
	.string	"w"
	.align 8
.LC5:
	.string	"Attempting to open/create new file %s failed\n"
.LC6:
	.string	"a"
	.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, 64
	mov	DWORD PTR -52[rbp], edi
	mov	QWORD PTR -64[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -52[rbp], 2
	je	.L2
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L11
.L2:
	mov	rax, QWORD PTR -64[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -32[rbp], rax
	cmp	QWORD PTR -32[rbp], 0
	jne	.L4
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L11
.L4:
	mov	esi, 1
	mov	edi, 512
	call	calloc@PLT
	mov	QWORD PTR -24[rbp], rax
	mov	DWORD PTR -44[rbp], -1
	mov	QWORD PTR -40[rbp], 0
	jmp	.L5
.L10:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	jpg_header
	xor	eax, 1
	test	al, al
	je	.L6
	cmp	DWORD PTR -44[rbp], 0
	js	.L6
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rcx, rdx
	mov	edx, 512
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
	jmp	.L5
.L6:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	jpg_header
	test	al, al
	je	.L7
	cmp	DWORD PTR -44[rbp], 0
	js	.L7
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	fclose@PLT
	add	DWORD PTR -44[rbp], 1
	mov	edx, DWORD PTR -44[rbp]
	lea	rax, -15[rbp]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	sprintf@PLT
	lea	rax, -15[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L8
	lea	rax, -15[rbp]
	mov	rsi, rax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L11
.L8:
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rcx, rdx
	mov	edx, 512
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
	jmp	.L5
.L7:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	jpg_header
	test	al, al
	je	.L5
	cmp	DWORD PTR -44[rbp], -1
	jne	.L5
	add	DWORD PTR -44[rbp], 1
	mov	edx, DWORD PTR -44[rbp]
	lea	rax, -15[rbp]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	sprintf@PLT
	lea	rax, -15[rbp]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L9
	lea	rax, -15[rbp]
	mov	rsi, rax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L11
.L9:
	mov	rdx, QWORD PTR -40[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rcx, rdx
	mov	edx, 512
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
.L5:
	mov	rdx, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rcx, rdx
	mov	edx, 512
	mov	esi, 1
	mov	rdi, rax
	call	fread@PLT
	cmp	rax, 512
	je	.L10
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	eax, 0
.L11:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	jpg_header
	.type	jpg_header, @function
jpg_header:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	movzx	eax, BYTE PTR [rax]
	cmp	al, -1
	jne	.L14
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 1
	movzx	eax, BYTE PTR [rax]
	cmp	al, -40
	jne	.L14
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 2
	movzx	eax, BYTE PTR [rax]
	cmp	al, -1
	jne	.L14
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 3
	movzx	eax, BYTE PTR [rax]
	cmp	al, -33
	jbe	.L14
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 4
	movzx	eax, BYTE PTR [rax]
	cmp	al, -17
	ja	.L14
	mov	eax, 1
	jmp	.L15
.L14:
	mov	eax, 0
.L15:
	and	eax, 1
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	jpg_header, .-jpg_header
	.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	"63021.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Program not run correctly. Should be recover name_o"
	.ascii	"f_file.\000"
	.align	2
.LC1:
	.ascii	"r\000"
	.align	2
.LC2:
	.ascii	"File could not be opened. Please enter valid filena"
	.ascii	"me.\000"
	.align	2
.LC3:
	.ascii	"%03i.jpg\000"
	.align	2
.LC4:
	.ascii	"w\000"
	.align	2
.LC5:
	.ascii	"Attempting to open/create new file %s failed\012\000"
	.align	2
.LC6:
	.ascii	"a\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	str	r0, [fp, #-40]
	str	r1, [fp, #-44]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-40]
	cmp	r3, #2
	beq	.L2
	ldr	r0, .L13+4
	bl	puts
	mov	r3, #1
	b	.L11
.L2:
	ldr	r3, [fp, #-44]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L13+8
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bne	.L4
	ldr	r0, .L13+12
	bl	puts
	mov	r3, #1
	b	.L11
.L4:
	mov	r1, #1
	mov	r0, #512
	bl	calloc
	mov	r3, r0
	str	r3, [fp, #-20]
	mvn	r3, #0
	str	r3, [fp, #-32]
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L5
.L10:
	ldr	r0, [fp, #-20]
	bl	jpg_header
	mov	r3, r0
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L6
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	blt	.L6
	ldr	r3, [fp, #-28]
	mov	r2, #512
	mov	r1, #1
	ldr	r0, [fp, #-20]
	bl	fwrite
	b	.L5
.L6:
	ldr	r0, [fp, #-20]
	bl	jpg_header
	mov	r3, r0
	cmp	r3, #0
	beq	.L7
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	blt	.L7
	ldr	r0, [fp, #-28]
	bl	fclose
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
	sub	r3, fp, #16
	ldr	r2, [fp, #-32]
	ldr	r1, .L13+16
	mov	r0, r3
	bl	sprintf
	sub	r3, fp, #16
	ldr	r1, .L13+20
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L8
	sub	r3, fp, #16
	mov	r1, r3
	ldr	r0, .L13+24
	bl	printf
	mov	r3, #1
	b	.L11
.L8:
	ldr	r3, [fp, #-28]
	mov	r2, #512
	mov	r1, #1
	ldr	r0, [fp, #-20]
	bl	fwrite
	b	.L5
.L7:
	ldr	r0, [fp, #-20]
	bl	jpg_header
	mov	r3, r0
	cmp	r3, #0
	beq	.L5
	ldr	r3, [fp, #-32]
	cmn	r3, #1
	bne	.L5
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
	sub	r3, fp, #16
	ldr	r2, [fp, #-32]
	ldr	r1, .L13+16
	mov	r0, r3
	bl	sprintf
	sub	r3, fp, #16
	ldr	r1, .L13+28
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L9
	sub	r3, fp, #16
	mov	r1, r3
	ldr	r0, .L13+24
	bl	printf
	mov	r3, #1
	b	.L11
.L9:
	ldr	r3, [fp, #-28]
	mov	r2, #512
	mov	r1, #1
	ldr	r0, [fp, #-20]
	bl	fwrite
.L5:
	ldr	r3, [fp, #-24]
	mov	r2, #512
	mov	r1, #1
	ldr	r0, [fp, #-20]
	bl	fread
	mov	r3, r0
	cmp	r3, #512
	beq	.L10
	ldr	r0, [fp, #-28]
	bl	fclose
	ldr	r0, [fp, #-24]
	bl	fclose
	ldr	r0, [fp, #-20]
	bl	free
	mov	r3, #0
.L11:
	ldr	r2, .L13
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC7
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	main, .-main
	.align	2
	.global	jpg_header
	.syntax unified
	.arm
	.fpu softvfp
	.type	jpg_header, %function
jpg_header:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #255
	bne	.L16
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #216
	bne	.L16
	ldr	r3, [fp, #-8]
	add	r3, r3, #2
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #255
	bne	.L16
	ldr	r3, [fp, #-8]
	add	r3, r3, #3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #223
	bls	.L16
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #239
	bhi	.L16
	mov	r3, #1
	b	.L17
.L16:
	mov	r3, #0
.L17:
	and	r3, r3, #1
	and	r3, r3, #255
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	jpg_header, .-jpg_header
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
