	.file	"675394.c"
	.intel_syntax noprefix
	.text
	.globl	empty_sem
	.bss
	.align 32
	.type	empty_sem, @object
	.size	empty_sem, 32
empty_sem:
	.zero	32
	.globl	full_sem
	.align 32
	.type	full_sem, @object
	.size	full_sem, 32
full_sem:
	.zero	32
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.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	buff
	.align 32
	.type	buff, @object
	.size	buff, 40
buff:
	.zero	40
	.globl	product_id
	.align 4
	.type	product_id, @object
	.size	product_id, 4
product_id:
	.zero	4
	.globl	consumer_id
	.align 4
	.type	consumer_id, @object
	.size	consumer_id, 4
consumer_id:
	.zero	4
	.globl	data
	.align 4
	.type	data, @object
	.size	data, 4
data:
	.zero	4
	.globl	fp
	.align 8
	.type	fp, @object
	.size	fp, 8
fp:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
	.align 8
.LC1:
	.string	"\347\224\237\344\272\247\350\200\205 %d \347\224\237\344\272\247 %d \344\272\216 %d\n"
	.text
	.globl	product
	.type	product, @function
product:
.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	eax, DWORD PTR product_id[rip]
	add	eax, 1
	mov	DWORD PTR product_id[rip], eax
	mov	eax, DWORD PTR product_id[rip]
	mov	DWORD PTR -4[rbp], eax
