	.file	"885572.c"
	.intel_syntax noprefix
	.text
	.globl	global_counter
	.bss
	.align 8
	.type	global_counter, @object
	.size	global_counter, 8
global_counter:
	.zero	8
	.globl	pipe_dx
	.align 8
	.type	pipe_dx, @object
	.size	pipe_dx, 8
pipe_dx:
	.zero	8
	.globl	pipe_sx
	.align 8
	.type	pipe_sx, @object
	.size	pipe_sx, 8
pipe_sx:
	.zero	8
	.section	.rodata
.LC0:
	.string	"pipe DX()"
.LC1:
	.string	"pipe SX()"
.LC2:
	.string	"malloc()!"
.LC3:
	.string	"fork()"
	.align 8
.LC4:
	.string	"[child] global_counter incrementato %d \n"
.LC5:
	.string	"Write in pipe! "
.LC6:
	.string	"[child] MAX_VALUE raggiunto!"
.LC7:
	.string	"[child] pipe closed\n"
.LC8:
	.string	"Write in pipe!"
	.align 8
.LC9:
	.string	"[parent] global_counter incrementato %d \n"
.LC10:
	.string	"[parent] MAX_VALUE raggiunto!"
.LC11:
	.string	"[parent] pipe closed\n"
.LC12:
	.string	"wait!"
.LC13:
	.string	"[parent] global_counter %d \n"
.LC14:
	.string	"bye!"
	.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, 16
	lea	rdi, pipe_dx[rip]
	call	pipe@PLT
	cmp	eax, -1
	jne	.L2
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	lea	rdi, pipe_sx[rip]
	call	pipe@PLT
	cmp	eax, -1
	jne	.L3
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	mov	edi, 4
	call	malloc@PLT
	mov	QWORD PTR global_counter[rip], rax
	mov	rax, QWORD PTR global_counter[rip]
	test	rax, rax
	jne	.L4
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	rax, QWORD PTR global_counter[rip]
	mov	DWORD PTR [rax], 0
	call	fork@PLT
	cmp	eax, -1
	je	.L5
	test	eax, eax
	je	.L6
	jmp	.L21
.L5:
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	mov	eax, DWORD PTR pipe_dx[rip+4]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR pipe_sx[rip]
	mov	edi, eax
	call	close@PLT
	jmp	.L8
.L11:
	mov	rax, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 999999
	jg	.L9
	mov	rax, QWORD PTR global_counter[rip]
	mov	edx, DWORD PTR [rax]
	add	edx, 1
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_sx[rip+4]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L8
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_sx[rip+4]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L10
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	mov	edi, 0
	call	exit@PLT
