	.file	"159515837.c"
	.intel_syntax noprefix
	.text
	.globl	count
	.data
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.long	5
	.globl	data
	.bss
	.align 4
	.type	data, @object
	.size	data, 4
data:
	.zero	4
	.globl	ms
	.section	.rodata
	.align 16
	.type	ms, @object
	.size	ms, 16
ms:
	.zero	8
	.quad	1000000
.LC0:
	.string	"Reader %d is reading %d\n"
	.text
	.globl	reader
	.type	reader, @function
reader:
.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	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	jmp	.L2
.L3:
	lock add	DWORD PTR count[rip], 1
	call	thrd_yield@PLT
.L2:
	mov	eax, 1
	neg	eax
	lock xadd	DWORD PTR count[rip], eax
	test	eax, eax
	jle	.L3
	mov	eax, DWORD PTR data[rip]
	test	eax, eax
	jle	.L4
	mov	edx, DWORD PTR data[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
.L4:
	mov	eax, DWORD PTR data[rip]
	test	eax, eax
	js	.L9
	lock add	DWORD PTR count[rip], 1
	mov	esi, 0
	lea	rdi, ms[rip]
	call	thrd_sleep@PLT
	jmp	.L2
.L9:
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	reader, .-reader
	.section	.rodata
.LC1:
	.string	"Writer is writing %d\n"
	.text
	.globl	writer
	.type	writer, @function
writer:
.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, 16
	mov	DWORD PTR -8[rbp], 20
	mov	DWORD PTR -12[rbp], 0
	jmp	.L11
.L16:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jge	.L12
	mov	eax, DWORD PTR -12[rbp]
	add	eax, 10
	jmp	.L13
.L12:
	mov	eax, -1
.L13:
	mov	DWORD PTR -4[rbp], eax
	jmp	.L14
.L15:
	lock add	DWORD PTR count[rip], 6
.L14:
	mov	eax, 6
	neg	eax
	lock xadd	DWORD PTR count[rip], eax
	cmp	eax, 5
	jne	.L15
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR data[rip], eax
	lock add	DWORD PTR count[rip], 6
	mov	esi, 0
	lea	rdi, ms[rip]
	call	thrd_sleep@PLT
	add	DWORD PTR -12[rbp], 1
.L11:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jle	.L16
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	writer, .-writer
	.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, 112
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, -104[rbp]
	mov	edx, 0
	lea	rsi, writer[rip]
	mov	rdi, rax
	call	thrd_create@PLT
	test	eax, eax
	je	.L18
	mov	eax, 1
	jmp	.L25
.L18:
	mov	DWORD PTR -112[rbp], 0
	jmp	.L20
.L22:
	mov	eax, DWORD PTR -112[rbp]
	cdqe
	sal	rax, 4
	add	rax, rbp
	lea	rdx, -88[rax]
	mov	eax, DWORD PTR -112[rbp]
	mov	DWORD PTR [rdx], eax
	lea	rdx, -96[rbp]
	mov	eax, DWORD PTR -112[rbp]
	cdqe
	sal	rax, 4
	add	rax, rdx
	lea	rdx, 8[rax]
	lea	rcx, -96[rbp]
	mov	eax, DWORD PTR -112[rbp]
	cdqe
	sal	rax, 4
	add	rax, rcx
	lea	rsi, reader[rip]
	mov	rdi, rax
	call	thrd_create@PLT
	test	eax, eax
	je	.L21
	mov	eax, 1
	jmp	.L25
.L21:
	add	DWORD PTR -112[rbp], 1
.L20:
	cmp	DWORD PTR -112[rbp], 4
	jle	.L22
	mov	rax, QWORD PTR -104[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	thrd_join@PLT
	mov	DWORD PTR -108[rbp], 0
	jmp	.L23
.L24:
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	sal	rax, 4
	add	rax, rbp
	sub	rax, 96
	mov	rax, QWORD PTR [rax]
	mov	esi, 0
	mov	rdi, rax
	call	thrd_join@PLT
	add	DWORD PTR -108[rbp], 1
.L23:
	cmp	DWORD PTR -108[rbp], 4
	jle	.L24
	mov	eax, 0
.L25:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.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	"159515837.c"
	.text
	.global	count
	.data
	.align	2
	.type	count, %object
	.size	count, 4
count:
	.word	5
	.global	data
	.bss
	.align	2
	.type	data, %object
	.size	data, 4
data:
	.space	4
	.global	ms
	.section	.rodata
	.align	2
	.type	ms, %object
	.size	ms, 8
ms:
	.space	4
	.word	1000000
	.global	__sync_fetch_and_add_4
	.global	__sync_fetch_and_sub_4
	.align	2
.LC0:
	.ascii	"Reader %d is reading %d\012\000"
	.text
	.align	2
	.global	reader
	.syntax unified
	.arm
	.fpu softvfp
	.type	reader, %function
reader:
	@ 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]
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r3, .L10
	mov	r1, #1
	mov	r0, r3
	bl	__sync_fetch_and_add_4
	bl	thrd_yield
.L2:
	ldr	r3, .L10
	mov	r1, #1
	mov	r0, r3
	bl	__sync_fetch_and_sub_4
	mov	r3, r0
	cmp	r3, #0
	ble	.L3
	ldr	r3, .L10+4
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L4
	ldr	r3, .L10+4
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L10+8
	bl	printf
.L4:
	ldr	r3, .L10+4
	ldr	r3, [r3]
	cmp	r3, #0
	blt	.L9
	ldr	r3, .L10
	mov	r1, #1
	mov	r0, r3
	bl	__sync_fetch_and_add_4
	mov	r1, #0
	ldr	r0, .L10+12
	bl	thrd_sleep
	b	.L2
.L9:
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	count
	.word	data
	.word	.LC0
	.word	ms
	.size	reader, .-reader
	.section	.rodata
	.align	2
.LC1:
	.ascii	"Writer is writing %d\012\000"
	.text
	.align	2
	.global	writer
	.syntax unified
	.arm
	.fpu softvfp
	.type	writer, %function
writer:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	mov	r3, #20
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L13
.L18:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	bge	.L14
	ldr	r3, [fp, #-16]
	add	r3, r3, #10
	b	.L15
.L14:
	mvn	r3, #0
.L15:
	str	r3, [fp, #-8]
	b	.L16
.L17:
	ldr	r3, .L19
	mov	r1, #6
	mov	r0, r3
	bl	__sync_fetch_and_add_4
.L16:
	ldr	r3, .L19
	mov	r1, #6
	mov	r0, r3
	bl	__sync_fetch_and_sub_4
	mov	r3, r0
	cmp	r3, #5
	bne	.L17
	ldr	r1, [fp, #-8]
	ldr	r0, .L19+4
	bl	printf
	ldr	r2, .L19+8
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	ldr	r3, .L19
	mov	r1, #6
	mov	r0, r3
	bl	__sync_fetch_and_add_4
	mov	r1, #0
	ldr	r0, .L19+12
	bl	thrd_sleep
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L13:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	ble	.L18
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L20:
	.align	2
.L19:
	.word	count
	.word	.LC1
	.word	data
	.word	ms
	.size	writer, .-writer
	.section	.rodata
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	ldr	r3, .L31
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #60
	mov	r2, #0
	ldr	r1, .L31+4
	mov	r0, r3
	bl	thrd_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L22
	mov	r3, #1
	b	.L29
.L22:
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L24
.L26:
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #3
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [fp, #-56]
	str	r2, [r3, #-40]
	sub	r2, fp, #48
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #3
	add	r0, r2, r3
	sub	r2, fp, #48
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #3
	add	r3, r2, r3
	add	r3, r3, #4
	mov	r2, r3
	ldr	r1, .L31+8
	bl	thrd_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L25
	mov	r3, #1
	b	.L29
.L25:
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L24:
	ldr	r3, [fp, #-56]
	cmp	r3, #4
	ble	.L26
	ldr	r3, [fp, #-60]
	mov	r1, #0
	mov	r0, r3
	bl	thrd_join
	mov	r3, #0
	str	r3, [fp, #-52]
	b	.L27
.L28:
	ldr	r3, [fp, #-52]
	lsl	r3, r3, #3
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	mov	r1, #0
	mov	r0, r3
	bl	thrd_join
	ldr	r3, [fp, #-52]
	add	r3, r3, #1
	str	r3, [fp, #-52]
.L27:
	ldr	r3, [fp, #-52]
	cmp	r3, #4
	ble	.L28
	mov	r3, #0
.L29:
	ldr	r2, .L31
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L30
	bl	__stack_chk_fail
.L30:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L32:
	.align	2
.L31:
	.word	.LC2
	.word	writer
	.word	reader
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
