	.file	"899620.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"Usage: %s num_readers num_writers\nRuns the readers and writers problem with specified number of them\n--help - show this message"
	.text
	.globl	print_help
	.type	print_help, @function
print_help:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	mov	QWORD PTR -16[rbp], rsi
	mov	rax, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	print_help, .-print_help
	.globl	barrier
	.bss
	.align 32
	.type	barrier, @object
	.size	barrier, 32
barrier:
	.zero	32
	.globl	database
	.align 32
	.type	database, @object
	.size	database, 120
database:
	.zero	120
	.text
	.globl	shared_mutex_init
	.type	shared_mutex_init, @function
shared_mutex_init:
.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	esi, 0
	mov	rdi, rax
	call	pthread_mutex_init@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	esi, 0
	mov	rdi, rax
	call	pthread_mutex_init@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	shared_mutex_init, .-shared_mutex_init
	.globl	shared_mutex_destroy
	.type	shared_mutex_destroy, @function
shared_mutex_destroy:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	rdi, rax
	call	pthread_mutex_destroy@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	pthread_mutex_destroy@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_destroy@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	shared_mutex_destroy, .-shared_mutex_destroy
	.globl	shared_mutex_reader_lock
	.type	shared_mutex_reader_lock, @function
shared_mutex_reader_lock:
.LFB9:
	.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 1
	jne	.L5
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_wait@PLT
.L5:
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	shared_mutex_reader_lock, .-shared_mutex_reader_lock
	.globl	shared_mutex_reader_unlock
	.type	shared_mutex_reader_unlock, @function
shared_mutex_reader_unlock:
.LFB10:
	.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	test	eax, eax
	jne	.L7
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_post@PLT
.L7:
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	shared_mutex_reader_unlock, .-shared_mutex_reader_unlock
	.globl	shared_mutex_writer_lock
	.type	shared_mutex_writer_lock, @function
shared_mutex_writer_lock:
.LFB11:
	.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	rdi, rax
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 80
	mov	rdi, rax
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	shared_mutex_writer_lock, .-shared_mutex_writer_lock
	.globl	shared_mutex_writer_unlock
	.type	shared_mutex_writer_unlock, @function
shared_mutex_writer_unlock:
.LFB12:
	.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	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	shared_mutex_writer_unlock, .-shared_mutex_writer_unlock
	.globl	wait
	.type	wait, @function
wait:
.LFB13:
	.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
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1125899907
	shr	rdx, 32
	sar	edx, 20
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 4000000
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 1000000[rdx]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	usleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	wait, .-wait
	.section	.rodata
.LC1:
	.string	"reader %d says hello!\n"
.LC2:
	.string	"reader %d wants to read\n"
.LC3:
	.string	"reader %d reads: %u\n"
	.text
	.globl	reader
	.type	reader, @function
reader:
.LFB14:
	.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
	lea	rdi, barrier[rip]
	call	pthread_barrier_wait@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
