	.file	"68313.c"
	.intel_syntax noprefix
	.text
	.globl	init_context
	.type	init_context, @function
init_context:
.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
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	sem_init@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	sem_wait@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init_context, .-init_context
	.globl	producer
	.type	producer, @function
producer:
.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
	mov	QWORD PTR -8[rbp], rdi
.L4:
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	mov	edi, 1
	call	sleep@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L4
	.cfi_endproc
.LFE7:
	.size	producer, .-producer
	.section	.rodata
.LC0:
	.string	"cons %d\n"
	.text
	.globl	consumer
	.type	consumer, @function
consumer:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
.L6:
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 40
	mov	rdi, rax
	call	sem_wait@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sem_post@PLT
	jmp	.L6
	.cfi_endproc
.LFE8:
	.size	consumer, .-consumer
	.section	.rodata
.LC1:
	.string	"/dev/zero"
.LC2:
	.string	"open"
.LC3:
	.string	"close"
.LC4:
	.string	"mmap"
.LC5:
	.string	"fork"
.LC6:
	.string	"munmap"
	.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, 16
	mov	esi, 2
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -16[rbp], eax
	cmp	DWORD PTR -16[rbp], 0
	jns	.L8
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 72
	call	exit@PLT
.L8:
	mov	eax, DWORD PTR -16[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 1
	mov	edx, 3
	mov	esi, 72
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -16[rbp]
	mov	edi, eax
	call	close@PLT
	test	eax, eax
	jns	.L9
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 72
	call	exit@PLT
.L9:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L10
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	edi, 71
	call	exit@PLT
.L10:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	init_context
	call	fork@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], 0
	jns	.L11
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 71
	call	exit@PLT
.L11:
	cmp	DWORD PTR -12[rbp], 0
	je	.L12
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	consumer
	jmp	.L13
.L12:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	producer
.L13:
	mov	rax, QWORD PTR -8[rbp]
	mov	esi, 72
	mov	rdi, rax
	call	munmap@PLT
	test	eax, eax
	jns	.L14
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	edi, 71
	call	exit@PLT
.L14:
	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	"68313.c"
	.text
	.align	2
	.global	init_context
	.syntax unified
	.arm
	.fpu softvfp
	.type	init_context, %function
init_context:
	@ 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]
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r2, #1
	mov	r1, #1
	mov	r0, r3
	bl	sem_init
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	sem_wait
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	init_context, .-init_context
	.align	2
	.global	producer
	.syntax unified
	.arm
	.fpu softvfp
	.type	producer, %function
producer:
	@ 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]
.L4:
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_wait
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	mov	r0, #1
	bl	sleep
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	sem_post
	b	.L4
	.size	producer, .-producer
	.section	.rodata
	.align	2
.LC0:
	.ascii	"cons %d\012\000"
	.text
	.align	2
	.global	consumer
	.syntax unified
	.arm
	.fpu softvfp
	.type	consumer, %function
consumer:
	@ 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]
.L6:
	ldr	r3, [fp, #-8]
	add	r3, r3, #20
	mov	r0, r3
	bl	sem_wait
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L7
	bl	printf
	ldr	r3, [fp, #-8]
	add	r3, r3, #4
	mov	r0, r3
	bl	sem_post
	b	.L6
.L8:
	.align	2
.L7:
	.word	.LC0
	.size	consumer, .-consumer
	.section	.rodata
	.align	2
.LC1:
	.ascii	"/dev/zero\000"
	.align	2
.LC2:
	.ascii	"open\000"
	.align	2
.LC3:
	.ascii	"close\000"
	.align	2
.LC4:
	.ascii	"mmap\000"
	.align	2
.LC5:
	.ascii	"fork\000"
	.align	2
.LC6:
	.ascii	"munmap\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, #24
	mov	r1, #2
	ldr	r0, .L18
	bl	open
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	bge	.L10
	ldr	r0, .L18+4
	bl	perror
	mov	r0, #72
	bl	exit
.L10:
	mov	r3, #0
	str	r3, [sp, #4]
	ldr	r3, [fp, #-16]
	str	r3, [sp]
	mov	r3, #1
	mov	r2, #3
	mov	r1, #36
	mov	r0, #0
	bl	mmap
	str	r0, [fp, #-12]
	ldr	r0, [fp, #-16]
	bl	close
	mov	r3, r0
	cmp	r3, #0
	bge	.L11
	ldr	r0, .L18+8
	bl	perror
	mov	r0, #72
	bl	exit
.L11:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L12
	ldr	r0, .L18+12
	bl	perror
	mov	r0, #71
	bl	exit
.L12:
	ldr	r0, [fp, #-12]
	bl	init_context
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L13
	ldr	r0, .L18+16
	bl	perror
	mov	r0, #71
	bl	exit
.L13:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L14
	ldr	r0, [fp, #-12]
	bl	consumer
	b	.L15
.L14:
	ldr	r0, [fp, #-12]
	bl	producer
.L15:
	mov	r1, #36
	ldr	r0, [fp, #-12]
	bl	munmap
	mov	r3, r0
	cmp	r3, #0
	bge	.L16
	ldr	r0, .L18+20
	bl	perror
	mov	r0, #71
	bl	exit
.L16:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
