	.file	"316293.c"
	.intel_syntax noprefix
	.text
	.globl	sem_thread1
	.bss
	.align 32
	.type	sem_thread1, @object
	.size	sem_thread1, 32
sem_thread1:
	.zero	32
	.globl	sem_thread2
	.align 32
	.type	sem_thread2, @object
	.size	sem_thread2, 32
sem_thread2:
	.zero	32
	.globl	lock
	.align 32
	.type	lock, @object
	.size	lock, 40
lock:
	.zero	40
	.section	.rodata
.LC0:
	.string	"Time: %s \n"
	.text
	.globl	get_time
	.type	get_time, @function
get_time:
.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 0
	call	time@PLT
	mov	QWORD PTR -24[rbp], rax
	lea	rax, -24[rbp]
	mov	rdi, rax
	call	ctime@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L2
	call	__stack_chk_fail@PLT
.L2:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	get_time, .-get_time
	.section	.rodata
	.align 8
.LC1:
	.string	"Message Sent! -> Event:%d Val:%d ID:%d Total:%d\n"
	.text
	.globl	msg_send
	.type	msg_send, @function
msg_send:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -48[rbp]
	mov	QWORD PTR -8[rbp], rax
	lea	rdi, lock[rip]
	call	pthread_mutex_lock@PLT
	mov	DWORD PTR -20[rbp], 0
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 396[rax]
	mov	rcx, QWORD PTR -16[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	lea	rdx, [rcx+rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	rcx, QWORD PTR [rax]
	mov	QWORD PTR [rdx], rcx
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR 8[rdx], eax
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 384[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 384[rax], edx
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, DWORD PTR 384[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	ecx, DWORD PTR 8[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, DWORD PTR 4[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	r8d, esi
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 388[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 388[rax], edx
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 396[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 396[rax], edx
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 396[rax]
	cmp	eax, 32
	jne	.L4
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 396[rax], 0
.L4:
	lea	rdi, lock[rip]
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	msg_send, .-msg_send
	.globl	thread1
	.type	thread1, @function
thread1:
.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	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -32[rbp], rax
	jmp	.L6
.L7:
	mov	edi, 100000
	call	usleep@PLT
	mov	DWORD PTR -20[rbp], 1
	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
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 1[rdx]
	mov	DWORD PTR -16[rbp], eax
	mov	rax, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR 384[rax]
	add	eax, 1
	mov	DWORD PTR -12[rbp], eax
	lea	rdx, -20[rbp]
	mov	rax, QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	msg_send
	lea	rdi, sem_thread1[rip]
	call	sem_wait@PLT
.L6:
	mov	rax, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR 388[rax]
	cmp	eax, 31
	jle	.L7
	nop
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	thread1, .-thread1
	.globl	thread2
	.type	thread2, @function
thread2:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -32[rbp], rax
	jmp	.L10
.L11:
	mov	edi, 110000
	call	usleep@PLT
	mov	DWORD PTR -20[rbp], 2
	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
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	lea	eax, 1[rdx]
	mov	DWORD PTR -16[rbp], eax
	mov	rax, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR 384[rax]
	add	eax, 1
	mov	DWORD PTR -12[rbp], eax
	lea	rdx, -20[rbp]
	mov	rax, QWORD PTR -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	msg_send
	lea	rdi, sem_thread2[rip]
	call	sem_wait@PLT
.L10:
	mov	rax, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR 388[rax]
	cmp	eax, 31
	jle	.L11
	nop
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	thread2, .-thread2
	.section	.rodata
	.align 8
.LC2:
	.string	"Recieved Event! Event:%d Val:%d ID:%d Total:%d \n"
	.text
	.globl	rec_event
	.type	rec_event, @function
rec_event:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 392[rax]
	mov	rcx, QWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rcx
	mov	rdx, QWORD PTR [rax]
	mov	QWORD PTR -12[rbp], rdx
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -4[rbp], eax
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, DWORD PTR 384[rax]
	mov	ecx, DWORD PTR -4[rbp]
	mov	edx, DWORD PTR -8[rbp]
	mov	eax, DWORD PTR -12[rbp]
	mov	r8d, esi
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	get_time
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 392[rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR 392[rax], edx
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 388[rax]
	lea	edx, -1[rax]
	mov	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR 388[rax], edx
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 392[rax]
	cmp	eax, 32
	jne	.L15
	mov	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR 392[rax], 0
.L15:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	rec_event, .-rec_event
	.globl	thread3
	.type	thread3, @function
thread3:
.LFB11:
	.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	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -24[rbp], rax
	mov	DWORD PTR -28[rbp], 0
	jmp	.L17
.L20:
	lea	rdi, lock[rip]
	call	pthread_mutex_lock@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 392[rax]
	mov	rcx, QWORD PTR -24[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	add	rax, rax
	add	rax, rdx
	sal	rax, 2
	add	rax, rcx
	mov	rdx, QWORD PTR [rax]
	mov	QWORD PTR -12[rbp], rdx
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -4[rbp], eax
	add	DWORD PTR -28[rbp], 1
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	rec_event
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, 1
	jne	.L18
	lea	rdi, sem_thread1[rip]
	call	sem_post@PLT
	jmp	.L19
.L18:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, 2
	jne	.L19
	lea	rdi, sem_thread2[rip]
	call	sem_post@PLT
.L19:
	lea	rdi, lock[rip]
	call	pthread_mutex_unlock@PLT
.L17:
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 384[rax]
	cmp	DWORD PTR -28[rbp], eax
	jl	.L20
	jmp	.L17
	.cfi_endproc
.LFE11:
	.size	thread3, .-thread3
	.globl	main
	.type	main, @function
main:
.LFB12:
	.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	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	esi, 0
	lea	rdi, lock[rip]
	call	pthread_mutex_init@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, sem_thread1[rip]
	call	sem_init@PLT
	mov	DWORD PTR -48[rbp], eax
	mov	edx, 1
	mov	esi, 0
	lea	rdi, sem_thread2[rip]
	call	sem_init@PLT
	mov	DWORD PTR -48[rbp], eax
	mov	edi, 400
	call	malloc@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 396[rax], 0
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 392[rax], 0
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 384[rax], 0
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 388[rax], 0
	mov	rdx, QWORD PTR -16[rbp]
	lea	rax, -40[rbp]
	mov	rcx, rdx
	lea	rdx, thread1[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rdx, QWORD PTR -16[rbp]
	lea	rax, -32[rbp]
	mov	rcx, rdx
	lea	rdx, thread2[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rdx, QWORD PTR -16[rbp]
	lea	rax, -24[rbp]
	mov	rcx, rdx
	lea	rdx, thread3[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -40[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -32[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -16[rbp]
	mov	rdi, rax
	call	free@PLT
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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	"316293.c"
	.text
	.comm	sem_thread1,16,4
	.comm	sem_thread2,16,4
	.comm	lock,24,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Time: %s \012\000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	get_time
	.syntax unified
	.arm
	.fpu softvfp
	.type	get_time, %function
get_time:
	@ 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, .L3
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #0
	bl	time
	mov	r3, r0
	str	r3, [fp, #-16]
	sub	r3, fp, #16
	mov	r0, r3
	bl	ctime
	str	r0, [fp, #-12]
	ldr	r1, [fp, #-12]
	ldr	r0, .L3+4
	bl	printf
	nop
	ldr	r3, .L3
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L2
	bl	__stack_chk_fail
.L2:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L4:
	.align	2
.L3:
	.word	.LC1
	.word	.LC0
	.size	get_time, .-get_time
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Message Sent! -> Event:%d Val:%d ID:%d Total:%d\012"
	.ascii	"\000"
	.text
	.align	2
	.global	msg_send
	.syntax unified
	.arm
	.fpu softvfp
	.type	msg_send, %function
msg_send:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-28]
	str	r3, [fp, #-12]
	ldr	r0, .L7
	bl	pthread_mutex_lock
	mov	r3, #0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-16]
	ldr	r2, [r3, #396]
	ldr	r1, [fp, #-16]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r3, r1, r3
	ldr	r2, [fp, #-12]
	ldm	r2, {r0, r1, r2}
	stm	r3, {r0, r1, r2}
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #384]
	add	r2, r3, #1
	ldr	r3, [fp, #-16]
	str	r2, [r3, #384]
	ldr	r3, [fp, #-12]
	ldr	r1, [r3]
	ldr	r3, [fp, #-12]
	ldr	r2, [r3, #4]
	ldr	r3, [fp, #-12]
	ldr	r0, [r3, #8]
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #384]
	str	r3, [sp]
	mov	r3, r0
	ldr	r0, .L7+4
	bl	printf
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #388]
	add	r2, r3, #1
	ldr	r3, [fp, #-16]
	str	r2, [r3, #388]
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #396]
	add	r2, r3, #1
	ldr	r3, [fp, #-16]
	str	r2, [r3, #396]
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #396]
	cmp	r3, #32
	bne	.L6
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #396]
.L6:
	ldr	r0, .L7
	bl	pthread_mutex_unlock
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	lock
	.word	.LC2
	.size	msg_send, .-msg_send
	.section	.rodata
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	thread1
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread1, %function
thread1:
	@ 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]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-32]
	str	r3, [fp, #-24]
	b	.L10
.L11:
	ldr	r0, .L13+4
	bl	usleep
	mov	r3, #1
	str	r3, [fp, #-20]
	bl	rand
	mov	r1, r0
	ldr	r3, .L13+8
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	add	r3, r2, #1
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #384]
	add	r3, r3, #1
	str	r3, [fp, #-12]
	sub	r3, fp, #20
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	msg_send
	ldr	r0, .L13+12
	bl	sem_wait
.L10:
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #388]
	cmp	r3, #31
	ble	.L11
	nop
	ldr	r2, .L13
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC3
	.word	100000
	.word	1374389535
	.word	sem_thread1
	.size	thread1, .-thread1
	.section	.rodata
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	thread2
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread2, %function
thread2:
	@ 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]
	ldr	r3, .L19
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-32]
	str	r3, [fp, #-24]
	b	.L16
.L17:
	ldr	r0, .L19+4
	bl	usleep
	mov	r3, #2
	str	r3, [fp, #-20]
	bl	rand
	mov	r1, r0
	ldr	r3, .L19+8
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	add	r3, r2, #1
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #384]
	add	r3, r3, #1
	str	r3, [fp, #-12]
	sub	r3, fp, #20
	mov	r1, r3
	ldr	r0, [fp, #-24]
	bl	msg_send
	ldr	r0, .L19+12
	bl	sem_wait
.L16:
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #388]
	cmp	r3, #31
	ble	.L17
	nop
	ldr	r2, .L19
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L18
	bl	__stack_chk_fail
.L18:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L20:
	.align	2
.L19:
	.word	.LC4
	.word	110000
	.word	1374389535
	.word	sem_thread2
	.size	thread2, .-thread2
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Recieved Event! Event:%d Val:%d ID:%d Total:%d \012"
	.ascii	"\000"
	.text
	.align	2
	.global	rec_event
	.syntax unified
	.arm
	.fpu softvfp
	.type	rec_event, %function
rec_event:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	ldr	r2, [r3, #392]
	ldr	r1, [fp, #-24]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r2, r1, r3
	sub	r3, fp, #16
	ldm	r2, {r0, r1, r2}
	stm	r3, {r0, r1, r2}
	ldr	r1, [fp, #-16]
	ldr	r2, [fp, #-12]
	ldr	r0, [fp, #-8]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #384]
	str	r3, [sp]
	mov	r3, r0
	ldr	r0, .L24
	bl	printf
	bl	get_time
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #392]
	add	r2, r3, #1
	ldr	r3, [fp, #-24]
	str	r2, [r3, #392]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #388]
	sub	r2, r3, #1
	ldr	r3, [fp, #-24]
	str	r2, [r3, #388]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #392]
	cmp	r3, #32
	bne	.L23
	ldr	r3, [fp, #-24]
	mov	r2, #0
	str	r2, [r3, #392]
.L23:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC5
	.size	rec_event, .-rec_event
	.align	2
	.global	thread3
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread3, %function
thread3:
	@ 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]
	ldr	r3, [fp, #-32]
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-24]
	b	.L27
.L30:
	ldr	r0, .L32
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-20]
	ldr	r2, [r3, #392]
	ldr	r1, [fp, #-20]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #2
	add	r2, r1, r3
	sub	r3, fp, #16
	ldm	r2, {r0, r1, r2}
	stm	r3, {r0, r1, r2}
	ldr	r3, [fp, #-24]
	add	r3, r3, #1
	str	r3, [fp, #-24]
	ldr	r0, [fp, #-20]
	bl	rec_event
	ldr	r3, [fp, #-16]
	cmp	r3, #1
	bne	.L28
	ldr	r0, .L32+4
	bl	sem_post
	b	.L29
.L28:
	ldr	r3, [fp, #-16]
	cmp	r3, #2
	bne	.L29
	ldr	r0, .L32+8
	bl	sem_post
.L29:
	ldr	r0, .L32
	bl	pthread_mutex_unlock
.L27:
	ldr	r3, [fp, #-20]
	ldr	r3, [r3, #384]
	ldr	r2, [fp, #-24]
	cmp	r2, r3
	blt	.L30
	b	.L27
.L33:
	.align	2
.L32:
	.word	lock
	.word	sem_thread1
	.word	sem_thread2
	.size	thread3, .-thread3
	.section	.rodata
	.align	2
.LC6:
	.word	__stack_chk_guard
	.text
	.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
	ldr	r3, .L36
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r1, #0
	ldr	r0, .L36+4
	bl	pthread_mutex_init
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L36+8
	bl	sem_init
	str	r0, [fp, #-20]
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L36+12
	bl	sem_init
	str	r0, [fp, #-20]
	mov	r0, #400
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #396]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #392]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #384]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #388]
	sub	r0, fp, #32
	ldr	r3, [fp, #-16]
	ldr	r2, .L36+16
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	sub	r0, fp, #28
	ldr	r3, [fp, #-16]
	ldr	r2, .L36+20
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	sub	r0, fp, #24
	ldr	r3, [fp, #-16]
	ldr	r2, .L36+24
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-32]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-28]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-24]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r0, [fp, #-16]
	bl	free
	nop
	ldr	r3, .L36
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L35
	bl	__stack_chk_fail
.L35:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L37:
	.align	2
.L36:
	.word	.LC6
	.word	lock
	.word	sem_thread1
	.word	sem_thread2
	.word	thread1
	.word	thread2
	.word	thread3
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
