	.file	"188426.c"
	.intel_syntax noprefix
	.text
	.globl	ARRAY_SIZE
	.section	.rodata
	.align 4
	.type	ARRAY_SIZE, @object
	.size	ARRAY_SIZE, 4
ARRAY_SIZE:
	.long	10
	.globl	data_arr
	.bss
	.align 32
	.type	data_arr, @object
	.size	data_arr, 40
data_arr:
	.zero	40
	.globl	CurrentIndex
	.align 4
	.type	CurrentIndex, @object
	.size	CurrentIndex, 4
CurrentIndex:
	.zero	4
	.globl	ReadIndex
	.align 4
	.type	ReadIndex, @object
	.size	ReadIndex, 4
ReadIndex:
	.zero	4
	.globl	lastGenerated
	.align 4
	.type	lastGenerated, @object
	.size	lastGenerated, 4
lastGenerated:
	.zero	4
	.globl	semaphore
	.align 32
	.type	semaphore, @object
	.size	semaphore, 32
semaphore:
	.zero	32
	.globl	delay
	.align 32
	.type	delay, @object
	.size	delay, 32
delay:
	.zero	32
	.globl	block
	.align 32
	.type	block, @object
	.size	block, 32
block:
	.zero	32
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	empty
	.data
	.align 4
	.type	empty, @object
	.size	empty, 4
empty:
	.long	10
	.globl	consumed1
	.bss
	.align 4
	.type	consumed1, @object
	.size	consumed1, 4
consumed1:
	.zero	4
	.globl	consumed2
	.align 4
	.type	consumed2, @object
	.size	consumed2, 4
consumed2:
	.zero	4
	.globl	consumed3
	.align 4
	.type	consumed3, @object
	.size	consumed3, 4
consumed3:
	.zero	4
	.globl	consumed4
	.align 4
	.type	consumed4, @object
	.size	consumed4, 4
consumed4:
	.zero	4
	.globl	produced1
	.align 4
	.type	produced1, @object
	.size	produced1, 4
produced1:
	.zero	4
	.globl	produced2
	.align 4
	.type	produced2, @object
	.size	produced2, 4
produced2:
	.zero	4
	.globl	produced3
	.align 4
	.type	produced3, @object
	.size	produced3, 4
produced3:
	.zero	4
	.globl	produced4
	.align 4
	.type	produced4, @object
	.size	produced4, 4
produced4:
	.zero	4
	.globl	producer1lastindex
	.align 4
	.type	producer1lastindex, @object
	.size	producer1lastindex, 4
producer1lastindex:
	.zero	4
	.globl	producer2lastindex
	.align 4
	.type	producer2lastindex, @object
	.size	producer2lastindex, 4
producer2lastindex:
	.zero	4
	.globl	producer3lastindex
	.align 4
	.type	producer3lastindex, @object
	.size	producer3lastindex, 4
producer3lastindex:
	.zero	4
	.globl	producer4lastindex
	.align 4
	.type	producer4lastindex, @object
	.size	producer4lastindex, 4
producer4lastindex:
	.zero	4
	.section	.rodata
.LC0:
	.string	"w"
	.align 8
.LC1:
	.string	"/home/ramy/os/producer-consumer-limited/producer1.txt"
	.align 8
.LC2:
	.string	"/home/ramy/os/producer-consumer-limited/consumer1.txt"
	.align 8
.LC3:
	.string	"/home/ramy/os/producer-consumer-limited/consumer2.txt"
	.align 8
.LC4:
	.string	"/home/ramy/os/producer-consumer-limited/consumer3.txt"
	.align 8
.LC5:
	.string	"/home/ramy/os/producer-consumer-limited/consumer4.txt"
.LC6:
	.string	"All files are clean now!"
	.text
	.globl	CleanUp
	.type	CleanUp, @function
CleanUp:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rsi, .LC0[rip]
	lea	rdi, .LC1[rip]
	call	fopen@PLT
	mov	rdi, rax
	call	fclose@PLT
	lea	rsi, .LC0[rip]
	lea	rdi, .LC2[rip]
	call	fopen@PLT
	mov	rdi, rax
	call	fclose@PLT
	lea	rsi, .LC0[rip]
	lea	rdi, .LC3[rip]
	call	fopen@PLT
	mov	rdi, rax
	call	fclose@PLT
	lea	rsi, .LC0[rip]
	lea	rdi, .LC4[rip]
	call	fopen@PLT
	mov	rdi, rax
	call	fclose@PLT
	lea	rsi, .LC0[rip]
	lea	rdi, .LC5[rip]
	call	fopen@PLT
	mov	rdi, rax
	call	fclose@PLT
	lea	rdi, .LC6[rip]
	call	puts@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	CleanUp, .-CleanUp
	.globl	combine
	.type	combine, @function
combine:
.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, 64
	mov	QWORD PTR -40[rbp], rdi
	mov	QWORD PTR -48[rbp], rsi
	mov	QWORD PTR -56[rbp], rdx
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	QWORD PTR -48[rbp], 0
	jne	.L3
	cmp	QWORD PTR -56[rbp], 0
	jne	.L3
	mov	rax, QWORD PTR -40[rbp]
	mov	BYTE PTR [rax], 0
	jmp	.L4
