	.file	"405554.c"
	.intel_syntax noprefix
	.text
	.globl	N
	.section	.rodata
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.long	9
	.globl	shm_size
	.align 8
	.type	shm_size, @object
	.size	shm_size, 8
shm_size:
	.quad	44
	.globl	shm_attached_address
	.bss
	.align 8
	.type	shm_attached_address, @object
	.size	shm_attached_address, 8
shm_attached_address:
	.zero	8
	.globl	shm_buffer
	.align 8
	.type	shm_buffer, @object
	.size	shm_buffer, 8
shm_buffer:
	.zero	8
	.globl	shm_pos_consumer
	.align 8
	.type	shm_pos_consumer, @object
	.size	shm_pos_consumer, 8
shm_pos_consumer:
	.zero	8
	.globl	shm_pos_producer
	.align 8
	.type	shm_pos_producer, @object
	.size	shm_pos_producer, 8
shm_pos_producer:
	.zero	8
	.globl	producer_start
	.data
	.align 8
	.type	producer_start, @object
	.size	producer_start, 12
producer_start:
	.value	1
	.value	-1
	.value	0
	.value	0
	.value	-1
	.value	0
	.globl	producer_stop
	.align 8
	.type	producer_stop, @object
	.size	producer_stop, 12
producer_stop:
	.value	0
	.value	1
	.value	0
	.value	2
	.value	1
	.value	0
	.globl	consumer_start
	.align 8
	.type	consumer_start, @object
	.size	consumer_start, 12
consumer_start:
	.value	2
	.value	-1
	.value	0
	.value	0
	.value	-1
	.value	0
	.globl	consumer_stop
	.align 8
	.type	consumer_stop, @object
	.size	consumer_stop, 12
consumer_stop:
	.value	0
	.value	1
	.value	0
	.value	1
	.value	1
	.value	0
	.section	.rodata
	.align 8
.LC0:
	.string	"!!! PRODUCER can't make operation on semaphors. "
	.align 8
.LC1:
	.string	"PRODUCER  %d   pos %d ===> produced %d\n"
	.text
	.globl	producer
	.type	producer, @function
producer:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	DWORD PTR -4[rbp], edi
	mov	DWORD PTR -8[rbp], esi
	mov	DWORD PTR -12[rbp], edx
	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
	mov	eax, edx
	mov	edi, eax
	call	sleep@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 2
	lea	rsi, producer_start[rip]
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	rdx, QWORD PTR shm_buffer[rip]
	mov	rax, QWORD PTR shm_pos_producer[rip]
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	eax, DWORD PTR -8[rbp]
	mov	DWORD PTR [rdx], eax
	mov	rdx, QWORD PTR shm_buffer[rip]
	mov	rax, QWORD PTR shm_pos_producer[rip]
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	ecx, DWORD PTR [rax]
	mov	rax, QWORD PTR shm_pos_producer[rip]
	mov	edx, DWORD PTR [rax]
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR shm_pos_producer[rip]
	mov	edx, DWORD PTR [rax]
	add	edx, 1
	mov	DWORD PTR [rax], edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 2
	lea	rsi, producer_stop[rip]
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L4
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	producer, .-producer
	.section	.rodata
	.align 8
.LC2:
	.string	"CONSUMER  %d   pos %d <=== consumed %d\n"
	.text
	.globl	consumer
	.type	consumer, @function
consumer:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	DWORD PTR -4[rbp], edi
	mov	DWORD PTR -8[rbp], esi
	mov	DWORD PTR -12[rbp], edx
	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
	mov	eax, edx
	mov	edi, eax
	call	sleep@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 2
	lea	rsi, consumer_start[rip]
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L6
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	rdx, QWORD PTR shm_buffer[rip]
	mov	rax, QWORD PTR shm_pos_consumer[rip]
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	ecx, DWORD PTR [rax]
	mov	rax, QWORD PTR shm_pos_consumer[rip]
	mov	edx, DWORD PTR [rax]
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR shm_pos_consumer[rip]
	mov	edx, DWORD PTR [rax]
	add	edx, 1
	mov	DWORD PTR [rax], edx
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 2
	lea	rsi, consumer_stop[rip]
	mov	edi, eax
	call	semop@PLT
	cmp	eax, -1
	jne	.L8
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	consumer, .-consumer
	.section	.rodata
