	.file	"233895.c"
	.intel_syntax noprefix
	.text
	.globl	make_children
	.type	make_children, @function
make_children:
.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
	call	getpid@PLT
	mov	DWORD PTR -8[rbp], eax
	mov	DWORD PTR -12[rbp], 0
	jmp	.L2
.L7:
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jns	.L3
	mov	eax, -1
	jmp	.L4
.L3:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L5
	mov	eax, DWORD PTR -12[rbp]
	jmp	.L4
.L5:
	call	getpid@PLT
	cmp	DWORD PTR -8[rbp], eax
	jne	.L6
	mov	eax, DWORD PTR -20[rbp]
	sub	eax, 1
	cmp	DWORD PTR -12[rbp], eax
	jne	.L6
	mov	eax, DWORD PTR -8[rbp]
	jmp	.L4
.L6:
	add	DWORD PTR -12[rbp], 1
.L2:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -20[rbp]
	jl	.L7
	mov	eax, 0
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	make_children, .-make_children
	.section	.rodata
.LC0:
	.string	"/shm_ex03"
.LC1:
	.string	"/sem_ex03"
.LC2:
	.string	"Opening shared memory ERROR.\n"
.LC3:
	.string	"Space in Shared Memory ERROR\n"
.LC4:
	.string	"Error maping the object.\n"
.LC5:
	.string	"Error in sem_open()"
.LC6:
	.string	"Child writing - i:%d\n"
	.align 8
.LC7:
	.string	"I\342\200\231m the Father - with PID %d"
.LC8:
	.string	"Munmap failed.\n"
.LC9:
	.string	"Cant close object.\n"
.LC10:
	.string	"%s - i:%d\n"
.LC11:
	.string	"unlink failed\n"
.LC12:
	.string	"Error at sem close"
