	.file	"407214.c"
	.intel_syntax noprefix
	.text
	.globl	shared
	.bss
	.align 32
	.type	shared, @object
	.size	shared, 64
shared:
	.zero	64
	.globl	ptr
	.align 8
	.type	ptr, @object
	.size	ptr, 8
ptr:
	.zero	8
	.globl	Max_Run
	.align 4
	.type	Max_Run, @object
	.size	Max_Run, 4
Max_Run:
	.zero	4
	.section	.rodata
.LC0:
	.string	"Parent %d: I started.\n"
.LC1:
	.string	"Parent %d: I am running.\n"
	.text
	.globl	parent_code
	.type	parent_code, @function
parent_code:
.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
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -4[rbp], 1
	jmp	.L2
.L3:
	mov	rax, QWORD PTR ptr[rip]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR ptr[rip]
	add	rax, 32
	mov	rdi, rax
	call	sem_post@PLT
	add	DWORD PTR -4[rbp], 1
.L2:
	mov	eax, DWORD PTR Max_Run[rip]
	cmp	DWORD PTR -4[rbp], eax
	jle	.L3
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	parent_code, .-parent_code
	.section	.rodata
.LC2:
	.string	"Child  %d: I started.\n"
.LC3:
	.string	"Child  %d: I am running.\n"
	.text
	.globl	child_code
	.type	child_code, @function
child_code:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -4[rbp], 1
	jmp	.L5
.L6:
	mov	rax, QWORD PTR ptr[rip]
	add	rax, 32
	mov	rdi, rax
	call	sem_wait@PLT
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR ptr[rip]
	mov	rdi, rax
	call	sem_post@PLT
	add	DWORD PTR -4[rbp], 1
.L5:
	mov	eax, DWORD PTR Max_Run[rip]
	cmp	DWORD PTR -4[rbp], eax
	jle	.L6
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	child_code, .-child_code
	.section	.rodata
.LC4:
	.string	"Use %s #-of-iterations\n"
	.align 8
.LC5:
	.string	"error in the function sem_init()"
.LC6:
	.string	"error in the function fork()"
.LC7:
	.string	"Child  %d: I exit.\n"
