	.file	"242666.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"Usage: %s input.txt copy.txt\n"
.LC1:
	.string	"Pipe failed.\n"
.LC2:
	.string	"Fork failed.\n"
.LC3:
	.string	"r"
	.align 8
.LC4:
	.string	"fopen failed for file name %s.\n"
	.align 8
.LC5:
	.string	"An error occurred for file name %s.\n"
.LC6:
	.string	"Parent"
	.align 8
.LC7:
	.string	"Parent. Error writing to pipe.\n"
.LC8:
	.string	"Parent wrote %d bytes.\n"
	.align 8
.LC9:
	.string	"fclose failed for file name %s.\n"
.LC10:
	.string	"w"
	.align 8
.LC11:
	.string	"Child. An error occurred reading from the pipe.\n"
.LC12:
	.string	"Child"
.LC13:
	.string	"Child read %d bytes.\n"
	.align 8
.LC14:
	.string	"Error writing to file name %s.\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, 352
	mov	DWORD PTR -340[rbp], edi
	mov	QWORD PTR -352[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -340[rbp], 3
	je	.L2
	mov	rax, QWORD PTR -352[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, 1
	jmp	.L18
.L2:
	mov	rax, QWORD PTR -352[rbp]
	mov	rax, QWORD PTR 8[rax]
	mov	QWORD PTR -312[rbp], rax
	mov	rax, QWORD PTR -352[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	QWORD PTR -304[rbp], rax
	lea	rax, -280[rbp]
	mov	rdi, rax
	call	pipe@PLT
	cmp	eax, -1
	jne	.L4
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 13
	mov	esi, 1
	lea	rdi, .LC1[rip]
	call	fwrite@PLT
	mov	eax, 2
	jmp	.L18
.L4:
	call	fork@PLT
	mov	DWORD PTR -324[rbp], eax
	cmp	DWORD PTR -324[rbp], 0
	jns	.L5
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 13
	mov	esi, 1
	lea	rdi, .LC2[rip]
	call	fwrite@PLT
	mov	eax, 3
	jmp	.L18
.L5:
	cmp	DWORD PTR -324[rbp], 0
	jle	.L6
	mov	rax, QWORD PTR -312[rbp]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -288[rbp], rax
	cmp	QWORD PTR -288[rbp], 0
	jne	.L7
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -312[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, -1
	jmp	.L18
.L7:
	mov	eax, DWORD PTR -280[rbp]
	mov	edi, eax
	call	close@PLT
	jmp	.L8
.L11:
	mov	rdx, QWORD PTR -288[rbp]
	lea	rax, -272[rbp]
	mov	rcx, rdx
	mov	edx, 256
	mov	esi, 1
	mov	rdi, rax
	call	fread@PLT
	mov	DWORD PTR -320[rbp], eax
	cmp	DWORD PTR -320[rbp], 255
	jg	.L9
	mov	rax, QWORD PTR -288[rbp]
	mov	rdi, rax
	call	ferror@PLT
	test	eax, eax
	je	.L9
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -312[rbp]
	lea	rsi, .LC5[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L18
.L9:
	mov	eax, DWORD PTR -320[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -276[rbp]
	lea	rcx, -272[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -316[rbp], eax
	cmp	DWORD PTR -316[rbp], -1
	jne	.L10
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 31
	mov	esi, 1
	lea	rdi, .LC7[rip]
	call	fwrite@PLT
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L18
.L10:
	mov	eax, DWORD PTR -316[rbp]
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
.L8:
	mov	rax, QWORD PTR -288[rbp]
	mov	rdi, rax
	call	feof@PLT
	test	eax, eax
	je	.L11
	mov	rax, QWORD PTR -288[rbp]
	mov	rdi, rax
	call	fclose@PLT
	test	eax, eax
	je	.L12
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -312[rbp]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
.L12:
	mov	eax, DWORD PTR -276[rbp]
	mov	edi, eax
	call	close@PLT
	jmp	.L13
.L6:
	mov	rax, QWORD PTR -304[rbp]
	lea	rsi, .LC10[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -296[rbp], rax
	cmp	QWORD PTR -296[rbp], 0
	jne	.L14
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -304[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, -1
	jmp	.L18
.L14:
	mov	eax, DWORD PTR -276[rbp]
	mov	edi, eax
	call	close@PLT
	jmp	.L15
.L17:
	cmp	DWORD PTR -320[rbp], -1
	jne	.L16
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 48
	mov	esi, 1
	lea	rdi, .LC11[rip]
	call	fwrite@PLT
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L18
.L16:
	mov	eax, DWORD PTR -320[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -320[rbp]
	movsx	rdx, eax
	mov	rcx, QWORD PTR -296[rbp]
	lea	rax, -272[rbp]
	mov	esi, 1
	mov	rdi, rax
	call	fwrite@PLT
	mov	DWORD PTR -316[rbp], eax
	mov	eax, DWORD PTR -316[rbp]
	cmp	eax, DWORD PTR -320[rbp]
	jge	.L15
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -304[rbp]
	lea	rsi, .LC14[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L18
.L15:
	mov	eax, DWORD PTR -280[rbp]
	lea	rcx, -272[rbp]
	mov	edx, 256
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	DWORD PTR -320[rbp], eax
	cmp	DWORD PTR -320[rbp], 0
	jne	.L17
	mov	eax, DWORD PTR -280[rbp]
	mov	edi, eax
	call	close@PLT
	mov	rax, QWORD PTR -296[rbp]
	mov	rdi, rax
	call	fclose@PLT
	test	eax, eax
	je	.L13
	mov	rax, QWORD PTR stderr[rip]
	mov	rdx, QWORD PTR -304[rbp]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
.L13:
	mov	eax, 0
.L18:
	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
.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	"242666.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage: %s input.txt copy.txt\012\000"
	.align	2
.LC1:
	.ascii	"Pipe failed.\012\000"
	.align	2
.LC2:
	.ascii	"Fork failed.\012\000"
	.align	2
.LC3:
	.ascii	"r\000"
	.align	2
.LC4:
	.ascii	"fopen failed for file name %s.\012\000"
	.align	2
.LC5:
	.ascii	"An error occurred for file name %s.\012\000"
	.align	2
.LC6:
	.ascii	"Parent\000"
	.align	2
.LC7:
	.ascii	"Parent. Error writing to pipe.\012\000"
	.align	2
.LC8:
	.ascii	"Parent wrote %d bytes.\012\000"
	.align	2
.LC9:
	.ascii	"fclose failed for file name %s.\012\000"
	.align	2
.LC10:
	.ascii	"w\000"
	.align	2
.LC11:
	.ascii	"Child. An error occurred reading from the pipe.\012"
	.ascii	"\000"
	.align	2
.LC12:
	.ascii	"Child\000"
	.align	2
.LC13:
	.ascii	"Child read %d bytes.\012\000"
	.align	2
.LC14:
	.ascii	"Error writing to file name %s.\012\000"
	.align	2
.LC15:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 304
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #304
	str	r0, [fp, #-304]
	str	r1, [fp, #-308]
	ldr	r3, .L20
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-304]
	cmp	r3, #3
	beq	.L2
	ldr	r3, .L20+4
	ldr	r0, [r3]
	ldr	r3, [fp, #-308]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L20+8
	bl	fprintf
	mov	r3, #1
	b	.L18
.L2:
	ldr	r3, [fp, #-308]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-300]
	ldr	r3, [fp, #-308]
	ldr	r3, [r3, #8]
	str	r3, [fp, #-296]
	sub	r3, fp, #272
	mov	r0, r3
	bl	pipe
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	ldr	r3, .L20+4
	ldr	r3, [r3]
	mov	r2, #13
	mov	r1, #1
	ldr	r0, .L20+12
	bl	fwrite
	mov	r3, #2
	b	.L18
.L4:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-292]
	ldr	r3, [fp, #-292]
	cmp	r3, #0
	bge	.L5
	ldr	r3, .L20+4
	ldr	r3, [r3]
	mov	r2, #13
	mov	r1, #1
	ldr	r0, .L20+16
	bl	fwrite
	mov	r3, #3
	b	.L18
.L5:
	ldr	r3, [fp, #-292]
	cmp	r3, #0
	ble	.L6
	ldr	r1, .L20+20
	ldr	r0, [fp, #-300]
	bl	fopen
	str	r0, [fp, #-276]
	ldr	r3, [fp, #-276]
	cmp	r3, #0
	bne	.L7
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-300]
	ldr	r1, .L20+24
	mov	r0, r3
	bl	fprintf
	mvn	r3, #0
	b	.L18
.L7:
	ldr	r3, [fp, #-272]
	mov	r0, r3
	bl	close
	b	.L8
.L11:
	sub	r0, fp, #264
	ldr	r3, [fp, #-276]
	mov	r2, #256
	mov	r1, #1
	bl	fread
	mov	r3, r0
	str	r3, [fp, #-284]
	ldr	r3, [fp, #-284]
	cmp	r3, #255
	bgt	.L9
	ldr	r0, [fp, #-276]
	bl	ferror
	mov	r3, r0
	cmp	r3, #0
	beq	.L9
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-300]
	ldr	r1, .L20+28
	mov	r0, r3
	bl	fprintf
	ldr	r0, .L20+32
	bl	perror
	mvn	r3, #0
	b	.L18
.L9:
	ldr	r3, [fp, #-268]
	ldr	r2, [fp, #-284]
	sub	r1, fp, #264
	mov	r0, r3
	bl	write
	str	r0, [fp, #-280]
	ldr	r3, [fp, #-280]
	cmn	r3, #1
	bne	.L10
	ldr	r3, .L20+4
	ldr	r3, [r3]
	mov	r2, #31
	mov	r1, #1
	ldr	r0, .L20+36
	bl	fwrite
	ldr	r0, .L20+32
	bl	perror
	mvn	r3, #0
	b	.L18
.L10:
	ldr	r1, [fp, #-280]
	ldr	r0, .L20+40
	bl	printf
.L8:
	ldr	r0, [fp, #-276]
	bl	feof
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r0, [fp, #-276]
	bl	fclose
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-300]
	ldr	r1, .L20+44
	mov	r0, r3
	bl	fprintf
.L12:
	ldr	r3, [fp, #-268]
	mov	r0, r3
	bl	close
	b	.L13
.L6:
	ldr	r1, .L20+48
	ldr	r0, [fp, #-296]
	bl	fopen
	str	r0, [fp, #-288]
	ldr	r3, [fp, #-288]
	cmp	r3, #0
	bne	.L14
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-296]
	ldr	r1, .L20+24
	mov	r0, r3
	bl	fprintf
	mvn	r3, #0
	b	.L18
.L14:
	ldr	r3, [fp, #-268]
	mov	r0, r3
	bl	close
	b	.L15
.L17:
	ldr	r3, [fp, #-284]
	cmn	r3, #1
	bne	.L16
	ldr	r3, .L20+4
	ldr	r3, [r3]
	mov	r2, #48
	mov	r1, #1
	ldr	r0, .L20+52
	bl	fwrite
	ldr	r0, .L20+56
	bl	perror
	mvn	r3, #0
	b	.L18
.L16:
	ldr	r1, [fp, #-284]
	ldr	r0, .L20+60
	bl	printf
	ldr	r2, [fp, #-284]
	sub	r0, fp, #264
	ldr	r3, [fp, #-288]
	mov	r1, #1
	bl	fwrite
	mov	r3, r0
	str	r3, [fp, #-280]
	ldr	r2, [fp, #-280]
	ldr	r3, [fp, #-284]
	cmp	r2, r3
	bge	.L15
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-296]
	ldr	r1, .L20+64
	mov	r0, r3
	bl	fprintf
	ldr	r0, .L20+56
	bl	perror
	mvn	r3, #0
	b	.L18
.L15:
	ldr	r3, [fp, #-272]
	sub	r1, fp, #264
	mov	r2, #256
	mov	r0, r3
	bl	read
	str	r0, [fp, #-284]
	ldr	r3, [fp, #-284]
	cmp	r3, #0
	bne	.L17
	ldr	r3, [fp, #-272]
	mov	r0, r3
	bl	close
	ldr	r0, [fp, #-288]
	bl	fclose
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	ldr	r3, .L20+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-296]
	ldr	r1, .L20+44
	mov	r0, r3
	bl	fprintf
.L13:
	mov	r3, #0
.L18:
	ldr	r2, .L20
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC15
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