.L3:
	mov	edi, 1
	call	sleep@PLT
	lea	rdi, empty_sem[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR fp[rip]
	lea	rdx, data[rip]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_fscanf@PLT
	cmp	eax, -1
	jne	.L2
	mov	rax, QWORD PTR fp[rip]
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	mov	rax, QWORD PTR fp[rip]
	lea	rdx, data[rip]
	lea	rsi, .LC0[rip]
	mov	rdi, rax
	mov	eax, 0
	call	__isoc99_fscanf@PLT
.L2:
	mov	ecx, DWORD PTR in[rip]
	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	edx, DWORD PTR in[rip]
	mov	eax, DWORD PTR data[rip]
	movsx	rdx, edx
	lea	rcx, 0[0+rdx*4]
	lea	rdx, buff[rip]
	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, buff[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR in[rip]
	add	eax, 1
	mov	DWORD PTR in[rip], eax
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, full_sem[rip]
	call	sem_post@PLT
	jmp	.L3
	.cfi_endproc
.LFE6:
	.size	product, .-product
	.section	.rodata
	.align 8
.LC2:
	.string	"\346\266\210\350\264\271\350\200\205 %d \346\266\210\350\264\271 %d \344\272\216 %d\n"
	.text
	.globl	consume
	.type	consume, @function
consume:
.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	eax, DWORD PTR consumer_id[rip]
	add	eax, 1
	mov	DWORD PTR consumer_id[rip], eax
	mov	eax, DWORD PTR consumer_id[rip]
	mov	DWORD PTR -4[rbp], eax
.L5:
	mov	edi, 1
	call	sleep@PLT
	lea	rdi, full_sem[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	ecx, DWORD PTR out[rip]
	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	ecx, DWORD PTR out[rip]
	mov	eax, DWORD PTR out[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, buff[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR out[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, buff[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR out[rip]
	add	eax, 1
	mov	DWORD PTR out[rip], eax
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, empty_sem[rip]
	call	sem_post@PLT
	jmp	.L5
	.cfi_endproc
.LFE7:
	.size	consume, .-consume
	.section	.rodata
.LC3:
	.string	"r"
.LC4:
	.string	"./problem_2_data"
	.text
	.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, 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 10
	mov	esi, 0
	lea	rdi, empty_sem[rip]
	call	sem_init@PLT
	mov	edx, 0
	mov	esi, 0
	lea	rdi, full_sem[rip]
	call	sem_init@PLT
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	lea	rsi, .LC3[rip]
	lea	rdi, .LC4[rip]
	call	fopen@PLT
	mov	QWORD PTR fp[rip], rax
	mov	DWORD PTR -84[rbp], 0
	jmp	.L7
.L8:
	mov	eax, DWORD PTR -84[rbp]
	lea	rdx, -80[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	lea	rax, -84[rbp]
	mov	rcx, rax
	lea	rdx, product[rip]
	mov	esi, 0
	call	pthread_create@PLT
	mov	eax, DWORD PTR -84[rbp]
	add	eax, 1
	mov	DWORD PTR -84[rbp], eax
.L7:
	mov	eax, DWORD PTR -84[rbp]
	cmp	eax, 2
	jle	.L8
	mov	DWORD PTR -84[rbp], 0
	jmp	.L9
.L10:
	mov	eax, DWORD PTR -84[rbp]
	lea	rdx, -48[rbp]
	cdqe
	sal	rax, 3
	add	rax, rdx
	mov	ecx, 0
	lea	rdx, consume[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, DWORD PTR -84[rbp]
	add	eax, 1
	mov	DWORD PTR -84[rbp], eax
.L9:
	mov	eax, DWORD PTR -84[rbp]
	cmp	eax, 3
	jle	.L10
	mov	DWORD PTR -84[rbp], 0
	jmp	.L11
.L12:
	mov	eax, DWORD PTR -84[rbp]
	cdqe
	mov	rax, QWORD PTR -80[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, DWORD PTR -84[rbp]
	add	eax, 1
	mov	DWORD PTR -84[rbp], eax
.L11:
	mov	eax, DWORD PTR -84[rbp]
	cmp	eax, 2
	jle	.L12
	mov	DWORD PTR -84[rbp], 0
	jmp	.L13
.L14:
	mov	eax, DWORD PTR -84[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, DWORD PTR -84[rbp]
	add	eax, 1
	mov	DWORD PTR -84[rbp], eax
.L13:
	mov	eax, DWORD PTR -84[rbp]
	cmp	eax, 3
	jle	.L14
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"675394.c"
	.text
	.comm	empty_sem,16,4
	.comm	full_sem,16,4
	.comm	mutex,24,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
	.global	buff
	.align	2
	.type	buff, %object
	.size	buff, 40
buff:
	.space	40
	.global	product_id
	.align	2
	.type	product_id, %object
	.size	product_id, 4
product_id:
	.space	4
	.global	consumer_id
	.align	2
	.type	consumer_id, %object
	.size	consumer_id, 4
consumer_id:
	.space	4
	.comm	data,4,4
	.comm	fp,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"%d\000"
	.align	2
.LC1:
	.ascii	"\347\224\237\344\272\247\350\200\205 %d \347\224\237"
	.ascii	"\344\272\247 %d \344\272\216 %d\012\000"
	.text
	.align	2
	.global	product
	.syntax unified
	.arm
	.fpu softvfp
	.type	product, %function
product:
	@ 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	r3, .L4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L4
	str	r3, [r2]
	ldr	r3, .L4
	ldr	r3, [r3]
	str	r3, [fp, #-8]
.L3:
	mov	r0, #1
	bl	sleep
	ldr	r0, .L4+4
	bl	sem_wait
	ldr	r0, .L4+8
	bl	pthread_mutex_lock
	ldr	r3, .L4+12
	ldr	r3, [r3]
	ldr	r2, .L4+16
	ldr	r1, .L4+20
	mov	r0, r3
	bl	__isoc99_fscanf
	mov	r3, r0
	cmn	r3, #1
	bne	.L2
	ldr	r3, .L4+12
	ldr	r3, [r3]
	mov	r2, #0
	mov	r1, #0
	mov	r0, r3
	bl	fseek
	ldr	r3, .L4+12
	ldr	r3, [r3]
	ldr	r2, .L4+16
	ldr	r1, .L4+20
	mov	r0, r3
	bl	__isoc99_fscanf
.L2:
	ldr	r3, .L4+24
	ldr	r1, [r3]
	ldr	r3, .L4+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, .L4+24
	str	r2, [r3]
	ldr	r3, .L4+24
	ldr	r3, [r3]
	ldr	r2, .L4+16
	ldr	r2, [r2]
	ldr	r1, .L4+32
	str	r2, [r1, r3, lsl #2]
	ldr	r3, .L4+24
	ldr	r3, [r3]
	ldr	r2, .L4+32
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L4+24
	ldr	r3, [r3]
	ldr	r1, [fp, #-8]
	ldr	r0, .L4+36
	bl	printf
	ldr	r3, .L4+24
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L4+24
	str	r3, [r2]
	ldr	r0, .L4+8
	bl	pthread_mutex_unlock
	ldr	r0, .L4+40
	bl	sem_post
	b	.L3
.L5:
	.align	2
.L4:
	.word	product_id
	.word	empty_sem
	.word	mutex
	.word	fp
	.word	data
	.word	.LC0
	.word	in
	.word	1717986919
	.word	buff
	.word	.LC1
	.word	full_sem
	.size	product, .-product
	.section	.rodata
	.align	2
.LC2:
	.ascii	"\346\266\210\350\264\271\350\200\205 %d \346\266\210"
	.ascii	"\350\264\271 %d \344\272\216 %d\012\000"
	.text
	.align	2
	.global	consume
	.syntax unified
	.arm
	.fpu softvfp
	.type	consume, %function
consume:
	@ 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	r3, .L8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L8
	str	r3, [r2]
	ldr	r3, .L8
	ldr	r3, [r3]
	str	r3, [fp, #-8]
.L7:
	mov	r0, #1
	bl	sleep
	ldr	r0, .L8+4
	bl	sem_wait
	ldr	r0, .L8+8
	bl	pthread_mutex_lock
	ldr	r3, .L8+12
	ldr	r1, [r3]
	ldr	r3, .L8+16
	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, .L8+12
	str	r2, [r3]
	ldr	r3, .L8+12
	ldr	r3, [r3]
	ldr	r2, .L8+20
	ldr	r2, [r2, r3, lsl #2]
	ldr	r3, .L8+12
	ldr	r3, [r3]
	ldr	r1, [fp, #-8]
	ldr	r0, .L8+24
	bl	printf
	ldr	r3, .L8+12
	ldr	r3, [r3]
	ldr	r2, .L8+20
	mov	r1, #0
	str	r1, [r2, r3, lsl #2]
	ldr	r3, .L8+12
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L8+12
	str	r3, [r2]
	ldr	r0, .L8+8
	bl	pthread_mutex_unlock
	ldr	r0, .L8+28
	bl	sem_post
	b	.L7
.L9:
	.align	2
.L8:
	.word	consumer_id
	.word	full_sem
	.word	mutex
	.word	out
	.word	1717986919
	.word	buff
	.word	.LC2
	.word	empty_sem
	.size	consume, .-consume
	.section	.rodata
	.align	2
.LC3:
	.ascii	"r\000"
	.align	2
.LC4:
	.ascii	"./problem_2_data\000"
	.align	2
.LC5:
	.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, .L21
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #10
	mov	r1, #0
	ldr	r0, .L21+4
	bl	sem_init
	mov	r2, #0
	mov	r1, #0
	ldr	r0, .L21+8
	bl	sem_init
	mov	r1, #0
	ldr	r0, .L21+12
	bl	pthread_mutex_init
	ldr	r1, .L21+16
	ldr	r0, .L21+20
	bl	fopen
	mov	r3, r0
	ldr	r2, .L21+24
	str	r3, [r2]
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L11
.L12:
	ldr	r3, [fp, #-40]
	sub	r2, fp, #36
	lsl	r3, r3, #2
	add	r0, r2, r3
	sub	r3, fp, #40
	ldr	r2, .L21+28
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L11:
	ldr	r3, [fp, #-40]
	cmp	r3, #2
	ble	.L12
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L13
.L14:
	ldr	r3, [fp, #-40]
	sub	r2, fp, #24
	lsl	r3, r3, #2
	add	r0, r2, r3
	mov	r3, #0
	ldr	r2, .L21+32
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L13:
	ldr	r3, [fp, #-40]
	cmp	r3, #3
	ble	.L14
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L15
.L16:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-32]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L15:
	ldr	r3, [fp, #-40]
	cmp	r3, #2
	ble	.L16
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L17
.L18:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-20]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L17:
	ldr	r3, [fp, #-40]
	cmp	r3, #3
	ble	.L18
	mov	r3, #0
	ldr	r2, .L21
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L20
	bl	__stack_chk_fail
.L20:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	.LC5
	.word	empty_sem
	.word	full_sem
	.word	mutex
	.word	.LC3
	.word	.LC4
	.word	fp
	.word	product
	.word	consume
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