.LC8:
	.string	"Parent %d: I exit.\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -36[rbp], 2
	je	.L8
	mov	rax, QWORD PTR -48[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	exit@PLT
.L8:
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	cdq
	xor	eax, edx
	sub	eax, edx
	mov	DWORD PTR Max_Run[rip], eax
	mov	r9d, 0
	mov	r8d, -1
	mov	ecx, 33
	mov	edx, 3
	mov	esi, 64
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR ptr[rip], rax
	mov	rax, QWORD PTR ptr[rip]
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	test	eax, eax
	je	.L9
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	rax, QWORD PTR ptr[rip]
	add	rax, 32
	mov	edx, 0
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	test	eax, eax
	je	.L10
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	call	fork@PLT
	mov	DWORD PTR -16[rbp], eax
	cmp	DWORD PTR -16[rbp], -1
	je	.L11
	cmp	DWORD PTR -16[rbp], 0
	je	.L12
	jmp	.L16
.L11:
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	call	getpid@PLT
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	child_code
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	exit@PLT
.L16:
	call	getpid@PLT
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	call	parent_code
	lea	rax, -20[rbp]
	mov	rdi, rax
	call	wait@PLT
	mov	rax, QWORD PTR ptr[rip]
	mov	rdi, rax
	call	sem_destroy@PLT
	mov	rax, QWORD PTR ptr[rip]
	add	rax, 32
	mov	rdi, rax
	call	sem_destroy@PLT
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"407214.c"
	.text
	.comm	shared,32,4
	.comm	ptr,4,4
	.comm	Max_Run,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Parent %d: I started.\012\000"
	.align	2
.LC1:
	.ascii	"Parent %d: I am running.\012\000"
	.text
	.align	2
	.global	parent_code
	.syntax unified
	.arm
	.fpu softvfp
	.type	parent_code, %function
parent_code:
	@ 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, #-16]
	ldr	r1, [fp, #-16]
	ldr	r0, .L4
	bl	printf
	mov	r3, #1
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r3, .L4+4
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_wait
	ldr	r1, [fp, #-16]
	ldr	r0, .L4+8
	bl	printf
	ldr	r3, .L4+4
	ldr	r3, [r3]
	add	r3, r3, #16
	mov	r0, r3
	bl	sem_post
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, .L4+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	ble	.L3
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L5:
	.align	2
.L4:
	.word	.LC0
	.word	ptr
	.word	.LC1
	.word	Max_Run
	.size	parent_code, .-parent_code
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Child  %d: I started.\012\000"
	.align	2
.LC3:
	.ascii	"Child  %d: I am running.\012\000"
	.text
	.align	2
	.global	child_code
	.syntax unified
	.arm
	.fpu softvfp
	.type	child_code, %function
child_code:
	@ 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, #-16]
	ldr	r1, [fp, #-16]
	ldr	r0, .L9
	bl	printf
	mov	r3, #1
	str	r3, [fp, #-8]
	b	.L7
.L8:
	ldr	r3, .L9+4
	ldr	r3, [r3]
	add	r3, r3, #16
	mov	r0, r3
	bl	sem_wait
	ldr	r1, [fp, #-16]
	ldr	r0, .L9+8
	bl	printf
	ldr	r3, .L9+4
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_post
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L7:
	ldr	r3, .L9+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	ble	.L8
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	.LC2
	.word	ptr
	.word	.LC3
	.word	Max_Run
	.size	child_code, .-child_code
	.section	.rodata
	.align	2
.LC4:
	.ascii	"Use %s #-of-iterations\012\000"
	.align	2
.LC5:
	.ascii	"error in the function sem_init()\000"
	.align	2
.LC6:
	.ascii	"error in the function fork()\000"
	.align	2
.LC7:
	.ascii	"Child  %d: I exit.\012\000"
	.align	2
.LC8:
	.ascii	"Parent %d: I exit.\012\000"
	.align	2
.LC9:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, .L21
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-24]
	cmp	r3, #2
	beq	.L12
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L21+4
	bl	printf
	mov	r0, #0
	bl	exit
.L12:
	ldr	r3, [fp, #-28]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	cmp	r3, #0
	rsblt	r3, r3, #0
	ldr	r2, .L21+8
	str	r3, [r2]
	mov	r3, #0
	str	r3, [sp, #4]
	mvn	r3, #0
	str	r3, [sp]
	mov	r3, #33
	mov	r2, #3
	mov	r1, #32
	mov	r0, #0
	bl	mmap
	mov	r3, r0
	ldr	r2, .L21+12
	str	r3, [r2]
	ldr	r3, .L21+12
	ldr	r3, [r3]
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	ldr	r0, .L21+16
	bl	perror
	mov	r0, #1
	bl	exit
.L13:
	ldr	r3, .L21+12
	ldr	r3, [r3]
	add	r3, r3, #16
	mov	r2, #0
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L14
	ldr	r0, .L21+16
	bl	perror
	mov	r0, #1
	bl	exit
.L14:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmn	r3, #1
	beq	.L15
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	beq	.L16
	b	.L20
.L15:
	ldr	r0, .L21+20
	bl	perror
	mov	r0, #1
	bl	exit
.L16:
	bl	getpid
	str	r0, [fp, #-12]
	ldr	r0, [fp, #-12]
	bl	child_code
	ldr	r1, [fp, #-12]
	ldr	r0, .L21+24
	bl	printf
	mov	r0, #0
	bl	exit
.L20:
	bl	getpid
	str	r0, [fp, #-12]
	ldr	r0, [fp, #-12]
	bl	parent_code
	sub	r3, fp, #20
	mov	r0, r3
	bl	wait
	ldr	r3, .L21+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_destroy
	ldr	r3, .L21+12
	ldr	r3, [r3]
	add	r3, r3, #16
	mov	r0, r3
	bl	sem_destroy
	ldr	r1, [fp, #-12]
	ldr	r0, .L21+28
	bl	printf
	mov	r3, #0
	ldr	r2, .L21
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	.LC9
	.word	.LC4
	.word	Max_Run
	.word	ptr
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
