	.file	"292669.c"
	.intel_syntax noprefix
	.text
	.globl	mutex
	.bss
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.globl	c_cons
	.align 32
	.type	c_cons, @object
	.size	c_cons, 48
c_cons:
	.zero	48
	.globl	c_prod
	.align 32
	.type	c_prod, @object
	.size	c_prod, 48
c_prod:
	.zero	48
	.globl	in
	.align 4
	.type	in, @object
	.size	in, 4
in:
	.zero	4
	.globl	out
	.align 4
	.type	out, @object
	.size	out, 4
out:
	.zero	4
	.globl	buffer
	.align 32
	.type	buffer, @object
	.size	buffer, 40
buffer:
	.zero	40
	.globl	nfull
	.align 4
	.type	nfull, @object
	.size	nfull, 4
nfull:
	.zero	4
	.globl	scrittori
	.align 32
	.type	scrittori, @object
	.size	scrittori, 40
scrittori:
	.zero	40
	.globl	lettori
	.align 32
	.type	lettori, @object
	.size	lettori, 40
lettori:
	.zero	40
	.section	.rodata
	.align 8
.LC0:
	.string	"[Scrittore] #%d: scritto il numero %d nella posizione #%d\n"
	.text
	.globl	producer
	.type	producer, @function
producer:
.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
.L4:
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -4[rbp], edx
	mov	edx, DWORD PTR -4[rbp]
	imul	edx, edx, 100
	sub	eax, edx
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L2
.L3:
	lea	rsi, mutex[rip]
	lea	rdi, c_prod[rip]
	call	pthread_cond_wait@PLT
