	.file	"84827.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"/shmex13"
.LC1:
	.string	"In shm_open()"
.LC2:
	.string	"files/file%d.txt"
.LC3:
	.string	"Erro no fork!\n"
.LC4:
	.string	"r"
.LC5:
	.string	"Erro no processo filho"
	.align 8
.LC6:
	.string	"O filho n.%d encontrou '%s' %d vezes no seu ficheiro - %s.\n"
	.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, 1088
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -1072[rbp], 3596
	mov	edx, 384
	mov	esi, 194
	lea	rdi, .LC0[rip]
	call	shm_open@PLT
	mov	DWORD PTR -1068[rbp], eax
	cmp	DWORD PTR -1068[rbp], 0
	jns	.L2
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	eax, DWORD PTR -1072[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -1068[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	ftruncate@PLT
	mov	eax, DWORD PTR -1072[rbp]
	cdqe
	mov	edx, DWORD PTR -1068[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 -1056[rbp], rax
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 40
	mov	DWORD PTR [rax], 1635017058
	mov	WORD PTR 4[rax], 24948
	mov	BYTE PTR 6[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 295
	mov	DWORD PTR [rax], 1869771361
	mov	WORD PTR 4[rax], 122
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 550
	movabs	rsi, 27417896030529904
	mov	QWORD PTR [rax], rsi
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 805
	mov	DWORD PTR [rax], 1785292134
	mov	WORD PTR 4[rax], 28513
	mov	BYTE PTR 6[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 1060
	movabs	rsi, 7956016013909778787
	mov	QWORD PTR [rax], rsi
	mov	WORD PTR 8[rax], 24936
	mov	BYTE PTR 10[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 1315
	mov	DWORD PTR [rax], 1869767014
	mov	WORD PTR 4[rax], 24934
	mov	BYTE PTR 6[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 1570
	mov	DWORD PTR [rax], 1635017058
	mov	WORD PTR 4[rax], 24948
	mov	BYTE PTR 6[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 1825
	mov	DWORD PTR [rax], 1869771361
	mov	WORD PTR 4[rax], 122
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 2080
	mov	DWORD PTR [rax], 1785292134
	mov	WORD PTR 4[rax], 28513
	mov	BYTE PTR 6[rax], 0
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, 2335
	mov	DWORD PTR [rax], 1869767014
	mov	WORD PTR 4[rax], 24934
	mov	BYTE PTR 6[rax], 0
	mov	DWORD PTR -1076[rbp], 0
	jmp	.L3
.L9:
	mov	eax, DWORD PTR -1076[rbp]
	lea	edx, 1[rax]
	mov	eax, DWORD PTR -1076[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	lea	rcx, 0[0+rax*4]
	add	rax, rcx
	sal	rax, 2
	lea	rcx, 2576[rax]
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, rcx
	add	rax, 14
	lea	rsi, .LC2[rip]
	mov	rdi, rax
	mov	eax, 0
	call	sprintf@PLT
	call	fork@PLT
	mov	DWORD PTR -1060[rbp], eax
	cmp	DWORD PTR -1060[rbp], -1
	jne	.L4
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	rax, QWORD PTR -1056[rbp]
	mov	DWORD PTR 3592[rax], 1
	cmp	DWORD PTR -1060[rbp], 0
	jne	.L5
	nop
.L6:
	mov	rax, QWORD PTR -1056[rbp]
	mov	eax, DWORD PTR 3592[rax]
	test	eax, eax
	je	.L6
	mov	rax, QWORD PTR -1056[rbp]
	mov	DWORD PTR 3592[rax], 0
	mov	eax, DWORD PTR -1076[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 2
	lea	rdx, 2576[rax]
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, rdx
	add	rax, 14
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -1048[rbp], rax
	jmp	.L7
.L8:
	mov	eax, DWORD PTR -1076[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 8
	sub	rax, rdx
	lea	rdx, 32[rax]
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, rdx
	lea	rdx, 8[rax]
	lea	rax, -1040[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	strstr@PLT
	test	rax, rax
	je	.L7
	mov	rax, QWORD PTR -1056[rbp]
	mov	edx, DWORD PTR -1076[rbp]
	movsx	rdx, edx
	mov	eax, DWORD PTR [rax+rdx*4]
	lea	ecx, 1[rax]
	mov	rax, QWORD PTR -1056[rbp]
	mov	edx, DWORD PTR -1076[rbp]
	movsx	rdx, edx
	mov	DWORD PTR [rax+rdx*4], ecx
.L7:
	mov	rdx, QWORD PTR -1048[rbp]
	lea	rax, -1040[rbp]
	mov	esi, 1024
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L8
	mov	rax, QWORD PTR -1048[rbp]
	mov	rdi, rax
	call	fclose@PLT
	mov	rax, QWORD PTR -1056[rbp]
	mov	DWORD PTR 3592[rax], 1
	mov	edi, 0
	call	exit@PLT
.L5:
	add	DWORD PTR -1076[rbp], 1
.L3:
	cmp	DWORD PTR -1076[rbp], 9
	jle	.L9
	mov	DWORD PTR -1080[rbp], 0
	mov	DWORD PTR -1076[rbp], 0
	jmp	.L10
.L13:
	lea	rax, -1080[rbp]
	mov	rdi, rax
	call	wait@PLT
	mov	eax, DWORD PTR -1080[rbp]
	and	eax, 127
	test	eax, eax
	jne	.L11
	mov	eax, DWORD PTR -1080[rbp]
	sar	eax, 8
	movzx	eax, al
	test	eax, eax
	je	.L12
.L11:
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	mov	eax, DWORD PTR -1076[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	add	rax, rdx
	sal	rax, 2
	lea	rdx, 2576[rax]
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, rdx
	lea	rdi, 14[rax]
	mov	rax, QWORD PTR -1056[rbp]
	mov	edx, DWORD PTR -1076[rbp]
	movsx	rdx, edx
	mov	edx, DWORD PTR [rax+rdx*4]
	mov	eax, DWORD PTR -1076[rbp]
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 8
	sub	rax, rcx
	lea	rcx, 32[rax]
	mov	rax, QWORD PTR -1056[rbp]
	add	rax, rcx
	lea	rsi, 8[rax]
	mov	eax, DWORD PTR -1076[rbp]
	add	eax, 1
	mov	r8, rdi
	mov	ecx, edx
	mov	rdx, rsi
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -1076[rbp], 1
.L10:
	cmp	DWORD PTR -1076[rbp], 9
	jle	.L13
	mov	eax, DWORD PTR -1072[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -1056[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	munmap@PLT
	mov	DWORD PTR -1064[rbp], eax
	cmp	DWORD PTR -1064[rbp], 0
	jns	.L14
	mov	edi, 1
	call	exit@PLT
.L14:
	mov	eax, DWORD PTR -1068[rbp]
	mov	edi, eax
	call	close@PLT
	cmp	DWORD PTR -1064[rbp], 0
	jns	.L15
	mov	edi, 1
	call	exit@PLT
.L15:
	lea	rdi, .LC0[rip]
	call	shm_unlink@PLT
	mov	DWORD PTR -1064[rbp], eax
	cmp	DWORD PTR -1064[rbp], 0
	jns	.L16
	mov	edi, 1
	call	exit@PLT
.L16:
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	"84827.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/shmex13\000"
	.align	2
.LC1:
	.ascii	"In shm_open()\000"
	.align	2
.LC2:
	.ascii	"batata\000"
	.align	2
.LC3:
	.ascii	"arroz\000"
	.align	2
.LC4:
	.ascii	"picanha\000"
	.align	2
.LC5:
	.ascii	"feijao\000"
	.align	2
.LC6:
	.ascii	"caipirinha\000"
	.align	2
.LC7:
	.ascii	"farofa\000"
	.align	2
.LC8:
	.ascii	"files/file%d.txt\000"
	.align	2
.LC9:
	.ascii	"Erro no fork!\012\000"
	.align	2
.LC10:
	.ascii	"r\000"
	.align	2
.LC11:
	.ascii	"Erro no processo filho\000"
	.align	2
.LC12:
	.ascii	"O filho n.%d encontrou '%s' %d vezes no seu ficheir"
	.ascii	"o - %s.\012\000"
	.align	2
.LC13:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 1064
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #1072
	ldr	r3, .L19
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L19+4
	str	r3, [fp, #-1056]
	mov	r2, #384
	mov	r1, #194
	ldr	r0, .L19+8
	bl	shm_open
	str	r0, [fp, #-1052]
	ldr	r3, [fp, #-1052]
	cmp	r3, #0
	bge	.L2
	ldr	r0, .L19+12
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	ldr	r1, [fp, #-1056]
	ldr	r0, [fp, #-1052]
	bl	ftruncate
	ldr	r1, [fp, #-1056]
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-1052]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-1048]
	ldr	r3, [fp, #-1048]
	add	r3, r3, #40
	ldr	r2, .L19+16
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #292
	add	r3, r3, #3
	ldr	r2, .L19+20
	mov	r0, r3
	mov	r1, r2
	mov	r3, #6
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #548
	add	r3, r3, #2
	ldr	r2, .L19+24
	mov	r0, r3
	mov	r1, r2
	mov	r3, #8
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #804
	add	r3, r3, #1
	ldr	r2, .L19+28
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #1056
	add	r3, r3, #4
	ldr	r2, .L19+32
	mov	r0, r3
	mov	r1, r2
	mov	r3, #11
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #1312
	add	r3, r3, #3
	ldr	r2, .L19+36
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #1568
	add	r3, r3, #2
	ldr	r2, .L19+16
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #1824
	add	r3, r3, #1
	ldr	r2, .L19+20
	mov	r0, r3
	mov	r1, r2
	mov	r3, #6
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #2080
	ldr	r2, .L19+28
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	ldr	r3, [fp, #-1048]
	add	r3, r3, #2320
	add	r3, r3, #15
	ldr	r2, .L19+36
	mov	r0, r3
	mov	r1, r2
	mov	r3, #7
	mov	r2, r3
	bl	memcpy
	mov	r3, #0
	str	r3, [fp, #-1060]
	b	.L3
.L9:
	ldr	r2, [fp, #-1060]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, #2576
	add	r3, r3, #8
	ldr	r2, [fp, #-1048]
	add	r3, r2, r3
	add	r0, r3, #6
	ldr	r3, [fp, #-1060]
	add	r3, r3, #1
	mov	r2, r3
	ldr	r1, .L19+40
	bl	sprintf
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-1040]
	ldr	r3, [fp, #-1040]
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L19+44
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	ldr	r3, [fp, #-1048]
	mov	r2, #1
	str	r2, [r3, #3592]
	ldr	r3, [fp, #-1040]
	cmp	r3, #0
	bne	.L5
	nop
.L6:
	ldr	r3, [fp, #-1048]
	ldr	r3, [r3, #3592]
	cmp	r3, #0
	beq	.L6
	ldr	r3, [fp, #-1048]
	mov	r2, #0
	str	r2, [r3, #3592]
	ldr	r2, [fp, #-1060]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, #2576
	add	r3, r3, #8
	ldr	r2, [fp, #-1048]
	add	r3, r2, r3
	add	r3, r3, #6
	ldr	r1, .L19+48
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-1036]
	b	.L7
.L8:
	ldr	r2, [fp, #-1060]
	mov	r3, r2
	lsl	r3, r3, #8
	sub	r3, r3, r2
	add	r3, r3, #40
	ldr	r2, [fp, #-1048]
	add	r2, r2, r3
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	mov	r1, r2
	mov	r0, r3
	bl	strstr
	mov	r3, r0
	cmp	r3, #0
	beq	.L7
	ldr	r3, [fp, #-1048]
	ldr	r2, [fp, #-1060]
	ldr	r3, [r3, r2, lsl #2]
	add	r1, r3, #1
	ldr	r3, [fp, #-1048]
	ldr	r2, [fp, #-1060]
	str	r1, [r3, r2, lsl #2]
.L7:
	sub	r3, fp, #1024
	sub	r3, r3, #4
	sub	r3, r3, #4
	ldr	r2, [fp, #-1036]
	mov	r1, #1024
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L8
	ldr	r0, [fp, #-1036]
	bl	fclose
	ldr	r3, [fp, #-1048]
	mov	r2, #1
	str	r2, [r3, #3592]
	mov	r0, #0
	bl	exit
.L5:
	ldr	r3, [fp, #-1060]
	add	r3, r3, #1
	str	r3, [fp, #-1060]
.L3:
	ldr	r3, [fp, #-1060]
	cmp	r3, #9
	ble	.L9
	mov	r3, #0
	str	r3, [fp, #-1064]
	mov	r3, #0
	str	r3, [fp, #-1060]
	b	.L10
.L13:
	sub	r3, fp, #1056
	sub	r3, r3, #4
	sub	r3, r3, #4
	mov	r0, r3
	bl	wait
	ldr	r3, [fp, #-1064]
	and	r3, r3, #127
	cmp	r3, #0
	bne	.L11
	ldr	r3, [fp, #-1064]
	asr	r3, r3, #8
	and	r3, r3, #255
	cmp	r3, #0
	beq	.L12
.L11:
	ldr	r0, .L19+52
	bl	perror
	mov	r0, #1
	bl	exit
.L12:
	ldr	r3, [fp, #-1060]
	add	r1, r3, #1
	ldr	r2, [fp, #-1060]
	mov	r3, r2
	lsl	r3, r3, #8
	sub	r3, r3, r2
	add	r3, r3, #40
	ldr	r2, [fp, #-1048]
	add	r0, r2, r3
	ldr	r3, [fp, #-1048]
	ldr	r2, [fp, #-1060]
	ldr	ip, [r3, r2, lsl #2]
	ldr	r2, [fp, #-1060]
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r3, #2576
	add	r3, r3, #8
	ldr	r2, [fp, #-1048]
	add	r3, r2, r3
	add	r3, r3, #6
	str	r3, [sp]
	mov	r3, ip
	mov	r2, r0
	ldr	r0, .L19+56
	bl	printf
	ldr	r3, [fp, #-1060]
	add	r3, r3, #1
	str	r3, [fp, #-1060]
.L10:
	ldr	r3, [fp, #-1060]
	cmp	r3, #9
	ble	.L13
	ldr	r3, [fp, #-1056]
	mov	r1, r3
	ldr	r0, [fp, #-1048]
	bl	munmap
	str	r0, [fp, #-1044]
	ldr	r3, [fp, #-1044]
	cmp	r3, #0
	bge	.L14
	mov	r0, #1
	bl	exit
.L14:
	ldr	r0, [fp, #-1052]
	bl	close
	ldr	r3, [fp, #-1044]
	cmp	r3, #0
	bge	.L15
	mov	r0, #1
	bl	exit
.L15:
	ldr	r0, .L19+8
	bl	shm_unlink
	str	r0, [fp, #-1044]
	ldr	r3, [fp, #-1044]
	cmp	r3, #0
	bge	.L16
	mov	r0, #1
	bl	exit
.L16:
	mov	r3, #0
	ldr	r2, .L19
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L18
	bl	__stack_chk_fail
.L18:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L20:
	.align	2
.L19:
	.word	.LC13
	.word	3596
	.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
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
