	.file	"200142355.c"
	.intel_syntax noprefix
	.text
	.globl	up
	.type	up, @function
up:
.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	QWORD PTR -16[rbp], rdx
	mov	eax, DWORD PTR -8[rbp]
	mov	edx, eax
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR [rax], dx
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR 2[rax], 1
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR 4[rax], 0
	mov	rcx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	up, .-up
	.globl	down
	.type	down, @function
down:
.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	QWORD PTR -16[rbp], rdx
	mov	eax, DWORD PTR -8[rbp]
	mov	edx, eax
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR [rax], dx
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR 2[rax], -1
	mov	rax, QWORD PTR -16[rbp]
	mov	WORD PTR 4[rax], 0
	mov	rcx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -4[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	semop@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	down, .-down
	.globl	initSem
	.type	initSem, @function
initSem:
.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	eax, DWORD PTR -28[rbp]
	mov	DWORD PTR -8[rbp], eax
	mov	rdx, QWORD PTR -8[rbp]
	mov	esi, DWORD PTR -24[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	rcx, rdx
	mov	edx, 16
	mov	edi, eax
	mov	eax, 0
	call	semctl@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	initSem, .-initSem
	.section	.rodata
.LC0:
	.string	"There are %d chairs.\n"
.LC1:
	.string	"Now barber cutting hair"
	.align 8
.LC2:
	.string	"Customer %d enters barbershop.\n"
	.align 8
.LC3:
	.string	"Customer %d left the barbershop.\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -40[rbp], 1111
	mov	DWORD PTR -36[rbp], 2222
	mov	DWORD PTR -44[rbp], 1
	mov	eax, DWORD PTR -36[rbp]
	mov	edx, 950
	mov	esi, 4
	mov	edi, eax
	call	shmget@PLT
	mov	DWORD PTR -32[rbp], eax
	mov	eax, DWORD PTR -40[rbp]
	mov	edx, 950
	mov	esi, 3
	mov	edi, eax
	call	semget@PLT
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR -32[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	shmat@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR [rax], 0
	mov	eax, DWORD PTR -28[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	initSem
	mov	eax, DWORD PTR -28[rbp]
	mov	edx, 0
	mov	esi, 1
	mov	edi, eax
	call	initSem
	mov	eax, DWORD PTR -28[rbp]
	mov	edx, 1
	mov	esi, 2
	mov	edi, eax
	call	initSem
	mov	esi, 5
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	call	fork@PLT
	test	eax, eax
	je	.L5
.L6:
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 0
	mov	edi, eax
	call	down
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 2
	mov	edi, eax
	call	down
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR [rax], edx
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 1
	mov	edi, eax
	call	up
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 2
	mov	edi, eax
	call	up
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	edi, 6
	call	sleep@PLT
	jmp	.L6
.L5:
	mov	edi, 1
	call	sleep@PLT
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 2
	mov	edi, eax
	call	down
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	jg	.L7
	mov	eax, DWORD PTR -44[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -44[rbp], edx
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR [rax], edx
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 0
	mov	edi, eax
	call	up
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 2
	mov	edi, eax
	call	up
	jmp	.L5
.L7:
	mov	eax, DWORD PTR -44[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -44[rbp], edx
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdx, -22[rbp]
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, 2
	mov	edi, eax
	call	up
	jmp	.L5
	.cfi_endproc
.LFE9:
	.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	"200142355.c"
	.text
	.align	2
	.global	up
	.syntax unified
	.arm
	.fpu softvfp
	.type	up, %function
up:
	@ 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]
	ldr	r3, [fp, #-12]
	lsl	r3, r3, #16
	lsr	r2, r3, #16
	ldr	r3, [fp, #-16]
	strh	r2, [r3]	@ movhi
	ldr	r3, [fp, #-16]
	mov	r2, #1
	strh	r2, [r3, #2]	@ movhi
	ldr	r3, [fp, #-16]
	mov	r2, #0
	strh	r2, [r3, #4]	@ movhi
	mov	r2, #1
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-8]
	bl	semop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	up, .-up
	.align	2
	.global	down
	.syntax unified
	.arm
	.fpu softvfp
	.type	down, %function
down:
	@ 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]
	ldr	r3, [fp, #-12]
	lsl	r3, r3, #16
	lsr	r2, r3, #16
	ldr	r3, [fp, #-16]
	strh	r2, [r3]	@ movhi
	ldr	r3, [fp, #-16]
	mvn	r2, #0
	strh	r2, [r3, #2]	@ movhi
	ldr	r3, [fp, #-16]
	mov	r2, #0
	strh	r2, [r3, #4]	@ movhi
	mov	r2, #1
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-8]
	bl	semop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	down, .-down
	.align	2
	.global	initSem
	.syntax unified
	.arm
	.fpu softvfp
	.type	initSem, %function
initSem:
	@ 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]
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	mov	r2, #16
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-16]
	bl	semctl
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	initSem, .-initSem
	.section	.rodata
	.align	2
.LC0:
	.ascii	"There are %d chairs.\012\000"
	.align	2
.LC1:
	.ascii	"Now barber cutting hair\000"
	.align	2
.LC2:
	.ascii	"Customer %d enters barbershop.\012\000"
	.align	2
.LC3:
	.ascii	"Customer %d left the barbershop.\012\000"
	.align	2
.LC4:
	.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, .L10
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L10+4
	str	r3, [fp, #-36]
	ldr	r3, .L10+8
	str	r3, [fp, #-32]
	mov	r3, #1
	str	r3, [fp, #-40]
	ldr	r2, .L10+12
	mov	r1, #4
	ldr	r0, [fp, #-32]
	bl	shmget
	str	r0, [fp, #-28]
	ldr	r2, .L10+12
	mov	r1, #3
	ldr	r0, [fp, #-36]
	bl	semget
	str	r0, [fp, #-24]
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-28]
	bl	shmat
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	mov	r2, #0
	str	r2, [r3]
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-24]
	bl	initSem
	mov	r2, #0
	mov	r1, #1
	ldr	r0, [fp, #-24]
	bl	initSem
	mov	r2, #1
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	initSem
	mov	r1, #5
	ldr	r0, .L10+16
	bl	printf
	bl	fork
	mov	r3, r0
	cmp	r3, #0
	beq	.L5
.L6:
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-24]
	bl	down
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	down
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, [fp, #-20]
	str	r2, [r3]
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #1
	ldr	r0, [fp, #-24]
	bl	up
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	up
	ldr	r0, .L10+20
	bl	puts
	mov	r0, #6
	bl	sleep
	b	.L6
.L5:
	mov	r0, #1
	bl	sleep
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	down
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	cmp	r3, #4
	bgt	.L7
	ldr	r3, [fp, #-40]
	add	r2, r3, #1
	str	r2, [fp, #-40]
	mov	r1, r3
	ldr	r0, .L10+24
	bl	printf
	ldr	r3, [fp, #-20]
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r3, [fp, #-20]
	str	r2, [r3]
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-24]
	bl	up
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	up
	b	.L5
.L7:
	ldr	r3, [fp, #-40]
	add	r2, r3, #1
	str	r2, [fp, #-40]
	mov	r1, r3
	ldr	r0, .L10+28
	bl	printf
	sub	r3, fp, #16
	mov	r2, r3
	mov	r1, #2
	ldr	r0, [fp, #-24]
	bl	up
	b	.L5
.L11:
	.align	2
.L10:
	.word	.LC4
	.word	1111
	.word	2222
	.word	950
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
