	.file	"277276.c"
	.intel_syntax noprefix
	.text
	.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
	.globl	bEnd
	.align 4
	.type	bEnd, @object
	.size	bEnd, 4
bEnd:
	.zero	4
	.globl	cmd
	.align 32
	.type	cmd, @object
	.size	cmd, 120
cmd:
	.zero	120
	.globl	role
	.align 32
	.type	role, @object
	.size	role, 120
role:
	.zero	120
	.globl	arg
	.align 32
	.type	arg, @object
	.size	arg, 120
arg:
	.zero	120
	.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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	pid
	.align 4
	.type	pid, @object
	.size	pid, 4
pid:
	.zero	4
	.globl	programpath
	.align 32
	.type	programpath, @object
	.size	programpath, 80
programpath:
	.zero	80
	.globl	args
	.align 32
	.type	args, @object
	.size	args, 32
args:
	.zero	32
	.section	.rodata
.LC0:
	.string	"/mutex"
.LC1:
	.string	"/fillSlots"
.LC2:
	.string	"/emptySlots"
	.align 8
.LC3:
	.string	"error allocating shared memory key %d\n"
.LC4:
	.string	"*** FactoryShell Usage **** "
	.align 8
.LC5:
	.string	"FactoryShell> producer 3      (type this to produce 3 items)"
	.align 8
.LC6:
	.string	"FactoryShell> consumer 4      (type this to consume 4 items,"
	.align 8
.LC7:
	.string	"                               3 will be consumed and then block)"
.LC8:
	.string	"Return or end to quit"
.LC9:
	.string	"FactoryShell> "
.LC10:
	.string	"%s %s"
.LC11:
	.string	"%s"
.LC12:
	.string	"end"
.LC13:
	.string	"exit"
.LC14:
	.string	"10"
.LC15:
	.string	"consumer"
.LC16:
	.string	"producer"
	.align 8
.LC17:
	.string	"Error when forking the program"
.LC18:
	.string	"Command not recognized"
	.align 8
.LC19:
	.string	"Usage: producer integer  (num of elems to produce)"
	.align 8
