	.file	"286155.c"
	.intel_syntax noprefix
	.text
	.globl	Lock
	.bss
	.align 32
	.type	Lock, @object
	.size	Lock, 96
Lock:
	.zero	96
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.text
	.globl	aquireReadLock
	.type	aquireReadLock, @function
aquireReadLock:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, Lock[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR Lock[rip+88]
	add	eax, 1
	mov	DWORD PTR Lock[rip+88], eax
	lea	rdi, Lock[rip]
	call	pthread_mutex_unlock@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	aquireReadLock, .-aquireReadLock
	.globl	releaseReadLock
	.type	releaseReadLock, @function
releaseReadLock:
.LFB1:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, Lock[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR Lock[rip+88]
	sub	eax, 1
	mov	DWORD PTR Lock[rip+88], eax
	mov	eax, DWORD PTR Lock[rip+88]
	test	eax, eax
	jne	.L3
	lea	rdi, Lock[rip+40]
	call	pthread_cond_signal@PLT
.L3:
	lea	rdi, Lock[rip]
	call	pthread_mutex_unlock@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	releaseReadLock, .-releaseReadLock
	.globl	aquireWriteLock
	.type	aquireWriteLock, @function
aquireWriteLock:
.LFB2:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, Lock[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L5
.L6:
	lea	rsi, Lock[rip]
	lea	rdi, Lock[rip+40]
	call	pthread_cond_wait@PLT
.L5:
	mov	eax, DWORD PTR Lock[rip+88]
	test	eax, eax
	jne	.L6
	nop
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	aquireWriteLock, .-aquireWriteLock
	.globl	releaseWriteLock
	.type	releaseWriteLock, @function
releaseWriteLock:
.LFB3:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, Lock[rip]
	call	pthread_mutex_unlock@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	releaseWriteLock, .-releaseWriteLock
	.section	.rodata
.LC0:
	.string	"M: %9d\tN: %9d\n"
	.text
	.globl	readerThread
	.type	readerThread, @function
readerThread:
.LFB4:
	.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	DWORD PTR -4[rbp], 0
	jmp	.L9
.L11:
	mov	eax, 0
	call	aquireReadLock
	mov	edx, DWORD PTR -4[rbp]
	movsx	rax, edx
	imul	rax, rax, 1125899907
	shr	rax, 32
	sar	eax, 18
	mov	ecx, edx
	sar	ecx, 31
	sub	eax, ecx
	imul	ecx, eax, 1000000
	mov	eax, edx
	sub	eax, ecx
	test	eax, eax
	jne	.L10
	mov	edx, DWORD PTR N[rip]
	mov	eax, DWORD PTR M[rip]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
.L10:
	mov	eax, 0
	call	releaseReadLock
	add	DWORD PTR -4[rbp], 1
.L9:
	cmp	DWORD PTR -4[rbp], 49999999
	jle	.L11
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	readerThread, .-readerThread
	.globl	writerThread
	.type	writerThread, @function
writerThread:
.LFB5:
	.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	DWORD PTR -4[rbp], 0
	jmp	.L14
.L15:
	mov	eax, 0
	call	aquireWriteLock
	mov	eax, DWORD PTR M[rip]
	add	eax, 1
	mov	DWORD PTR M[rip], eax
	mov	eax, DWORD PTR N[rip]
	add	eax, 1
	mov	DWORD PTR N[rip], eax
	mov	eax, 0
	call	releaseWriteLock
	add	DWORD PTR -4[rbp], 1
.L14:
	cmp	DWORD PTR -4[rbp], 49999999
	jle	.L15
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	writerThread, .-writerThread
	.section	.rodata
	.align 8
.LC1:
	.string	"END ----------------------------------------\nM: %9d\tN: %9d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 0
	lea	rdi, Lock[rip]
	call	pthread_mutex_init@PLT
	mov	esi, 0
	lea	rdi, Lock[rip+40]
	call	pthread_cond_init@PLT
	mov	DWORD PTR -64[rbp], 0
	jmp	.L18
.L19:
	mov	eax, DWORD PTR -64[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, -48[rbp]
	add	rax, rdx
	mov	ecx, 0
	lea	rdx, readerThread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -64[rbp], 1
.L18:
	cmp	DWORD PTR -64[rbp], 1
	jle	.L19
	mov	DWORD PTR -60[rbp], 0
	jmp	.L20
.L21:
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, -32[rbp]
	add	rax, rdx
	mov	ecx, 0
	lea	rdx, writerThread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	add	DWORD PTR -60[rbp], 1
.L20:
	cmp	DWORD PTR -60[rbp], 1
	jle	.L21
	mov	DWORD PTR -56[rbp], 0
	jmp	.L22
.L23:
	mov	eax, DWORD PTR -56[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -56[rbp], 1
.L22:
	cmp	DWORD PTR -56[rbp], 1
	jle	.L23
	mov	DWORD PTR -52[rbp], 0
	jmp	.L24
.L25:
	mov	eax, DWORD PTR -52[rbp]
	cdqe
	mov	rax, QWORD PTR -32[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -52[rbp], 1
.L24:
	cmp	DWORD PTR -52[rbp], 1
	jle	.L25
	mov	edx, DWORD PTR N[rip]
	mov	eax, DWORD PTR M[rip]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"286155.c"
	.text
	.comm	Lock,80,8
	.comm	M,4,4
	.comm	N,4,4
	.align	2
	.global	aquireReadLock
	.syntax unified
	.arm
	.fpu softvfp
	.type	aquireReadLock, %function
aquireReadLock:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L2
	bl	pthread_mutex_lock
	ldr	r3, .L2
	ldr	r3, [r3, #72]
	add	r3, r3, #1
	ldr	r2, .L2
	str	r3, [r2, #72]
	ldr	r0, .L2
	bl	pthread_mutex_unlock
	nop
	pop	{fp, pc}
.L3:
	.align	2
.L2:
	.word	Lock
	.size	aquireReadLock, .-aquireReadLock
	.align	2
	.global	releaseReadLock
	.syntax unified
	.arm
	.fpu softvfp
	.type	releaseReadLock, %function
releaseReadLock:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L6
	bl	pthread_mutex_lock
	ldr	r3, .L6
	ldr	r3, [r3, #72]
	sub	r3, r3, #1
	ldr	r2, .L6
	str	r3, [r2, #72]
	ldr	r3, .L6
	ldr	r3, [r3, #72]
	cmp	r3, #0
	bne	.L5
	ldr	r0, .L6+4
	bl	pthread_cond_signal
.L5:
	ldr	r0, .L6
	bl	pthread_mutex_unlock
	nop
	pop	{fp, pc}
.L7:
	.align	2
.L6:
	.word	Lock
	.word	Lock+24
	.size	releaseReadLock, .-releaseReadLock
	.align	2
	.global	aquireWriteLock
	.syntax unified
	.arm
	.fpu softvfp
	.type	aquireWriteLock, %function
aquireWriteLock:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L11
	bl	pthread_mutex_lock
	b	.L9
.L10:
	ldr	r1, .L11
	ldr	r0, .L11+4
	bl	pthread_cond_wait
.L9:
	ldr	r3, .L11
	ldr	r3, [r3, #72]
	cmp	r3, #0
	bne	.L10
	nop
	nop
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	Lock
	.word	Lock+24
	.size	aquireWriteLock, .-aquireWriteLock
	.align	2
	.global	releaseWriteLock
	.syntax unified
	.arm
	.fpu softvfp
	.type	releaseWriteLock, %function
releaseWriteLock:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L14
	bl	pthread_mutex_unlock
	nop
	pop	{fp, pc}
.L15:
	.align	2
.L14:
	.word	Lock
	.size	releaseWriteLock, .-releaseWriteLock
	.section	.rodata
	.align	2
.LC0:
	.ascii	"M: %9d\011N: %9d\012\000"
	.text
	.align	2
	.global	readerThread
	.syntax unified
	.arm
	.fpu softvfp
	.type	readerThread, %function
readerThread:
	@ 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, #-8]
	b	.L17
.L19:
	bl	aquireReadLock
	ldr	r0, [fp, #-8]
	ldr	r3, .L21
	smull	r2, r3, r0, r3
	asr	r2, r3, #18
	asr	r3, r0, #31
	sub	r1, r2, r3
	mov	r2, r1
	lsl	r2, r2, #5
	sub	r2, r2, r1
	lsl	r3, r2, #6
	sub	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r3, r1
	lsl	r3, r3, #6
	sub	r1, r0, r3
	cmp	r1, #0
	bne	.L18
	ldr	r3, .L21+4
	ldr	r3, [r3]
	ldr	r2, .L21+8
	ldr	r2, [r2]
	mov	r1, r3
	ldr	r0, .L21+12
	bl	printf
.L18:
	bl	releaseReadLock
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L17:
	ldr	r3, [fp, #-8]
	ldr	r2, .L21+16
	cmp	r3, r2
	ble	.L19
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	1125899907
	.word	M
	.word	N
	.word	.LC0
	.word	49999999
	.size	readerThread, .-readerThread
	.align	2
	.global	writerThread
	.syntax unified
	.arm
	.fpu softvfp
	.type	writerThread, %function
writerThread:
	@ 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, #-8]
	b	.L24
.L25:
	bl	aquireWriteLock
	ldr	r3, .L27
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L27
	str	r3, [r2]
	ldr	r3, .L27+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L27+4
	str	r3, [r2]
	bl	releaseWriteLock
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L24:
	ldr	r3, [fp, #-8]
	ldr	r2, .L27+8
	cmp	r3, r2
	ble	.L25
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	M
	.word	N
	.word	49999999
	.size	writerThread, .-writerThread
	.section	.rodata
	.align	2
.LC1:
	.ascii	"END ----------------------------------------\012M: "
	.ascii	"%9d\011N: %9d\012\000"
	.align	2
.LC2:
	.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, .L40
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L40+4
	bl	pthread_mutex_init
	mov	r1, #0
	ldr	r0, .L40+8
	bl	pthread_cond_init
	mov	r3, #0
	str	r3, [fp, #-40]
	b	.L30
.L31:
	ldr	r3, [fp, #-40]
	lsl	r3, r3, #2
	sub	r2, fp, #24
	add	r0, r2, r3
	mov	r3, #0
	ldr	r2, .L40+12
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	str	r3, [fp, #-40]
.L30:
	ldr	r3, [fp, #-40]
	cmp	r3, #1
	ble	.L31
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L32
.L33:
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	sub	r2, fp, #16
	add	r0, r2, r3
	mov	r3, #0
	ldr	r2, .L40+16
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L32:
	ldr	r3, [fp, #-36]
	cmp	r3, #1
	ble	.L33
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L34
.L35:
	ldr	r3, [fp, #-32]
	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, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L34:
	ldr	r3, [fp, #-32]
	cmp	r3, #1
	ble	.L35
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L36
.L37:
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L36:
	ldr	r3, [fp, #-28]
	cmp	r3, #1
	ble	.L37
	ldr	r3, .L40+20
	ldr	r3, [r3]
	ldr	r2, .L40+24
	ldr	r2, [r2]
	mov	r1, r3
	ldr	r0, .L40+28
	bl	printf
	mov	r3, #0
	ldr	r2, .L40
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L39
	bl	__stack_chk_fail
.L39:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L41:
	.align	2
.L40:
	.word	.LC2
	.word	Lock
	.word	Lock+24
	.word	readerThread
	.word	writerThread
	.word	M
	.word	N
	.word	.LC1
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