.LC13:
	.string	"Error at unlink sem"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 56
	.cfi_offset 3, -24
	mov	DWORD PTR -48[rbp], 4000
	lea	rdi, .LC0[rip]
	call	shm_unlink@PLT
	lea	rdi, .LC1[rip]
	call	sem_unlink@PLT
	mov	edx, 384
	mov	esi, 66
	lea	rdi, .LC0[rip]
	call	shm_open@PLT
	mov	DWORD PTR -44[rbp], eax
	cmp	DWORD PTR -44[rbp], -1
	jne	.L9
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	eax, DWORD PTR -48[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -44[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	ftruncate@PLT
	cmp	eax, -1
	jne	.L10
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	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 -32[rbp], rax
	cmp	QWORD PTR -32[rbp], -1
	jne	.L11
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L11:
	mov	ecx, 1
	mov	edx, 420
	mov	esi, 64
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	sem_open@PLT
	mov	QWORD PTR -24[rbp], rax
	cmp	QWORD PTR -24[rbp], 0
	jne	.L12
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	call	getpid@PLT
	mov	DWORD PTR -40[rbp], eax
	mov	edi, 50
	call	make_children
	mov	DWORD PTR -36[rbp], eax
	cmp	DWORD PTR -36[rbp], 0
	js	.L13
	mov	eax, DWORD PTR -36[rbp]
	cmp	eax, DWORD PTR -40[rbp]
	je	.L13
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	eax, DWORD PTR -36[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -36[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 4
	mov	rdx, QWORD PTR -32[rbp]
	add	rax, rdx
	mov	edx, ecx
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	mov	eax, 0
	call	sprintf@PLT
	mov	edi, 0
	call	time@PLT
	mov	ebx, eax
	call	getpid@PLT
	imul	eax, ebx
	mov	edi, eax
	call	srand@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_post@PLT
	mov	eax, DWORD PTR -48[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	munmap@PLT
	cmp	eax, -1
	jne	.L14
	lea	rdi, .LC8[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L14:
	mov	eax, DWORD PTR -44[rbp]
	mov	edi, eax
	call	close@PLT
	cmp	eax, -1
	jne	.L15
	lea	rdi, .LC9[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L15:
	mov	edi, 0
	call	exit@PLT
.L13:
	mov	DWORD PTR -52[rbp], 0
	jmp	.L16
.L17:
	mov	edi, 0
	call	wait@PLT
	add	DWORD PTR -52[rbp], 1
.L16:
	cmp	DWORD PTR -52[rbp], 49
	jle	.L17
	mov	DWORD PTR -52[rbp], 0
	jmp	.L18
.L19:
	mov	eax, DWORD PTR -52[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 4
	mov	rdx, QWORD PTR -32[rbp]
	lea	rcx, [rax+rdx]
	mov	eax, DWORD PTR -52[rbp]
	mov	edx, eax
	mov	rsi, rcx
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -52[rbp], 1
.L18:
	cmp	DWORD PTR -52[rbp], 49
	jle	.L19
	mov	eax, DWORD PTR -48[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	munmap@PLT
	cmp	eax, -1
	jne	.L20
	lea	rdi, .LC8[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L20:
	mov	eax, DWORD PTR -44[rbp]
	mov	edi, eax
	call	close@PLT
	cmp	eax, -1
	jne	.L21
	lea	rdi, .LC9[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L21:
	lea	rdi, .LC0[rip]
	call	shm_unlink@PLT
	test	eax, eax
	jns	.L22
	lea	rdi, .LC11[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L22:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_close@PLT
	test	eax, eax
	jns	.L23
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L23:
	lea	rdi, .LC1[rip]
	call	sem_unlink@PLT
	test	eax, eax
	jns	.L24
	lea	rdi, .LC13[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L24:
	mov	eax, 0
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	"233895.c"
	.text
	.align	2
	.global	make_children
	.syntax unified
	.arm
	.fpu softvfp
	.type	make_children, %function
make_children:
	@ 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, #-24]
	bl	getpid
	str	r0, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L2
.L7:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L3
	mvn	r3, #0
	b	.L4
.L3:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L5
	ldr	r3, [fp, #-16]
	b	.L4
.L5:
	bl	getpid
	mov	r2, r0
	ldr	r3, [fp, #-12]
	cmp	r3, r2
	bne	.L6
	ldr	r3, [fp, #-24]
	sub	r3, r3, #1
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L6
	ldr	r3, [fp, #-12]
	b	.L4
.L6:
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L2:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	blt	.L7
	mov	r3, #0
.L4:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	make_children, .-make_children
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/shm_ex03\000"
	.align	2
.LC1:
	.ascii	"/sem_ex03\000"
	.align	2
.LC2:
	.ascii	"Opening shared memory ERROR.\012\000"
	.align	2
.LC3:
	.ascii	"Space in Shared Memory ERROR\012\000"
	.align	2
.LC4:
	.ascii	"Error maping the object.\012\000"
	.align	2
.LC5:
	.ascii	"Error in sem_open()\000"
	.align	2
.LC6:
	.ascii	"Child writing - i:%d\012\000"
	.align	2
.LC7:
	.ascii	"I\342\200\231m the Father - with PID %d\000"
	.align	2
.LC8:
	.ascii	"Munmap failed.\012\000"
	.align	2
.LC9:
	.ascii	"Cant close object.\012\000"
	.align	2
.LC10:
	.ascii	"%s - i:%d\012\000"
	.align	2
.LC11:
	.ascii	"unlink failed\012\000"
	.align	2
.LC12:
	.ascii	"Error at sem close\000"
	.align	2
.LC13:
	.ascii	"Error at unlink sem\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #44
	mov	r3, #4000
	str	r3, [fp, #-36]
	ldr	r0, .L26
	bl	shm_unlink
	ldr	r0, .L26+4
	bl	sem_unlink
	mov	r2, #384
	mov	r1, #66
	ldr	r0, .L26
	bl	shm_open
	str	r0, [fp, #-32]
	ldr	r3, [fp, #-32]
	cmn	r3, #1
	bne	.L9
	ldr	r0, .L26+8
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	ldr	r1, [fp, #-36]
	ldr	r0, [fp, #-32]
	bl	ftruncate
	mov	r3, r0
	cmn	r3, #1
	bne	.L10
	ldr	r0, .L26+12
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	ldr	r1, [fp, #-36]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-32]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmn	r3, #1
	bne	.L11
	ldr	r0, .L26+16
	bl	perror
	mov	r0, #1
	bl	exit
.L11:
	mov	r3, #1
	mov	r2, #420
	mov	r1, #64
	ldr	r0, .L26+4
	bl	sem_open
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bne	.L12
	ldr	r0, .L26+20
	bl	perror
	mov	r0, #1
	bl	exit
.L12:
	bl	getpid
	str	r0, [fp, #-20]
	mov	r0, #50
	bl	make_children
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	blt	.L13
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	beq	.L13
	ldr	r0, [fp, #-24]
	bl	sem_wait
	ldr	r1, [fp, #-16]
	ldr	r0, .L26+24
	bl	printf
	ldr	r2, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, [fp, #-28]
	add	r4, r2, r3
	bl	getpid
	mov	r3, r0
	mov	r2, r3
	ldr	r1, .L26+28
	mov	r0, r4
	bl	sprintf
	mov	r0, #0
	bl	time
	mov	r4, r0
	bl	getpid
	mov	r3, r0
	mul	r3, r4, r3
	mov	r0, r3
	bl	srand
	ldr	r0, [fp, #-24]
	bl	sem_post
	ldr	r3, [fp, #-36]
	mov	r1, r3
	ldr	r0, [fp, #-28]
	bl	munmap
	mov	r3, r0
	cmn	r3, #1
	bne	.L14
	ldr	r0, .L26+32
	bl	perror
	mov	r0, #1
	bl	exit
.L14:
	ldr	r0, [fp, #-32]
	bl	close
	mov	r3, r0
	cmn	r3, #1
	bne	.L15
	ldr	r0, .L26+36
	bl	perror
	mov	r0, #1
	bl	exit
.L15:
	mov	r0, #0
	bl	exit
.L13:
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L16
.L17:
	mov	r0, #0
	bl	wait
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L16:
	ldr	r3, [fp, #-40]
	cmp	r3, #49
	ble	.L17
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L18
.L19:
	ldr	r2, [fp, #-40]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #4
	ldr	r2, [fp, #-28]
	add	r3, r2, r3
	ldr	r2, [fp, #-40]
	mov	r1, r3
	ldr	r0, .L26+40
	bl	printf
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L18:
	ldr	r3, [fp, #-40]
	cmp	r3, #49
	ble	.L19
	ldr	r3, [fp, #-36]
	mov	r1, r3
	ldr	r0, [fp, #-28]
	bl	munmap
	mov	r3, r0
	cmn	r3, #1
	bne	.L20
	ldr	r0, .L26+32
	bl	perror
	mov	r0, #1
	bl	exit
.L20:
	ldr	r0, [fp, #-32]
	bl	close
	mov	r3, r0
	cmn	r3, #1
	bne	.L21
	ldr	r0, .L26+36
	bl	perror
	mov	r0, #1
	bl	exit
.L21:
	ldr	r0, .L26
	bl	shm_unlink
	mov	r3, r0
	cmp	r3, #0
	bge	.L22
	ldr	r0, .L26+44
	bl	perror
	mov	r0, #1
	bl	exit
.L22:
	ldr	r0, [fp, #-24]
	bl	sem_close
	mov	r3, r0
	cmp	r3, #0
	bge	.L23
	ldr	r0, .L26+48
	bl	perror
	mov	r0, #1
	bl	exit
.L23:
	ldr	r0, .L26+4
	bl	sem_unlink
	mov	r3, r0
	cmp	r3, #0
	bge	.L24
	ldr	r0, .L26+52
	bl	perror
	mov	r0, #1
	bl	exit
.L24:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L27:
	.align	2
.L26:
	.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
