	.file	"566879.c"
	.intel_syntax noprefix
	.text
	.globl	sem
	.bss
	.align 32
	.type	sem, @object
	.size	sem, 32
sem:
	.zero	32
	.section	.rodata
	.align 8
.LC0:
	.string	"[child]ricevuto SIGINT, il processo %d rimane attivo.\n"
	.align 8
.LC1:
	.string	"[child]ricevuto SIGCHLD da child process terminato"
	.text
	.type	handler, @function
handler:
.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
	cmp	DWORD PTR -4[rbp], 2
	jne	.L2
	call	getpid@PLT
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L4
.L2:
	cmp	DWORD PTR -4[rbp], 17
	jne	.L4
	lea	rdi, .LC1[rip]
	call	puts@PLT
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	handler, .-handler
	.section	.rodata
	.align 8
.LC2:
	.string	"[child]prima di sem_wait, sem_val=%d\n"
	.align 8
.LC3:
	.string	"[child]dentro while, sem_wait ha restituito -1 e errno == EINTR, sem_val=%d\n"
.LC4:
	.string	"sem_wait"
	.align 8
.LC5:
	.string	"[child]bye! fine child process"
	.text
	.globl	wait_on_signal
	.type	wait_on_signal, @function
wait_on_signal:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, -16[rbp]
	mov	rsi, rax
	lea	rdi, sem[rip]
	call	sem_getvalue@PLT
	mov	eax, DWORD PTR -16[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L6
.L8:
	lea	rax, -16[rbp]
	mov	rsi, rax
	lea	rdi, sem[rip]
	call	sem_getvalue@PLT
	mov	eax, DWORD PTR -16[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
.L6:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	sem_wait@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], -1
	jne	.L7
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L8
.L7:
	cmp	DWORD PTR -12[rbp], -1
	jne	.L9
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	lea	rdi, .LC5[rip]
	call	puts@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	wait_on_signal, .-wait_on_signal
	.globl	siginterrupt
	.type	siginterrupt, @function
siginterrupt:
.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, 192
	mov	DWORD PTR -180[rbp], edi
	mov	DWORD PTR -184[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rdx, -160[rbp]
	mov	eax, DWORD PTR -180[rbp]
	mov	esi, 0
	mov	edi, eax
	call	sigaction@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], -1
	jne	.L12
	mov	eax, -1
	jmp	.L16
.L12:
	cmp	DWORD PTR -184[rbp], 0
	je	.L14
	mov	eax, DWORD PTR -24[rbp]
	and	eax, -268435457
	mov	DWORD PTR -24[rbp], eax
	jmp	.L15
.L14:
	mov	eax, DWORD PTR -24[rbp]
	or	eax, 268435456
	mov	DWORD PTR -24[rbp], eax
.L15:
	lea	rcx, -160[rbp]
	mov	eax, DWORD PTR -180[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	edi, eax
	call	sigaction@PLT
.L16:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	siginterrupt, .-siginterrupt
	.section	.rodata
.LC6:
	.string	"sem_init"
	.align 8
.LC7:
	.string	"premi enter per mandare il segnale SIGINT al processo %d,'q' per uscire\n"
	.align 8
.LC8:
	.string	"mando segnale 2 (SIGINT) al processo %d\n"
.LC9:
	.string	"kill"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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	QWORD PTR -32[rbp], rsi
	call	fork@PLT
	mov	DWORD PTR -8[rbp], eax
	cmp	DWORD PTR -8[rbp], 0
	jne	.L26
	mov	edx, 0
	mov	esi, 1
	lea	rdi, sem[rip]
	call	sem_init@PLT
	cmp	eax, -1
	jne	.L20
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L20:
	lea	rsi, handler[rip]
	mov	edi, 2
	call	signal@PLT
	lea	rsi, handler[rip]
	mov	edi, 17
	call	signal@PLT
	mov	esi, 1
	mov	edi, 2
	call	siginterrupt
	mov	esi, 1
	mov	edi, 17
	call	siginterrupt
	call	fork@PLT
	test	eax, eax
	jne	.L21
	mov	edi, 2
	call	sleep@PLT
	mov	edi, 0
	call	exit@PLT
.L21:
	lea	rdi, sem[rip]
	call	wait_on_signal
	lea	rdi, sem[rip]
	call	sem_close@PLT
	mov	edi, 0
	call	exit@PLT
.L26:
	nop
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -4[rbp], 0
	jmp	.L22
.L23:
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, 2
	mov	edi, eax
	call	kill@PLT
	cmp	eax, -1
	jne	.L22
	lea	rdi, .LC9[rip]
	call	perror@PLT
.L22:
	call	getchar@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 113
	jne	.L23
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, 9
	mov	edi, eax
	call	kill@PLT
	mov	edi, 0
	call	wait@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	"566879.c"
	.text
	.comm	sem,16,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"[child]ricevuto SIGINT, il processo %d rimane attiv"
	.ascii	"o.\012\000"
	.align	2
.LC1:
	.ascii	"[child]ricevuto SIGCHLD da child process terminato\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	handler, %function
handler:
	@ 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]
	ldr	r3, [fp, #-8]
	cmp	r3, #2
	bne	.L2
	bl	getpid
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L5
	bl	printf
	b	.L4
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #17
	bne	.L4
	ldr	r0, .L5+4
	bl	puts
.L4:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	.LC0
	.word	.LC1
	.size	handler, .-handler
	.section	.rodata
	.align	2
.LC2:
	.ascii	"[child]prima di sem_wait, sem_val=%d\012\000"
	.align	2
.LC3:
	.ascii	"[child]dentro while, sem_wait ha restituito -1 e er"
	.ascii	"rno == EINTR, sem_val=%d\012\000"
	.align	2
.LC4:
	.ascii	"sem_wait\000"
	.align	2
.LC5:
	.ascii	"[child]bye! fine child process\000"
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	wait_on_signal
	.syntax unified
	.arm
	.fpu softvfp
	.type	wait_on_signal, %function
wait_on_signal:
	@ 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]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #16
	mov	r1, r3
	ldr	r0, .L13+4
	bl	sem_getvalue
	ldr	r3, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L13+8
	bl	printf
	b	.L8
.L10:
	sub	r3, fp, #16
	mov	r1, r3
	ldr	r0, .L13+4
	bl	sem_getvalue
	ldr	r3, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L13+12
	bl	printf
.L8:
	ldr	r0, [fp, #-24]
	bl	sem_wait
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	bne	.L9
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L10
.L9:
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	bne	.L11
	ldr	r0, .L13+16
	bl	perror
	mov	r0, #1
	bl	exit
.L11:
	ldr	r0, .L13+20
	bl	puts
	nop
	ldr	r3, .L13
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC6
	.word	sem
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.size	wait_on_signal, .-wait_on_signal
	.section	.rodata
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	siginterrupt
	.syntax unified
	.arm
	.fpu softvfp
	.type	siginterrupt, %function
siginterrupt:
	@ args = 0, pretend = 0, frame = 160
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #160
	str	r0, [fp, #-160]
	str	r1, [fp, #-164]
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #148
	mov	r2, r3
	mov	r1, #0
	ldr	r0, [fp, #-160]
	bl	sigaction
	str	r0, [fp, #-152]
	ldr	r3, [fp, #-152]
	cmn	r3, #1
	bne	.L16
	mvn	r3, #0
	b	.L20
.L16:
	ldr	r3, [fp, #-164]
	cmp	r3, #0
	beq	.L18
	ldr	r3, [fp, #-16]
	bic	r3, r3, #268435456
	str	r3, [fp, #-16]
	b	.L19
.L18:
	ldr	r3, [fp, #-16]
	orr	r3, r3, #268435456
	str	r3, [fp, #-16]
.L19:
	sub	r3, fp, #148
	mov	r2, #0
	mov	r1, r3
	ldr	r0, [fp, #-160]
	bl	sigaction
	mov	r3, r0
.L20:
	ldr	r2, .L22
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L21
	bl	__stack_chk_fail
.L21:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L23:
	.align	2
.L22:
	.word	.LC7
	.size	siginterrupt, .-siginterrupt
	.section	.rodata
	.align	2
.LC8:
	.ascii	"sem_init\000"
	.align	2
.LC9:
	.ascii	"premi enter per mandare il segnale SIGINT al proces"
	.ascii	"so %d,'q' per uscire\012\000"
	.align	2
.LC10:
	.ascii	"mando segnale 2 (SIGINT) al processo %d\012\000"
	.align	2
.LC11:
	.ascii	"kill\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, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L32
	mov	r2, #0
	mov	r1, #1
	ldr	r0, .L33
	bl	sem_init
	mov	r3, r0
	cmn	r3, #1
	bne	.L26
	ldr	r0, .L33+4
	bl	perror
	mov	r0, #1
	bl	exit
.L26:
	ldr	r1, .L33+8
	mov	r0, #2
	bl	signal
	ldr	r1, .L33+8
	mov	r0, #17
	bl	signal
	mov	r1, #1
	mov	r0, #2
	bl	siginterrupt
	mov	r1, #1
	mov	r0, #17
	bl	siginterrupt
	bl	fork
	mov	r3, r0
	cmp	r3, #0
	bne	.L27
	mov	r0, #2
	bl	sleep
	mov	r0, #0
	bl	exit
.L27:
	ldr	r0, .L33
	bl	wait_on_signal
	ldr	r0, .L33
	bl	sem_close
	mov	r0, #0
	bl	exit
.L32:
	nop
	ldr	r1, [fp, #-12]
	ldr	r0, .L33+12
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L28
.L29:
	ldr	r1, [fp, #-12]
	ldr	r0, .L33+16
	bl	printf
	mov	r1, #2
	ldr	r0, [fp, #-12]
	bl	kill
	mov	r3, r0
	cmn	r3, #1
	bne	.L28
	ldr	r0, .L33+20
	bl	perror
.L28:
	bl	getchar
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #113
	bne	.L29
	mov	r1, #9
	ldr	r0, [fp, #-12]
	bl	kill
	mov	r0, #0
	bl	wait
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L34:
	.align	2
.L33:
	.word	sem
	.word	.LC8
	.word	handler
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