.L2:
	mov	eax, DWORD PTR nfull[rip]
	cmp	eax, 10
	je	.L3
	mov	eax, DWORD PTR in[rip]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rdx, buffer[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	ecx, DWORD PTR in[rip]
	mov	eax, DWORD PTR in[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, buffer[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR in[rip]
	lea	ecx, 1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR in[rip], edx
	mov	eax, DWORD PTR nfull[rip]
	add	eax, 1
	mov	DWORD PTR nfull[rip], eax
	lea	rdi, c_cons[rip]
	call	pthread_cond_signal@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L4
	.cfi_endproc
.LFE6:
	.size	producer, .-producer
	.section	.rodata
	.align 8
.LC1:
	.string	"[Lettore] #%d: letto numero %d nella posizione #%d\n"
	.text
	.globl	consumer
	.type	consumer, @function
consumer:
.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
.L8:
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L6
.L7:
	lea	rsi, mutex[rip]
	lea	rdi, c_cons[rip]
	call	pthread_cond_wait@PLT
.L6:
	mov	eax, DWORD PTR nfull[rip]
	test	eax, eax
	je	.L7
	mov	eax, DWORD PTR out[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, buffer[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -4[rbp], eax
	mov	ecx, DWORD PTR out[rip]
	mov	edx, DWORD PTR -4[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	mov	eax, DWORD PTR out[rip]
	lea	ecx, 1[rax]
	movsx	rax, ecx
	imul	rax, rax, 1717986919
	shr	rax, 32
	sar	eax, 2
	mov	esi, ecx
	sar	esi, 31
	sub	eax, esi
	mov	edx, eax
	mov	eax, edx
	sal	eax, 2
	add	eax, edx
	add	eax, eax
	sub	ecx, eax
	mov	edx, ecx
	mov	DWORD PTR out[rip], edx
	mov	eax, DWORD PTR nfull[rip]
	sub	eax, 1
	mov	DWORD PTR nfull[rip], eax
	lea	rdi, c_prod[rip]
	call	pthread_cond_signal@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L8
	.cfi_endproc
.LFE7:
	.size	consumer, .-consumer
	.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -32[rbp], 1
	mov	DWORD PTR -28[rbp], 2
	mov	DWORD PTR -24[rbp], 3
	mov	DWORD PTR -20[rbp], 4
	mov	DWORD PTR -16[rbp], 5
	mov	DWORD PTR -44[rbp], 0
	jmp	.L10
.L11:
	mov	eax, DWORD PTR -44[rbp]
	cdqe
	mov	eax, DWORD PTR -32[rbp+rax*4]
	cdqe
	mov	rdx, rax
	mov	eax, DWORD PTR -44[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, scrittori[rip]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, producer[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -44[rbp], 1
.L10:
	cmp	DWORD PTR -44[rbp], 4
	jle	.L11
	mov	DWORD PTR -40[rbp], 0
	jmp	.L12
.L13:
	mov	eax, DWORD PTR -40[rbp]
	cdqe
	mov	eax, DWORD PTR -32[rbp+rax*4]
	cdqe
	mov	rdx, rax
	mov	eax, DWORD PTR -40[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rax, lettori[rip]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, consumer[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -40[rbp], 1
.L12:
	cmp	DWORD PTR -40[rbp], 4
	jle	.L13
	mov	edi, 1
	mov	eax, 0
	call	sleep@PLT
	mov	DWORD PTR -36[rbp], 0
	jmp	.L14
.L15:
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, scrittori[rip]
	add	rax, rdx
	mov	esi, 0
	mov	rdi, rax
	call	pthread_kill@PLT
	mov	eax, DWORD PTR -36[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, scrittori[rip]
	add	rax, rdx
	mov	esi, 0
	mov	rdi, rax
	call	pthread_kill@PLT
	add	DWORD PTR -36[rbp], 1
.L14:
	cmp	DWORD PTR -36[rbp], 4
	jle	.L15
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	"292669.c"
	.text
	.comm	mutex,24,4
	.global	c_cons
	.bss
	.align	3
	.type	c_cons, %object
	.size	c_cons, 48
c_cons:
	.space	48
	.global	c_prod
	.align	3
	.type	c_prod, %object
	.size	c_prod, 48
c_prod:
	.space	48
	.global	in
	.align	2
	.type	in, %object
	.size	in, 4
in:
	.space	4
	.global	out
	.align	2
	.type	out, %object
	.size	out, 4
out:
	.space	4
	.comm	buffer,40,4
	.global	nfull
	.align	2
	.type	nfull, %object
	.size	nfull, 4
nfull:
	.space	4
	.comm	scrittori,20,4
	.comm	lettori,20,4
	.section	.rodata
	.align	2
.LC1:
	.ascii	"[Scrittore] #%d: scritto il numero %d nella posizio"
	.ascii	"ne #%d\012\000"
	.text
	.align	2
	.global	producer
	.syntax unified
	.arm
	.fpu softvfp
	.type	producer, %function
producer:
	@ 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]
.L4:
	bl	rand
	mov	r2, r0
	ldr	r3, .L5
	smull	r1, r3, r2, r3
	asr	r1, r3, #5
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r1, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #2
	sub	r3, r2, r3
	str	r3, [fp, #-8]
	ldr	r0, .L5+4
	bl	pthread_mutex_lock
	b	.L2
.L3:
	ldr	r1, .L5+4
	ldr	r0, .L5+8
	bl	pthread_cond_wait
.L2:
	ldr	r3, .L5+12
	ldr	r3, [r3]
	cmp	r3, #10
	beq	.L3
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r1, .L5+20
	ldr	r2, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r2, .L5+20
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	ldr	r1, [fp, #-16]
	ldr	r0, .L5+24
	bl	printf
	ldr	r3, .L5+28
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, .L5+16
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r3, .L5+32
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L5+16
	str	r2, [r3]
	ldr	r3, .L5+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L5+12
	str	r3, [r2]
	ldr	r0, .L5+36
	bl	pthread_cond_signal
	ldr	r0, .L5+4
	bl	pthread_mutex_unlock
	b	.L4
.L6:
	.align	2
.L5:
	.word	1374389535
	.word	mutex
	.word	c_prod
	.word	nfull
	.word	in
	.word	buffer
	.word	.LC1
	.word	stdout
	.word	1717986919
	.word	c_cons
	.size	producer, .-producer
	.section	.rodata
	.align	2
.LC2:
	.ascii	"[Lettore] #%d: letto numero %d nella posizione #%d\012"
	.ascii	"\000"
	.text
	.align	2
	.global	consumer
	.syntax unified
	.arm
	.fpu softvfp
	.type	consumer, %function
consumer:
	@ 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]
.L10:
	ldr	r0, .L11
	bl	pthread_mutex_lock
	b	.L8
.L9:
	ldr	r1, .L11
	ldr	r0, .L11+4
	bl	pthread_cond_wait
.L8:
	ldr	r3, .L11+8
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L9
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r2, .L11+16
	ldr	r3, [r2, r3, lsl #2]
	str	r3, [fp, #-8]
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	ldr	r1, [fp, #-16]
	ldr	r0, .L11+20
	bl	printf
	ldr	r3, .L11+24
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	ldr	r3, .L11+12
	ldr	r3, [r3]
	add	r1, r3, #1
	ldr	r3, .L11+28
	smull	r2, r3, r1, r3
	asr	r2, r3, #2
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L11+12
	str	r2, [r3]
	ldr	r3, .L11+8
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L11+8
	str	r3, [r2]
	ldr	r0, .L11+32
	bl	pthread_cond_signal
	ldr	r0, .L11
	bl	pthread_mutex_unlock
	b	.L10
.L12:
	.align	2
.L11:
	.word	mutex
	.word	c_cons
	.word	nfull
	.word	out
	.word	buffer
	.word	.LC2
	.word	stdout
	.word	1717986919
	.word	c_prod
	.size	consumer, .-consumer
	.section	.rodata
	.align	2
.LC0:
	.word	1
	.word	2
	.word	3
	.word	4
	.word	5
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	ldr	r3, .L22
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L22+4
	bl	pthread_mutex_init
	ldr	r3, .L22+8
	sub	ip, fp, #28
	mov	lr, r3
	ldmia	lr!, {r0, r1, r2, r3}
	stmia	ip!, {r0, r1, r2, r3}
	ldr	r3, [lr]
	str	r3, [ip]
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L14
.L15:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	ldr	r2, .L22+12
	add	r0, r3, r2
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-24]
	ldr	r2, .L22+16
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L14:
	ldr	r3, [fp, #-40]
	cmp	r3, #4
	ble	.L15
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L16
.L17:
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	ldr	r2, .L22+20
	add	r0, r3, r2
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-24]
	ldr	r2, .L22+24
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L16:
	ldr	r3, [fp, #-36]
	cmp	r3, #4
	ble	.L17
	mov	r0, #1
	bl	sleep
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L18
.L19:
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	ldr	r2, .L22+12
	add	r3, r3, r2
	mov	r1, #0
	mov	r0, r3
	bl	pthread_kill
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	ldr	r2, .L22+12
	add	r3, r3, r2
	mov	r1, #0
	mov	r0, r3
	bl	pthread_kill
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L18:
	ldr	r3, [fp, #-32]
	cmp	r3, #4
	ble	.L19
	mov	r3, #0
	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	.LC3
	.word	mutex
	.word	.LC0
	.word	scrittori
	.word	producer
	.word	lettori
	.word	consumer
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