.LC3:
	.string	"!!! Can't fork"
.LC4:
	.string	"Created producer %d\n"
	.align 8
.LC5:
	.string	"\tPRODUCER  %d   finished. Terminating...\n"
	.text
	.globl	create_producer
	.type	create_producer, @function
create_producer:
.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	DWORD PTR -20[rbp], edi
	mov	DWORD PTR -24[rbp], esi
	mov	DWORD PTR -28[rbp], edx
	mov	DWORD PTR -32[rbp], ecx
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L10
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L14
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -8[rbp], 0
	jmp	.L12
.L13:
	mov	edx, DWORD PTR -20[rbp]
	mov	ecx, DWORD PTR -28[rbp]
	mov	eax, DWORD PTR -24[rbp]
	mov	esi, ecx
	mov	edi, eax
	call	producer
	add	DWORD PTR -28[rbp], 1
	add	DWORD PTR -8[rbp], 1
.L12:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -32[rbp]
	jl	.L13
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	exit@PLT
.L14:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	create_producer, .-create_producer
	.section	.rodata
.LC6:
	.string	"Created consumer %d\n"
	.align 8
.LC7:
	.string	"\tCONSUMER  %d   finished. Terminating...\n"
	.text
	.globl	create_consumer
	.type	create_consumer, @function
create_consumer:
.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
	mov	DWORD PTR -24[rbp], esi
	mov	DWORD PTR -28[rbp], edx
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L16
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L20
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -8[rbp], 0
	jmp	.L18
.L19:
	mov	edx, DWORD PTR -20[rbp]
	mov	ecx, DWORD PTR -8[rbp]
	mov	eax, DWORD PTR -24[rbp]
	mov	esi, ecx
	mov	edi, eax
	call	consumer
	add	DWORD PTR -8[rbp], 1
.L18:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jl	.L19
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	exit@PLT
.L20:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	create_consumer, .-create_consumer
	.section	.rodata
.LC8:
	.string	"Parent pid: %i\n"
.LC9:
	.string	"Unable to create shared area"
.LC10:
	.string	"!!! can't attach memory"
.LC11:
	.string	"Unable to create semapthores"
	.align 8
.LC12:
	.string	"!!! Cannot set controll semaphores"
	.align 8
.LC13:
	.string	"!!! Can't detach shared memory segment"
	.text
	.globl	main
	.type	main, @function
