	.file	"45825.c"
	.intel_syntax noprefix
	.text
	.globl	full
	.bss
	.align 32
	.type	full, @object
	.size	full, 32
full:
	.zero	32
	.globl	empty
	.align 32
	.type	empty, @object
	.size	empty, 32
empty:
	.zero	32
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.globl	buffer
	.align 16
	.type	buffer, @object
	.size	buffer, 20
buffer:
	.zero	20
	.globl	bufferCounter
	.align 4
	.type	bufferCounter, @object
	.size	bufferCounter, 4
bufferCounter:
	.zero	4
	.globl	tid
	.align 8
	.type	tid, @object
	.size	tid, 8
tid:
	.zero	8
	.globl	attr
	.align 32
	.type	attr, @object
	.size	attr, 56
attr:
	.zero	56
	.section	.rodata
.LC0:
	.string	"Producer error\n"
.LC1:
	.string	"Producer produced: %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	QWORD PTR -24[rbp], rdi
.L4:
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1441151881
	shr	rdx, 32
	sar	edx, 25
	sar	eax, 31
	mov	ecx, eax
	mov	eax, edx
	sub	eax, ecx
	mov	DWORD PTR -8[rbp], eax
	mov	eax, DWORD PTR -8[rbp]
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	call	rand@PLT
	mov	DWORD PTR -4[rbp], eax
	lea	rdi, empty[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	insert_item
	test	eax, eax
	je	.L2
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 15
	mov	esi, 1
	lea	rdi, .LC0[rip]
	call	fwrite@PLT
	jmp	.L3
.L2:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
.L3:
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, full[rip]
	call	sem_post@PLT
	jmp	.L4
	.cfi_endproc
.LFE6:
	.size	producer, .-producer
	.section	.rodata
.LC2:
	.string	"Consumer error\n"
.LC3:
	.string	"Consumer consumed: %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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
.L8:
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1441151881
	shr	rdx, 32
	sar	edx, 25
	sar	eax, 31
	mov	ecx, eax
	mov	eax, edx
	sub	eax, ecx
	mov	DWORD PTR -12[rbp], eax
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	lea	rdi, full[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	lea	rax, -16[rbp]
	mov	rdi, rax
	call	remove_item
	test	eax, eax
	je	.L6
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 15
	mov	esi, 1
	lea	rdi, .LC2[rip]
	call	fwrite@PLT
	jmp	.L7
.L6:
	mov	eax, DWORD PTR -16[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
.L7:
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, empty[rip]
	call	sem_post@PLT
	jmp	.L8
	.cfi_endproc
.LFE7:
	.size	consumer, .-consumer
	.globl	insert_item
	.type	insert_item, @function
insert_item:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], edi
	mov	eax, DWORD PTR bufferCounter[rip]
	cmp	eax, 4
	jg	.L11
	mov	eax, DWORD PTR bufferCounter[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	eax, DWORD PTR bufferCounter[rip]
	add	eax, 1
	mov	DWORD PTR bufferCounter[rip], eax
	mov	eax, 0
	jmp	.L12
.L11:
	mov	eax, -1
.L12:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	insert_item, .-insert_item
	.globl	remove_item
	.type	remove_item, @function
remove_item:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -8[rbp], rdi
	mov	eax, DWORD PTR bufferCounter[rip]
	test	eax, eax
	jle	.L14
	mov	eax, DWORD PTR bufferCounter[rip]
	sub	eax, 1
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, buffer[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	mov	eax, DWORD PTR bufferCounter[rip]
	sub	eax, 1
	mov	DWORD PTR bufferCounter[rip], eax
	mov	eax, 0
	jmp	.L15
.L14:
	mov	eax, -1
.L15:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	remove_item, .-remove_item
	.globl	main
	.type	main, @function
main:
.LFB10:
	.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 -48[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -12[rbp], eax
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -8[rbp], eax
	mov	rax, QWORD PTR -48[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR -4[rbp], eax
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	mov	edx, 0
	mov	esi, 0
	lea	rdi, full[rip]
	call	sem_init@PLT
	mov	edx, 5
	mov	esi, 0
	lea	rdi, empty[rip]
	call	sem_init@PLT
	lea	rdi, attr[rip]
	call	pthread_attr_init@PLT
	mov	DWORD PTR bufferCounter[rip], 0
	mov	DWORD PTR -20[rbp], 0
	jmp	.L17
.L18:
	mov	ecx, 0
	lea	rdx, producer[rip]
	lea	rsi, attr[rip]
	lea	rdi, tid[rip]
	call	pthread_create@PLT
	add	DWORD PTR -20[rbp], 1
.L17:
	mov	eax, DWORD PTR -20[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jl	.L18
	mov	DWORD PTR -16[rbp], 0
	jmp	.L19
.L20:
	mov	ecx, 0
	lea	rdx, consumer[rip]
	lea	rsi, attr[rip]
	lea	rdi, tid[rip]
	call	pthread_create@PLT
	add	DWORD PTR -16[rbp], 1
.L19:
	mov	eax, DWORD PTR -16[rbp]
	cmp	eax, DWORD PTR -4[rbp]
	jl	.L20
	mov	eax, DWORD PTR -12[rbp]
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE10:
	.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	"45825.c"
	.text
	.comm	full,16,4
	.comm	empty,16,4
	.comm	mutex,24,4
	.comm	buffer,20,4
	.comm	bufferCounter,4,4
	.comm	tid,4,4
	.comm	attr,36,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Producer error\012\000"
	.align	2
.LC1:
	.ascii	"Producer produced: %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	r3, r0
	ldr	r2, .L5
	smull	r1, r2, r3, r2
	asr	r2, r2, #25
	asr	r3, r3, #31
	sub	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r0, [fp, #-12]
	bl	sleep
	bl	rand
	str	r0, [fp, #-8]
	ldr	r0, .L5+4
	bl	sem_wait
	ldr	r0, .L5+8
	bl	pthread_mutex_lock
	ldr	r0, [fp, #-8]
	bl	insert_item
	mov	r3, r0
	cmp	r3, #0
	beq	.L2
	ldr	r3, .L5+12
	ldr	r3, [r3]
	mov	r2, #15
	mov	r1, #1
	ldr	r0, .L5+16
	bl	fwrite
	b	.L3
.L2:
	ldr	r1, [fp, #-8]
	ldr	r0, .L5+20
	bl	printf
.L3:
	ldr	r0, .L5+8
	bl	pthread_mutex_unlock
	ldr	r0, .L5+24
	bl	sem_post
	b	.L4
.L6:
	.align	2
.L5:
	.word	1441151881
	.word	empty
	.word	mutex
	.word	stderr
	.word	.LC0
	.word	.LC1
	.word	full
	.size	producer, .-producer
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Consumer error\012\000"
	.align	2
.LC3:
	.ascii	"Consumer consumed: %d\012\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	consumer
	.syntax unified
	.arm
	.fpu softvfp
	.type	consumer, %function
consumer:
	@ 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, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
.L10:
	bl	rand
	mov	r3, r0
	ldr	r2, .L12+4
	smull	r1, r2, r3, r2
	asr	r2, r2, #25
	asr	r3, r3, #31
	sub	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r0, [fp, #-12]
	bl	sleep
	ldr	r0, .L12+8
	bl	sem_wait
	ldr	r0, .L12+12
	bl	pthread_mutex_lock
	sub	r3, fp, #16
	mov	r0, r3
	bl	remove_item
	mov	r3, r0
	cmp	r3, #0
	beq	.L8
	ldr	r3, .L12+16
	ldr	r3, [r3]
	mov	r2, #15
	mov	r1, #1
	ldr	r0, .L12+20
	bl	fwrite
	b	.L9
.L8:
	ldr	r3, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L12+24
	bl	printf
.L9:
	ldr	r0, .L12+12
	bl	pthread_mutex_unlock
	ldr	r0, .L12+28
	bl	sem_post
	b	.L10
.L13:
	.align	2
.L12:
	.word	.LC4
	.word	1441151881
	.word	full
	.word	mutex
	.word	stderr
	.word	.LC2
	.word	.LC3
	.word	empty
	.size	consumer, .-consumer
	.align	2
	.global	insert_item
	.syntax unified
	.arm
	.fpu softvfp
	.type	insert_item, %function
insert_item:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, .L17
	ldr	r3, [r3]
	cmp	r3, #4
	bgt	.L15
	ldr	r3, .L17
	ldr	r3, [r3]
	ldr	r1, .L17+4
	ldr	r2, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r3, .L17
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L17
	str	r3, [r2]
	mov	r3, #0
	b	.L16
.L15:
	mvn	r3, #0
.L16:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L18:
	.align	2
.L17:
	.word	bufferCounter
	.word	buffer
	.size	insert_item, .-insert_item
	.align	2
	.global	remove_item
	.syntax unified
	.arm
	.fpu softvfp
	.type	remove_item, %function
remove_item:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	str	r0, [fp, #-8]
	ldr	r3, .L22
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L20
	ldr	r3, .L22
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L22+4
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	ldr	r3, .L22
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L22
	str	r3, [r2]
	mov	r3, #0
	b	.L21
.L20:
	mvn	r3, #0
.L21:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L23:
	.align	2
.L22:
	.word	bufferCounter
	.word	buffer
	.size	remove_item, .-remove_item
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-36]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-36]
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	str	r0, [fp, #-8]
	mov	r1, #0
	ldr	r0, .L29
	bl	pthread_mutex_init
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L29+4
	bl	sem_init
	mov	r2, #5
	mov	r1, #0
	ldr	r0, .L29+8
	bl	sem_init
	ldr	r0, .L29+12
	bl	pthread_attr_init
	ldr	r3, .L29+16
	mov	r2, #0
	str	r2, [r3]
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L25
.L26:
	mov	r3, #0
	ldr	r2, .L29+20
	ldr	r1, .L29+12
	ldr	r0, .L29+24
	bl	pthread_create
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
.L25:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	blt	.L26
	mov	r3, #0
	str	r3, [fp, #-20]
	b	.L27
.L28:
	mov	r3, #0
	ldr	r2, .L29+28
	ldr	r1, .L29+12
	ldr	r0, .L29+24
	bl	pthread_create
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
.L27:
	ldr	r2, [fp, #-20]
	ldr	r3, [fp, #-8]
	cmp	r2, r3
	blt	.L28
	ldr	r0, [fp, #-16]
	bl	sleep
	mov	r0, #0
	bl	exit
.L30:
	.align	2
.L29:
	.word	mutex
	.word	full
	.word	empty
	.word	attr
	.word	bufferCounter
	.word	producer
	.word	tid
	.word	consumer
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
