	.file	"867317.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"/wolne"
.LC1:
	.string	"/zajete"
.LC2:
	.string	"/buf_gl"
.LC3:
	.string	"/suma_produktow"
	.align 8
.LC4:
	.string	"Nie mozna aktywowac konsumenta, dopoki producent nie rozpocznie pracy"
.LC5:
	.string	"/Sp1"
.LC6:
	.string	"/Sp2"
.LC7:
	.string	"/Sw"
.LC8:
	.string	"/Sz"
.LC9:
	.string	"sem_open_Sp1\n"
.LC10:
	.string	"sem_open_Sp2\n"
.LC11:
	.string	"sem_open_Sw\n"
.LC12:
	.string	"sem_open_Sz\n"
	.align 8
.LC13:
	.string	"Kosument: %d korzysta z produktu: %d na miejscu: %d\n"
	.align 8
.LC14:
	.string	"Konsument: %d zakonczyl prace\n"
	.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
	add	rsp, -128
	mov	DWORD PTR -116[rbp], edi
	mov	QWORD PTR -128[rbp], rsi
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	call	getpid@PLT
	mov	DWORD PTR -100[rbp], eax
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC0[rip]
	call	shm_open@PLT
	mov	DWORD PTR -96[rbp], eax
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC1[rip]
	call	shm_open@PLT
	mov	DWORD PTR -92[rbp], eax
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC2[rip]
	call	shm_open@PLT
	mov	DWORD PTR -88[rbp], eax
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC3[rip]
	call	shm_open@PLT
	mov	DWORD PTR -84[rbp], eax
	mov	eax, DWORD PTR -96[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 48
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -64[rbp], rax
	mov	eax, DWORD PTR -92[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 48
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -56[rbp], rax
	mov	eax, DWORD PTR -88[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 40
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -48[rbp], rax
	mov	eax, DWORD PTR -84[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 4
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -48[rbp], -1
	je	.L2
	cmp	QWORD PTR -56[rbp], -1
	je	.L2
	cmp	QWORD PTR -64[rbp], -1
	je	.L2
	cmp	QWORD PTR -40[rbp], -1
	jne	.L3
.L2:
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	ecx, 1
	mov	edx, 384
	mov	esi, 66
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -32[rbp], rax
	mov	ecx, 1
	mov	edx, 384
	mov	esi, 66
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -24[rbp], rax
	mov	ecx, 10
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	ecx, 0
	mov	edx, 384
	mov	esi, 2
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -32[rbp], 0
	jne	.L4
	lea	rdi, .LC9[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	cmp	QWORD PTR -24[rbp], 0
	jne	.L5
	lea	rdi, .LC10[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	cmp	QWORD PTR -16[rbp], 0
	jne	.L6
	lea	rdi, .LC11[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L8
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	eax, DWORD PTR 44[rax]
	mov	DWORD PTR -80[rbp], eax
	mov	rax, QWORD PTR -56[rbp]
	add	rax, 44
	mov	eax, DWORD PTR [rax]
	lea	ecx, 1[rax]
	mov	rax, QWORD PTR -56[rbp]
	lea	rsi, 44[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	edi, ecx
	sar	edi, 31
	sub	eax, edi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR [rsi], edx
	mov	eax, DWORD PTR -80[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -76[rbp], eax
	mov	eax, DWORD PTR -80[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -56[rbp]
	add	rax, rdx
	mov	DWORD PTR [rax], -1
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1431655766
	shr	rdx, 32
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	ecx, edx
	add	ecx, ecx
	add	ecx, edx
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 3[rdx]
	mov	edi, eax
	call	sleep@PLT
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -48[rbp]
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -72[rbp], eax
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 44[rax]
	mov	DWORD PTR -68[rbp], eax
	mov	rax, QWORD PTR -64[rbp]
	add	rax, 44
	mov	eax, DWORD PTR [rax]
	lea	ecx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	lea	rsi, 44[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	edi, ecx
	sar	edi, 31
	sub	eax, edi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR [rsi], edx
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	mov	rax, QWORD PTR -64[rbp]
	add	rdx, rax
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR [rdx], eax
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	mov	ecx, DWORD PTR -76[rbp]
	mov	edx, DWORD PTR -72[rbp]
	mov	eax, DWORD PTR -100[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	sem_post@PLT
.L8:
	mov	rax, QWORD PTR -40[rbp]
	mov	eax, DWORD PTR [rax]
	lea	ecx, -1[rax]
	mov	rdx, QWORD PTR -40[rbp]
	mov	DWORD PTR [rdx], ecx
	test	eax, eax
	jg	.L9
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	sem_close@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_close@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	sem_close@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	sem_close@PLT
	lea	rdi, .LC5[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC6[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC7[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC8[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC0[rip]
	call	shm_unlink@PLT
	lea	rdi, .LC1[rip]
	call	shm_unlink@PLT
	lea	rdi, .LC2[rip]
	call	shm_unlink@PLT
	lea	rdi, .LC3[rip]
	call	shm_unlink@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	esi, 48
	mov	rdi, rax
	call	munmap@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	esi, 48
	mov	rdi, rax
	call	munmap@PLT
	mov	rax, QWORD PTR -48[rbp]
	mov	esi, 40
	mov	rdi, rax
	call	munmap@PLT
	mov	rax, QWORD PTR -40[rbp]
	mov	esi, 4
	mov	rdi, rax
	call	munmap@PLT
	mov	eax, DWORD PTR -100[rbp]
	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
.LFE6:
	.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	"867317.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/wolne\000"
	.align	2
.LC1:
	.ascii	"/zajete\000"
	.align	2
.LC2:
	.ascii	"/buf_gl\000"
	.align	2
.LC3:
	.ascii	"/suma_produktow\000"
	.align	2
.LC4:
	.ascii	"Nie mozna aktywowac konsumenta, dopoki producent ni"
	.ascii	"e rozpocznie pracy\000"
	.align	2
.LC5:
	.ascii	"/Sp1\000"
	.align	2
.LC6:
	.ascii	"/Sp2\000"
	.align	2
.LC7:
	.ascii	"/Sw\000"
	.align	2
.LC8:
	.ascii	"/Sz\000"
	.align	2
.LC9:
	.ascii	"sem_open_Sp1\012\000"
	.align	2
.LC10:
	.ascii	"sem_open_Sp2\012\000"
	.align	2
.LC11:
	.ascii	"sem_open_Sw\012\000"
	.align	2
.LC12:
	.ascii	"sem_open_Sz\012\000"
	.align	2
.LC13:
	.ascii	"Kosument: %d korzysta z produktu: %d na miejscu: %d"
	.ascii	"\012\000"
	.align	2
.LC14:
	.ascii	"Konsument: %d zakonczyl prace\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 80
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #88
	str	r0, [fp, #-80]
	str	r1, [fp, #-84]
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	bl	getpid
	str	r0, [fp, #-72]
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11
	bl	shm_open
	str	r0, [fp, #-68]
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11+4
	bl	shm_open
	str	r0, [fp, #-64]
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11+8
	bl	shm_open
	str	r0, [fp, #-60]
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11+12
	bl	shm_open
	str	r0, [fp, #-56]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-68]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #48
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-52]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-64]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #48
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-48]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-60]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #40
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-44]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-56]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #4
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-40]
	ldr	r3, [fp, #-44]
	cmn	r3, #1
	beq	.L2
	ldr	r3, [fp, #-48]
	cmn	r3, #1
	beq	.L2
	ldr	r3, [fp, #-52]
	cmn	r3, #1
	beq	.L2
	ldr	r3, [fp, #-40]
	cmn	r3, #1
	bne	.L3
.L2:
	ldr	r0, .L11+16
	bl	puts
	mov	r0, #1
	bl	exit
.L3:
	mov	r3, #1
	mov	r2, #384
	mov	r1, #66
	ldr	r0, .L11+20
	bl	sem_open
	str	r0, [fp, #-36]
	mov	r3, #1
	mov	r2, #384
	mov	r1, #66
	ldr	r0, .L11+24
	bl	sem_open
	str	r0, [fp, #-32]
	mov	r3, #10
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11+28
	bl	sem_open
	str	r0, [fp, #-28]
	mov	r3, #0
	mov	r2, #384
	mov	r1, #2
	ldr	r0, .L11+32
	bl	sem_open
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-36]
	cmp	r3, #0
	bne	.L4
	ldr	r0, .L11+36
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	bne	.L5
	ldr	r0, .L11+40
	bl	perror
	mov	r0, #1
	bl	exit
.L5:
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L11+44
	bl	perror
	mov	r0, #1
	bl	exit
.L6:
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bne	.L8
	ldr	r0, .L11+48
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	ldr	r0, [fp, #-24]
	bl	sem_wait
	ldr	r0, [fp, #-32]
	bl	sem_wait
	ldr	r3, [fp, #-48]
	ldr	r3, [r3, #44]
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-48]
	add	r3, r3, #44
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r3, [fp, #-48]
	add	r0, r3, #44
	ldr	r3, .L11+52
	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
	str	r2, [r0]
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-48]
	add	r3, r2, r3
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-20]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-48]
	add	r3, r2, r3
	mvn	r2, #0
	str	r2, [r3]
	ldr	r0, [fp, #-32]
	bl	sem_post
	bl	rand
	mov	r1, r0
	ldr	r3, .L11+56
	smull	r0, r2, r3, r1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	sub	r2, r1, r3
	add	r3, r2, #3
	mov	r0, r3
	bl	sleep
	ldr	r3, [fp, #-16]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-44]
	add	r3, r2, r3
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	ldr	r0, [fp, #-36]
	bl	sem_wait
	ldr	r3, [fp, #-52]
	ldr	r3, [r3, #44]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-52]
	add	r3, r3, #44
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r3, [fp, #-52]
	add	r0, r3, #44
	ldr	r3, .L11+52
	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
	str	r2, [r0]
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-52]
	add	r3, r2, r3
	ldr	r2, [fp, #-16]
	str	r2, [r3]
	ldr	r0, [fp, #-36]
	bl	sem_post
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-72]
	ldr	r0, .L11+60
	bl	printf
	ldr	r0, [fp, #-28]
	bl	sem_post
.L8:
	ldr	r3, [fp, #-40]
	ldr	r3, [r3]
	sub	r1, r3, #1
	ldr	r2, [fp, #-40]
	str	r1, [r2]
	cmp	r3, #0
	bgt	.L9
	ldr	r0, [fp, #-36]
	bl	sem_close
	ldr	r0, [fp, #-32]
	bl	sem_close
	ldr	r0, [fp, #-24]
	bl	sem_close
	ldr	r0, [fp, #-28]
	bl	sem_close
	ldr	r0, .L11+20
	bl	sem_unlink
	ldr	r0, .L11+24
	bl	sem_unlink
	ldr	r0, .L11+28
	bl	sem_unlink
	ldr	r0, .L11+32
	bl	sem_unlink
	ldr	r0, .L11
	bl	shm_unlink
	ldr	r0, .L11+4
	bl	shm_unlink
	ldr	r0, .L11+8
	bl	shm_unlink
	ldr	r0, .L11+12
	bl	shm_unlink
	mov	r1, #48
	ldr	r0, [fp, #-52]
	bl	munmap
	mov	r1, #48
	ldr	r0, [fp, #-48]
	bl	munmap
	mov	r1, #40
	ldr	r0, [fp, #-44]
	bl	munmap
	mov	r1, #4
	ldr	r0, [fp, #-40]
	bl	munmap
	ldr	r1, [fp, #-72]
	ldr	r0, .L11+64
	bl	printf
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	1717986919
	.word	1431655766
	.word	.LC13
	.word	.LC14
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
