	.file	"393722.c"
	.intel_syntax noprefix
	.text
	.globl	mutex
	.bss
	.align 32
	.type	mutex, @object
	.size	mutex, 32
mutex:
	.zero	32
	.globl	write_block
	.align 32
	.type	write_block, @object
	.size	write_block, 32
write_block:
	.zero	32
	.globl	data
	.data
	.align 4
	.type	data, @object
	.size	data, 4
data:
	.long	1
	.globl	rcount
	.align 4
	.type	rcount, @object
	.size	rcount, 4
rcount:
	.long	1
	.section	.rodata
.LC0:
	.string	"\t\tIncreasing Read Count !"
	.align 8
.LC1:
	.string	"Data read by the Reader %d is %d\n"
.LC2:
	.string	"\t\tDecreasing Read Count !!"
	.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	DWORD PTR -4[rbp], eax
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR rcount[rip]
	add	eax, 1
	mov	DWORD PTR rcount[rip], eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR rcount[rip]
	cmp	eax, 1
	jne	.L2
	lea	rdi, write_block[rip]
	call	sem_wait@PLT
.L2:
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	mov	edx, DWORD PTR data[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	mov	eax, 0
	call	sleep@PLT
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR rcount[rip]
	sub	eax, 1
	mov	DWORD PTR rcount[rip], eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR rcount[rip]
	test	eax, eax
	jne	.L3
	lea	rdi, write_block[rip]
	call	sem_post@PLT
.L3:
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	reader, .-reader
	.section	.rodata
.LC3:
	.string	"Blocking All other Writers !"
	.align 8
.LC4:
	.string	"Data written by the Writer %d is %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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, write_block[rip]
	call	sem_wait@PLT
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR data[rip]
	add	eax, 1
	mov	DWORD PTR data[rip], eax
	mov	edx, DWORD PTR data[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	mov	eax, 0
	call	sleep@PLT
	lea	rdi, write_block[rip]
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	writer, .-writer
	.section	.rodata
.LC5:
	.string	"Enter the number of writers :"
.LC6:
	.string	"%d"
.LC7:
	.string	"Enter the number of readers :"
.LC8:
	.string	"\n/**/\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, 352
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rax, -348[rbp]
	mov	rsi, rax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rax, -344[rbp]
	mov	rsi, rax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	sem_init@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, write_block[rip]
	call	sem_init@PLT
	mov	DWORD PTR -340[rbp], 1
.L6:
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	mov	rdx, rax
	lea	rcx, -176[rbp]
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	sal	rax, 3
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, writer[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	mov	rdx, rax
	lea	rcx, -336[rbp]
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	sal	rax, 3
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, reader[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	mov	rax, QWORD PTR -176[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, DWORD PTR -340[rbp]
	cdqe
	mov	rax, QWORD PTR -336[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -340[rbp], 1
	jmp	.L6
	.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	"393722.c"
	.text
	.comm	mutex,16,4
	.comm	write_block,16,4
	.global	data
	.data
	.align	2
	.type	data, %object
	.size	data, 4
data:
	.word	1
	.global	rcount
	.align	2
	.type	rcount, %object
	.size	rcount, 4
rcount:
	.word	1
	.section	.rodata
	.align	2
.LC0:
	.ascii	"\011\011Increasing Read Count !\000"
	.align	2
.LC1:
	.ascii	"Data read by the Reader %d is %d\012\000"
	.align	2
.LC2:
	.ascii	"\011\011Decreasing Read Count !!\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]
	str	r3, [fp, #-8]
	ldr	r0, .L4
	bl	sem_wait
	ldr	r3, .L4+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L4+4
	str	r3, [r2]
	ldr	r0, .L4+8
	bl	printf
	ldr	r3, .L4+4
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L2
	ldr	r0, .L4+12
	bl	sem_wait
.L2:
	ldr	r0, .L4
	bl	sem_post
	ldr	r3, .L4+16
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L4+20
	bl	printf
	mov	r0, #1
	bl	sleep
	ldr	r0, .L4
	bl	sem_wait
	ldr	r3, .L4+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L4+4
	str	r3, [r2]
	ldr	r0, .L4+24
	bl	printf
	ldr	r3, .L4+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L3
	ldr	r0, .L4+12
	bl	sem_post
.L3:
	ldr	r0, .L4
	bl	sem_post
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	mutex
	.word	rcount
	.word	.LC0
	.word	write_block
	.word	data
	.word	.LC1
	.word	.LC2
	.size	reader, .-reader
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Blocking All other Writers !\000"
	.align	2
.LC4:
	.ascii	"Data written by the Writer %d is %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
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	str	r3, [fp, #-8]
	ldr	r0, .L7
	bl	sem_wait
	ldr	r0, .L7+4
	bl	printf
	ldr	r3, .L7+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L7+8
	str	r3, [r2]
	ldr	r3, .L7+8
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L7+12
	bl	printf
	mov	r0, #1
	bl	sleep
	ldr	r0, .L7
	bl	sem_post
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	write_block
	.word	.LC3
	.word	data
	.word	.LC4
	.size	writer, .-writer
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Enter the number of writers :\000"
	.align	2
.LC6:
	.ascii	"%d\000"
	.align	2
.LC7:
	.ascii	"Enter the number of readers :\000"
	.align	2
.LC8:
	.ascii	"\012/**/\012\000"
	.align	2
.LC9:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 176
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #176
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r0, .L12+4
	bl	printf
	sub	r3, fp, #180
	mov	r1, r3
	ldr	r0, .L12+8
	bl	__isoc99_scanf
	ldr	r0, .L12+12
	bl	printf
	sub	r3, fp, #176
	mov	r1, r3
	ldr	r0, .L12+8
	bl	__isoc99_scanf
	ldr	r0, .L12+16
	bl	puts
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L12+20
	bl	sem_init
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L12+24
	bl	sem_init
	mov	r3, #1
	str	r3, [fp, #-172]
.L10:
	sub	r2, fp, #88
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-172]
	ldr	r2, .L12+28
	mov	r1, #0
	bl	pthread_create
	sub	r2, fp, #168
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-172]
	ldr	r2, .L12+32
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-84]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-164]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-172]
	add	r3, r3, #1
	str	r3, [fp, #-172]
	b	.L10
.L13:
	.align	2
.L12:
	.word	.LC9
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	mutex
	.word	write_block
	.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