main:
.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, 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 0
	call	srand@PLT
	call	getpid@PLT
	mov	DWORD PTR -32[rbp], eax
	mov	eax, DWORD PTR -32[rbp]
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 44
	mov	edx, 1023
	mov	rsi, rax
	mov	edi, 0
	call	shmget@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], -1
	jne	.L22
	lea	rdi, .LC9[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L22:
	mov	eax, DWORD PTR -28[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	shmat@PLT
	mov	QWORD PTR shm_attached_address[rip], rax
	mov	rax, QWORD PTR shm_attached_address[rip]
	movzx	eax, BYTE PTR [rax]
	cmp	al, -1
	jne	.L23
	lea	rdi, .LC10[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L23:
	mov	rax, QWORD PTR shm_attached_address[rip]
	mov	QWORD PTR shm_pos_producer[rip], rax
	mov	rax, QWORD PTR shm_attached_address[rip]
	add	rax, 16
	mov	QWORD PTR shm_pos_consumer[rip], rax
	mov	rax, QWORD PTR shm_attached_address[rip]
	add	rax, 32
	mov	QWORD PTR shm_buffer[rip], rax
	mov	rax, QWORD PTR shm_pos_producer[rip]
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR shm_pos_consumer[rip]
	mov	DWORD PTR [rax], 0
	mov	edx, 1023
	mov	esi, 3
	mov	edi, 0
	call	semget@PLT
	mov	DWORD PTR -24[rbp], eax
	cmp	DWORD PTR -24[rbp], -1
	jne	.L24
	lea	rdi, .LC11[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L24:
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, 1
	mov	edx, 16
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -20[rbp], eax
	mov	edx, 9
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, edx
	mov	edx, 16
	mov	esi, 1
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -16[rbp], eax
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, 0
	mov	edx, 16
	mov	esi, 2
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -20[rbp], -1
	je	.L25
	cmp	DWORD PTR -16[rbp], -1
	je	.L25
	cmp	DWORD PTR -12[rbp], -1
	jne	.L26
.L25:
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L26:
	mov	eax, DWORD PTR -24[rbp]
	mov	edx, 4
	mov	esi, eax
	mov	edi, 0
	call	create_consumer
	mov	eax, DWORD PTR -24[rbp]
	mov	edx, 5
	mov	esi, eax
	mov	edi, 1
	call	create_consumer
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, 3
	mov	edx, 0
	mov	esi, eax
	mov	edi, 0
	call	create_producer
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, 3
	mov	edx, 10
	mov	esi, eax
	mov	edi, 1
	call	create_producer
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, 3
	mov	edx, 100
	mov	esi, eax
	mov	edi, 2
	call	create_producer
	mov	DWORD PTR -36[rbp], 0
	jmp	.L27
.L28:
	lea	rax, -40[rbp]
	mov	rdi, rax
	call	wait@PLT
	add	DWORD PTR -36[rbp], 1
.L27:
	cmp	DWORD PTR -36[rbp], 4
	jle	.L28
	mov	rax, QWORD PTR shm_attached_address[rip]
	mov	rdi, rax
	call	shmdt@PLT
	cmp	eax, -1
	jne	.L29
	lea	rdi, .LC13[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L29:
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE10:
	.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	"405554.c"
	.text
	.global	N
	.section	.rodata
	.align	2
	.type	N, %object
	.size	N, 4
N:
	.word	9
	.global	shm_size
	.align	2
	.type	shm_size, %object
	.size	shm_size, 4
shm_size:
	.word	44
	.comm	shm_attached_address,4,4
	.comm	shm_buffer,4,4
	.comm	shm_pos_consumer,4,4
	.comm	shm_pos_producer,4,4
	.global	producer_start
	.data
	.align	2
	.type	producer_start, %object
	.size	producer_start, 12
producer_start:
	.short	1
	.short	-1
	.short	0
	.short	0
	.short	-1
	.short	0
	.global	producer_stop
	.align	2
	.type	producer_stop, %object
	.size	producer_stop, 12
producer_stop:
	.short	0
	.short	1
	.short	0
	.short	2
	.short	1
	.short	0
	.global	consumer_start
	.align	2
	.type	consumer_start, %object
	.size	consumer_start, 12
consumer_start:
	.short	2
	.short	-1
	.short	0
	.short	0
	.short	-1
	.short	0
	.global	consumer_stop
	.align	2
	.type	consumer_stop, %object
	.size	consumer_stop, 12
consumer_stop:
	.short	0
	.short	1
	.short	0
	.short	1
	.short	1
	.short	0
	.section	.rodata
	.align	2
.LC0:
	.ascii	"!!! PRODUCER can't make operation on semaphors. \000"
	.align	2
.LC1:
	.ascii	"PRODUCER  %d   pos %d ===> produced %d\012\000"
	.text
	.align	2
	.global	producer
	.syntax unified
	.arm
	.fpu softvfp
	.type	producer, %function
producer:
	@ 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, #-8]
	str	r1, [fp, #-12]
	str	r2, [fp, #-16]
	bl	rand
	mov	r2, r0
	ldr	r3, .L5
	smull	r0, r1, r3, r2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	sleep
	mov	r2, #2
	ldr	r1, .L5+4
	ldr	r0, [fp, #-8]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L5+8
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	ldr	r3, .L5+12
	ldr	r2, [r3]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, [fp, #-12]
	str	r2, [r3]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r1, [r3]
	ldr	r3, .L5+12
	ldr	r2, [r3]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r3, [r3]
	mov	r2, r1
	ldr	r1, [fp, #-16]
	ldr	r0, .L5+20
	bl	printf
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r2, [r3]
	add	r2, r2, #1
	str	r2, [r3]
	mov	r2, #2
	ldr	r1, .L5+24
	ldr	r0, [fp, #-8]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L5+8
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	1431655766
	.word	producer_start
	.word	.LC0
	.word	shm_buffer
	.word	shm_pos_producer
	.word	.LC1
	.word	producer_stop
	.size	producer, .-producer
	.section	.rodata
	.align	2
.LC2:
	.ascii	"CONSUMER  %d   pos %d <=== consumed %d\012\000"
	.text
	.align	2
	.global	consumer
	.syntax unified
	.arm
	.fpu softvfp
	.type	consumer, %function
consumer:
	@ 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, #-8]
	str	r1, [fp, #-12]
	str	r2, [fp, #-16]
	bl	rand
	mov	r2, r0
	ldr	r3, .L11
	smull	r0, r1, r3, r2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	sub	r1, r2, r3
	mov	r3, r1
	mov	r0, r3
	bl	sleep
	mov	r2, #2
	ldr	r1, .L11+4
	ldr	r0, [fp, #-8]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L8
	ldr	r0, .L11+8
	bl	perror
	mov	r0, #1
	bl	exit
.L8:
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r1, [r3]
	ldr	r3, .L11+16
	ldr	r2, [r3]
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r3, [r3]
	mov	r2, r1
	ldr	r1, [fp, #-16]
	ldr	r0, .L11+20
	bl	printf
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r2, [r3]
	add	r2, r2, #1
	str	r2, [r3]
	mov	r2, #2
	ldr	r1, .L11+24
	ldr	r0, [fp, #-8]
	bl	semop
	mov	r3, r0
	cmn	r3, #1
	bne	.L10
	ldr	r0, .L11+8
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	1431655766
	.word	consumer_start
	.word	.LC0
	.word	shm_pos_consumer
	.word	shm_buffer
	.word	.LC2
	.word	consumer_stop
	.size	consumer, .-consumer
	.section	.rodata
	.align	2
.LC3:
	.ascii	"!!! Can't fork\000"
	.align	2
.LC4:
	.ascii	"Created producer %d\012\000"
	.align	2
.LC5:
	.ascii	"\011PRODUCER  %d   finished. Terminating...\012\000"
	.text
	.align	2
	.global	create_producer
	.syntax unified
	.arm
	.fpu softvfp
	.type	create_producer, %function
create_producer:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	str	r3, [fp, #-28]
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L14
	ldr	r0, .L19
	bl	perror
	mov	r0, #1
	bl	exit
.L14:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L18
	ldr	r1, [fp, #-16]
	ldr	r0, .L19+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L16
.L17:
	ldr	r2, [fp, #-16]
	ldr	r1, [fp, #-24]
	ldr	r0, [fp, #-20]
	bl	producer
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L16:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L17
	ldr	r1, [fp, #-16]
	ldr	r0, .L19+8
	bl	printf
	mov	r0, #0
	bl	exit
.L18:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L20:
	.align	2
.L19:
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.size	create_producer, .-create_producer
	.section	.rodata
	.align	2
.LC6:
	.ascii	"Created consumer %d\012\000"
	.align	2
.LC7:
	.ascii	"\011CONSUMER  %d   finished. Terminating...\012\000"
	.text
	.align	2
	.global	create_consumer
	.syntax unified
	.arm
	.fpu softvfp
	.type	create_consumer, %function
create_consumer:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L22
	ldr	r0, .L27
	bl	perror
	mov	r0, #1
	bl	exit
.L22:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L26
	ldr	r1, [fp, #-16]
	ldr	r0, .L27+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L24
.L25:
	ldr	r2, [fp, #-16]
	ldr	r1, [fp, #-12]
	ldr	r0, [fp, #-20]
	bl	consumer
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L24:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	blt	.L25
	ldr	r1, [fp, #-16]
	ldr	r0, .L27+8
	bl	printf
	mov	r0, #0
	bl	exit
.L26:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC3
	.word	.LC6
	.word	.LC7
	.size	create_consumer, .-create_consumer
	.section	.rodata
	.align	2
.LC8:
	.ascii	"Parent pid: %i\012\000"
	.align	2
.LC9:
	.ascii	"Unable to create shared area\000"
	.align	2
.LC10:
	.ascii	"Unable to create semapthores\000"
	.align	2
.LC11:
	.ascii	"!!! Cannot set controll semaphores\000"
	.align	2
.LC12:
	.ascii	"!!! Can't detach shared memory segment\000"
	.align	2
.LC13:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	ldr	r3, .L38
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #0
	bl	srand
	bl	getpid
	str	r0, [fp, #-32]
	ldr	r1, [fp, #-32]
	ldr	r0, .L38+4
	bl	printf
	mov	r3, #44
	ldr	r2, .L38+8
	mov	r1, r3
	mov	r0, #0
	bl	shmget
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmn	r3, #1
	bne	.L30
	ldr	r0, .L38+12
	bl	perror
	mov	r0, #1
	bl	exit
.L30:
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-28]
	bl	shmat
	mov	r3, r0
	ldr	r2, .L38+16
	str	r3, [r2]
	ldr	r3, .L38+16
	ldr	r3, [r3]
	ldr	r2, .L38+20
	str	r3, [r2]
	ldr	r3, .L38+16
	ldr	r3, [r3]
	add	r3, r3, #16
	ldr	r2, .L38+24
	str	r3, [r2]
	ldr	r3, .L38+16
	ldr	r3, [r3]
	add	r3, r3, #32
	ldr	r2, .L38+28
	str	r3, [r2]
	ldr	r3, .L38+20
	ldr	r3, [r3]
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L38+24
	ldr	r3, [r3]
	mov	r2, #0
	str	r2, [r3]
	ldr	r2, .L38+8
	mov	r1, #3
	mov	r0, #0
	bl	semget
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	cmn	r3, #1
	bne	.L31
	ldr	r0, .L38+32
	bl	perror
	mov	r0, #1
	bl	exit
.L31:
	mov	r3, #1
	mov	r2, #16
	mov	r1, #0
	ldr	r0, [fp, #-24]
	bl	semctl
	str	r0, [fp, #-20]
	mov	r3, #9
	mov	r2, #16
	mov	r1, #1
	ldr	r0, [fp, #-24]
	bl	semctl
	str	r0, [fp, #-16]
	mov	r3, #0
	mov	r2, #16
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	semctl
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-20]
	cmn	r3, #1
	beq	.L32
	ldr	r3, [fp, #-16]
	cmn	r3, #1
	beq	.L32
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	bne	.L33
.L32:
	ldr	r0, .L38+36
	bl	perror
	mov	r0, #1
	bl	exit
.L33:
	mov	r2, #4
	ldr	r1, [fp, #-24]
	mov	r0, #0
	bl	create_consumer
	mov	r2, #5
	ldr	r1, [fp, #-24]
	mov	r0, #1
	bl	create_consumer
	mov	r3, #3
	mov	r2, #0
	ldr	r1, [fp, #-24]
	mov	r0, #0
	bl	create_producer
	mov	r3, #3
	mov	r2, #10
	ldr	r1, [fp, #-24]
	mov	r0, #1
	bl	create_producer
	mov	r3, #3
	mov	r2, #100
	ldr	r1, [fp, #-24]
	mov	r0, #2
	bl	create_producer
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L34
.L35:
	sub	r3, fp, #40
	mov	r0, r3
	bl	wait
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L34:
	ldr	r3, [fp, #-36]
	cmp	r3, #4
	ble	.L35
	ldr	r3, .L38+16
	ldr	r3, [r3]
	mov	r0, r3
	bl	shmdt
	mov	r3, r0
	cmn	r3, #1
	bne	.L36
	ldr	r0, .L38+40
	bl	perror
	mov	r0, #1
	bl	exit
.L36:
	mov	r0, #0
	bl	exit
.L39:
	.align	2
.L38:
	.word	.LC13
	.word	.LC8
	.word	1023
	.word	.LC9
	.word	shm_attached_address
	.word	shm_pos_producer
	.word	shm_pos_consumer
	.word	shm_buffer
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