.L8:
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_dx[rip]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	test	rax, rax
	setg	al
	movzx	eax, al
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jne	.L11
	cmp	DWORD PTR -4[rbp], 0
	jne	.L12
	lea	rdi, .LC7[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	mov	edi, 0
	call	exit@PLT
.L21:
	mov	eax, DWORD PTR pipe_dx[rip]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR pipe_sx[rip+4]
	mov	edi, eax
	call	close@PLT
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_dx[rip+4]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	cmp	rax, -1
	jne	.L14
	lea	rdi, .LC8[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L17:
	mov	rax, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 999999
	jg	.L15
	mov	rax, QWORD PTR global_counter[rip]
	mov	edx, DWORD PTR [rax]
	add	edx, 1
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_dx[rip+4]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L14
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L15:
	lea	rdi, .LC10[rip]
	call	puts@PLT
	jmp	.L16
.L14:
	mov	rcx, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR pipe_sx[rip]
	mov	edx, 4
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	test	rax, rax
	setg	al
	movzx	eax, al
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jne	.L17
.L16:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L22
	lea	rdi, .LC11[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L22:
	nop
	mov	edi, 0
	call	wait@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L19
	lea	rdi, .LC12[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L19:
	mov	rax, QWORD PTR global_counter[rip]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC14[rip]
	call	puts@PLT
	mov	edi, 0
	call	exit@PLT
	.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	"885572.c"
	.text
	.comm	global_counter,4,4
	.comm	pipe_dx,8,4
	.comm	pipe_sx,8,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"pipe DX()\000"
	.align	2
.LC1:
	.ascii	"pipe SX()\000"
	.align	2
.LC2:
	.ascii	"malloc()!\000"
	.align	2
.LC3:
	.ascii	"fork()\000"
	.align	2
.LC4:
	.ascii	"[child] global_counter incrementato %d \012\000"
	.align	2
.LC5:
	.ascii	"Write in pipe! \000"
	.align	2
.LC6:
	.ascii	"[child] MAX_VALUE raggiunto!\000"
	.align	2
.LC7:
	.ascii	"[child] pipe closed\012\000"
	.align	2
.LC8:
	.ascii	"Write in pipe!\000"
	.align	2
.LC9:
	.ascii	"[parent] global_counter incrementato %d \012\000"
	.align	2
.LC10:
	.ascii	"[parent] MAX_VALUE raggiunto!\000"
	.align	2
.LC11:
	.ascii	"[parent] pipe closed\012\000"
	.align	2
.LC12:
	.ascii	"wait!\000"
	.align	2
.LC13:
	.ascii	"[parent] global_counter %d \012\000"
	.align	2
.LC14:
	.ascii	"bye!\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L23
	bl	pipe
	mov	r3, r0
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L23+4
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	ldr	r0, .L23+8
	bl	pipe
	mov	r3, r0
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L23+12
	bl	perror
	mov	r0, #1
	bl	exit
.L3:
	mov	r0, #4
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L23+16
	str	r2, [r3]
	ldr	r3, .L23+16
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L4
	ldr	r0, .L23+20
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	ldr	r3, .L23+16
	ldr	r3, [r3]
	mov	r2, #0
	str	r2, [r3]
	bl	fork
	mov	r3, r0
	cmn	r3, #1
	beq	.L5
	cmp	r3, #0
	beq	.L6
	b	.L21
.L5:
	ldr	r0, .L23+24
	bl	perror
	mov	r0, #1
	bl	exit
.L6:
	ldr	r3, .L23
	ldr	r3, [r3, #4]
	mov	r0, r3
	bl	close
	ldr	r3, .L23+8
	ldr	r3, [r3]
	mov	r0, r3
	bl	close
	b	.L8
.L11:
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	ldr	r2, .L23+28
	cmp	r3, r2
	bge	.L9
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r2, [r3]
	add	r2, r2, #1
	str	r2, [r3]
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L23+32
	bl	printf
	ldr	r3, .L23+8
	ldr	r3, [r3, #4]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	write
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L8
	ldr	r0, .L23+36
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	ldr	r0, .L23+40
	bl	puts
	ldr	r3, .L23+8
	ldr	r3, [r3, #4]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	write
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L10
	ldr	r0, .L23+36
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	mov	r0, #0
	bl	exit
.L8:
	ldr	r3, .L23
	ldr	r3, [r3]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	read
	mov	r3, r0
	cmp	r3, #0
	movgt	r3, #1
	movle	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L11
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L12
	ldr	r0, .L23+44
	bl	perror
	mov	r0, #1
	bl	exit
.L12:
	mov	r0, #0
	bl	exit
.L21:
	ldr	r3, .L23
	ldr	r3, [r3]
	mov	r0, r3
	bl	close
	ldr	r3, .L23+8
	ldr	r3, [r3, #4]
	mov	r0, r3
	bl	close
	ldr	r3, .L23
	ldr	r3, [r3, #4]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	write
	mov	r3, r0
	cmn	r3, #1
	bne	.L14
	ldr	r0, .L23+48
	bl	perror
	mov	r0, #1
	bl	exit
.L17:
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	ldr	r2, .L23+28
	cmp	r3, r2
	bge	.L15
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r2, [r3]
	add	r2, r2, #1
	str	r2, [r3]
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L23+52
	bl	printf
	ldr	r3, .L23
	ldr	r3, [r3, #4]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	write
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L14
	ldr	r0, .L23+36
	bl	perror
	mov	r0, #1
	bl	exit
.L15:
	ldr	r0, .L23+56
	bl	puts
	b	.L16
.L14:
	ldr	r3, .L23+8
	ldr	r3, [r3]
	ldr	r2, .L23+16
	ldr	r1, [r2]
	mov	r2, #4
	mov	r0, r3
	bl	read
	mov	r3, r0
	cmp	r3, #0
	movgt	r3, #1
	movle	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L17
.L16:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L22
	ldr	r0, .L23+60
	bl	perror
	mov	r0, #1
	bl	exit
.L22:
	nop
	mov	r0, #0
	bl	wait
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L19
	ldr	r0, .L23+64
	bl	perror
	mov	r0, #1
	bl	exit
.L19:
	ldr	r3, .L23+16
	ldr	r3, [r3]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L23+68
	bl	printf
	ldr	r0, .L23+72
	bl	puts
	mov	r0, #0
	bl	exit
.L24:
	.align	2
.L23:
	.word	pipe_dx
	.word	.LC0
	.word	pipe_sx
	.word	.LC1
	.word	global_counter
	.word	.LC2
	.word	.LC3
	.word	1000000
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
