	.file	"97012441.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"sem3"
.LC1:
	.string	"sem_open failure"
.LC2:
	.string	"sharedmem"
.LC3:
	.string	"shm_open"
.LC4:
	.string	"mmap"
.LC5:
	.string	"sem1"
.LC6:
	.string	"sem2"
.LC7:
	.string	"Press 'q' to quit or..."
	.align 8
.LC8:
	.string	"Press ENTER to consume an item..."
	.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, 80
	mov	DWORD PTR -68[rbp], edi
	mov	QWORD PTR -80[rbp], rsi
	mov	ecx, 0
	mov	edx, 432
	mov	esi, 64
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -32[rbp], rax
	cmp	QWORD PTR -32[rbp], 0
	jne	.L2
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 0
	call	exit@PLT
.L2:
	mov	rax, QWORD PTR -32[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	DWORD PTR -48[rbp], 4096
	lea	rax, .LC2[rip]
	mov	QWORD PTR -24[rbp], rax
	mov	rax, QWORD PTR -24[rbp]
	mov	edx, 0
	mov	esi, 2
	mov	rdi, rax
	call	shm_open@PLT
	mov	DWORD PTR -44[rbp], eax
	cmp	DWORD PTR -44[rbp], -1
	jne	.L3
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	eax, DWORD PTR -48[rbp]
	cdqe
	mov	edx, DWORD PTR -44[rbp]
	mov	r9d, 0
	mov	r8d, edx
	mov	ecx, 1
	mov	edx, 3
	mov	rsi, rax
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], -1
	jne	.L4
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	esi, 0
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jne	.L5
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 0
	call	exit@PLT
.L5:
	mov	esi, 0
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L6
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 0
	call	exit@PLT
.L6:
	mov	DWORD PTR -52[rbp], 0
	lea	rdi, .LC7[rip]
	call	puts@PLT
.L12:
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	call	getchar@PLT
	mov	BYTE PTR -53[rbp], al
	cmp	BYTE PTR -53[rbp], 113
	je	.L15
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	cmp	DWORD PTR -52[rbp], 0
	jne	.L9
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	DWORD PTR -52[rbp], 2047
	mov	rax, QWORD PTR -40[rbp]
	mov	edx, 2047
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	jmp	.L10
.L9:
	cmp	DWORD PTR -52[rbp], 2047
	jne	.L10
	add	QWORD PTR -40[rbp], 2047
	mov	rax, QWORD PTR -40[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L11
	sub	QWORD PTR -40[rbp], 2047
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	DWORD PTR -52[rbp], 2047
	mov	rax, QWORD PTR -40[rbp]
	mov	edx, 2047
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	jmp	.L10
.L11:
	mov	rax, QWORD PTR -40[rbp]
	movzx	eax, BYTE PTR [rax]
	test	al, al
	je	.L10
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	puts@PLT
	mov	rax, QWORD PTR -40[rbp]
	mov	edx, 2047
	mov	esi, 0
	mov	rdi, rax
	call	memset@PLT
	sub	QWORD PTR -40[rbp], 2047
	mov	DWORD PTR -52[rbp], 0
.L10:
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L12
.L15:
	nop
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	shm_unlink@PLT
	lea	rdi, .LC0[rip]
	call	sem_unlink@PLT
	mov	eax, 0
	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	"97012441.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"sem3\000"
	.align	2
.LC1:
	.ascii	"sem_open failure\000"
	.align	2
.LC2:
	.ascii	"sharedmem\000"
	.align	2
.LC3:
	.ascii	"shm_open\000"
	.align	2
.LC4:
	.ascii	"mmap\000"
	.align	2
.LC5:
	.ascii	"sem1\000"
	.align	2
.LC6:
	.ascii	"sem2\000"
	.align	2
.LC7:
	.ascii	"Press 'q' to quit or...\000"
	.align	2
.LC8:
	.ascii	"Press ENTER to consume an item...\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	mov	r3, #0
	mov	r2, #432
	mov	r1, #64
	ldr	r0, .L16
	bl	sem_open
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L2
	ldr	r0, .L16+4
	bl	perror
	mov	r0, #0
	bl	exit
.L2:
	ldr	r0, [fp, #-28]
	bl	sem_wait
	mov	r3, #4096
	str	r3, [fp, #-24]
	ldr	r3, .L16+8
	str	r3, [fp, #-20]
	mov	r2, #0
	mov	r1, #2
	ldr	r0, [fp, #-20]
	bl	shm_open
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L16+12
	bl	perror
	mov	r0, #1
	bl	exit
.L3:
	ldr	r1, [fp, #-24]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-16]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-36]
	ldr	r3, [fp, #-36]
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L16+16
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	mov	r1, #0
	ldr	r0, .L16+20
	bl	sem_open
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L5
	ldr	r0, .L16+4
	bl	perror
	mov	r0, #0
	bl	exit
.L5:
	mov	r1, #0
	ldr	r0, .L16+24
	bl	sem_open
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L16+4
	bl	perror
	mov	r0, #0
	bl	exit
.L6:
	mov	r3, #0
	str	r3, [fp, #-32]
	ldr	r0, .L16+28
	bl	puts
.L12:
	ldr	r0, .L16+32
	bl	printf
	bl	getchar
	mov	r3, r0
	strb	r3, [fp, #-37]
	ldrb	r3, [fp, #-37]	@ zero_extendqisi2
	cmp	r3, #113
	beq	.L15
	ldr	r0, [fp, #-8]
	bl	sem_wait
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	bne	.L9
	ldr	r0, [fp, #-36]
	bl	puts
	ldr	r3, .L16+36
	str	r3, [fp, #-32]
	ldr	r2, .L16+36
	mov	r1, #0
	ldr	r0, [fp, #-36]
	bl	memset
	b	.L10
.L9:
	ldr	r3, [fp, #-32]
	ldr	r2, .L16+36
	cmp	r3, r2
	bne	.L10
	ldr	r3, [fp, #-36]
	add	r3, r3, #2032
	add	r3, r3, #15
	str	r3, [fp, #-36]
	ldr	r3, [fp, #-36]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L11
	ldr	r3, [fp, #-36]
	sub	r3, r3, #2032
	sub	r3, r3, #15
	str	r3, [fp, #-36]
	ldr	r0, [fp, #-36]
	bl	puts
	ldr	r3, .L16+36
	str	r3, [fp, #-32]
	ldr	r2, .L16+36
	mov	r1, #0
	ldr	r0, [fp, #-36]
	bl	memset
	b	.L10
.L11:
	ldr	r3, [fp, #-36]
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L10
	ldr	r0, [fp, #-36]
	bl	puts
	ldr	r2, .L16+36
	mov	r1, #0
	ldr	r0, [fp, #-36]
	bl	memset
	ldr	r3, [fp, #-36]
	sub	r3, r3, #2032
	sub	r3, r3, #15
	str	r3, [fp, #-36]
	mov	r3, #0
	str	r3, [fp, #-32]
.L10:
	ldr	r0, [fp, #-12]
	bl	sem_post
	b	.L12
.L15:
	nop
	ldr	r0, [fp, #-20]
	bl	shm_unlink
	ldr	r0, .L16
	bl	sem_unlink
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	2047
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