.LC20:
	.string	"       consumer integer  (num of elems to consume)\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
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	ecx, 1
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC0[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, .LC1[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR fillSlots[rip], rax
	mov	ecx, 10
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR emptySlots[rip], rax
	mov	DWORD PTR SHM_SIZE[rip], 52
	mov	eax, DWORD PTR SHM_SIZE[rip]
	movsx	rcx, eax
	mov	eax, DWORD PTR shmkey[rip]
	mov	edx, 950
	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 -8[rbp], rax
	mov	eax, DWORD PTR shmid[rip]
	test	eax, eax
	js	.L2
	cmp	QWORD PTR -8[rbp], 0
	jne	.L3
.L2:
	mov	eax, DWORD PTR shmkey[rip]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L4
.L3:
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 4
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	DWORD PTR [rax], 1
	lea	rdi, .LC4[rip]
	call	puts@PLT
	lea	rdi, .LC5[rip]
	call	puts@PLT
	lea	rdi, .LC6[rip]
	call	puts@PLT
	lea	rdi, .LC7[rip]
	call	puts@PLT
	lea	rdi, .LC8[rip]
	call	puts@PLT
	jmp	.L5
.L16:
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdin[rip]
	mov	rdx, rax
	mov	esi, 120
	lea	rdi, cmd[rip]
	call	fgets@PLT
	mov	BYTE PTR arg[rip], 0
	mov	esi, 32
	lea	rdi, cmd[rip]
	call	strchr@PLT
	test	rax, rax
	je	.L6
	lea	rcx, arg[rip]
	lea	rdx, role[rip]
	lea	rsi, .LC10[rip]
	lea	rdi, cmd[rip]
	mov	eax, 0
	call	__isoc99_sscanf@PLT
	jmp	.L7
.L6:
	lea	rdx, role[rip]
	lea	rsi, .LC11[rip]
	lea	rdi, cmd[rip]
	mov	eax, 0
	call	__isoc99_sscanf@PLT
.L7:
	lea	rsi, .LC12[rip]
	lea	rdi, role[rip]
	call	strcmp@PLT
	test	eax, eax
	je	.L8
	lea	rsi, .LC13[rip]
	lea	rdi, role[rip]
	call	strcmp@PLT
	test	eax, eax
	jne	.L9
.L8:
	mov	DWORD PTR bEnd[rip], 1
	jmp	.L10
.L9:
	mov	esi, 80
	lea	rdi, programpath[rip]
	call	getcwd@PLT
	lea	rdi, programpath[rip]
	call	strlen@PLT
	mov	rdx, rax
	lea	rax, programpath[rip]
	add	rax, rdx
	mov	WORD PTR [rax], 47
	lea	rsi, role[rip]
	lea	rdi, programpath[rip]
	call	strcat@PLT
	lea	rax, programpath[rip]
	mov	QWORD PTR args[rip], rax
	lea	rax, arg[rip]
	mov	QWORD PTR args[rip+8], rax
	lea	rax, .LC14[rip]
	mov	QWORD PTR args[rip+16], rax
	mov	QWORD PTR args[rip+24], 0
	lea	rsi, .LC15[rip]
	lea	rdi, role[rip]
	call	strcmp@PLT
	test	eax, eax
	je	.L11
	lea	rsi, .LC16[rip]
	lea	rdi, role[rip]
	call	strcmp@PLT
	test	eax, eax
	jne	.L12
.L11:
	call	fork@PLT
	mov	DWORD PTR pid[rip], eax
	mov	eax, DWORD PTR pid[rip]
	test	eax, eax
	jne	.L13
	mov	edx, 0
	lea	rsi, args[rip]
	lea	rdi, programpath[rip]
	call	execve@PLT
	jmp	.L17
.L13:
	mov	eax, DWORD PTR pid[rip]
	test	eax, eax
	jns	.L17
	lea	rdi, .LC17[rip]
	call	puts@PLT
	mov	DWORD PTR bEnd[rip], 1
	jmp	.L17
.L12:
	lea	rdi, .LC18[rip]
	call	puts@PLT
	lea	rdi, .LC19[rip]
	call	puts@PLT
	lea	rdi, .LC20[rip]
	call	puts@PLT
	lea	rdi, cmd[rip]
	call	strlen@PLT
	cmp	rax, 1
	jne	.L15
	mov	DWORD PTR bEnd[rip], 1
	jmp	.L15
.L17:
	nop
.L15:
	mov	edi, 1000000
	call	usleep@PLT
.L5:
	mov	eax, DWORD PTR bEnd[rip]
	test	eax, eax
	je	.L16
.L10:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	shmdt@PLT
	mov	eax, DWORD PTR shmid[rip]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	shmctl@PLT
	mov	rax, QWORD PTR mutex[rip]
	mov	rdi, rax
	call	sem_close@PLT
	mov	rax, QWORD PTR fillSlots[rip]
	mov	rdi, rax
	call	sem_close@PLT
	mov	rax, QWORD PTR emptySlots[rip]
	mov	rdi, rax
	call	sem_close@PLT
	lea	rdi, .LC0[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC1[rip]
	call	sem_unlink@PLT
	lea	rdi, .LC2[rip]
	call	sem_unlink@PLT
	mov	eax, 0
.L4:
	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	"277276.c"
	.text
	.comm	mutex,4,4
	.comm	fillSlots,4,4
	.comm	emptySlots,4,4
	.global	bEnd
	.bss
	.align	2
	.type	bEnd, %object
	.size	bEnd, 4
bEnd:
	.space	4
	.comm	cmd,120,4
	.comm	role,120,4
	.comm	arg,120,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	i,4,4
	.comm	pid,4,4
	.comm	programpath,80,4
	.comm	args,16,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/mutex\000"
	.align	2
.LC1:
	.ascii	"/fillSlots\000"
	.align	2
.LC2:
	.ascii	"/emptySlots\000"
	.align	2
.LC3:
	.ascii	"error allocating shared memory key %d\012\000"
	.align	2
.LC4:
	.ascii	"*** FactoryShell Usage **** \000"
	.align	2
.LC5:
	.ascii	"FactoryShell> producer 3      (type this to produce"
	.ascii	" 3 items)\000"
	.align	2
.LC6:
	.ascii	"FactoryShell> consumer 4      (type this to consume"
	.ascii	" 4 items,\000"
	.align	2
.LC7:
	.ascii	"                               3 will be consumed a"
	.ascii	"nd then block)\000"
	.align	2
.LC8:
	.ascii	"Return or end to quit\000"
	.align	2
.LC9:
	.ascii	"FactoryShell> \000"
	.align	2
.LC10:
	.ascii	"%s %s\000"
	.align	2
.LC11:
	.ascii	"%s\000"
	.align	2
.LC12:
	.ascii	"end\000"
	.align	2
.LC13:
	.ascii	"exit\000"
	.align	2
.LC14:
	.ascii	"/\000"
	.align	2
.LC15:
	.ascii	"10\000"
	.align	2
.LC16:
	.ascii	"consumer\000"
	.align	2
.LC17:
	.ascii	"producer\000"
	.align	2
.LC18:
	.ascii	"Error when forking the program\000"
	.align	2
.LC19:
	.ascii	"Command not recognized\000"
	.align	2
.LC20:
	.ascii	"Usage: producer integer  (num of elems to produce)\000"
	.align	2
.LC21:
	.ascii	"       consumer integer  (num of elems to consume)\012"
	.ascii	"\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ 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]
	str	r1, [fp, #-20]
	mov	r3, #1
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L18
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L18+4
	str	r3, [r2]
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L18+8
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L18+12
	str	r3, [r2]
	mov	r3, #10
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L18+16
	bl	sem_open
	mov	r3, r0
	ldr	r2, .L18+20
	str	r3, [r2]
	ldr	r3, .L18+24
	mov	r2, #52
	str	r2, [r3]
	ldr	r3, .L18+28
	ldr	r3, [r3]
	ldr	r2, .L18+24
	ldr	r2, [r2]
	mov	r1, r2
	ldr	r2, .L18+32
	mov	r0, r3
	bl	shmget
	mov	r3, r0
	ldr	r2, .L18+36
	str	r3, [r2]
	ldr	r3, .L18+36
	ldr	r3, [r3]
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	shmat
	str	r0, [fp, #-8]
	ldr	r3, .L18+36
	ldr	r3, [r3]
	cmp	r3, #0
	blt	.L2
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L3
.L2:
	ldr	r3, .L18+28
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L18+40
	bl	printf
	mvn	r3, #0
	b	.L4
.L3:
	ldr	r3, [fp, #-8]
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #8
	mov	r2, #1
	str	r2, [r3]
	ldr	r0, .L18+44
	bl	puts
	ldr	r0, .L18+48
	bl	puts
	ldr	r0, .L18+52
	bl	puts
	ldr	r0, .L18+56
	bl	puts
	ldr	r0, .L18+60
	bl	puts
	b	.L5
.L16:
	ldr	r0, .L18+64
	bl	printf
	ldr	r3, .L18+68
	ldr	r3, [r3]
	mov	r2, r3
	mov	r1, #120
	ldr	r0, .L18+72
	bl	fgets
	ldr	r3, .L18+76
	mov	r2, #0
	strb	r2, [r3]
	mov	r1, #32
	ldr	r0, .L18+72
	bl	strchr
	mov	r3, r0
	cmp	r3, #0
	beq	.L6
	ldr	r3, .L18+76
	ldr	r2, .L18+80
	ldr	r1, .L18+84
	ldr	r0, .L18+72
	bl	__isoc99_sscanf
	b	.L7
.L6:
	ldr	r2, .L18+80
	ldr	r1, .L18+88
	ldr	r0, .L18+72
	bl	__isoc99_sscanf
.L7:
	ldr	r1, .L18+92
	ldr	r0, .L18+80
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L8
	ldr	r1, .L18+96
	ldr	r0, .L18+80
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L9
.L8:
	ldr	r3, .L18+100
	mov	r2, #1
	str	r2, [r3]
	b	.L10
.L9:
	mov	r1, #80
	ldr	r0, .L18+104
	bl	getcwd
	ldr	r0, .L18+104
	bl	strlen
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L18+104
	add	r3, r2, r3
	ldr	r2, .L18+108
	mov	r0, r3
	mov	r1, r2
	mov	r3, #2
	mov	r2, r3
	bl	memcpy
	ldr	r1, .L18+80
	ldr	r0, .L18+104
	bl	strcat
	ldr	r3, .L18+112
	ldr	r2, .L18+104
	str	r2, [r3]
	ldr	r3, .L18+112
	ldr	r2, .L18+76
	str	r2, [r3, #4]
	ldr	r3, .L18+112
	ldr	r2, .L18+116
	str	r2, [r3, #8]
	ldr	r3, .L18+112
	mov	r2, #0
	str	r2, [r3, #12]
	ldr	r1, .L18+120
	ldr	r0, .L18+80
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r1, .L18+124
	ldr	r0, .L18+80
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L12
.L11:
	bl	fork
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L18+128
	str	r2, [r3]
	ldr	r3, .L18+128
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L13
	mov	r2, #0
	ldr	r1, .L18+112
	ldr	r0, .L18+104
	bl	execve
	b	.L17
.L13:
	ldr	r3, .L18+128
	ldr	r3, [r3]
	cmp	r3, #0
	bge	.L17
	ldr	r0, .L18+132
	bl	puts
	ldr	r3, .L18+100
	mov	r2, #1
	str	r2, [r3]
	b	.L17
.L12:
	ldr	r0, .L18+136
	bl	puts
	ldr	r0, .L18+140
	bl	puts
	ldr	r0, .L18+144
	bl	puts
	ldr	r0, .L18+72
	bl	strlen
	mov	r3, r0
	cmp	r3, #1
	bne	.L15
	ldr	r3, .L18+100
	mov	r2, #1
	str	r2, [r3]
	b	.L15
.L17:
	nop
.L15:
	ldr	r0, .L18+148
	bl	usleep
.L5:
	ldr	r3, .L18+100
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L16
.L10:
	ldr	r0, [fp, #-8]
	bl	shmdt
	ldr	r3, .L18+36
	ldr	r3, [r3]
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	shmctl
	ldr	r3, .L18+4
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_close
	ldr	r3, .L18+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_close
	ldr	r3, .L18+20
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_close
	ldr	r0, .L18
	bl	sem_unlink
	ldr	r0, .L18+8
	bl	sem_unlink
	ldr	r0, .L18+16
	bl	sem_unlink
	mov	r3, #0
.L4:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC0
	.word	mutex
	.word	.LC1
	.word	fillSlots
	.word	.LC2
	.word	emptySlots
	.word	SHM_SIZE
	.word	shmkey
	.word	950
	.word	shmid
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	stdin
	.word	cmd
	.word	arg
	.word	role
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	bEnd
	.word	programpath
	.word	.LC14
	.word	args
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.word	pid
	.word	.LC18
	.word	.LC19
	.word	.LC20
	.word	.LC21
	.word	1000000
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
