	.file	"169857.c"
	.intel_syntax noprefix
	.text
	.local	flag
	.comm	flag,4,4
	.section	.rodata
.LC0:
	.string	"sigemptyset"
.LC1:
	.string	"sigaction"
.LC2:
	.string	"/system_hw04_shm"
.LC3:
	.string	"shm_open"
.LC4:
	.string	"shm_unlink"
.LC5:
	.string	"ftruncate"
.LC6:
	.string	"mmap"
.LC7:
	.string	"sem_init"
	.align 8
.LC8:
	.string	"Chef1 is waiting for FLOUR and EGG"
.LC9:
	.string	"Chef1 has taken FLOUR and EGG"
	.align 8
.LC10:
	.string	"Chef2 is waiting for EGG and BUTTER"
	.align 8
.LC11:
	.string	"Chef2 has taken EGG and BUTTER"
	.align 8
.LC12:
	.string	"Chef3 is waiting for EGG and SUGAR"
.LC13:
	.string	"Chef3 has taken EGG and SUGAR"
	.align 8
.LC14:
	.string	"Chef4 is waiting for FLOUR and BUTTER"
	.align 8
.LC15:
	.string	"Chef4 has taken FLOUR and BUTTER"
	.align 8
.LC16:
	.string	"Chef5 is waiting for FLOUR and SUGAR"
	.align 8
.LC17:
	.string	"Chef5 has taken FLOUR and SUGAR"
	.align 8
.LC18:
	.string	"Chef6 is waiting for BUTTER and SUGAR"
	.align 8
.LC19:
	.string	"Chef6 has taken BUTTER and SUGAR"
.LC20:
	.string	"munmap"
.LC21:
	.string	"Chef%d exits gracefully.\n"
.LC22:
	.string	"fork"
.LC23:
	.string	"fork kill"
.LC24:
	.string	"sem_wait producer"
	.align 8
.LC25:
	.string	"Wholesaler delivers EGG and FLOUR"
	.align 8
.LC26:
	.string	"Wholesaler delivers EGG and BUTTER"
	.align 8
.LC27:
	.string	"Wholesaler delivers EGG and SUGAR"
	.align 8
.LC28:
	.string	"Wholesaler delivers FLOUR and BUTTER"
	.align 8
.LC29:
	.string	"Wholesaler delivers FLOUR and SUGAR"
	.align 8
.LC30:
	.string	"Wholesaler delivers BUTTER and SUGAR"
.LC31:
	.string	"sem_destroy"
.LC32:
	.string	"chef process cleaned up"
