	.file	"1253302.c"
	.intel_syntax noprefix
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 8192
buf:
	.zero	8192
	.globl	endfile
	.align 4
	.type	endfile, @object
	.size	endfile, 4
endfile:
	.zero	4
	.local	sem
	.comm	sem,32,32
	.globl	dstfile
	.align 32
	.type	dstfile, @object
	.size	dstfile, 8192
dstfile:
	.zero	8192
	.globl	totByte
	.align 4
	.type	totByte, @object
	.size	totByte, 4
totByte:
	.zero	4
	.globl	totXfrs
	.align 4
	.type	totXfrs, @object
	.size	totXfrs, 4
totXfrs:
	.zero	4
	.section	.rodata
.LC0:
	.string	"writer_sem_wait"
.LC1:
	.string	"writer_read"
.LC2:
	.string	"writer_sem_post"
	.text
	.type	threadWrite, @function
threadWrite:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR -40[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -12[rbp], eax
	mov	DWORD PTR -16[rbp], 0
	mov	DWORD PTR -20[rbp], 0
.L7:
	lea	rdi, sem[rip]
	call	sem_wait@PLT
	cmp	eax, -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L2:
	mov	edx, 8192
	lea	rsi, buf[rip]
	mov	edi, 0
	call	read@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], -1
	jne	.L3
	lea	rdi, .LC1[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L3:
	lea	rdi, sem[rip]
	call	sem_post@PLT
	cmp	eax, -1
	jne	.L4
	lea	rdi, .LC2[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L4:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L5
	mov	DWORD PTR endfile[rip], 1
	jmp	.L9
.L5:
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR totByte[rip]
	add	eax, edx
	mov	DWORD PTR totByte[rip], eax
	mov	eax, DWORD PTR totXfrs[rip]
	add	eax, 1
	mov	DWORD PTR totXfrs[rip], eax
	mov	edi, 1
	call	sleep@PLT
	add	DWORD PTR -16[rbp], 1
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -20[rbp]
	add	eax, edx
	mov	DWORD PTR -20[rbp], eax
	jmp	.L7
.L9:
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	threadWrite, .-threadWrite
	.section	.rodata
.LC3:
	.string	"open dst"
.LC4:
	.string	"reader_sem_wait"
.LC5:
	.string	"reader_write"
.LC6:
	.string	"sem_post"
	.text
	.type	threadRead, @function
threadRead:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	esi, 1526
	lea	rdi, dstfile[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], -1
	jne	.L11
	lea	rdi, .LC3[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L11:
	mov	DWORD PTR -16[rbp], 0
	mov	DWORD PTR -20[rbp], 0
.L17:
	lea	rdi, sem[rip]
	call	sem_wait@PLT
	cmp	eax, -1
	jne	.L12
	lea	rdi, .LC4[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L12:
	mov	eax, DWORD PTR endfile[rip]
	test	eax, eax
	je	.L13
	mov	eax, DWORD PTR -20[rbp]
	add	eax, 8192
	mov	DWORD PTR -20[rbp], eax
	jmp	.L19
.L13:
	mov	eax, DWORD PTR -12[rbp]
	mov	edx, 8192
	lea	rsi, buf[rip]
	mov	edi, eax
	call	write@PLT
	cmp	rax, 8192
	je	.L15
	lea	rdi, .LC5[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L15:
	lea	rdi, sem[rip]
	call	sem_post@PLT
	cmp	eax, -1
	jne	.L16
	lea	rdi, .LC6[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L16:
	mov	edi, 1
	call	sleep@PLT
	add	DWORD PTR -16[rbp], 1
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, eax
	mov	eax, DWORD PTR -20[rbp]
	add	eax, edx
	mov	DWORD PTR -20[rbp], eax
	jmp	.L17
.L19:
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	threadRead, .-threadRead
	.section	.rodata
.LC7:
	.string	"--help"
.LC8:
	.string	"Usage : %s destinationFILE\n"
.LC9:
	.string	"Dstfile = %s\n"
.LC10:
	.string	"sem_init"
.LC11:
	.string	"pthread_create1"
.LC12:
	.string	"pthread_create2"
.LC13:
	.string	"pthread_join1"
.LC14:
	.string	"pthread_join2"
.LC15:
	.string	"Received %d bytes (%d xfrs)\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -32[rbp], 10000000
	cmp	DWORD PTR -36[rbp], 2
	jne	.L21
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L22
.L21:
	mov	rax, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC8[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
.L22:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, dstfile[rip]
	call	strcpy@PLT
	lea	rsi, dstfile[rip]
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, sem[rip]
	call	sem_init@PLT
	cmp	eax, -1
	jne	.L23
	lea	rdi, .LC10[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L23:
	lea	rdx, -32[rbp]
	lea	rax, -24[rbp]
	mov	rcx, rdx
	lea	rdx, threadWrite[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L24
	lea	rdi, .LC11[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L24:
	lea	rdx, -32[rbp]
	lea	rax, -16[rbp]
	mov	rcx, rdx
	lea	rdx, threadRead[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L25
	lea	rdi, .LC12[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L25:
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L26
	lea	rdi, .LC13[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L26:
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L27
	lea	rdi, .LC14[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	exit@PLT
.L27:
	mov	edx, DWORD PTR totXfrs[rip]
	mov	eax, DWORD PTR totByte[rip]
	mov	esi, eax
	lea	rdi, .LC15[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE8:
	.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	"1253302.c"
	.text
	.comm	buf,8192,4
	.global	endfile
	.bss
	.align	2
	.type	endfile, %object
	.size	endfile, 4
endfile:
	.space	4
	.local	sem
	.comm	sem,16,4
	.comm	dstfile,8192,4
	.global	totByte
	.align	2
	.type	totByte, %object
	.size	totByte, 4
totByte:
	.space	4
	.global	totXfrs
	.align	2
	.type	totXfrs, %object
	.size	totXfrs, 4
totXfrs:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"writer_sem_wait\000"
	.align	2
.LC1:
	.ascii	"writer_read\000"
	.align	2
.LC2:
	.ascii	"writer_sem_post\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	threadWrite, %function
threadWrite:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-16]
	mov	r3, #0
	str	r3, [fp, #-20]
.L7:
	ldr	r0, .L10
	bl	sem_wait
	mov	r3, r0
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L10+4
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L2:
	mov	r2, #8192
	ldr	r1, .L10+8
	mov	r0, #0
	bl	read
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L10+12
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L3:
	ldr	r0, .L10
	bl	sem_post
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L10+16
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L4:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L5
	ldr	r3, .L10+20
	mov	r2, #1
	str	r2, [r3]
	b	.L9
.L5:
	ldr	r3, .L10+24
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	mov	r2, r3
	ldr	r3, .L10+24
	str	r2, [r3]
	ldr	r3, .L10+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L10+28
	str	r3, [r2]
	mov	r0, #1
	bl	sleep
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	str	r3, [fp, #-20]
	b	.L7
.L9:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	sem
	.word	.LC0
	.word	buf
	.word	.LC1
	.word	.LC2
	.word	endfile
	.word	totByte
	.word	totXfrs
	.size	threadWrite, .-threadWrite
	.section	.rodata
	.align	2
.LC3:
	.ascii	"open dst\000"
	.align	2
.LC4:
	.ascii	"reader_sem_wait\000"
	.align	2
.LC5:
	.ascii	"reader_write\000"
	.align	2
.LC6:
	.ascii	"sem_post\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	threadRead, %function
threadRead:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r1, .L22
	ldr	r0, .L22+4
	bl	open
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	bne	.L13
	ldr	r0, .L22+8
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L13:
	mov	r3, #0
	str	r3, [fp, #-16]
	mov	r3, #0
	str	r3, [fp, #-20]
.L19:
	ldr	r0, .L22+12
	bl	sem_wait
	mov	r3, r0
	cmn	r3, #1
	bne	.L14
	ldr	r0, .L22+16
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L14:
	ldr	r3, .L22+20
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L15
	ldr	r3, [fp, #-20]
	add	r3, r3, #8192
	str	r3, [fp, #-20]
	b	.L21
.L15:
	mov	r2, #8192
	ldr	r1, .L22+24
	ldr	r0, [fp, #-12]
	bl	write
	mov	r3, r0
	cmp	r3, #8192
	beq	.L17
	ldr	r0, .L22+28
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L17:
	ldr	r0, .L22+12
	bl	sem_post
	mov	r3, r0
	cmn	r3, #1
	bne	.L18
	ldr	r0, .L22+32
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L18:
	mov	r0, #1
	bl	sleep
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	str	r3, [fp, #-20]
	b	.L19
.L21:
	ldr	r0, [fp, #-12]
	bl	close
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	1526
	.word	dstfile
	.word	.LC3
	.word	sem
	.word	.LC4
	.word	endfile
	.word	buf
	.word	.LC5
	.word	.LC6
	.size	threadRead, .-threadRead
	.section	.rodata
	.align	2
.LC7:
	.ascii	"--help\000"
	.align	2
.LC8:
	.ascii	"Usage : %s destinationFILE\012\000"
	.align	2
.LC9:
	.ascii	"Dstfile = %s\012\000"
	.align	2
.LC10:
	.ascii	"sem_init\000"
	.align	2
.LC11:
	.ascii	"pthread_create1\000"
	.align	2
.LC12:
	.ascii	"pthread_create2\000"
	.align	2
.LC13:
	.ascii	"pthread_join1\000"
	.align	2
.LC14:
	.ascii	"pthread_join2\000"
	.align	2
.LC15:
	.ascii	"Received %d bytes (%d xfrs)\012\000"
	.align	2
.LC16:
	.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
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, .L33
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L33+4
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-32]
	cmp	r3, #2
	bne	.L25
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L33+8
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L26
.L25:
	ldr	r3, .L33+12
	ldr	r0, [r3]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L33+16
	bl	fprintf
	mov	r0, #1
	bl	exit
.L26:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L33+20
	bl	strcpy
	ldr	r1, .L33+20
	ldr	r0, .L33+24
	bl	printf
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L33+28
	bl	sem_init
	mov	r3, r0
	cmn	r3, #1
	bne	.L27
	ldr	r0, .L33+32
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L27:
	sub	r3, fp, #16
	sub	r0, fp, #24
	ldr	r2, .L33+36
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L28
	ldr	r0, .L33+40
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L28:
	sub	r3, fp, #16
	sub	r0, fp, #20
	ldr	r2, .L33+44
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L29
	ldr	r0, .L33+48
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L29:
	ldr	r3, [fp, #-24]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L30
	ldr	r0, .L33+52
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L30:
	ldr	r3, [fp, #-20]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L31
	ldr	r0, .L33+56
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	exit
.L31:
	ldr	r3, .L33+60
	ldr	r3, [r3]
	ldr	r2, .L33+64
	ldr	r2, [r2]
	mov	r1, r3
	ldr	r0, .L33+68
	bl	printf
	mov	r0, #0
	bl	exit
.L34:
	.align	2
.L33:
	.word	.LC16
	.word	10000000
	.word	.LC7
	.word	stderr
	.word	.LC8
	.word	dstfile
	.word	.LC9
	.word	sem
	.word	.LC10
	.word	threadWrite
	.word	.LC11
	.word	threadRead
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	totByte
	.word	totXfrs
	.word	.LC15
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
