	.file	"78146.c"
	.intel_syntax noprefix
	.text
	.globl	lock_bd
	.bss
	.align 32
	.type	lock_bd, @object
	.size	lock_bd, 40
lock_bd:
	.zero	40
	.globl	lock_nl
	.align 32
	.type	lock_nl, @object
	.size	lock_nl, 40
lock_nl:
	.zero	40
	.globl	lock_solucao
	.align 32
	.type	lock_solucao, @object
	.size	lock_solucao, 40
lock_solucao:
	.zero	40
	.globl	num_leitores
	.align 4
	.type	num_leitores, @object
	.size	num_leitores, 4
num_leitores:
	.zero	4
	.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, 144
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -140[rbp], 0
	jmp	.L2
.L3:
	mov	edi, 4
	call	malloc@PLT
	mov	QWORD PTR -136[rbp], rax
	mov	rax, QWORD PTR -136[rbp]
	mov	edx, DWORD PTR -140[rbp]
	mov	DWORD PTR [rax], edx
	lea	rdx, -96[rbp]
	mov	eax, DWORD PTR -140[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -136[rbp]
	mov	rcx, rax
	lea	rdx, reader[rip]
	mov	esi, 0
	call	pthread_create@PLT
	add	DWORD PTR -140[rbp], 1
.L2:
	cmp	DWORD PTR -140[rbp], 9
	jle	.L3
	mov	DWORD PTR -140[rbp], 0
	jmp	.L4
.L5:
	mov	edi, 4
	call	malloc@PLT
	mov	QWORD PTR -136[rbp], rax
	mov	rax, QWORD PTR -136[rbp]
	mov	edx, DWORD PTR -140[rbp]
	mov	DWORD PTR [rax], edx
	lea	rdx, -128[rbp]
	mov	eax, DWORD PTR -140[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -136[rbp]
	mov	rcx, rax
	lea	rdx, writer[rip]
	mov	esi, 0
	call	pthread_create@PLT
	add	DWORD PTR -140[rbp], 1
.L4:
	cmp	DWORD PTR -140[rbp], 2
	jle	.L5
	mov	rax, QWORD PTR -96[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	reader
	.type	reader, @function
reader:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
.L11:
	lea	rdi, lock_solucao[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, lock_nl[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR num_leitores[rip]
	add	eax, 1
	mov	DWORD PTR num_leitores[rip], eax
	mov	eax, DWORD PTR num_leitores[rip]
	cmp	eax, 1
	jne	.L9
	lea	rdi, lock_bd[rip]
	call	pthread_mutex_lock@PLT
.L9:
	lea	rdi, lock_nl[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, lock_solucao[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	mov	eax, 0
	call	read_data_base
	lea	rdi, lock_nl[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR num_leitores[rip]
	sub	eax, 1
	mov	DWORD PTR num_leitores[rip], eax
	mov	eax, DWORD PTR num_leitores[rip]
	test	eax, eax
	jne	.L10
	lea	rdi, lock_bd[rip]
	call	pthread_mutex_unlock@PLT
.L10:
	lea	rdi, lock_nl[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	mov	eax, 0
	call	use_data_read
	jmp	.L11
	.cfi_endproc
.LFE7:
	.size	reader, .-reader
	.globl	writer
	.type	writer, @function
writer:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
.L13:
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	mov	eax, 0
	call	think_up_data
	lea	rdi, lock_solucao[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, lock_bd[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	mov	eax, 0
	call	write_data_base
	lea	rdi, lock_bd[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, lock_solucao[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L13
	.cfi_endproc
.LFE8:
	.size	writer, .-writer
	.section	.rodata
	.align 8
.LC0:
	.string	"Leitor %d est\303\241 lendo os dados! N\303\272mero de leitores: %d\n"
	.text
	.globl	read_data_base
	.type	read_data_base, @function
read_data_base:
.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	DWORD PTR -4[rbp], edi
	mov	edx, DWORD PTR num_leitores[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	sal	ecx, 2
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	sleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	read_data_base, .-read_data_base
	.section	.rodata
	.align 8
.LC1:
	.string	"Leitor %d est\303\241 usando os dados lidos! N\303\272mero de leitores: %d\n"
	.text
	.globl	use_data_read
	.type	use_data_read, @function
use_data_read:
.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	DWORD PTR -4[rbp], edi
	mov	edx, DWORD PTR num_leitores[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	sal	ecx, 2
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	sleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	use_data_read, .-use_data_read
	.section	.rodata
	.align 8
.LC2:
	.string	"Escritor %d est\303\241 pensando no que escrever!\n"
	.text
	.globl	think_up_data
	.type	think_up_data, @function
think_up_data:
.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	DWORD PTR -4[rbp], edi
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	sal	ecx, 2
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	mov	eax, edx
	mov	edi, eax
	call	sleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	think_up_data, .-think_up_data
	.section	.rodata
	.align 8
.LC3:
	.string	"Escritor %d est\303\241 escrevendo os dados! N\303\272mero de leitores: %d\n"
	.text
	.globl	write_data_base
	.type	write_data_base, @function
write_data_base:
.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	DWORD PTR -4[rbp], edi
	mov	edx, DWORD PTR num_leitores[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1717986919
	shr	rdx, 32
	sar	edx
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	sal	ecx, 2
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 5[rdx]
	mov	edi, eax
	call	sleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	write_data_base, .-write_data_base
	.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	"78146.c"
	.text
	.global	lock_bd
	.bss
	.align	2
	.type	lock_bd, %object
	.size	lock_bd, 24
lock_bd:
	.space	24
	.global	lock_nl
	.align	2
	.type	lock_nl, %object
	.size	lock_nl, 24
lock_nl:
	.space	24
	.global	lock_solucao
	.align	2
	.type	lock_solucao, %object
	.size	lock_solucao, 24
lock_solucao:
	.space	24
	.global	num_leitores
	.align	2
	.type	num_leitores, %object
	.size	num_leitores, 4
num_leitores:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #64
	ldr	r3, .L8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L2
.L3:
	mov	r0, #4
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-64]
	ldr	r3, [fp, #-64]
	ldr	r2, [fp, #-68]
	str	r2, [r3]
	sub	r2, fp, #48
	ldr	r3, [fp, #-68]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-64]
	ldr	r2, .L8+4
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L2:
	ldr	r3, [fp, #-68]
	cmp	r3, #9
	ble	.L3
	mov	r3, #0
	str	r3, [fp, #-68]
	b	.L4
.L5:
	mov	r0, #4
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-64]
	ldr	r3, [fp, #-64]
	ldr	r2, [fp, #-68]
	str	r2, [r3]
	sub	r2, fp, #60
	ldr	r3, [fp, #-68]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-64]
	ldr	r2, .L8+8
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-68]
	add	r3, r3, #1
	str	r3, [fp, #-68]
.L4:
	ldr	r3, [fp, #-68]
	cmp	r3, #2
	ble	.L5
	ldr	r3, [fp, #-48]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, #0
	ldr	r2, .L8
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L7
	bl	__stack_chk_fail
.L7:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	.LC0
	.word	reader
	.word	writer
	.size	main, .-main
	.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]
.L13:
	ldr	r0, .L14
	bl	pthread_mutex_lock
	ldr	r0, .L14+4
	bl	pthread_mutex_lock
	ldr	r3, .L14+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L14+8
	str	r3, [r2]
	ldr	r3, .L14+8
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L11
	ldr	r0, .L14+12
	bl	pthread_mutex_lock
.L11:
	ldr	r0, .L14+4
	bl	pthread_mutex_unlock
	ldr	r0, .L14
	bl	pthread_mutex_unlock
	ldr	r0, [fp, #-8]
	bl	read_data_base
	ldr	r0, .L14+4
	bl	pthread_mutex_lock
	ldr	r3, .L14+8
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L14+8
	str	r3, [r2]
	ldr	r3, .L14+8
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L12
	ldr	r0, .L14+12
	bl	pthread_mutex_unlock
.L12:
	ldr	r0, .L14+4
	bl	pthread_mutex_unlock
	ldr	r0, [fp, #-8]
	bl	use_data_read
	b	.L13
.L15:
	.align	2
.L14:
	.word	lock_solucao
	.word	lock_nl
	.word	num_leitores
	.word	lock_bd
	.size	reader, .-reader
	.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	r3, [fp, #-16]
	ldr	r3, [r3]
	str	r3, [fp, #-8]
.L17:
	ldr	r0, [fp, #-8]
	bl	think_up_data
	ldr	r0, .L18
	bl	pthread_mutex_lock
	ldr	r0, .L18+4
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	write_data_base
	ldr	r0, .L18+4
	bl	pthread_mutex_unlock
	ldr	r0, .L18
	bl	pthread_mutex_unlock
	b	.L17
.L19:
	.align	2
.L18:
	.word	lock_solucao
	.word	lock_bd
	.size	writer, .-writer
	.section	.rodata
	.align	2
.LC1:
	.ascii	"Leitor %d est\303\241 lendo os dados! N\303\272mero"
	.ascii	" de leitores: %d\012\000"
	.text
	.align	2
	.global	read_data_base
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_data_base, %function
read_data_base:
	@ 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, .L21
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+4
	bl	printf
	bl	rand
	mov	r2, r0
	ldr	r3, .L21+8
	smull	r1, r3, r2, r3
	asr	r1, r3, #1
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	sleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	num_leitores
	.word	.LC1
	.word	1717986919
	.size	read_data_base, .-read_data_base
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Leitor %d est\303\241 usando os dados lidos! N\303\272"
	.ascii	"mero de leitores: %d\012\000"
	.text
	.align	2
	.global	use_data_read
	.syntax unified
	.arm
	.fpu softvfp
	.type	use_data_read, %function
use_data_read:
	@ 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, .L24
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L24+4
	bl	printf
	bl	rand
	mov	r2, r0
	ldr	r3, .L24+8
	smull	r1, r3, r2, r3
	asr	r1, r3, #1
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	sleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	num_leitores
	.word	.LC2
	.word	1717986919
	.size	use_data_read, .-use_data_read
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Escritor %d est\303\241 pensando no que escrever!\012"
	.ascii	"\000"
	.text
	.align	2
	.global	think_up_data
	.syntax unified
	.arm
	.fpu softvfp
	.type	think_up_data, %function
think_up_data:
	@ 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	r1, [fp, #-8]
	ldr	r0, .L27
	bl	printf
	bl	rand
	mov	r2, r0
	ldr	r3, .L27+4
	smull	r1, r3, r2, r3
	asr	r1, r3, #1
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	sleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC3
	.word	1717986919
	.size	think_up_data, .-think_up_data
	.section	.rodata
	.align	2
.LC4:
	.ascii	"Escritor %d est\303\241 escrevendo os dados! N\303\272"
	.ascii	"mero de leitores: %d\012\000"
	.text
	.align	2
	.global	write_data_base
	.syntax unified
	.arm
	.fpu softvfp
	.type	write_data_base, %function
write_data_base:
	@ 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, .L30
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L30+4
	bl	printf
	bl	rand
	mov	r1, r0
	ldr	r3, .L30+8
	smull	r2, r3, r1, r3
	asr	r2, r3, #1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	sub	r2, r1, r3
	add	r3, r2, #5
	mov	r0, r3
	bl	sleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L31:
	.align	2
.L30:
	.word	num_leitores
	.word	.LC4
	.word	1717986919
	.size	write_data_base, .-write_data_base
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
