	.file	"636330.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"/pl4ex17"
	.align 8
.LC1:
	.string	"Erro na cria\303\247\303\243o da mem\303\263ria partilhada!"
.LC2:
	.string	"Erro no ftruncate!"
.LC3:
	.string	"ex17b"
.LC4:
	.string	"Error in sem_open()"
.LC5:
	.string	"2ex17b"
.LC6:
	.string	"3ex17b"
.LC7:
	.string	"4ex17b"
.LC8:
	.string	"5ex17b"
.LC9:
	.string	"6ex17b"
.LC10:
	.string	"7ex17b"
.LC11:
	.string	"Pode entrar"
.LC12:
	.string	"Esta tudo cheio!"
.LC13:
	.string	"Est\303\241 tudo cheio!"
	.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 -72[rbp], 36
	mov	edx, 384
	mov	esi, 66
	lea	rdi, .LC0[rip]
	call	shm_open@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], -1
	jne	.L2
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L3
.L2:
	mov	eax, DWORD PTR -72[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -68[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	ftruncate@PLT
	cmp	eax, -1
	jne	.L4
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L3
.L4:
	mov	eax, DWORD PTR -72[rbp]
	cdqe
	mov	edx, DWORD PTR -68[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 -64[rbp], rax
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -56[rbp], rax
	cmp	QWORD PTR -56[rbp], 0
	jne	.L5
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -48[rbp], rax
	cmp	QWORD PTR -48[rbp], 0
	jne	.L6
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	ecx, 1
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -40[rbp], rax
	cmp	QWORD PTR -40[rbp], 0
	jne	.L7
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	ecx, 1
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -32[rbp], rax
	cmp	QWORD PTR -32[rbp], 0
	jne	.L8
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -24[rbp], rax
	cmp	QWORD PTR -24[rbp], 0
	jne	.L9
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jne	.L10
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	mov	ecx, 0
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L11
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L11:
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 32[rax], 2
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 8[rax], 1
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 4[rax], 1
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 12[rax], 0
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 16[rax], 0
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 20[rax], 0
	jmp	.L12
.L16:
	mov	rax, QWORD PTR -48[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 24[rax]
	cmp	eax, 1
	jne	.L13
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 12[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 12[rax], edx
	jmp	.L14
.L13:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 24[rax]
	cmp	eax, 2
	jne	.L15
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 20[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 20[rax], edx
	jmp	.L14
.L15:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 16[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 16[rax], edx
.L14:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 32[rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 32[rax], edx
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	sem_post@PLT
.L12:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 32[rax]
	test	eax, eax
	jg	.L16
.L23:
	mov	rax, QWORD PTR -48[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 24[rax]
	cmp	eax, 1
	jne	.L17
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 16[rax]
	test	eax, eax
	jle	.L18
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 16[rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 16[rax], edx
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 12[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 12[rax], edx
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L17
.L18:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 20[rax]
	test	eax, eax
	jle	.L19
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 20[rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 20[rax], edx
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 12[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 12[rax], edx
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L17
.L19:
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 28[rax], 1
.L17:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 24[rax]
	cmp	eax, 2
	jne	.L20
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 16[rax]
	test	eax, eax
	jle	.L21
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 16[rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 16[rax], edx
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 20[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 20[rax], edx
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L20
.L21:
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 28[rax], 1
.L20:
	mov	rax, QWORD PTR -64[rbp]
	mov	eax, DWORD PTR 24[rax]
	cmp	eax, 3
	jne	.L22
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -64[rbp]
	mov	DWORD PTR 28[rax], 1
.L22:
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L23
.L3:
	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	"636330.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/pl4ex17\000"
	.align	2
.LC1:
	.ascii	"Erro na cria\303\247\303\243o da mem\303\263ria par"
	.ascii	"tilhada!\000"
	.align	2
.LC2:
	.ascii	"Erro no ftruncate!\000"
	.align	2
.LC3:
	.ascii	"ex17b\000"
	.align	2
.LC4:
	.ascii	"Error in sem_open()\000"
	.align	2
.LC5:
	.ascii	"2ex17b\000"
	.align	2
.LC6:
	.ascii	"3ex17b\000"
	.align	2
.LC7:
	.ascii	"4ex17b\000"
	.align	2
.LC8:
	.ascii	"5ex17b\000"
	.align	2
.LC9:
	.ascii	"6ex17b\000"
	.align	2
.LC10:
	.ascii	"7ex17b\000"
	.align	2
.LC11:
	.ascii	"Pode entrar\000"
	.align	2
.LC12:
	.ascii	"Esta tudo cheio!\000"
	.align	2
.LC13:
	.ascii	"Est\303\241 tudo cheio!\000"
	.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, #48
	mov	r3, #36
	str	r3, [fp, #-44]
	mov	r2, #384
	mov	r1, #66
	ldr	r0, .L24
	bl	shm_open
	str	r0, [fp, #-40]
	ldr	r3, [fp, #-40]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L24+4
	bl	printf
	mov	r3, #1
	b	.L3
.L2:
	ldr	r1, [fp, #-44]
	ldr	r0, [fp, #-40]
	bl	ftruncate
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L24+8
	bl	printf
	mov	r3, #1
	b	.L3
.L4:
	ldr	r1, [fp, #-44]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-40]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-36]
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+12
	bl	sem_open
	str	r0, [fp, #-32]
	ldr	r3, [fp, #-32]
	cmp	r3, #0
	bne	.L5
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L5:
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+20
	bl	sem_open
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L6:
	mov	r3, #1
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+24
	bl	sem_open
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bne	.L7
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L7:
	mov	r3, #1
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+28
	bl	sem_open
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	cmp	r3, #0
	bne	.L8
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L8:
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+32
	bl	sem_open
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	bne	.L9
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+36
	bl	sem_open
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L10
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	mov	r3, #0
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L24+40
	bl	sem_open
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L11
	ldr	r0, .L24+16
	bl	perror
	mov	r0, #1
	bl	exit
.L11:
	ldr	r3, [fp, #-36]
	mov	r2, #2
	str	r2, [r3, #32]
	ldr	r3, [fp, #-36]
	mov	r2, #1
	str	r2, [r3, #8]
	ldr	r3, [fp, #-36]
	mov	r2, #1
	str	r2, [r3, #4]
	ldr	r3, [fp, #-36]
	mov	r2, #0
	str	r2, [r3, #12]
	ldr	r3, [fp, #-36]
	mov	r2, #0
	str	r2, [r3, #16]
	ldr	r3, [fp, #-36]
	mov	r2, #0
	str	r2, [r3, #20]
	b	.L12
.L16:
	ldr	r0, [fp, #-28]
	bl	sem_wait
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #24]
	cmp	r3, #1
	bne	.L13
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #12]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #12]
	b	.L14
.L13:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #24]
	cmp	r3, #2
	bne	.L15
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #20]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #20]
	b	.L14
.L15:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #16]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #16]
.L14:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #32]
	sub	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #32]
	ldr	r0, .L24+44
	bl	puts
	ldr	r0, [fp, #-32]
	bl	sem_post
.L12:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #32]
	cmp	r3, #0
	bgt	.L16
.L23:
	ldr	r0, [fp, #-28]
	bl	sem_wait
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #24]
	cmp	r3, #1
	bne	.L17
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #16]
	cmp	r3, #0
	ble	.L18
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #16]
	sub	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #16]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #12]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #12]
	ldr	r0, [fp, #-16]
	bl	sem_post
	b	.L17
.L18:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #20]
	cmp	r3, #0
	ble	.L19
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #20]
	sub	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #20]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #12]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #12]
	ldr	r0, [fp, #-12]
	bl	sem_post
	b	.L17
.L19:
	ldr	r0, .L24+48
	bl	printf
	ldr	r3, [fp, #-36]
	mov	r2, #1
	str	r2, [r3, #28]
.L17:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #24]
	cmp	r3, #2
	bne	.L20
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #16]
	cmp	r3, #0
	ble	.L21
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #16]
	sub	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #16]
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #20]
	add	r2, r3, #1
	ldr	r3, [fp, #-36]
	str	r2, [r3, #20]
	ldr	r0, [fp, #-16]
	bl	sem_post
	b	.L20
.L21:
	ldr	r0, .L24+48
	bl	printf
	ldr	r3, [fp, #-36]
	mov	r2, #1
	str	r2, [r3, #28]
.L20:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #24]
	cmp	r3, #3
	bne	.L22
	ldr	r0, .L24+52
	bl	printf
	ldr	r3, [fp, #-36]
	mov	r2, #1
	str	r2, [r3, #28]
.L22:
	ldr	r0, [fp, #-32]
	bl	sem_post
	b	.L23
.L3:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.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
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
