	.file	"576428.c"
	.intel_syntax noprefix
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 128
buffer:
	.zero	128
	.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	countsem
	.align 32
	.type	countsem, @object
	.size	countsem, 32
countsem:
	.zero	32
	.globl	spacesem
	.align 32
	.type	spacesem, @object
	.size	spacesem, 32
spacesem:
	.zero	32
	.globl	lock
	.align 32
	.type	lock, @object
	.size	lock, 32
lock:
	.zero	32
	.text
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.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	QWORD PTR -8[rbp], rdi
	nop
.L2:
	lea	rdi, spacesem[rip]
	call	sem_wait@PLT
	test	eax, eax
	js	.L2
	nop
.L3:
	lea	rdi, lock[rip]
	call	sem_wait@PLT
	test	eax, eax
	js	.L3
	mov	eax, DWORD PTR in[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR in[rip], edx
	and	eax, 15
	cdqe
	lea	rcx, 0[0+rax*8]
	lea	rdx, buffer[rip]
	mov	rax, QWORD PTR -8[rbp]
	mov	QWORD PTR [rcx+rdx], rax
	lea	rdi, lock[rip]
	call	sem_post@PLT
	lea	rdi, countsem[rip]
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	enqueue, .-enqueue
	.globl	dequeue
	.type	dequeue, @function
dequeue:
.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
	nop
.L6:
	lea	rdi, countsem[rip]
	call	sem_wait@PLT
	test	eax, eax
	js	.L6
	nop
.L7:
	lea	rdi, lock[rip]
	call	sem_wait@PLT
	test	eax, eax
	js	.L7
	mov	eax, DWORD PTR out[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR out[rip], edx
	and	eax, 15
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, buffer[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	QWORD PTR -8[rbp], rax
	lea	rdi, lock[rip]
	call	sem_post@PLT
	lea	rdi, spacesem[rip]
	call	sem_post@PLT
	mov	rax, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dequeue, .-dequeue
	.globl	prod
	.type	prod, @function
prod:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	QWORD PTR -8[rbp], 0
.L12:
	mov	DWORD PTR -12[rbp], 0
	jmp	.L10
.L11:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	enqueue
	add	DWORD PTR -12[rbp], 1
	add	QWORD PTR -8[rbp], 1
.L10:
	cmp	DWORD PTR -12[rbp], 31
	jle	.L11
	mov	edi, 1
	call	sleep@PLT
	jmp	.L12
	.cfi_endproc
.LFE8:
	.size	prod, .-prod
	.section	.rodata
.LC0:
	.string	"%lu\n"
	.text
	.globl	cons
	.type	cons, @function
cons:
.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	QWORD PTR -24[rbp], rdi
.L14:
	call	dequeue
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	rdi, rax
	call	fflush@PLT
	jmp	.L14
	.cfi_endproc
.LFE9:
	.size	cons, .-cons
	.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, 32
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 0
	mov	esi, 0
	lea	rdi, countsem[rip]
	call	sem_init@PLT
	mov	edx, 16
	mov	esi, 0
	lea	rdi, spacesem[rip]
	call	sem_init@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, lock[rip]
	call	sem_init@PLT
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, prod[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	lea	rax, -16[rbp]
	mov	ecx, 0
	lea	rdx, cons[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, 0
	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
.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	"576428.c"
	.text
	.comm	buffer,64,4
	.global	in
	.bss
	.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	countsem,16,4
	.comm	spacesem,16,4
	.comm	lock,16,4
	.text
	.align	2
	.global	enqueue
	.syntax unified
	.arm
	.fpu softvfp
	.type	enqueue, %function
enqueue:
	@ 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]
	nop
.L2:
	ldr	r0, .L5
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	blt	.L2
	nop
.L3:
	ldr	r0, .L5+4
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	blt	.L3
	ldr	r3, .L5+8
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r1, .L5+8
	str	r2, [r1]
	and	r3, r3, #15
	ldr	r1, .L5+12
	ldr	r2, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r0, .L5+4
	bl	sem_post
	ldr	r0, .L5+16
	bl	sem_post
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	spacesem
	.word	lock
	.word	in
	.word	buffer
	.word	countsem
	.size	enqueue, .-enqueue
	.align	2
	.global	dequeue
	.syntax unified
	.arm
	.fpu softvfp
	.type	dequeue, %function
dequeue:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	nop
.L8:
	ldr	r0, .L11
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	blt	.L8
	nop
.L9:
	ldr	r0, .L11+4
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	blt	.L9
	ldr	r3, .L11+8
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r1, .L11+8
	str	r2, [r1]
	and	r3, r3, #15
	ldr	r2, .L11+12
	ldr	r3, [r2, r3, lsl #2]
	str	r3, [fp, #-8]
	ldr	r0, .L11+4
	bl	sem_post
	ldr	r0, .L11+16
	bl	sem_post
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	countsem
	.word	lock
	.word	out
	.word	buffer
	.word	spacesem
	.size	dequeue, .-dequeue
	.align	2
	.global	prod
	.syntax unified
	.arm
	.fpu softvfp
	.type	prod, %function
prod:
	@ 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]
	mov	r3, #0
	str	r3, [fp, #-12]
.L16:
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L14
.L15:
	ldr	r3, [fp, #-12]
	mov	r0, r3
	bl	enqueue
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L14:
	ldr	r3, [fp, #-8]
	cmp	r3, #31
	ble	.L15
	mov	r0, #1
	bl	sleep
	b	.L16
	.size	prod, .-prod
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%lu\012\000"
	.text
	.align	2
	.global	cons
	.syntax unified
	.arm
	.fpu softvfp
	.type	cons, %function
cons:
	@ 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]
.L18:
	bl	dequeue
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L19
	bl	printf
	ldr	r3, .L19+4
	ldr	r3, [r3]
	mov	r0, r3
	bl	fflush
	b	.L18
.L20:
	.align	2
.L19:
	.word	.LC0
	.word	stdout
	.size	cons, .-cons
	.section	.rodata
	.align	2
.LC1:
	.word	__stack_chk_guard
	.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
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L24+4
	bl	sem_init
	mov	r2, #16
	mov	r1, #0
	ldr	r0, .L24+8
	bl	sem_init
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L24+12
	bl	sem_init
	sub	r0, fp, #16
	mov	r3, #0
	ldr	r2, .L24+16
	mov	r1, #0
	bl	pthread_create
	sub	r0, fp, #12
	mov	r3, #0
	ldr	r2, .L24+20
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-16]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, #0
	ldr	r2, .L24
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L23
	bl	__stack_chk_fail
.L23:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC1
	.word	countsem
	.word	spacesem
	.word	lock
	.word	prod
	.word	cons
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