.LC33:
	.string	"Wholesaler exits gracefully."
	.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, 224
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, signalHandler[rip]
	mov	QWORD PTR -160[rbp], rax
	mov	DWORD PTR -24[rbp], 0
	lea	rax, -160[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sigemptyset@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L47
.L2:
	lea	rax, -160[rbp]
	mov	edx, 0
	mov	rsi, rax
	mov	edi, 2
	call	sigaction@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L4
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	eax, 1
	jmp	.L47
.L4:
	mov	edx, 384
	mov	esi, 194
	lea	rdi, .LC2[rip]
	call	shm_open@PLT
	mov	DWORD PTR -196[rbp], eax
	cmp	DWORD PTR -196[rbp], -1
	jne	.L5
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L47
.L5:
	lea	rdi, .LC2[rip]
	call	shm_unlink@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L6
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	eax, -5
	jmp	.L47
.L6:
	mov	eax, DWORD PTR -196[rbp]
	mov	esi, 224
	mov	edi, eax
	call	ftruncate@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L7
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	eax, -2
	jmp	.L47
.L7:
	mov	eax, DWORD PTR -196[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 224
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -168[rbp], rax
	cmp	QWORD PTR -168[rbp], -1
	jne	.L8
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	eax, -3
	jmp	.L47
.L8:
	mov	DWORD PTR -212[rbp], 0
	jmp	.L9
.L11:
	mov	eax, DWORD PTR -212[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	mov	rax, QWORD PTR -168[rbp]
	add	rax, rdx
	mov	edx, 0
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L10
	lea	rdi, .LC7[rip]
	call	perror@PLT
	mov	eax, -4
	jmp	.L47
.L10:
	add	DWORD PTR -212[rbp], 1
.L9:
	cmp	DWORD PTR -212[rbp], 5
	jle	.L11
	mov	rax, QWORD PTR -168[rbp]
	add	rax, 192
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L12
	lea	rdi, .LC7[rip]
	call	perror@PLT
	mov	eax, -4
	jmp	.L47
.L12:
	mov	DWORD PTR -208[rbp], 0
	jmp	.L13
.L27:
	call	fork@PLT
	cmp	eax, -1
	je	.L14
	test	eax, eax
	jne	.L49
	cmp	DWORD PTR -208[rbp], 5
	ja	.L16
	mov	eax, DWORD PTR -208[rbp]
	lea	rdx, 0[0+rax*4]
	lea	rax, .L18[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cdqe
	lea	rdx, .L18[rip]
	add	rax, rdx
	notrack jmp	rax
	.section	.rodata
	.align 4
	.align 4
.L18:
	.long	.L23-.L18
	.long	.L22-.L18
	.long	.L21-.L18
	.long	.L20-.L18
	.long	.L19-.L18
	.long	.L17-.L18
	.text
.L23:
	lea	rax, .LC8[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC9[rip]
	mov	QWORD PTR -176[rbp], rax
	jmp	.L16
.L22:
	lea	rax, .LC10[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC11[rip]
	mov	QWORD PTR -176[rbp], rax
	jmp	.L16
.L21:
	lea	rax, .LC12[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC13[rip]
	mov	QWORD PTR -176[rbp], rax
	jmp	.L16
.L20:
	lea	rax, .LC14[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC15[rip]
	mov	QWORD PTR -176[rbp], rax
	jmp	.L16
.L19:
	lea	rax, .LC16[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC17[rip]
	mov	QWORD PTR -176[rbp], rax
	jmp	.L16
.L17:
	lea	rax, .LC18[rip]
	mov	QWORD PTR -184[rbp], rax
	lea	rax, .LC19[rip]
	mov	QWORD PTR -176[rbp], rax
	nop
.L16:
	mov	rax, QWORD PTR -168[rbp]
	lea	rcx, 192[rax]
	mov	eax, DWORD PTR -208[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	mov	rax, QWORD PTR -168[rbp]
	add	rdx, rax
	mov	rsi, QWORD PTR -176[rbp]
	mov	rax, QWORD PTR -184[rbp]
	mov	rdi, rax
	call	baker
	mov	rax, QWORD PTR -168[rbp]
	mov	esi, 224
	mov	rdi, rax
	call	munmap@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L24
	lea	rdi, .LC20[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L47
.L24:
	mov	eax, DWORD PTR -208[rbp]
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC21[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	edi, 0
	call	exit@PLT
.L14:
	lea	rdi, .LC22[rip]
	call	perror@PLT
	call	getpid@PLT
	neg	eax
	mov	esi, 2
	mov	edi, eax
	call	kill@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L50
	lea	rdi, .LC23[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L47
.L49:
	nop
	jmp	.L26
.L50:
	nop
.L26:
	add	DWORD PTR -208[rbp], 1
.L13:
	cmp	DWORD PTR -208[rbp], 5
	jle	.L27
	mov	edi, 0
	call	srand@PLT
	jmp	.L28
.L40:
	mov	rax, QWORD PTR -168[rbp]
	add	rax, 192
	mov	rdi, rax
	call	sem_wait@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L29
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L51
	lea	rdi, .LC24[rip]
	call	perror@PLT
	jmp	.L51
.L29:
	call	rand@PLT
	mov	edx, eax
	movsx	rax, edx
	imul	rax, rax, 715827883
	shr	rax, 32
	mov	ecx, edx
	sar	ecx, 31
	sub	eax, ecx
	mov	DWORD PTR -192[rbp], eax
	mov	ecx, DWORD PTR -192[rbp]
	mov	eax, ecx
	add	eax, eax
	add	eax, ecx
	add	eax, eax
	sub	edx, eax
	mov	DWORD PTR -192[rbp], edx
	cmp	DWORD PTR -192[rbp], 5
	ja	.L32
	mov	eax, DWORD PTR -192[rbp]
	lea	rdx, 0[0+rax*4]
	lea	rax, .L34[rip]
	mov	eax, DWORD PTR [rdx+rax]
	cdqe
	lea	rdx, .L34[rip]
	add	rax, rdx
	notrack jmp	rax
	.section	.rodata
	.align 4
	.align 4
.L34:
	.long	.L39-.L34
	.long	.L38-.L34
	.long	.L37-.L34
	.long	.L36-.L34
	.long	.L35-.L34
	.long	.L33-.L34
	.text
.L39:
	lea	rdi, .LC25[rip]
	call	puts@PLT
	jmp	.L32
.L38:
	lea	rdi, .LC26[rip]
	call	puts@PLT
	jmp	.L32
.L37:
	lea	rdi, .LC27[rip]
	call	puts@PLT
	jmp	.L32
.L36:
	lea	rdi, .LC28[rip]
	call	puts@PLT
	jmp	.L32
.L35:
	lea	rdi, .LC29[rip]
	call	puts@PLT
	jmp	.L32
.L33:
	lea	rdi, .LC30[rip]
	call	puts@PLT
	nop
.L32:
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR -192[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	mov	rax, QWORD PTR -168[rbp]
	add	rax, rdx
	mov	rdi, rax
	call	sem_post@PLT
.L28:
	mov	eax, DWORD PTR flag[rip]
	test	eax, eax
	je	.L40
	jmp	.L31
.L51:
	nop
.L31:
	mov	DWORD PTR -204[rbp], 0
	jmp	.L41
.L43:
	mov	eax, DWORD PTR -204[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	mov	rax, QWORD PTR -168[rbp]
	add	rax, rdx
	mov	rdi, rax
	call	sem_destroy@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L42
	lea	rdi, .LC31[rip]
	call	perror@PLT
.L42:
	add	DWORD PTR -204[rbp], 1
.L41:
	cmp	DWORD PTR -204[rbp], 6
	jle	.L43
	mov	rax, QWORD PTR -168[rbp]
	mov	esi, 224
	mov	rdi, rax
	call	munmap@PLT
	mov	DWORD PTR -200[rbp], eax
	cmp	DWORD PTR -200[rbp], -1
	jne	.L44
	lea	rdi, .LC20[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L47
.L44:
	call	getpid@PLT
	neg	eax
	mov	esi, 2
	mov	edi, eax
	call	kill@PLT
	mov	DWORD PTR -188[rbp], 0
	jmp	.L45
.L46:
	lea	rdi, .LC32[rip]
	call	puts@PLT
.L45:
	mov	edi, 0
	call	wait@PLT
	mov	DWORD PTR -188[rbp], eax
	cmp	DWORD PTR -188[rbp], -1
	jne	.L46
	lea	rdi, .LC33[rip]
	call	puts@PLT
	mov	eax, 0
.L47:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L48
	call	__stack_chk_fail@PLT
.L48:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
.LC34:
	.string	"sem_wait"
.LC35:
	.string	"sem_post"
	.text
	.globl	baker
	.type	baker, @function
baker:
.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	QWORD PTR -8[rbp], rdi
	mov	QWORD PTR -16[rbp], rsi
	mov	QWORD PTR -24[rbp], rdx
	mov	QWORD PTR -32[rbp], rcx
	jmp	.L53
.L58:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR flag[rip]
	test	eax, eax
	jne	.L54
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	cmp	eax, -1
	jne	.L54
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L59
	lea	rdi, .LC34[rip]
	call	perror@PLT
	jmp	.L59
.L54:
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR flag[rip]
	test	eax, eax
	jne	.L53
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	cmp	eax, -1
	jne	.L53
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L60
	lea	rdi, .LC35[rip]
	call	perror@PLT
	jmp	.L60
.L53:
	mov	eax, DWORD PTR flag[rip]
	test	eax, eax
	je	.L58
	jmp	.L52
.L59:
	nop
	jmp	.L52
.L60:
	nop
.L52:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	baker, .-baker
	.globl	signalHandler
	.type	signalHandler, @function
signalHandler:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	cmp	DWORD PTR -4[rbp], 2
	jne	.L63
	mov	DWORD PTR flag[rip], 1
.L63:
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	signalHandler, .-signalHandler
	.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	"169857.c"
	.text
	.local	flag
	.comm	flag,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"sigemptyset\000"
	.align	2
.LC1:
	.ascii	"sigaction\000"
	.align	2
.LC2:
	.ascii	"/system_hw04_shm\000"
	.align	2
.LC3:
	.ascii	"shm_open\000"
	.align	2
.LC4:
	.ascii	"shm_unlink\000"
	.align	2
.LC5:
	.ascii	"ftruncate\000"
	.align	2
.LC6:
	.ascii	"mmap\000"
	.align	2
.LC7:
	.ascii	"sem_init\000"
	.align	2
.LC8:
	.ascii	"Chef1 is waiting for FLOUR and EGG\000"
	.align	2
.LC9:
	.ascii	"Chef1 has taken FLOUR and EGG\000"
	.align	2
.LC10:
	.ascii	"Chef2 is waiting for EGG and BUTTER\000"
	.align	2
.LC11:
	.ascii	"Chef2 has taken EGG and BUTTER\000"
	.align	2
.LC12:
	.ascii	"Chef3 is waiting for EGG and SUGAR\000"
	.align	2
.LC13:
	.ascii	"Chef3 has taken EGG and SUGAR\000"
	.align	2
.LC14:
	.ascii	"Chef4 is waiting for FLOUR and BUTTER\000"
	.align	2
.LC15:
	.ascii	"Chef4 has taken FLOUR and BUTTER\000"
	.align	2
.LC16:
	.ascii	"Chef5 is waiting for FLOUR and SUGAR\000"
	.align	2
.LC17:
	.ascii	"Chef5 has taken FLOUR and SUGAR\000"
	.align	2
.LC18:
	.ascii	"Chef6 is waiting for BUTTER and SUGAR\000"
	.align	2
.LC19:
	.ascii	"Chef6 has taken BUTTER and SUGAR\000"
	.align	2
.LC20:
	.ascii	"munmap\000"
	.align	2
.LC21:
	.ascii	"Chef%d exits gracefully.\012\000"
	.align	2
.LC22:
	.ascii	"fork\000"
	.align	2
.LC23:
	.ascii	"fork kill\000"
	.align	2
.LC24:
	.ascii	"sem_wait producer\000"
	.align	2
.LC25:
	.ascii	"Wholesaler delivers EGG and FLOUR\000"
	.align	2
.LC26:
	.ascii	"Wholesaler delivers EGG and BUTTER\000"
	.align	2
.LC27:
	.ascii	"Wholesaler delivers EGG and SUGAR\000"
	.align	2
.LC28:
	.ascii	"Wholesaler delivers FLOUR and BUTTER\000"
	.align	2
.LC29:
	.ascii	"Wholesaler delivers FLOUR and SUGAR\000"
	.align	2
.LC30:
	.ascii	"Wholesaler delivers BUTTER and SUGAR\000"
	.align	2
.LC31:
	.ascii	"sem_destroy\000"
	.align	2
.LC32:
	.ascii	"chef process cleaned up\000"
	.align	2
.LC33:
	.ascii	"Wholesaler exits gracefully.\000"
	.align	2
.LC34:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 184
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #192
	ldr	r3, .L52
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L52+4
	str	r3, [fp, #-148]
	mov	r3, #0
	str	r3, [fp, #-16]
	sub	r3, fp, #148
	add	r3, r3, #4
	mov	r0, r3
	bl	sigemptyset
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L52+8
	bl	perror
	mov	r3, #1
	b	.L47
.L2:
	sub	r3, fp, #148
	mov	r2, #0
	mov	r1, r3
	mov	r0, #2
	bl	sigaction
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L52+12
	bl	perror
	mov	r3, #1
	b	.L47
.L4:
	mov	r2, #384
	mov	r1, #194
	ldr	r0, .L52+16
	bl	shm_open
	str	r0, [fp, #-164]
	ldr	r3, [fp, #-164]
	cmn	r3, #1
	bne	.L5
	ldr	r0, .L52+20
	bl	perror
	mvn	r3, #0
	b	.L47
.L5:
	ldr	r0, .L52+16
	bl	shm_unlink
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L6
	ldr	r0, .L52+24
	bl	perror
	mvn	r3, #4
	b	.L47
.L6:
	mov	r1, #112
	ldr	r0, [fp, #-164]
	bl	ftruncate
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L7
	ldr	r0, .L52+28
	bl	perror
	mvn	r3, #1
	b	.L47
.L7:
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-164]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #112
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-160]
	ldr	r3, [fp, #-160]
	cmn	r3, #1
	bne	.L8
	ldr	r0, .L52+32
	bl	perror
	mvn	r3, #2
	b	.L47
.L8:
	mov	r3, #0
	str	r3, [fp, #-188]
	b	.L9
.L11:
	ldr	r3, [fp, #-188]
	lsl	r3, r3, #4
	ldr	r2, [fp, #-160]
	add	r3, r2, r3
	mov	r2, #0
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L10
	ldr	r0, .L52+36
	bl	perror
	mvn	r3, #3
	b	.L47
.L10:
	ldr	r3, [fp, #-188]
	add	r3, r3, #1
	str	r3, [fp, #-188]
.L9:
	ldr	r3, [fp, #-188]
	cmp	r3, #5
	ble	.L11
	ldr	r3, [fp, #-160]
	add	r3, r3, #96
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L12
	ldr	r0, .L52+36
	bl	perror
	mvn	r3, #3
	b	.L47
.L12:
	mov	r3, #0
	str	r3, [fp, #-176]
	b	.L13
.L27:
	bl	fork
	mov	r3, r0
	cmn	r3, #1
	beq	.L14
	cmp	r3, #0
	bne	.L49
	ldr	r3, [fp, #-176]
	cmp	r3, #5
	ldrls	pc, [pc, r3, asl #2]
	b	.L16
.L18:
	.word	.L23
	.word	.L22
	.word	.L21
	.word	.L20
	.word	.L19
	.word	.L17
.L23:
	ldr	r3, .L52+40
	str	r3, [fp, #-184]
	ldr	r3, .L52+44
	str	r3, [fp, #-180]
	b	.L16
.L22:
	ldr	r3, .L52+48
	str	r3, [fp, #-184]
	ldr	r3, .L52+52
	str	r3, [fp, #-180]
	b	.L16
.L21:
	ldr	r3, .L52+56
	str	r3, [fp, #-184]
	ldr	r3, .L52+60
	str	r3, [fp, #-180]
	b	.L16
.L20:
	ldr	r3, .L52+64
	str	r3, [fp, #-184]
	ldr	r3, .L52+68
	str	r3, [fp, #-180]
	b	.L16
.L19:
	ldr	r3, .L52+72
	str	r3, [fp, #-184]
	ldr	r3, .L52+76
	str	r3, [fp, #-180]
	b	.L16
.L17:
	ldr	r3, .L52+80
	str	r3, [fp, #-184]
	ldr	r3, .L52+84
	str	r3, [fp, #-180]
	nop
.L16:
	ldr	r3, [fp, #-176]
	lsl	r3, r3, #4
	ldr	r2, [fp, #-160]
	add	r2, r2, r3
	ldr	r3, [fp, #-160]
	add	r3, r3, #96
	ldr	r1, [fp, #-180]
	ldr	r0, [fp, #-184]
	bl	baker
	mov	r1, #112
	ldr	r0, [fp, #-160]
	bl	munmap
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L24
	ldr	r0, .L52+88
	bl	perror
	mvn	r3, #0
	b	.L47
.L24:
	ldr	r3, [fp, #-176]
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L52+92
	bl	printf
	ldr	r3, .L52+96
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	mov	r0, #0
	bl	exit
.L14:
	ldr	r0, .L52+100
	bl	perror
	bl	getpid
	mov	r3, r0
	rsb	r3, r3, #0
	mov	r1, #2
	mov	r0, r3
	bl	kill
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L50
	ldr	r0, .L52+104
	bl	perror
	mvn	r3, #0
	b	.L47
.L49:
	nop
	b	.L26
.L50:
	nop
.L26:
	ldr	r3, [fp, #-176]
	add	r3, r3, #1
	str	r3, [fp, #-176]
.L13:
	ldr	r3, [fp, #-176]
	cmp	r3, #5
	ble	.L27
	mov	r0, #0
	bl	srand
	b	.L28
.L40:
	ldr	r3, [fp, #-160]
	add	r3, r3, #96
	mov	r0, r3
	bl	sem_wait
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L29
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L51
	ldr	r0, .L52+108
	bl	perror
	b	.L51
.L29:
	bl	rand
	mov	r2, r0
	ldr	r3, .L52+112
	smull	r0, r1, r3, r2
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r3, r2, r3
	str	r3, [fp, #-156]
	ldr	r3, [fp, #-156]
	cmp	r3, #5
	ldrls	pc, [pc, r3, asl #2]
	b	.L32
.L34:
	.word	.L39
	.word	.L38
	.word	.L37
	.word	.L36
	.word	.L35
	.word	.L33
.L39:
	ldr	r0, .L52+116
	bl	puts
	b	.L32
.L38:
	ldr	r0, .L52+120
	bl	puts
	b	.L32
.L37:
	ldr	r0, .L52+124
	bl	puts
	b	.L32
.L36:
	ldr	r0, .L52+128
	bl	puts
	b	.L32
.L35:
	ldr	r0, .L52+132
	bl	puts
	b	.L32
.L33:
	ldr	r0, .L52+136
	bl	puts
	nop
.L32:
	ldr	r3, .L52+96
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, [fp, #-156]
	lsl	r3, r3, #4
	ldr	r2, [fp, #-160]
	add	r3, r2, r3
	mov	r0, r3
	bl	sem_post
.L28:
	ldr	r3, .L52+140
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L40
	b	.L31
.L51:
	nop
.L31:
	mov	r3, #0
	str	r3, [fp, #-172]
	b	.L41
.L43:
	ldr	r3, [fp, #-172]
	lsl	r3, r3, #4
	ldr	r2, [fp, #-160]
	add	r3, r2, r3
	mov	r0, r3
	bl	sem_destroy
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L42
	ldr	r0, .L52+144
	bl	perror
.L42:
	ldr	r3, [fp, #-172]
	add	r3, r3, #1
	str	r3, [fp, #-172]
.L41:
	ldr	r3, [fp, #-172]
	cmp	r3, #6
	ble	.L43
	mov	r1, #112
	ldr	r0, [fp, #-160]
	bl	munmap
	str	r0, [fp, #-168]
	ldr	r3, [fp, #-168]
	cmn	r3, #1
	bne	.L44
	ldr	r0, .L52+88
	bl	perror
	mvn	r3, #0
	b	.L47
.L44:
	bl	getpid
	mov	r3, r0
	rsb	r3, r3, #0
	mov	r1, #2
	mov	r0, r3
	bl	kill
	mov	r3, #0
	str	r3, [fp, #-152]
	b	.L45
.L46:
	ldr	r0, .L52+148
	bl	puts
.L45:
	mov	r0, #0
	bl	wait
	str	r0, [fp, #-152]
	ldr	r3, [fp, #-152]
	cmn	r3, #1
	bne	.L46
	ldr	r0, .L52+152
	bl	puts
	mov	r3, #0
.L47:
	ldr	r2, .L52
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L48
	bl	__stack_chk_fail
.L48:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L53:
	.align	2
.L52:
	.word	.LC34
	.word	signalHandler
	.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	.LC13
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.word	.LC18
	.word	.LC19
	.word	.LC20
	.word	.LC21
	.word	stdout
	.word	.LC22
	.word	.LC23
	.word	.LC24
	.word	715827883
	.word	.LC25
	.word	.LC26
	.word	.LC27
	.word	.LC28
	.word	.LC29
	.word	.LC30
	.word	flag
	.word	.LC31
	.word	.LC32
	.word	.LC33
	.size	main, .-main
	.section	.rodata
	.align	2
.LC35:
	.ascii	"sem_wait\000"
	.align	2
.LC36:
	.ascii	"sem_post\000"
	.text
	.align	2
	.global	baker
	.syntax unified
	.arm
	.fpu softvfp
	.type	baker, %function
baker:
	@ 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]
	str	r3, [fp, #-20]
	b	.L55
.L60:
	ldr	r0, [fp, #-8]
	bl	puts
	ldr	r3, .L63
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, .L63+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L56
	ldr	r0, [fp, #-16]
	bl	sem_wait
	mov	r3, r0
	cmn	r3, #1
	bne	.L56
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L61
	ldr	r0, .L63+8
	bl	perror
	b	.L61
.L56:
	ldr	r0, [fp, #-12]
	bl	puts
	ldr	r3, .L63
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, .L63+4
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L55
	ldr	r0, [fp, #-20]
	bl	sem_post
	mov	r3, r0
	cmn	r3, #1
	bne	.L55
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L62
	ldr	r0, .L63+12
	bl	perror
	b	.L62
.L55:
	ldr	r3, .L63+4
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L60
	b	.L54
.L61:
	nop
	b	.L54
.L62:
	nop
.L54:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L64:
	.align	2
.L63:
	.word	stdout
	.word	flag
	.word	.LC35
	.word	.LC36
	.size	baker, .-baker
	.align	2
	.global	signalHandler
	.syntax unified
	.arm
	.fpu softvfp
	.type	signalHandler, %function
signalHandler:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #2
	bne	.L67
	ldr	r3, .L68
	mov	r2, #1
	str	r2, [r3]
.L67:
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L69:
	.align	2
.L68:
	.word	flag
	.size	signalHandler, .-signalHandler
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
