	.file	"156381.c"
	.intel_syntax noprefix
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	out
	.align 8
	.type	out, @object
	.size	out, 8
out:
	.zero	8
	.globl	buffer
	.align 8
	.type	buffer, @object
	.size	buffer, 8
buffer:
	.zero	8
	.globl	item
	.align 4
	.type	item, @object
	.size	item, 4
item:
	.zero	4
	.globl	SHM_SIZE
	.align 4
	.type	SHM_SIZE, @object
	.size	SHM_SIZE, 4
SHM_SIZE:
	.zero	4
	.globl	shmid
	.align 4
	.type	shmid, @object
	.size	shmid, 4
shmid:
	.zero	4
	.globl	shmkey
	.data
	.align 4
	.type	shmkey, @object
	.size	shmkey, 4
shmkey:
	.long	22222
	.globl	mutex
	.bss
	.align 8
	.type	mutex, @object
	.size	mutex, 8
mutex:
	.zero	8
	.globl	fillSlots
	.align 8
	.type	fillSlots, @object
	.size	fillSlots, 8
fillSlots:
	.zero	8
	.globl	emptySlots
	.align 8
	.type	emptySlots, @object
	.size	emptySlots, 8
emptySlots:
	.zero	8
	.text
	.globl	nap
	.type	nap, @function
nap:
.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
	call	rand@PLT
	cdq
	idiv	DWORD PTR -4[rbp]
	mov	eax, edx
	add	eax, 10000
	mov	edi, eax
	call	usleep@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	nap, .-nap
	.section	.rodata
.LC0:
	.string	"pid %d: consumed item %d\n"
	.align 8
.LC1:
	.string	"pid %d: consumed item %d but it's not prime\n"
	.text
	.globl	consumeItem
	.type	consumeItem, @function
consumeItem:
.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	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR -20[rbp]
	mov	DWORD PTR -4[rbp], eax
	mov	DWORD PTR -8[rbp], 1
	mov	eax, DWORD PTR -4[rbp]
	sub	eax, 1
	mov	DWORD PTR -12[rbp], eax
	jmp	.L3
.L6:
	mov	eax, DWORD PTR -4[rbp]
	cdq
	idiv	DWORD PTR -12[rbp]
	mov	eax, edx
	test	eax, eax
	jne	.L4
	mov	DWORD PTR -8[rbp], 0
	jmp	.L5
.L4:
	sub	DWORD PTR -12[rbp], 1
.L3:
	cmp	DWORD PTR -12[rbp], 1
	jg	.L6