.L12:
	mov	eax, 0
	call	wait
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, database[rip]
	call	shared_mutex_reader_lock
	mov	edx, DWORD PTR database[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	wait
	lea	rdi, database[rip]
	call	shared_mutex_reader_unlock
	jmp	.L12
	.cfi_endproc
.LFE14:
	.size	reader, .-reader
	.section	.rodata
.LC4:
	.string	"writer %d says hello!\n"
.LC5:
	.string	"writer %d wants to write\n"
.LC6:
	.string	"writer %d writes\n"
	.text
	.globl	writer
	.type	writer, @function
writer:
.LFB15:
	.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
	lea	rdi, barrier[rip]
	call	pthread_barrier_wait@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
.L14:
	mov	eax, 0
	call	wait
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, database[rip]
	call	shared_mutex_writer_lock
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	wait
	lea	rdi, database[rip]
	call	shared_mutex_writer_unlock
	jmp	.L14
	.cfi_endproc
.LFE15:
	.size	writer, .-writer
	.globl	simulate
	.type	simulate, @function
simulate:
.LFB16:
	.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	DWORD PTR -40[rbp], esi
	mov	eax, DWORD PTR -36[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	eax, DWORD PTR -40[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	edx, DWORD PTR -36[rbp]
	mov	eax, DWORD PTR -40[rbp]
	add	eax, edx
	add	eax, 1
	mov	edx, eax
	mov	esi, 0
	lea	rdi, barrier[rip]
	call	pthread_barrier_init@PLT
	lea	rdi, database[rip]
	call	shared_mutex_init
	mov	DWORD PTR -32[rbp], 0
	jmp	.L16
.L17:
	mov	eax, DWORD PTR -32[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -32[rbp]
	mov	DWORD PTR 8[rdx], eax
	mov	eax, DWORD PTR -32[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rdx
	lea	rdx, 8[rax]
	mov	eax, DWORD PTR -32[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, reader[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -32[rbp], 1
.L16:
	mov	eax, DWORD PTR -32[rbp]
	cmp	eax, DWORD PTR -36[rbp]
	jl	.L17
	mov	DWORD PTR -28[rbp], 0
	jmp	.L18
.L19:
	mov	eax, DWORD PTR -28[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -28[rbp]
	mov	DWORD PTR 8[rdx], eax
	mov	eax, DWORD PTR -28[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rax, rdx
	lea	rdx, 8[rax]
	mov	eax, DWORD PTR -28[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, writer[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -28[rbp], 1
.L18:
	mov	eax, DWORD PTR -28[rbp]
	cmp	eax, DWORD PTR -40[rbp]
	jl	.L19
	lea	rdi, barrier[rip]
	call	pthread_barrier_wait@PLT
	mov	DWORD PTR -24[rbp], 0
	jmp	.L20
.L21:
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -24[rbp]
	mov	DWORD PTR 8[rdx], eax
	mov	eax, DWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rax, rdx
	lea	rdx, 16[rax]
	mov	eax, DWORD PTR -24[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	mov	rax, QWORD PTR -8[rbp]
	add	rax, rcx
	mov	rax, QWORD PTR [rax]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -24[rbp], 1
.L20:
	mov	eax, DWORD PTR -24[rbp]
	cmp	eax, DWORD PTR -40[rbp]
	jl	.L21
	mov	DWORD PTR -20[rbp], 0
	jmp	.L22
.L23:
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -20[rbp]
	mov	DWORD PTR 8[rdx], eax
	mov	eax, DWORD PTR -20[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rdx
	lea	rdx, 16[rax]
	mov	eax, DWORD PTR -20[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	add	rax, rax
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, rcx
	mov	rax, QWORD PTR [rax]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -20[rbp], 1
.L22:
	mov	eax, DWORD PTR -20[rbp]
	cmp	eax, DWORD PTR -36[rbp]
	jl	.L23
	lea	rdi, database[rip]
	call	shared_mutex_destroy
	lea	rdi, barrier[rip]
	call	pthread_barrier_destroy@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE16:
	.size	simulate, .-simulate
	.section	.rodata
.LC7:
	.string	"--help"
.LC8:
	.string	"Simulation finished!"
	.text
	.globl	main
	.type	main, @function
main:
.LFB17:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 24
	.cfi_offset 3, -24
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	cmp	DWORD PTR -20[rbp], 2
	jg	.L25
	mov	rdx, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	print_help
	mov	eax, 1
	jmp	.L26
.L25:
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L27
	mov	rdx, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	print_help
	mov	eax, 1
	jmp	.L26
.L27:
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	ebx, eax
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	esi, ebx
	mov	edi, eax
	call	simulate
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	eax, 0
.L26:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE17:
	.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	"899620.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage: %s num_readers num_writers\012Runs the reade"
	.ascii	"rs and writers problem with specified number of the"
	.ascii	"m\012--help - show this message\000"
	.text
	.align	2
	.global	print_help
	.syntax unified
	.arm
	.fpu softvfp
	.type	print_help, %function
print_help:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	str	r1, [fp, #-12]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L2
	bl	printf
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L3:
	.align	2
.L2:
	.word	.LC0
	.size	print_help, .-print_help
	.comm	barrier,20,4
	.comm	database,68,4
	.align	2
	.global	shared_mutex_init
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_init, %function
shared_mutex_init:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r1, #0
	mov	r0, r3
	bl	pthread_mutex_init
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r1, #0
	mov	r0, r3
	bl	pthread_mutex_init
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_init, .-shared_mutex_init
	.align	2
	.global	shared_mutex_destroy
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_destroy, %function
shared_mutex_destroy:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r0, r3
	bl	pthread_mutex_destroy
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	pthread_mutex_destroy
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_destroy
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_destroy, .-shared_mutex_destroy
	.align	2
	.global	shared_mutex_reader_lock
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_reader_lock, %function
shared_mutex_reader_lock:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L7
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_wait
.L7:
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	pthread_mutex_unlock
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r0, r3
	bl	pthread_mutex_unlock
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_reader_lock, .-shared_mutex_reader_lock
	.align	2
	.global	shared_mutex_reader_unlock
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_reader_unlock, %function
shared_mutex_reader_unlock:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L9
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_post
.L9:
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	pthread_mutex_unlock
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_reader_unlock, .-shared_mutex_reader_unlock
	.align	2
	.global	shared_mutex_writer_lock
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_writer_lock, %function
shared_mutex_writer_lock:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r0, r3
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_wait
	ldr	r3, [fp, #-8]
	add	r3, r3, #44
	mov	r0, r3
	bl	pthread_mutex_unlock
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_writer_lock, .-shared_mutex_writer_lock
	.align	2
	.global	shared_mutex_writer_unlock
	.syntax unified
	.arm
	.fpu softvfp
	.type	shared_mutex_writer_unlock, %function
shared_mutex_writer_unlock:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_post
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	shared_mutex_writer_unlock, .-shared_mutex_writer_unlock
	.align	2
	.global	wait
	.syntax unified
	.arm
	.fpu softvfp
	.type	wait, %function
wait:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	bl	rand
	ldr	r3, .L13
	smull	r2, r3, r0, r3
	asr	r2, r3, #20
	asr	r3, r0, #31
	sub	r1, r2, r3
	mov	r2, r1
	lsl	r2, r2, #5
	sub	r2, r2, r1
	lsl	r3, r2, #6
	sub	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r3, r1
	lsl	r3, r3, #8
	sub	r1, r0, r3
	add	r3, r1, #999424
	add	r3, r3, #576
	str	r3, [fp, #-8]
	ldr	r0, [fp, #-8]
	bl	usleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	1125899907
	.size	wait, .-wait
	.section	.rodata
	.align	2
.LC1:
	.ascii	"reader %d says hello!\012\000"
	.align	2
.LC2:
	.ascii	"reader %d wants to read\012\000"
	.align	2
.LC3:
	.ascii	"reader %d reads: %u\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	r0, .L17
	bl	pthread_barrier_wait
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L17+4
	bl	printf
.L16:
	bl	wait
	ldr	r1, [fp, #-8]
	ldr	r0, .L17+8
	bl	printf
	ldr	r0, .L17+12
	bl	shared_mutex_reader_lock
	ldr	r3, .L17+12
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L17+16
	bl	printf
	bl	wait
	ldr	r0, .L17+12
	bl	shared_mutex_reader_unlock
	b	.L16
.L18:
	.align	2
.L17:
	.word	barrier
	.word	.LC1
	.word	.LC2
	.word	database
	.word	.LC3
	.size	reader, .-reader
	.section	.rodata
	.align	2
.LC4:
	.ascii	"writer %d says hello!\012\000"
	.align	2
.LC5:
	.ascii	"writer %d wants to write\012\000"
	.align	2
.LC6:
	.ascii	"writer %d writes\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
	str	r0, [fp, #-16]
	ldr	r0, .L21
	bl	pthread_barrier_wait
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+4
	bl	printf
.L20:
	bl	wait
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+8
	bl	printf
	ldr	r0, .L21+12
	bl	shared_mutex_writer_lock
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+16
	bl	printf
	bl	wait
	ldr	r0, .L21+12
	bl	shared_mutex_writer_unlock
	b	.L20
.L22:
	.align	2
.L21:
	.word	barrier
	.word	.LC4
	.word	.LC5
	.word	database
	.word	.LC6
	.size	writer, .-writer
	.align	2
	.global	simulate
	.syntax unified
	.arm
	.fpu softvfp
	.type	simulate, %function
simulate:
	@ 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	r2, [fp, #-32]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-12]
	ldr	r2, [fp, #-36]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r2, [fp, #-32]
	ldr	r3, [fp, #-36]
	add	r3, r2, r3
	add	r3, r3, #1
	mov	r2, r3
	mov	r1, #0
	ldr	r0, .L32
	bl	pthread_barrier_init
	ldr	r0, .L32+4
	bl	shared_mutex_init
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L24
.L25:
	ldr	r2, [fp, #-28]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	ldr	r2, [fp, #-28]
	str	r2, [r3, #4]
	ldr	r2, [fp, #-28]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	mov	r0, r3
	ldr	r2, [fp, #-28]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	add	r3, r3, #4
	ldr	r2, .L32+8
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L24:
	ldr	r2, [fp, #-28]
	ldr	r3, [fp, #-32]
	cmp	r2, r3
	blt	.L25
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L26
.L27:
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	ldr	r2, [fp, #-24]
	str	r2, [r3, #4]
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	mov	r0, r3
	ldr	r2, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	add	r3, r3, #4
	ldr	r2, .L32+12
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L26:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-36]
	cmp	r2, r3
	blt	.L27
	ldr	r0, .L32
	bl	pthread_barrier_wait
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L28
.L29:
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	ldr	r2, [fp, #-20]
	str	r2, [r3, #4]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	ldr	r0, [r3]
	ldr	r2, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-8]
	add	r3, r3, r2
	add	r3, r3, #8
	mov	r1, r3
	bl	pthread_join
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L28:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-36]
	cmp	r2, r3
	blt	.L29
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L30
.L31:
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	ldr	r2, [fp, #-16]
	str	r2, [r3, #4]
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	ldr	r0, [r3]
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	add	r3, r3, #8
	mov	r1, r3
	bl	pthread_join
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L30:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-32]
	cmp	r2, r3
	blt	.L31
	ldr	r0, .L32+4
	bl	shared_mutex_destroy
	ldr	r0, .L32
	bl	pthread_barrier_destroy
	ldr	r0, [fp, #-8]
	bl	free
	ldr	r0, [fp, #-12]
	bl	free
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L33:
	.align	2
.L32:
	.word	barrier
	.word	database
	.word	reader
	.word	writer
	.size	simulate, .-simulate
	.section	.rodata
	.align	2
.LC7:
	.ascii	"--help\000"
	.align	2
.LC8:
	.ascii	"Simulation finished!\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #12
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, [fp, #-16]
	cmp	r3, #2
	bgt	.L35
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-16]
	bl	print_help
	mov	r3, #1
	b	.L36
.L35:
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L38
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L37
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-16]
	bl	print_help
	mov	r3, #1
	b	.L36
.L37:
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	ldr	r3, [fp, #-20]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r4, r0
	ldr	r3, [fp, #-20]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	mov	r1, r3
	mov	r0, r4
	bl	simulate
	ldr	r0, .L38+4
	bl	puts
	mov	r3, #0
.L36:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L39:
	.align	2
.L38:
	.word	.LC7
	.word	.LC8
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
