	.file	"320419.c"
	.intel_syntax noprefix
	.text
	.globl	countdown
	.bss
	.align 4
	.type	countdown, @object
	.size	countdown, 4
countdown:
	.zero	4
	.globl	process_counter
	.align 32
	.type	process_counter, @object
	.size	process_counter, 40
process_counter:
	.zero	40
	.globl	shutdown
	.align 4
	.type	shutdown, @object
	.size	shutdown, 4
shutdown:
	.zero	4
	.globl	process_count
	.align 4
	.type	process_count, @object
	.size	process_count, 4
process_count:
	.zero	4
	.globl	semaphore
	.align 8
	.type	semaphore, @object
	.size	semaphore, 8
semaphore:
	.zero	8
	.globl	addr
	.align 8
	.type	addr, @object
	.size	addr, 8
addr:
	.zero	8
	.section	.rodata
.LC0:
	.string	"sem_wait"
.LC1:
	.string	"sem_post"
	.text
	.globl	child_process
	.type	child_process, @function
child_process:
.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, 16
	mov	DWORD PTR -4[rbp], edi
.L7:
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR countdown[rip]
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jne	.L2
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR shutdown[rip]
	cdqe
	add	rax, rdx
	mov	BYTE PTR [rax], 1
.L2:
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR shutdown[rip]
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	je	.L3
	mov	edi, 0
	call	exit@PLT
.L3:
	mov	rax, QWORD PTR semaphore[rip]
	mov	rdi, rax
	call	sem_wait@PLT
	cmp	eax, -1
	jne	.L4
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR countdown[rip]
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	test	al, al
	jle	.L5
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR countdown[rip]
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	lea	ecx, -1[rax]
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR countdown[rip]
	cdqe
	add	rax, rdx
	mov	edx, ecx
	mov	BYTE PTR [rax], dl
	mov	rdx, QWORD PTR addr[rip]
	mov	ecx, DWORD PTR process_count[rip]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, ecx
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	lea	esi, 1[rax]
	mov	rdx, QWORD PTR addr[rip]
	mov	ecx, DWORD PTR process_count[rip]
	mov	eax, DWORD PTR -4[rbp]
	add	eax, ecx
	cdqe
	add	rax, rdx
	mov	edx, esi
	mov	BYTE PTR [rax], dl
.L5:
	mov	rax, QWORD PTR semaphore[rip]
	mov	rdi, rax
	call	sem_post@PLT
	cmp	eax, -1
	jne	.L7
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	child_process, .-child_process
	.section	.rodata
.LC2:
	.string	"sem_init"
.LC3:
	.string	"fork() error"
.LC4:
	.string	"wait() error"
.LC5:
	.string	"processo figlio %d: %d\n"
	.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
	sub	rsp, 16
	mov	edi, 32
	call	malloc@PLT
	mov	QWORD PTR semaphore[rip], rax
	mov	rax, QWORD PTR semaphore[rip]
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L9
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	r9d, 0
	mov	r8d, -1
	mov	ecx, 33
	mov	edx, 3
	mov	esi, 48
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR addr[rip], rax
	mov	DWORD PTR countdown[rip], 0
	mov	DWORD PTR process_count[rip], 4
	mov	DWORD PTR shutdown[rip], 44
	mov	rdx, QWORD PTR addr[rip]
	mov	eax, DWORD PTR countdown[rip]
	cdqe
	add	rax, rdx
	mov	BYTE PTR [rax], 100
	mov	DWORD PTR -16[rbp], 0
	jmp	.L10
.L13:
	call	fork@PLT
	cmp	eax, -1
	je	.L11
	test	eax, eax
	jne	.L12
	mov	eax, DWORD PTR -16[rbp]
	mov	edi, eax
	call	child_process
	jmp	.L12
.L11:
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	add	DWORD PTR -16[rbp], 1
.L10:
	cmp	DWORD PTR -16[rbp], 9
	jle	.L13
	mov	DWORD PTR -12[rbp], 0
	jmp	.L14
.L16:
	mov	edi, 0
	call	wait@PLT
	cmp	eax, -1
	jne	.L15
	lea	rdi, .LC4[rip]
	call	perror@PLT
.L15:
	add	DWORD PTR -12[rbp], 1
.L14:
	cmp	DWORD PTR -12[rbp], 9
	jle	.L16
	mov	DWORD PTR -8[rbp], 0
	jmp	.L17
.L18:
	mov	rdx, QWORD PTR addr[rip]
	mov	ecx, DWORD PTR process_count[rip]
	mov	eax, DWORD PTR -8[rbp]
	add	eax, ecx
	cdqe
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	edx, al
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	add	DWORD PTR -8[rbp], 1
.L17:
	cmp	DWORD PTR -8[rbp], 9
	jle	.L18
	mov	eax, 0
	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	"320419.c"
	.text
	.comm	countdown,4,4
	.comm	process_counter,40,4
	.comm	shutdown,4,4
	.comm	process_count,4,4
	.comm	semaphore,4,4
	.comm	addr,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"sem_wait\000"
	.align	2