.L3:
	cmp	QWORD PTR -56[rbp], 0
	je	.L5
	mov	rax, QWORD PTR -56[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L6
.L5:
	mov	rdx, QWORD PTR -48[rbp]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcpy@PLT
	jmp	.L4
.L6:
	cmp	QWORD PTR -48[rbp], 0
	je	.L7
	mov	rax, QWORD PTR -48[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L8
.L7:
	mov	rdx, QWORD PTR -56[rbp]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcpy@PLT
	jmp	.L4
.L8:
	mov	WORD PTR -10[rbp], 47
	mov	rax, QWORD PTR -48[rbp]
	mov	QWORD PTR -24[rbp], rax
	jmp	.L9
.L10:
	add	QWORD PTR -24[rbp], 1
.L9:
	mov	rax, QWORD PTR -24[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L10
	mov	DWORD PTR -28[rbp], 0
	lea	rdx, -10[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	je	.L11
	mov	DWORD PTR -28[rbp], 1
.L11:
	mov	rdx, QWORD PTR -48[rbp]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcpy@PLT
	cmp	DWORD PTR -28[rbp], 0
	je	.L12
	lea	rdx, -10[rbp]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcat@PLT
.L12:
	mov	rdx, QWORD PTR -56[rbp]
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strcat@PLT
.L4:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	combine, .-combine
	.globl	Produce
	.type	Produce, @function
Produce:
.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	DWORD PTR -4[rbp], 0
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 274877907
	shr	rdx, 32
	sar	edx, 6
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -4[rbp], edx
	mov	edx, DWORD PTR -4[rbp]
	imul	edx, edx, 1000
	sub	eax, edx
	mov	DWORD PTR -4[rbp], eax
	jmp	.L15
.L16:
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 274877907
	shr	rdx, 32
	sar	edx, 6
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -4[rbp], edx
	mov	edx, DWORD PTR -4[rbp]
	imul	edx, edx, 1000
	sub	eax, edx
	mov	DWORD PTR -4[rbp], eax
.L15:
	mov	eax, DWORD PTR lastGenerated[rip]
	cmp	DWORD PTR -4[rbp], eax
	je	.L16
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR lastGenerated[rip], eax
	mov	eax, DWORD PTR -4[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	Produce, .-Produce
	.section	.rodata
.LC7:
	.string	"a"
.LC8:
	.string	"failed to open the file"
.LC9:
	.string	"%d\n"
	.text
	.globl	Store
	.type	Store, @function
Store:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	lea	rsi, .LC7[rip]
	lea	rdi, .LC1[rip]
	call	fopen@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L19
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L20
.L19:
	mov	edx, DWORD PTR -20[rbp]
	mov	rax, QWORD PTR -8[rbp]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
.L20:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	ecx, DWORD PTR CurrentIndex[rip]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	movsx	rax, edx
	lea	rcx, 0[0+rax*4]
	lea	rdx, data_arr[rip]
	mov	eax, DWORD PTR -20[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR CurrentIndex[rip]
	add	eax, 1
	mov	DWORD PTR CurrentIndex[rip], eax
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	Store, .-Store
	.section	.rodata
.LC10:
	.string	"r"
	.text
	.globl	Read
	.type	Read, @function
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, 32
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rsi, .LC10[rip]
	lea	rdi, .LC1[rip]
	call	fopen@PLT
	mov	QWORD PTR -24[rbp], rax
	mov	DWORD PTR -32[rbp], 0
	cmp	QWORD PTR -24[rbp], 0
	je	.L22
	jmp	.L23
.L25:
	mov	eax, DWORD PTR ReadIndex[rip]
	cmp	DWORD PTR -32[rbp], eax
	jne	.L24
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	fclose@PLT
	jmp	.L23
.L24:
	add	DWORD PTR -32[rbp], 1
.L23:
	mov	rdx, QWORD PTR -24[rbp]
	lea	rax, -13[rbp]
	mov	esi, 5
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L25
.L22:
	mov	ecx, DWORD PTR ReadIndex[rip]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	movsx	rax, edx
	lea	rdx, 0[0+rax*4]
	lea	rax, data_arr[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR ReadIndex[rip]
	add	eax, 1
	mov	DWORD PTR ReadIndex[rip], eax
	mov	eax, DWORD PTR -28[rbp]
	mov	rdi, QWORD PTR -8[rbp]
	sub	rdi, QWORD PTR fs:40
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	Read, .-Read
	.section	.rodata
	.align 8
.LC11:
	.string	"/home/ramy/os/producer-consumer-limited/"
	.text
	.globl	Consume
	.type	Consume, @function
Consume:
.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, 112
	mov	QWORD PTR -104[rbp], rdi
	mov	DWORD PTR -108[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, .LC11[rip]
	mov	QWORD PTR -88[rbp], rax
	mov	rax, QWORD PTR -104[rbp]
	mov	QWORD PTR -80[rbp], rax
	mov	rdx, QWORD PTR -80[rbp]
	mov	rcx, QWORD PTR -88[rbp]
	lea	rax, -64[rbp]
	mov	rsi, rcx
	mov	rdi, rax
	call	combine
	lea	rax, -64[rbp]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -72[rbp], rax
	cmp	QWORD PTR -72[rbp], 0
	jne	.L29
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L30
.L29:
	mov	edx, DWORD PTR -108[rbp]
	mov	rax, QWORD PTR -72[rbp]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
.L30:
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	fclose@PLT
	nop
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L31
	call	__stack_chk_fail@PLT
.L31:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	Consume, .-Consume
	.globl	CheckBeforeProducing
	.type	CheckBeforeProducing, @function
CheckBeforeProducing:
.LFB12:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR CurrentIndex[rip]
	mov	edx, DWORD PTR consumed1[rip]
	sub	eax, edx
	cmp	eax, 9
	jle	.L33
	lea	rdi, delay[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_wait@PLT
.L33:
	mov	eax, DWORD PTR CurrentIndex[rip]
	mov	edx, DWORD PTR consumed2[rip]
	sub	eax, edx
	cmp	eax, 9
	jle	.L34
	lea	rdi, delay[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_wait@PLT
.L34:
	mov	eax, DWORD PTR CurrentIndex[rip]
	mov	edx, DWORD PTR consumed3[rip]
	sub	eax, edx
	cmp	eax, 9
	jle	.L35
	lea	rdi, delay[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_wait@PLT
.L35:
	mov	eax, DWORD PTR CurrentIndex[rip]
	mov	edx, DWORD PTR consumed4[rip]
	sub	eax, edx
	cmp	eax, 9
	jle	.L36
	lea	rdi, delay[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_wait@PLT
.L36:
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	CheckBeforeProducing, .-CheckBeforeProducing
	.section	.rodata
.LC12:
	.string	"Producer1 Thread Started!"
	.align 8
.LC13:
	.string	"Producer #1, produced at place %d, value %d\n"
	.align 8
.LC14:
	.string	"Producer 1 Produced Items equals %d\n"
	.text
	.globl	Producer1Thread
	.type	Producer1Thread, @function
Producer1Thread:
.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
	lea	rdi, .LC12[rip]
	call	puts@PLT
	jmp	.L38
.L40:
	mov	eax, 0
	call	CheckBeforeProducing
	mov	eax, 0
	call	Produce
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	Store
	mov	eax, DWORD PTR CurrentIndex[rip]
	lea	ecx, -1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR producer1lastindex[rip], edx
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR producer1lastindex[rip]
	mov	edx, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR produced1[rip]
	add	eax, 1
	mov	DWORD PTR produced1[rip], eax
	mov	eax, DWORD PTR empty[rip]
	sub	eax, 1
	mov	DWORD PTR empty[rip], eax
	mov	eax, DWORD PTR n[rip]
	add	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR n[rip]
	cmp	eax, 1
	jne	.L39
	lea	rdi, delay[rip]
	call	sem_post@PLT
.L39:
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
.L38:
	mov	eax, DWORD PTR produced1[rip]
	cmp	eax, 99999
	jle	.L40
	mov	eax, DWORD PTR produced1[rip]
	mov	esi, eax
	lea	rdi, .LC14[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	Producer1Thread, .-Producer1Thread
	.section	.rodata
.LC15:
	.string	"Producer2 Thread Started!"
	.align 8
.LC16:
	.string	"Producer #2, produced at place %d, value %d\n"
	.align 8
.LC17:
	.string	"Producer 2 Produced Items equals %d\n"
	.text
	.globl	Producer2Thread
	.type	Producer2Thread, @function
Producer2Thread:
.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, 16
	lea	rdi, .LC15[rip]
	call	puts@PLT
	jmp	.L43
.L45:
	mov	eax, 0
	call	CheckBeforeProducing
	mov	eax, 0
	call	Produce
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	Store
	mov	eax, DWORD PTR CurrentIndex[rip]
	lea	ecx, -1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR producer2lastindex[rip], edx
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR producer2lastindex[rip]
	mov	edx, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC16[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR empty[rip]
	sub	eax, 1
	mov	DWORD PTR empty[rip], eax
	mov	eax, DWORD PTR produced2[rip]
	add	eax, 1
	mov	DWORD PTR produced2[rip], eax
	mov	eax, DWORD PTR n[rip]
	add	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR n[rip]
	cmp	eax, 1
	jne	.L44
	lea	rdi, delay[rip]
	call	sem_post@PLT
.L44:
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
.L43:
	mov	eax, DWORD PTR produced2[rip]
	cmp	eax, 99999
	jle	.L45
	mov	eax, DWORD PTR produced2[rip]
	mov	esi, eax
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	Producer2Thread, .-Producer2Thread
	.section	.rodata
.LC18:
	.string	"Producer3 Thread Started!"
	.align 8
.LC19:
	.string	"Producer #3, produced at place %d, value %d\n"
	.align 8
.LC20:
	.string	"Producer 3 Produced Items equals %d\n"
	.text
	.globl	Producer3Thread
	.type	Producer3Thread, @function
Producer3Thread:
.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, 16
	lea	rdi, .LC18[rip]
	call	puts@PLT
	jmp	.L48
.L50:
	mov	eax, 0
	call	CheckBeforeProducing
	mov	eax, 0
	call	Produce
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	Store
	mov	eax, DWORD PTR CurrentIndex[rip]
	lea	ecx, -1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR producer3lastindex[rip], edx
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR producer3lastindex[rip]
	mov	edx, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR produced3[rip]
	add	eax, 1
	mov	DWORD PTR produced3[rip], eax
	mov	eax, DWORD PTR empty[rip]
	sub	eax, 1
	mov	DWORD PTR empty[rip], eax
	mov	eax, DWORD PTR n[rip]
	add	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR n[rip]
	cmp	eax, 1
	jne	.L49
	lea	rdi, delay[rip]
	call	sem_post@PLT
.L49:
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
.L48:
	mov	eax, DWORD PTR produced3[rip]
	cmp	eax, 99999
	jle	.L50
	mov	eax, DWORD PTR produced3[rip]
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.size	Producer3Thread, .-Producer3Thread
	.section	.rodata
.LC21:
	.string	"Producer4 Thread Started!"
	.align 8
.LC22:
	.string	"Producer #4, produced at place %d, value %d\n"
	.align 8
.LC23:
	.string	"Producer 4 Produced Items equals %d\n"
	.text
	.globl	Producer4Thread
	.type	Producer4Thread, @function
Producer4Thread:
.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, 16
	lea	rdi, .LC21[rip]
	call	puts@PLT
	jmp	.L53
.L55:
	mov	eax, 0
	call	CheckBeforeProducing
	mov	eax, 0
	call	Produce
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	Store
	mov	eax, DWORD PTR CurrentIndex[rip]
	lea	ecx, -1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR producer4lastindex[rip], edx
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR producer4lastindex[rip]
	mov	edx, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC22[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR produced4[rip]
	add	eax, 1
	mov	DWORD PTR produced4[rip], eax
	mov	eax, DWORD PTR empty[rip]
	sub	eax, 1
	mov	DWORD PTR empty[rip], eax
	mov	eax, DWORD PTR n[rip]
	add	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR n[rip]
	cmp	eax, 1
	jne	.L54
	lea	rdi, delay[rip]
	call	sem_post@PLT
.L54:
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
.L53:
	mov	eax, DWORD PTR produced4[rip]
	cmp	eax, 99999
	jle	.L55
	mov	eax, DWORD PTR produced4[rip]
	mov	esi, eax
	lea	rdi, .LC23[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE16:
	.size	Producer4Thread, .-Producer4Thread
	.section	.rodata
.LC24:
	.string	"Consumer 1 Thread Started!"
	.align 8
.LC25:
	.string	"Consumer #1, consumed at place %d, value %d\n"
.LC26:
	.string	"consumer1.txt"
	.align 8
.LC27:
	.string	"Consumer 1 Consumed Items is %d\n"
	.text
	.globl	Consumer1Thread
	.type	Consumer1Thread, @function
Consumer1Thread:
.LFB17:
	.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
	lea	rdi, .LC24[rip]
	call	puts@PLT
	jmp	.L58
.L60:
	mov	eax, DWORD PTR n[rip]
	test	eax, eax
	jne	.L59
	lea	rdi, delay[rip]
	call	sem_wait@PLT
.L59:
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	mov	eax, 0
	call	Read
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR n[rip]
	sub	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR consumed1[rip]
	add	eax, 1
	mov	DWORD PTR consumed1[rip], eax
	mov	eax, DWORD PTR ReadIndex[rip]
	lea	edx, -1[rax]
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, edx
	sar	esi, 31
	sub	eax, esi
	mov	ecx, eax
	mov	eax, ecx
	sal	eax, 2
	add	eax, ecx
	add	eax, eax
	sub	edx, eax
	mov	ecx, edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC25[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC26[rip]
	call	Consume
.L58:
	mov	eax, DWORD PTR consumed1[rip]
	cmp	eax, 399999
	jle	.L60
	mov	eax, DWORD PTR consumed1[rip]
	mov	esi, eax
	lea	rdi, .LC27[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE17:
	.size	Consumer1Thread, .-Consumer1Thread
	.section	.rodata
.LC28:
	.string	"Consumer 2 Thread Started!"
	.align 8
.LC29:
	.string	"Consumer #2, consumed at place %d, value %d\n"
.LC30:
	.string	"consumer2.txt"
	.align 8
.LC31:
	.string	"Consumer 2 Consumed Items is %d\n"
	.text
	.globl	Consumer2Thread
	.type	Consumer2Thread, @function
Consumer2Thread:
.LFB18:
	.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
	lea	rdi, .LC28[rip]
	call	puts@PLT
	jmp	.L63
.L65:
	mov	eax, DWORD PTR n[rip]
	test	eax, eax
	jne	.L64
	lea	rdi, delay[rip]
	call	sem_wait@PLT
.L64:
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	mov	eax, 0
	call	Read
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR n[rip]
	sub	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR consumed2[rip]
	add	eax, 1
	mov	DWORD PTR consumed2[rip], eax
	mov	eax, DWORD PTR ReadIndex[rip]
	lea	edx, -1[rax]
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, edx
	sar	esi, 31
	sub	eax, esi
	mov	ecx, eax
	mov	eax, ecx
	sal	eax, 2
	add	eax, ecx
	add	eax, eax
	sub	edx, eax
	mov	ecx, edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC29[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC30[rip]
	call	Consume
.L63:
	mov	eax, DWORD PTR consumed2[rip]
	cmp	eax, 399999
	jle	.L65
	mov	eax, DWORD PTR consumed2[rip]
	mov	esi, eax
	lea	rdi, .LC31[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE18:
	.size	Consumer2Thread, .-Consumer2Thread
	.section	.rodata
.LC32:
	.string	"Consumer 3 Thread Started!"
	.align 8
.LC33:
	.string	"Consumer #3, consumed at place %d, value %d\n"
.LC34:
	.string	"consumer3.txt"
	.align 8
.LC35:
	.string	"Consumer 3 Consumed Items is %d\n"
	.text
	.globl	Consumer3Thread
	.type	Consumer3Thread, @function
Consumer3Thread:
.LFB19:
	.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
	lea	rdi, .LC32[rip]
	call	puts@PLT
	jmp	.L68
.L70:
	mov	eax, DWORD PTR n[rip]
	test	eax, eax
	jne	.L69
	lea	rdi, delay[rip]
	call	sem_wait@PLT
.L69:
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	mov	eax, 0
	call	Read
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR n[rip]
	sub	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR consumed3[rip]
	add	eax, 1
	mov	DWORD PTR consumed3[rip], eax
	mov	eax, DWORD PTR ReadIndex[rip]
	lea	edx, -1[rax]
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, edx
	sar	esi, 31
	sub	eax, esi
	mov	ecx, eax
	mov	eax, ecx
	sal	eax, 2
	add	eax, ecx
	add	eax, eax
	sub	edx, eax
	mov	ecx, edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC33[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC34[rip]
	call	Consume
.L68:
	mov	eax, DWORD PTR consumed3[rip]
	cmp	eax, 399999
	jle	.L70
	mov	eax, DWORD PTR consumed3[rip]
	mov	esi, eax
	lea	rdi, .LC35[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE19:
	.size	Consumer3Thread, .-Consumer3Thread
	.section	.rodata
.LC36:
	.string	"Consumer 4 Thread Started!"
	.align 8
.LC37:
	.string	"Consumer #4, consumed at place %d, value %d\n"
.LC38:
	.string	"consumer4.txt"
	.align 8
.LC39:
	.string	"Consumer 4 Consumed Items is %d\n"
	.text
	.globl	Consumer4Thread
	.type	Consumer4Thread, @function
Consumer4Thread:
.LFB20:
	.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
	lea	rdi, .LC36[rip]
	call	puts@PLT
	jmp	.L73
.L75:
	mov	eax, DWORD PTR n[rip]
	test	eax, eax
	jne	.L74
	lea	rdi, delay[rip]
	call	sem_wait@PLT
.L74:
	lea	rdi, semaphore[rip]
	call	sem_wait@PLT
	mov	eax, 0
	call	Read
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR n[rip]
	sub	eax, 1
	mov	DWORD PTR n[rip], eax
	mov	eax, DWORD PTR consumed4[rip]
	add	eax, 1
	mov	DWORD PTR consumed4[rip], eax
	mov	eax, DWORD PTR ReadIndex[rip]
	lea	edx, -1[rax]
	movsx	rax, edx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, edx
	sar	esi, 31
	sub	eax, esi
	mov	ecx, eax
	mov	eax, ecx
	sal	eax, 2
	add	eax, ecx
	add	eax, eax
	sub	edx, eax
	mov	ecx, edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC37[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
	lea	rdi, block[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC38[rip]
	call	Consume
.L73:
	mov	eax, DWORD PTR consumed4[rip]
	cmp	eax, 399999
	jle	.L75
	mov	eax, DWORD PTR consumed4[rip]
	mov	esi, eax
	lea	rdi, .LC39[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE20:
	.size	Consumer4Thread, .-Consumer4Thread
	.globl	MonitorThread
	.type	MonitorThread, @function
MonitorThread:
.LFB21:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
.L80:
	mov	eax, DWORD PTR CurrentIndex[rip]
	cmp	eax, 10000
	je	.L82
	jmp	.L80
.L82:
	nop
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE21:
	.size	MonitorThread, .-MonitorThread
	.globl	main
	.type	main, @function
main:
.LFB22:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 96
	mov	DWORD PTR -84[rbp], edi
	mov	QWORD PTR -96[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, 0
	call	CleanUp
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	mov	edx, 0
	mov	esi, 0
	lea	rdi, semaphore[rip]
	call	sem_init@PLT
	mov	edx, 0
	mov	esi, 0
	lea	rdi, delay[rip]
	call	sem_init@PLT
	mov	edx, 0
	mov	esi, 0
	lea	rdi, block[rip]
	call	sem_init@PLT
	lea	rdi, semaphore[rip]
	call	sem_post@PLT
	lea	rax, -40[rbp]
	mov	ecx, 0
	lea	rdx, Producer1Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -32[rbp]
	mov	ecx, 0
	lea	rdx, Producer2Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, Producer3Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -16[rbp]
	mov	ecx, 0
	lea	rdx, Producer4Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -72[rbp]
	mov	ecx, 0
	lea	rdx, Consumer1Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -64[rbp]
	mov	ecx, 0
	lea	rdx, Consumer2Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -56[rbp]
	mov	ecx, 0
	lea	rdx, Consumer3Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -48[rbp]
	mov	ecx, 0
	lea	rdx, Consumer4Thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	rax, QWORD PTR -40[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -32[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -72[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -48[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	.L85
	call	__stack_chk_fail@PLT
.L85:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE22:
	.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	"188426.c"
	.text
	.global	ARRAY_SIZE
	.section	.rodata
	.align	2
	.type	ARRAY_SIZE, %object
	.size	ARRAY_SIZE, 4
ARRAY_SIZE:
	.word	10
	.comm	data_arr,40,4
	.global	CurrentIndex
	.bss
	.align	2
	.type	CurrentIndex, %object
	.size	CurrentIndex, 4
CurrentIndex:
	.space	4
	.global	ReadIndex
	.align	2
	.type	ReadIndex, %object
	.size	ReadIndex, 4
ReadIndex:
	.space	4
	.global	lastGenerated
	.align	2
	.type	lastGenerated, %object
	.size	lastGenerated, 4
lastGenerated:
	.space	4
	.comm	semaphore,16,4
	.comm	delay,16,4
	.comm	block,16,4
	.comm	mutex,24,4
	.global	n
	.align	2
	.type	n, %object
	.size	n, 4
n:
	.space	4
	.global	empty
	.data
	.align	2
	.type	empty, %object
	.size	empty, 4
empty:
	.word	10
	.global	consumed1
	.bss
	.align	2
	.type	consumed1, %object
	.size	consumed1, 4
consumed1:
	.space	4
	.global	consumed2
	.align	2
	.type	consumed2, %object
	.size	consumed2, 4
consumed2:
	.space	4
	.global	consumed3
	.align	2
	.type	consumed3, %object
	.size	consumed3, 4
consumed3:
	.space	4
	.global	consumed4
	.align	2
	.type	consumed4, %object
	.size	consumed4, 4
consumed4:
	.space	4
	.global	produced1
	.align	2
	.type	produced1, %object
	.size	produced1, 4
produced1:
	.space	4
	.global	produced2
	.align	2
	.type	produced2, %object
	.size	produced2, 4
produced2:
	.space	4
	.global	produced3
	.align	2
	.type	produced3, %object
	.size	produced3, 4
produced3:
	.space	4
	.global	produced4
	.align	2
	.type	produced4, %object
	.size	produced4, 4
produced4:
	.space	4
	.global	producer1lastindex
	.align	2
	.type	producer1lastindex, %object
	.size	producer1lastindex, 4
producer1lastindex:
	.space	4
	.global	producer2lastindex
	.align	2
	.type	producer2lastindex, %object
	.size	producer2lastindex, 4
producer2lastindex:
	.space	4
	.global	producer3lastindex
	.align	2
	.type	producer3lastindex, %object
	.size	producer3lastindex, 4
producer3lastindex:
	.space	4
	.global	producer4lastindex
	.align	2
	.type	producer4lastindex, %object
	.size	producer4lastindex, 4
producer4lastindex:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"w\000"
	.align	2
.LC1:
	.ascii	"/home/ramy/os/producer-consumer-limited/producer1.t"
	.ascii	"xt\000"
	.align	2
.LC2:
	.ascii	"/home/ramy/os/producer-consumer-limited/consumer1.t"
	.ascii	"xt\000"
	.align	2
.LC3:
	.ascii	"/home/ramy/os/producer-consumer-limited/consumer2.t"
	.ascii	"xt\000"
	.align	2
.LC4:
	.ascii	"/home/ramy/os/producer-consumer-limited/consumer3.t"
	.ascii	"xt\000"
	.align	2
.LC5:
	.ascii	"/home/ramy/os/producer-consumer-limited/consumer4.t"
	.ascii	"xt\000"
	.align	2
.LC6:
	.ascii	"All files are clean now!\000"
	.text
	.align	2
	.global	CleanUp
	.syntax unified
	.arm
	.fpu softvfp
	.type	CleanUp, %function
CleanUp:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r1, .L2
	ldr	r0, .L2+4
	bl	fopen
	mov	r3, r0
	mov	r0, r3
	bl	fclose
	ldr	r1, .L2
	ldr	r0, .L2+8
	bl	fopen
	mov	r3, r0
	mov	r0, r3
	bl	fclose
	ldr	r1, .L2
	ldr	r0, .L2+12
	bl	fopen
	mov	r3, r0
	mov	r0, r3
	bl	fclose
	ldr	r1, .L2
	ldr	r0, .L2+16
	bl	fopen
	mov	r3, r0
	mov	r0, r3
	bl	fclose
	ldr	r1, .L2
	ldr	r0, .L2+20
	bl	fopen
	mov	r3, r0
	mov	r0, r3
	bl	fclose
	ldr	r0, .L2+24
	bl	puts
	nop
	mov	r0, r3
	pop	{fp, pc}
.L3:
	.align	2
.L2:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	CleanUp, .-CleanUp
	.section	.rodata
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	combine
	.syntax unified
	.arm
	.fpu softvfp
	.type	combine, %function
combine:
	@ 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, #-24]
	str	r1, [fp, #-28]
	str	r2, [fp, #-32]
	ldr	r3, .L16
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L5
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	bne	.L5
	ldr	r3, [fp, #-24]
	mov	r2, #0
	strb	r2, [r3]
	b	.L6
.L5:
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	beq	.L7
	ldr	r3, [fp, #-32]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L8
.L7:
	ldr	r1, [fp, #-28]
	ldr	r0, [fp, #-24]
	bl	strcpy
	b	.L6
.L8:
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L9
	ldr	r3, [fp, #-28]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L10
.L9:
	ldr	r1, [fp, #-32]
	ldr	r0, [fp, #-24]
	bl	strcpy
	b	.L6
.L10:
	mov	r3, #47
	strh	r3, [fp, #-12]	@ movhi
	ldr	r3, [fp, #-28]
	str	r3, [fp, #-20]
	b	.L11
.L12:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L11:
	ldr	r3, [fp, #-20]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L12
	mov	r3, #0
	str	r3, [fp, #-16]
	sub	r3, fp, #12
	mov	r1, r3
	ldr	r0, [fp, #-20]
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	mov	r3, #1
	str	r3, [fp, #-16]
.L13:
	ldr	r1, [fp, #-28]
	ldr	r0, [fp, #-24]
	bl	strcpy
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	beq	.L14
	sub	r3, fp, #12
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	strcat
.L14:
	ldr	r1, [fp, #-32]
	ldr	r0, [fp, #-24]
	bl	strcat
.L6:
	nop
	ldr	r3, .L16
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L15
	bl	__stack_chk_fail
.L15:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	.LC7
	.size	combine, .-combine
	.align	2
	.global	Produce
	.syntax unified
	.arm
	.fpu softvfp
	.type	Produce, %function
Produce:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r3, #0
	str	r3, [fp, #-8]
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	bl	rand
	mov	r2, r0
	ldr	r3, .L22
	smull	r1, r3, r2, r3
	asr	r1, r3, #6
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #3
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	b	.L19
.L20:
	bl	rand
	mov	r2, r0
	ldr	r3, .L22
	smull	r1, r3, r2, r3
	asr	r1, r3, #6
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #5
	sub	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #3
	sub	r3, r2, r3
	str	r3, [fp, #-8]
.L19:
	ldr	r3, .L22+4
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	beq	.L20
	ldr	r2, .L22+4
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	274877907
	.word	lastGenerated
	.size	Produce, .-Produce
	.section	.rodata
	.align	2
.LC8:
	.ascii	"a\000"
	.align	2
.LC9:
	.ascii	"failed to open the file\000"
	.align	2
.LC10:
	.ascii	"%d\012\000"
	.text
	.align	2
	.global	Store
	.syntax unified
	.arm
	.fpu softvfp
	.type	Store, %function
Store:
	@ 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	r1, .L27
	ldr	r0, .L27+4
	bl	fopen
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L25
	ldr	r0, .L27+8
	bl	printf
	b	.L26
.L25:
	ldr	r2, [fp, #-16]
	ldr	r1, .L27+12
	ldr	r0, [fp, #-8]
	bl	fprintf
.L26:
	ldr	r0, [fp, #-8]
	bl	fclose
	ldr	r3, .L27+16
	ldr	r1, [r3]
	ldr	r3, .L27+20
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r1, .L27+24
	ldr	r3, [fp, #-16]
	str	r3, [r1, r2, lsl #2]
	ldr	r3, .L27+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L27+16
	str	r3, [r2]
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC8
	.word	.LC1
	.word	.LC9
	.word	.LC10
	.word	CurrentIndex
	.word	1717986919
	.word	data_arr
	.size	Store, .-Store
	.section	.rodata
	.align	2
.LC11:
	.ascii	"r\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	Read
	.syntax unified
	.arm
	.fpu softvfp
	.type	Read, %function
Read:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	ldr	r3, .L36
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r1, .L36+4
	ldr	r0, .L36+8
	bl	fopen
	str	r0, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	beq	.L30
	b	.L31
.L33:
	ldr	r3, .L36+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	bne	.L32
	ldr	r0, [fp, #-24]
	bl	fclose
	b	.L31
.L32:
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L31:
	sub	r3, fp, #16
	ldr	r2, [fp, #-24]
	mov	r1, #5
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L33
.L30:
	ldr	r3, .L36+12
	ldr	r1, [r3]
	ldr	r3, .L36+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L36+20
	ldr	r3, [r3, r2, lsl #2]
	str	r3, [fp, #-20]
	ldr	r3, .L36+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L36+12
	str	r3, [r2]
	ldr	r3, [fp, #-20]
	ldr	r2, .L36
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L35
	bl	__stack_chk_fail
.L35:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L37:
	.align	2
.L36:
	.word	.LC12
	.word	.LC11
	.word	.LC1
	.word	ReadIndex
	.word	1717986919
	.word	data_arr
	.size	Read, .-Read
	.section	.rodata
	.align	2
.LC13:
	.ascii	"/home/ramy/os/producer-consumer-limited/\000"
	.align	2
.LC14:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	Consume
	.syntax unified
	.arm
	.fpu softvfp
	.type	Consume, %function
Consume:
	@ args = 0, pretend = 0, frame = 72
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #72
	str	r0, [fp, #-72]
	str	r1, [fp, #-76]
	ldr	r3, .L42
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L42+4
	str	r3, [fp, #-68]
	ldr	r3, [fp, #-72]
	str	r3, [fp, #-64]
	sub	r3, fp, #56
	ldr	r2, [fp, #-64]
	ldr	r1, [fp, #-68]
	mov	r0, r3
	bl	combine
	sub	r3, fp, #56
	ldr	r1, .L42+8
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-60]
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	bne	.L39
	ldr	r0, .L42+12
	bl	printf
	b	.L40
.L39:
	ldr	r2, [fp, #-76]
	ldr	r1, .L42+16
	ldr	r0, [fp, #-60]
	bl	fprintf
.L40:
	ldr	r0, [fp, #-60]
	bl	fclose
	nop
	ldr	r2, .L42
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L41
	bl	__stack_chk_fail
.L41:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L43:
	.align	2
.L42:
	.word	.LC14
	.word	.LC13
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.size	Consume, .-Consume
	.align	2
	.global	CheckBeforeProducing
	.syntax unified
	.arm
	.fpu softvfp
	.type	CheckBeforeProducing, %function
CheckBeforeProducing:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L49
	ldr	r2, [r3]
	ldr	r3, .L49+4
	ldr	r3, [r3]
	sub	r3, r2, r3
	cmp	r3, #9
	ble	.L45
	ldr	r0, .L49+8
	bl	sem_post
	ldr	r0, .L49+12
	bl	sem_wait
.L45:
	ldr	r3, .L49
	ldr	r2, [r3]
	ldr	r3, .L49+16
	ldr	r3, [r3]
	sub	r3, r2, r3
	cmp	r3, #9
	ble	.L46
	ldr	r0, .L49+8
	bl	sem_post
	ldr	r0, .L49+12
	bl	sem_wait
.L46:
	ldr	r3, .L49
	ldr	r2, [r3]
	ldr	r3, .L49+20
	ldr	r3, [r3]
	sub	r3, r2, r3
	cmp	r3, #9
	ble	.L47
	ldr	r0, .L49+8
	bl	sem_post
	ldr	r0, .L49+12
	bl	sem_wait
.L47:
	ldr	r3, .L49
	ldr	r2, [r3]
	ldr	r3, .L49+24
	ldr	r3, [r3]
	sub	r3, r2, r3
	cmp	r3, #9
	ble	.L48
	ldr	r0, .L49+8
	bl	sem_post
	ldr	r0, .L49+12
	bl	sem_wait
.L48:
	nop
	mov	r0, r3
	pop	{fp, pc}
.L50:
	.align	2
.L49:
	.word	CurrentIndex
	.word	consumed1
	.word	delay
	.word	block
	.word	consumed2
	.word	consumed3
	.word	consumed4
	.size	CheckBeforeProducing, .-CheckBeforeProducing
	.section	.rodata
	.align	2
.LC15:
	.ascii	"Producer1 Thread Started!\000"
	.align	2
.LC16:
	.ascii	"Producer #1, produced at place %d, value %d\012\000"
	.align	2
.LC17:
	.ascii	"Producer 1 Produced Items equals %d\012\000"
	.text
	.align	2
	.global	Producer1Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Producer1Thread, %function
Producer1Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L56
	bl	puts
	b	.L52
.L54:
	bl	CheckBeforeProducing
	bl	Produce
	str	r0, [fp, #-8]
	ldr	r0, .L56+4
	bl	sem_wait
	ldr	r0, .L56+8
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	Store
	ldr	r3, .L56+12
	ldr	r3, [r3]
	sub	r1, r3, #1
	ldr	r3, .L56+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L56+20
	str	r2, [r3]
	ldr	r0, .L56+8
	bl	pthread_mutex_unlock
	ldr	r3, .L56+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	mov	r1, r3
	ldr	r0, .L56+24
	bl	printf
	ldr	r3, .L56+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L56+28
	str	r3, [r2]
	ldr	r3, .L56+32
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L56+32
	str	r3, [r2]
	ldr	r3, .L56+36
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L56+36
	str	r3, [r2]
	ldr	r3, .L56+36
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L53
	ldr	r0, .L56+40
	bl	sem_post
.L53:
	ldr	r0, .L56+4
	bl	sem_post
.L52:
	ldr	r3, .L56+28
	ldr	r3, [r3]
	ldr	r2, .L56+44
	cmp	r3, r2
	blt	.L54
	ldr	r3, .L56+28
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L56+48
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L57:
	.align	2
.L56:
	.word	.LC15
	.word	semaphore
	.word	mutex
	.word	CurrentIndex
	.word	1717986919
	.word	producer1lastindex
	.word	.LC16
	.word	produced1
	.word	empty
	.word	n
	.word	delay
	.word	100000
	.word	.LC17
	.size	Producer1Thread, .-Producer1Thread
	.section	.rodata
	.align	2
.LC18:
	.ascii	"Producer2 Thread Started!\000"
	.align	2
.LC19:
	.ascii	"Producer #2, produced at place %d, value %d\012\000"
	.align	2
.LC20:
	.ascii	"Producer 2 Produced Items equals %d\012\000"
	.text
	.align	2
	.global	Producer2Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Producer2Thread, %function
Producer2Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L63
	bl	puts
	b	.L59
.L61:
	bl	CheckBeforeProducing
	bl	Produce
	str	r0, [fp, #-8]
	ldr	r0, .L63+4
	bl	sem_wait
	ldr	r0, .L63+8
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	Store
	ldr	r3, .L63+12
	ldr	r3, [r3]
	sub	r1, r3, #1
	ldr	r3, .L63+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L63+20
	str	r2, [r3]
	ldr	r0, .L63+8
	bl	pthread_mutex_unlock
	ldr	r3, .L63+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	mov	r1, r3
	ldr	r0, .L63+24
	bl	printf
	ldr	r3, .L63+28
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L63+28
	str	r3, [r2]
	ldr	r3, .L63+32
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L63+32
	str	r3, [r2]
	ldr	r3, .L63+36
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L63+36
	str	r3, [r2]
	ldr	r3, .L63+36
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L60
	ldr	r0, .L63+40
	bl	sem_post
.L60:
	ldr	r0, .L63+4
	bl	sem_post
.L59:
	ldr	r3, .L63+32
	ldr	r3, [r3]
	ldr	r2, .L63+44
	cmp	r3, r2
	blt	.L61
	ldr	r3, .L63+32
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L63+48
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L64:
	.align	2
.L63:
	.word	.LC18
	.word	semaphore
	.word	mutex
	.word	CurrentIndex
	.word	1717986919
	.word	producer2lastindex
	.word	.LC19
	.word	empty
	.word	produced2
	.word	n
	.word	delay
	.word	100000
	.word	.LC20
	.size	Producer2Thread, .-Producer2Thread
	.section	.rodata
	.align	2
.LC21:
	.ascii	"Producer3 Thread Started!\000"
	.align	2
.LC22:
	.ascii	"Producer #3, produced at place %d, value %d\012\000"
	.align	2
.LC23:
	.ascii	"Producer 3 Produced Items equals %d\012\000"
	.text
	.align	2
	.global	Producer3Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Producer3Thread, %function
Producer3Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L70
	bl	puts
	b	.L66
.L68:
	bl	CheckBeforeProducing
	bl	Produce
	str	r0, [fp, #-8]
	ldr	r0, .L70+4
	bl	sem_wait
	ldr	r0, .L70+8
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	Store
	ldr	r3, .L70+12
	ldr	r3, [r3]
	sub	r1, r3, #1
	ldr	r3, .L70+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L70+20
	str	r2, [r3]
	ldr	r0, .L70+8
	bl	pthread_mutex_unlock
	ldr	r3, .L70+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	mov	r1, r3
	ldr	r0, .L70+24
	bl	printf
	ldr	r3, .L70+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L70+28
	str	r3, [r2]
	ldr	r3, .L70+32
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L70+32
	str	r3, [r2]
	ldr	r3, .L70+36
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L70+36
	str	r3, [r2]
	ldr	r3, .L70+36
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L67
	ldr	r0, .L70+40
	bl	sem_post
.L67:
	ldr	r0, .L70+4
	bl	sem_post
.L66:
	ldr	r3, .L70+28
	ldr	r3, [r3]
	ldr	r2, .L70+44
	cmp	r3, r2
	blt	.L68
	ldr	r3, .L70+28
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L70+48
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L71:
	.align	2
.L70:
	.word	.LC21
	.word	semaphore
	.word	mutex
	.word	CurrentIndex
	.word	1717986919
	.word	producer3lastindex
	.word	.LC22
	.word	produced3
	.word	empty
	.word	n
	.word	delay
	.word	100000
	.word	.LC23
	.size	Producer3Thread, .-Producer3Thread
	.section	.rodata
	.align	2
.LC24:
	.ascii	"Producer4 Thread Started!\000"
	.align	2
.LC25:
	.ascii	"Producer #4, produced at place %d, value %d\012\000"
	.align	2
.LC26:
	.ascii	"Producer 4 Produced Items equals %d\012\000"
	.text
	.align	2
	.global	Producer4Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Producer4Thread, %function
Producer4Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L77
	bl	puts
	b	.L73
.L75:
	bl	CheckBeforeProducing
	bl	Produce
	str	r0, [fp, #-8]
	ldr	r0, .L77+4
	bl	sem_wait
	ldr	r0, .L77+8
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	Store
	ldr	r3, .L77+12
	ldr	r3, [r3]
	sub	r1, r3, #1
	ldr	r3, .L77+16
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L77+20
	str	r2, [r3]
	ldr	r0, .L77+8
	bl	pthread_mutex_unlock
	ldr	r3, .L77+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	mov	r1, r3
	ldr	r0, .L77+24
	bl	printf
	ldr	r3, .L77+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L77+28
	str	r3, [r2]
	ldr	r3, .L77+32
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L77+32
	str	r3, [r2]
	ldr	r3, .L77+36
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L77+36
	str	r3, [r2]
	ldr	r3, .L77+36
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L74
	ldr	r0, .L77+40
	bl	sem_post
.L74:
	ldr	r0, .L77+4
	bl	sem_post
.L73:
	ldr	r3, .L77+28
	ldr	r3, [r3]
	ldr	r2, .L77+44
	cmp	r3, r2
	blt	.L75
	ldr	r3, .L77+28
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L77+48
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L78:
	.align	2
.L77:
	.word	.LC24
	.word	semaphore
	.word	mutex
	.word	CurrentIndex
	.word	1717986919
	.word	producer4lastindex
	.word	.LC25
	.word	produced4
	.word	empty
	.word	n
	.word	delay
	.word	100000
	.word	.LC26
	.size	Producer4Thread, .-Producer4Thread
	.section	.rodata
	.align	2
.LC27:
	.ascii	"Consumer 1 Thread Started!\000"
	.align	2
.LC28:
	.ascii	"Consumer #1, consumed at place %d, value %d\012\000"
	.align	2
.LC29:
	.ascii	"consumer1.txt\000"
	.align	2
.LC30:
	.ascii	"Consumer 1 Consumed Items is %d\012\000"
	.text
	.align	2
	.global	Consumer1Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Consumer1Thread, %function
Consumer1Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L84
	bl	puts
	b	.L80
.L82:
	ldr	r3, .L84+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L81
	ldr	r0, .L84+8
	bl	sem_wait
.L81:
	ldr	r0, .L84+12
	bl	sem_wait
	bl	Read
	str	r0, [fp, #-8]
	ldr	r3, .L84+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L84+4
	str	r3, [r2]
	ldr	r3, .L84+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L84+16
	str	r3, [r2]
	ldr	r3, .L84+20
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, .L84+24
	smull	r1, r3, r2, r3
	asr	r1, r3, #2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r1, r2, r3
	ldr	r2, [fp, #-8]
	ldr	r0, .L84+28
	bl	printf
	ldr	r0, .L84+12
	bl	sem_post
	ldr	r0, .L84+32
	bl	sem_post
	ldr	r1, [fp, #-8]
	ldr	r0, .L84+36
	bl	Consume
.L80:
	ldr	r3, .L84+16
	ldr	r3, [r3]
	ldr	r2, .L84+40
	cmp	r3, r2
	blt	.L82
	ldr	r3, .L84+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L84+44
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L85:
	.align	2
.L84:
	.word	.LC27
	.word	n
	.word	delay
	.word	semaphore
	.word	consumed1
	.word	ReadIndex
	.word	1717986919
	.word	.LC28
	.word	block
	.word	.LC29
	.word	400000
	.word	.LC30
	.size	Consumer1Thread, .-Consumer1Thread
	.section	.rodata
	.align	2
.LC31:
	.ascii	"Consumer 2 Thread Started!\000"
	.align	2
.LC32:
	.ascii	"Consumer #2, consumed at place %d, value %d\012\000"
	.align	2
.LC33:
	.ascii	"consumer2.txt\000"
	.align	2
.LC34:
	.ascii	"Consumer 2 Consumed Items is %d\012\000"
	.text
	.align	2
	.global	Consumer2Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Consumer2Thread, %function
Consumer2Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L91
	bl	puts
	b	.L87
.L89:
	ldr	r3, .L91+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L88
	ldr	r0, .L91+8
	bl	sem_wait
.L88:
	ldr	r0, .L91+12
	bl	sem_wait
	bl	Read
	str	r0, [fp, #-8]
	ldr	r3, .L91+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L91+4
	str	r3, [r2]
	ldr	r3, .L91+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L91+16
	str	r3, [r2]
	ldr	r3, .L91+20
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, .L91+24
	smull	r1, r3, r2, r3
	asr	r1, r3, #2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r1, r2, r3
	ldr	r2, [fp, #-8]
	ldr	r0, .L91+28
	bl	printf
	ldr	r0, .L91+12
	bl	sem_post
	ldr	r0, .L91+32
	bl	sem_post
	ldr	r1, [fp, #-8]
	ldr	r0, .L91+36
	bl	Consume
.L87:
	ldr	r3, .L91+16
	ldr	r3, [r3]
	ldr	r2, .L91+40
	cmp	r3, r2
	blt	.L89
	ldr	r3, .L91+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L91+44
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L92:
	.align	2
.L91:
	.word	.LC31
	.word	n
	.word	delay
	.word	semaphore
	.word	consumed2
	.word	ReadIndex
	.word	1717986919
	.word	.LC32
	.word	block
	.word	.LC33
	.word	400000
	.word	.LC34
	.size	Consumer2Thread, .-Consumer2Thread
	.section	.rodata
	.align	2
.LC35:
	.ascii	"Consumer 3 Thread Started!\000"
	.align	2
.LC36:
	.ascii	"Consumer #3, consumed at place %d, value %d\012\000"
	.align	2
.LC37:
	.ascii	"consumer3.txt\000"
	.align	2
.LC38:
	.ascii	"Consumer 3 Consumed Items is %d\012\000"
	.text
	.align	2
	.global	Consumer3Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Consumer3Thread, %function
Consumer3Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L98
	bl	puts
	b	.L94
.L96:
	ldr	r3, .L98+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L95
	ldr	r0, .L98+8
	bl	sem_wait
.L95:
	ldr	r0, .L98+12
	bl	sem_wait
	bl	Read
	str	r0, [fp, #-8]
	ldr	r3, .L98+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L98+4
	str	r3, [r2]
	ldr	r3, .L98+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L98+16
	str	r3, [r2]
	ldr	r3, .L98+20
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, .L98+24
	smull	r1, r3, r2, r3
	asr	r1, r3, #2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r1, r2, r3
	ldr	r2, [fp, #-8]
	ldr	r0, .L98+28
	bl	printf
	ldr	r0, .L98+12
	bl	sem_post
	ldr	r0, .L98+32
	bl	sem_post
	ldr	r1, [fp, #-8]
	ldr	r0, .L98+36
	bl	Consume
.L94:
	ldr	r3, .L98+16
	ldr	r3, [r3]
	ldr	r2, .L98+40
	cmp	r3, r2
	blt	.L96
	ldr	r3, .L98+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L98+44
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L99:
	.align	2
.L98:
	.word	.LC35
	.word	n
	.word	delay
	.word	semaphore
	.word	consumed3
	.word	ReadIndex
	.word	1717986919
	.word	.LC36
	.word	block
	.word	.LC37
	.word	400000
	.word	.LC38
	.size	Consumer3Thread, .-Consumer3Thread
	.section	.rodata
	.align	2
.LC39:
	.ascii	"Consumer 4 Thread Started!\000"
	.align	2
.LC40:
	.ascii	"Consumer #4, consumed at place %d, value %d\012\000"
	.align	2
.LC41:
	.ascii	"consumer4.txt\000"
	.align	2
.LC42:
	.ascii	"Consumer 4 Consumed Items is %d\012\000"
	.text
	.align	2
	.global	Consumer4Thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	Consumer4Thread, %function
Consumer4Thread:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L105
	bl	puts
	b	.L101
.L103:
	ldr	r3, .L105+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L102
	ldr	r0, .L105+8
	bl	sem_wait
.L102:
	ldr	r0, .L105+12
	bl	sem_wait
	bl	Read
	str	r0, [fp, #-8]
	ldr	r3, .L105+4
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L105+4
	str	r3, [r2]
	ldr	r3, .L105+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L105+16
	str	r3, [r2]
	ldr	r3, .L105+20
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, .L105+24
	smull	r1, r3, r2, r3
	asr	r1, r3, #2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r1, r2, r3
	ldr	r2, [fp, #-8]
	ldr	r0, .L105+28
	bl	printf
	ldr	r0, .L105+12
	bl	sem_post
	ldr	r0, .L105+32
	bl	sem_post
	ldr	r1, [fp, #-8]
	ldr	r0, .L105+36
	bl	Consume
.L101:
	ldr	r3, .L105+16
	ldr	r3, [r3]
	ldr	r2, .L105+40
	cmp	r3, r2
	blt	.L103
	ldr	r3, .L105+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L105+44
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L106:
	.align	2
.L105:
	.word	.LC39
	.word	n
	.word	delay
	.word	semaphore
	.word	consumed4
	.word	ReadIndex
	.word	1717986919
	.word	.LC40
	.word	block
	.word	.LC41
	.word	400000
	.word	.LC42
	.size	Consumer4Thread, .-Consumer4Thread
	.align	2
	.global	MonitorThread
	.syntax unified
	.arm
	.fpu softvfp
	.type	MonitorThread, %function
MonitorThread:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
.L110:
	ldr	r3, .L113
	ldr	r3, [r3]
	ldr	r2, .L113+4
	cmp	r3, r2
	beq	.L112
	b	.L110
.L112:
	nop
	nop
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L114:
	.align	2
.L113:
	.word	CurrentIndex
	.word	10000
	.size	MonitorThread, .-MonitorThread
	.section	.rodata
	.align	2
.LC43:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	ldr	r3, .L118
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	CleanUp
	mov	r1, #0
	ldr	r0, .L118+4
	bl	pthread_mutex_init
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L118+8
	bl	sem_init
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L118+12
	bl	sem_init
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L118+16
	bl	sem_init
	ldr	r0, .L118+8
	bl	sem_post
	sub	r0, fp, #24
	mov	r3, #0
	ldr	r2, .L118+20
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #20
	mov	r3, #0
	ldr	r2, .L118+24
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #16
	mov	r3, #0
	ldr	r2, .L118+28
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #12
	mov	r3, #0
	ldr	r2, .L118+32
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #40
	mov	r3, #0
	ldr	r2, .L118+36
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #36
	mov	r3, #0
	ldr	r2, .L118+40
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #32
	mov	r3, #0
	ldr	r2, .L118+44
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #28
	mov	r3, #0
	ldr	r2, .L118+48
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-24]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-20]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-16]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-40]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-36]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-32]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-28]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, #0
	ldr	r2, .L118
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L117
	bl	__stack_chk_fail
.L117:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L119:
	.align	2
.L118:
	.word	.LC43
	.word	mutex
	.word	semaphore
	.word	delay
	.word	block
	.word	Producer1Thread
	.word	Producer2Thread
	.word	Producer3Thread
	.word	Producer4Thread
	.word	Consumer1Thread
	.word	Consumer2Thread
	.word	Consumer3Thread
	.word	Consumer4Thread
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