.L5:
	mov	edi, 1000
	call	nap
	cmp	DWORD PTR -8[rbp], 0
	je	.L7
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L9
.L7:
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -20[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
.L9:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	consumeItem, .-consumeItem
	.section	.rodata
	.align 8
.LC2:
	.string	"usage:  consumer  n  N  (where n : elems to consume   N : buffer size)"
	.align 8
.LC3:
	.string	"error allocating shared memory key %d\n"
.LC4:
	.string	"/mutex"
.LC5:
	.string	"/fillSlots"
.LC6:
	.string	"/emptySlots"
	.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, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -36[rbp], 3
	je	.L11
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L17
.L11:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR n[rip], eax
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR N[rip], eax
	mov	eax, DWORD PTR N[rip]
	cdqe
	add	rax, 3
	sal	eax, 2
	mov	DWORD PTR SHM_SIZE[rip], eax
	mov	eax, DWORD PTR SHM_SIZE[rip]
	movsx	rcx, eax
	mov	eax, DWORD PTR shmkey[rip]
	mov	edx, 292
	mov	rsi, rcx
	mov	edi, eax
	call	shmget@PLT
	mov	DWORD PTR shmid[rip], eax
	mov	eax, DWORD PTR shmid[rip]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	shmat@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	eax, DWORD PTR shmid[rip]
	test	eax, eax
	js	.L13
	mov	rax, QWORD PTR -16[rbp]
	test	rax, rax
	jne	.L14
.L13:
	mov	edx, DWORD PTR shmkey[rip]
	mov	rax, QWORD PTR stderr[rip]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	eax, -1
	jmp	.L17
.L14:
	mov	ecx, 1
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR mutex[rip], rax
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR fillSlots[rip], rax
	mov	eax, DWORD PTR N[rip]
	mov	ecx, eax
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR emptySlots[rip], rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 16
	mov	QWORD PTR out[rip], rax
	mov	rax, QWORD PTR -16[rbp]
	add	rax, 48
	mov	QWORD PTR buffer[rip], rax
	mov	DWORD PTR -20[rbp], 0
	jmp	.L15
.L16:
	mov	rax, QWORD PTR fillSlots[rip]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR mutex[rip]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rdx, QWORD PTR buffer[rip]
	mov	rax, QWORD PTR out[rip]
	mov	eax, DWORD PTR [rax]
	cdqe
	sal	rax, 2
	add	rax, rdx
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR item[rip], eax
	mov	rax, QWORD PTR out[rip]
	mov	eax, DWORD PTR [rax]
	add	eax, 1
	mov	esi, DWORD PTR N[rip]
	mov	rcx, QWORD PTR out[rip]
	cdq
	idiv	esi
	mov	eax, edx
	mov	DWORD PTR [rcx], eax
	mov	rax, QWORD PTR mutex[rip]
	mov	rdi, rax
	call	sem_post@PLT
	mov	rax, QWORD PTR emptySlots[rip]
	mov	rdi, rax
	call	sem_post@PLT
	mov	eax, DWORD PTR item[rip]
	mov	edi, eax
	call	consumeItem
	add	DWORD PTR -20[rbp], 1
.L15:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -20[rbp], eax
	jl	.L16
	lea	rax, -16[rbp]
	mov	rdi, rax
	call	shmdt@PLT
	mov	eax, 0
.L17:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.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	"156381.c"
	.text
	.comm	n,4,4
	.comm	N,4,4
	.comm	out,4,4
	.comm	buffer,4,4
	.comm	item,4,4
	.comm	SHM_SIZE,4,4
	.comm	shmid,4,4
	.global	shmkey
	.data
	.align	2
	.type	shmkey, %object
	.size	shmkey, 4
shmkey:
	.word	22222
	.comm	mutex,4,4
	.comm	fillSlots,4,4
	.comm	emptySlots,4,4
	.global	__aeabi_idivmod
	.text
	.align	2
	.global	nap
	.syntax unified
	.arm
	.fpu softvfp
	.type	nap, %function
nap:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	bl	rand
	mov	r3, r0
	ldr	r1, [fp, #-8]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	add	r3, r3, #9984
	add	r3, r3, #16
	mov	r0, r3
	bl	usleep
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	nap, .-nap
	.section	.rodata
	.align	2
.LC0:
	.ascii	"pid %d: consumed item %d\012\000"
	.align	2
.LC1:
	.ascii	"pid %d: consumed item %d but it's not prime\012\000"
	.text
	.align	2
	.global	consumeItem
	.syntax unified
	.arm
	.fpu softvfp
	.type	consumeItem, %function
consumeItem:
	@ 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, #-24]
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-8]
	mov	r3, #1
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-8]
	sub	r3, r3, #1
	str	r3, [fp, #-16]
	b	.L3
.L6:
	ldr	r3, [fp, #-8]
	ldr	r1, [fp, #-16]
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	cmp	r3, #0
	bne	.L4
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L5
.L4:
	ldr	r3, [fp, #-16]
	sub	r3, r3, #1
	str	r3, [fp, #-16]
.L3:
	ldr	r3, [fp, #-16]
	cmp	r3, #1
	bgt	.L6
.L5:
	mov	r0, #1000
	bl	nap
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L7
	bl	getpid
	mov	r3, r0
	ldr	r2, [fp, #-24]
	mov	r1, r3
	ldr	r0, .L10
	bl	printf
	b	.L9
.L7:
	bl	getpid
	mov	r3, r0
	ldr	r2, [fp, #-24]
	mov	r1, r3
	ldr	r0, .L10+4
	bl	printf
.L9:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC0
	.word	.LC1
	.size	consumeItem, .-consumeItem
	.section	.rodata
	.align	2
.LC2:
	.ascii	"usage:  consumer  n  N  (where n : elems to consume"
	.ascii	"   N : buffer size)\000"
	.align	2
.LC3:
	.ascii	"error allocating shared memory key %d\012\000"
	.align	2
.LC4:
	.ascii	"/mutex\000"
	.align	2
.LC5:
	.ascii	"/fillSlots\000"
	.align	2
.LC6:
	.ascii	"/emptySlots\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #28
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, .L21
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r3, [fp, #-32]
	cmp	r3, #3
	beq	.L13
	ldr	r0, .L21+4
	bl	puts
	mvn	r3, #0
	b	.L19
.L13:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L21+8
	str	r3, [r2]
	ldr	r3, [fp, #-36]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L21+12
	str	r3, [r2]
	ldr	r3, .L21+12
	ldr	r3, [r3]
	add	r3, r3, #3
	lsl	r3, r3, #2
	mov	r2, r3
	ldr	r3, .L21+16
	str	r2, [r3]
	ldr	r3, .L21+20
	ldr	r3, [r3]
	ldr	r2, .L21+16
	ldr	r2, [r2]
	mov	r1, r2
	mov	r2, #292
	mov	r0, r3
	bl	shmget
	mov	r3, r0
	ldr	r2, .L21+24
	str	r3, [r2]
	ldr	r3, .L21+24
	ldr	r3, [r3]
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	shmat
	mov	r3, r0
	str	r3, [fp, #-24]
	ldr	r3, .L21+24
	ldr	r3, [r3]
	cmp	r3, #0
	blt	.L15
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bne	.L16
.L15:
	ldr	r3, .L21+28
	ldr	r3, [r3]
	ldr	r2, .L21+20
	ldr	r2, [r2]
	ldr	r1, .L21+32
	mov	r0, r3
	bl	fprintf
	mvn	r3, #0
	b	.L19
.L16:
	mov	r3, #1
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L21+36
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L21+40
	str	r3, [r2]
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L21+44
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L21+48
	str	r3, [r2]
	ldr	r3, .L21+12
	ldr	r3, [r3]
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L21+52
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L21+56
	str	r3, [r2]
	ldr	r3, [fp, #-24]
	add	r3, r3, #16
	ldr	r2, .L21+60
	str	r3, [r2]
	ldr	r3, [fp, #-24]
	add	r3, r3, #48
	ldr	r2, .L21+64
	str	r3, [r2]
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L17
.L18:
	ldr	r3, .L21+48
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_wait
	ldr	r3, .L21+40
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_wait
	ldr	r3, .L21+64
	ldr	r2, [r3]
	ldr	r3, .L21+60
	ldr	r3, [r3]
	ldr	r3, [r3]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r3, [r3]
	ldr	r2, .L21+68
	str	r3, [r2]
	ldr	r3, .L21+60
	ldr	r3, [r3]
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L21+12
	ldr	r2, [r2]
	ldr	r1, .L21+60
	ldr	r4, [r1]
	mov	r1, r2
	mov	r0, r3
	bl	__aeabi_idivmod
	mov	r3, r1
	str	r3, [r4]
	ldr	r3, .L21+40
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_post
	ldr	r3, .L21+56
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_post
	ldr	r3, .L21+68
	ldr	r3, [r3]
	mov	r0, r3
	bl	consumeItem
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L17:
	ldr	r3, .L21+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-20]
	cmp	r2, r3
	blt	.L18
	sub	r3, fp, #24
	mov	r0, r3
	bl	shmdt
	mov	r3, #0
.L19:
	ldr	r2, .L21
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L20
	bl	__stack_chk_fail
.L20:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L22:
	.align	2
.L21:
	.word	.LC7
	.word	.LC2
	.word	n
	.word	N
	.word	SHM_SIZE
	.word	shmkey
	.word	shmid
	.word	stderr
	.word	.LC3
	.word	.LC4
	.word	mutex
	.word	.LC5
	.word	fillSlots
	.word	.LC6
	.word	emptySlots
	.word	out
	.word	buffer
	.word	item
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