.LC1:
	.ascii	"sem_post\000"
	.text
	.align	2
	.global	child_process
	.syntax unified
	.arm
	.fpu softvfp
	.type	child_process, %function
child_process:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
.L7:
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+4
	ldr	r2, [r2]
	add	r3, r3, r2
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L2
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+8
	ldr	r2, [r2]
	add	r3, r3, r2
	mov	r2, #1
	strb	r2, [r3]
.L2:
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+8
	ldr	r2, [r2]
	add	r3, r3, r2
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L3
	mov	r0, #0
	bl	exit
.L3:
	ldr	r3, .L8+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_wait
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	ldr	r0, .L8+16
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+4
	ldr	r2, [r2]
	add	r3, r3, r2
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L5
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+4
	ldr	r2, [r2]
	add	r3, r3, r2
	ldrb	r2, [r3]	@ zero_extendqisi2
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r1, .L8+4
	ldr	r1, [r1]
	add	r3, r3, r1
	sub	r2, r2, #1
	and	r2, r2, #255
	strb	r2, [r3]
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r2, .L8+20
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	add	r2, r1, r2
	add	r3, r3, r2
	ldrb	r2, [r3]	@ zero_extendqisi2
	ldr	r3, .L8
	ldr	r3, [r3]
	ldr	r1, .L8+20
	ldr	r0, [r1]
	ldr	r1, [fp, #-8]
	add	r1, r0, r1
	add	r3, r3, r1
	add	r2, r2, #1
	and	r2, r2, #255
	strb	r2, [r3]
.L5:
	ldr	r3, .L8+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	sem_post
	mov	r3, r0
	cmn	r3, #1
	bne	.L7
	ldr	r0, .L8+24
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	.align	2
.L8:
	.word	addr
	.word	countdown
	.word	shutdown
	.word	semaphore
	.word	.LC0
	.word	process_count
	.word	.LC1
	.size	child_process, .-child_process
	.section	.rodata
	.align	2
.LC2:
	.ascii	"sem_init\000"
	.align	2
.LC3:
	.ascii	"fork() error\000"
	.align	2
.LC4:
	.ascii	"wait() error\000"
	.align	2
.LC5:
	.ascii	"processo figlio %d: %d\012\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	mov	r0, #16
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L22
	str	r2, [r3]
	ldr	r3, .L22
	ldr	r3, [r3]
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L11
	ldr	r0, .L22+4
	bl	perror
	mov	r0, #1
	bl	exit
.L11:
	mov	r3, #0
	str	r3, [sp, #4]
	mvn	r3, #0
	str	r3, [sp]
	mov	r3, #33
	mov	r2, #3
	mov	r1, #48
	mov	r0, #0
	bl	mmap
	mov	r3, r0
	ldr	r2, .L22+8
	str	r3, [r2]
	ldr	r3, .L22+12
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L22+16
	mov	r2, #4
	str	r2, [r3]
	ldr	r3, .L22+20
	mov	r2, #44
	str	r2, [r3]
	ldr	r3, .L22+8
	ldr	r3, [r3]
	ldr	r2, .L22+12
	ldr	r2, [r2]
	add	r3, r3, r2
	mov	r2, #100
	strb	r2, [r3]
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L12
.L15:
	bl	fork
	mov	r3, r0
	cmn	r3, #1
	beq	.L13
	cmp	r3, #0
	bne	.L14
	ldr	r0, [fp, #-20]
	bl	child_process
	b	.L14
.L13:
	ldr	r0, .L22+24
	bl	perror
	mov	r0, #1
	bl	exit
.L14:
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L12:
	ldr	r3, [fp, #-20]
	cmp	r3, #9
	ble	.L15
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L16
.L18:
	mov	r0, #0
	bl	wait
	mov	r3, r0
	cmn	r3, #1
	bne	.L17
	ldr	r0, .L22+28
	bl	perror
.L17:
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L16:
	ldr	r3, [fp, #-16]
	cmp	r3, #9
	ble	.L18
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L19
.L20:
	ldr	r3, .L22+8
	ldr	r3, [r3]
	ldr	r2, .L22+16
	ldr	r1, [r2]
	ldr	r2, [fp, #-12]
	add	r2, r1, r2
	add	r3, r3, r2
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r1, [fp, #-12]
	ldr	r0, .L22+32
	bl	printf
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L19:
	ldr	r3, [fp, #-12]
	cmp	r3, #9
	ble	.L20
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	semaphore
	.word	.LC2
	.word	addr
	.word	countdown
	.word	process_count
	.word	shutdown
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
