	.file	"433099.c"
	.intel_syntax noprefix
	.text
	.globl	count
	.bss
	.align 4
	.type	count, @object
	.size	count, 4
count:
	.zero	4
	.globl	rw
	.align 32
	.type	rw, @object
	.size	rw, 56
rw:
	.zero	56
	.globl	running
	.data
	.align 4
	.type	running, @object
	.size	running, 4
running:
	.long	1
	.section	.rodata
.LC0:
	.string	"task1 wrlock start"
.LC1:
	.string	"task1 wrlock end"
.LC2:
	.string	"task1 count:%d\n"
.LC3:
	.string	"task1 unlock start"
.LC4:
	.string	"task1 unlock end"
	.text
	.globl	task1
	.type	task1, @function
task1:
.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	edi, 2
	call	sleep@PLT
	nop
	mov	eax, DWORD PTR running[rip]
	test	eax, eax
	je	.L4
	lea	rdi, .LC0[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_wrlock@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, DWORD PTR count[rip]
	add	eax, 1
	mov	DWORD PTR count[rip], eax
	mov	eax, DWORD PTR count[rip]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC3[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_unlock@PLT
	lea	rdi, .LC4[rip]
	call	puts@PLT
	call	abort@PLT
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	task1, .-task1
	.section	.rodata
.LC5:
	.string	"task2 rdlock start"
.LC6:
	.string	"task2 rdlock end"
.LC7:
	.string	"task2 count:%d\n"
.LC8:
	.string	"task2 unlock start"
.LC9:
	.string	"task2 unlock end"
	.text
	.globl	task2
	.type	task2, @function
task2:
.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
	mov	edi, 1
	call	sleep@PLT
	nop
	mov	eax, DWORD PTR running[rip]
	test	eax, eax
	je	.L7
	lea	rdi, .LC5[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_rdlock@PLT
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	eax, DWORD PTR count[rip]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 5
	call	sleep@PLT
	lea	rdi, .LC8[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_unlock@PLT
	lea	rdi, .LC9[rip]
	call	puts@PLT
	nop
.L7:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	task2, .-task2
	.section	.rodata
.LC10:
	.string	"sleep %ds\n"
.LC11:
	.string	"task3 rdlock start"
.LC12:
	.string	"task3 rdlock end"
.LC13:
	.string	"task3 count:%d\n"
.LC14:
	.string	"task3 unlock start"
.LC15:
	.string	"task3 unlock end"
	.text
	.globl	task3
	.type	task3, @function
task3:
.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	rax, QWORD PTR -24[rbp]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 3
	call	sleep@PLT
	nop
	mov	eax, DWORD PTR running[rip]
	test	eax, eax
	je	.L11
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	sleep@PLT
	lea	rdi, .LC11[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_rdlock@PLT
	lea	rdi, .LC12[rip]
	call	puts@PLT
	mov	eax, DWORD PTR count[rip]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 5
	call	sleep@PLT
	lea	rdi, .LC14[rip]
	call	puts@PLT
	lea	rdi, rw[rip]
	call	pthread_rwlock_unlock@PLT
	lea	rdi, .LC15[rip]
	call	puts@PLT
	nop
.L11:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	task3, .-task3
	.section	.rodata
.LC16:
	.string	"create thread fail"
	.text
	.globl	do1
	.type	do1, @function
do1:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 72
	.cfi_offset 3, -24
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -24[rbp], rax
	xor	eax, eax
	mov	rax, rsp
	mov	rbx, rax
	mov	DWORD PTR -72[rbp], 100
	mov	eax, DWORD PTR -72[rbp]
	movsx	rdx, eax
	sub	rdx, 1
	mov	QWORD PTR -48[rbp], rdx
	movsx	rdx, eax
	mov	r8, rdx
	mov	r9d, 0
	movsx	rdx, eax
	mov	rsi, rdx
	mov	edi, 0
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	eax, 16
	sub	rax, 1
	add	rax, rdx
	mov	ecx, 16
	mov	edx, 0
	div	rcx
	imul	rax, rax, 16
	mov	rcx, rax
	and	rcx, -4096
	mov	rdx, rsp
	sub	rdx, rcx
.L14:
	cmp	rsp, rdx
	je	.L15
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	jmp	.L14
.L15:
	mov	rdx, rax
	and	edx, 4095
	sub	rsp, rdx
	mov	rdx, rax
	and	edx, 4095
	test	rdx, rdx
	je	.L16
	and	eax, 4095
	sub	rax, 8
	add	rax, rsp
	or	QWORD PTR [rax], 0
.L16:
	mov	rax, rsp
	add	rax, 7
	shr	rax, 3
	sal	rax, 3
	mov	QWORD PTR -40[rbp], rax
	mov	DWORD PTR -68[rbp], -1
	lea	rax, -32[rbp]
	mov	rdi, rax
	call	pthread_rwlockattr_init@PLT
	lea	rax, -32[rbp]
	mov	esi, 2
	mov	rdi, rax
	call	pthread_rwlockattr_setkind_np@PLT
	lea	rax, -32[rbp]
	mov	rsi, rax
	lea	rdi, rw[rip]
	call	pthread_rwlock_init@PLT
	lea	rax, -64[rbp]
	mov	ecx, 0
	lea	rdx, task1[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], 0
	je	.L17
	lea	rdi, .LC16[rip]
	call	puts@PLT
	jmp	.L18
.L17:
	lea	rax, -56[rbp]
	mov	ecx, 0
	lea	rdx, task2[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], 0
	je	.L19
	lea	rdi, .LC16[rip]
	call	puts@PLT
	jmp	.L18
.L19:
	mov	DWORD PTR -76[rbp], 0
	jmp	.L20
.L22:
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	mov	rdx, rax
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, task3[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], 0
	je	.L21
	lea	rdi, .LC16[rip]
	call	puts@PLT
	jmp	.L18
.L21:
	add	DWORD PTR -76[rbp], 1
.L20:
	mov	eax, DWORD PTR -76[rbp]
	cmp	eax, DWORD PTR -72[rbp]
	jl	.L22
	mov	rax, QWORD PTR -64[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -80[rbp], 0
	jmp	.L23
.L24:
	mov	rax, QWORD PTR -40[rbp]
	mov	edx, DWORD PTR -80[rbp]
	movsx	rdx, edx
	mov	rax, QWORD PTR [rax+rdx*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -80[rbp], 1
.L23:
	mov	eax, DWORD PTR -80[rbp]
	cmp	eax, DWORD PTR -72[rbp]
	jl	.L24
	lea	rdi, rw[rip]
	call	pthread_rwlock_destroy@PLT
	mov	rsp, rbx
	jmp	.L13
.L18:
	mov	rsp, rbx
.L13:
	mov	rax, QWORD PTR -24[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	do1, .-do1
	.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, 16
	mov	DWORD PTR -4[rbp], edi
	mov	QWORD PTR -16[rbp], rsi
	mov	eax, 0
	call	do1
	mov	eax, 0
	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	"433099.c"
	.text
	.comm	count,4,4
	.comm	rw,32,4
	.global	running
	.data
	.align	2
	.type	running, %object
	.size	running, 4
running:
	.word	1
	.section	.rodata
	.align	2
.LC0:
	.ascii	"task1 wrlock start\000"
	.align	2
.LC1:
	.ascii	"task1 wrlock end\000"
	.align	2
.LC2:
	.ascii	"task1 count:%d\012\000"
	.align	2
.LC3:
	.ascii	"task1 unlock start\000"
	.align	2
.LC4:
	.ascii	"task1 unlock end\000"
	.text
	.align	2
	.global	task1
	.syntax unified
	.arm
	.fpu softvfp
	.type	task1, %function
task1:
	@ 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]
	mov	r0, #2
	bl	sleep
	nop
	ldr	r3, .L5
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L4
	ldr	r0, .L5+4
	bl	puts
	ldr	r0, .L5+8
	bl	pthread_rwlock_wrlock
	ldr	r0, .L5+12
	bl	puts
	ldr	r3, .L5+16
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L5+16
	str	r3, [r2]
	ldr	r3, .L5+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L5+20
	bl	printf
	ldr	r0, .L5+24
	bl	puts
	ldr	r0, .L5+8
	bl	pthread_rwlock_unlock
	ldr	r0, .L5+28
	bl	puts
	bl	abort
.L4:
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	running
	.word	.LC0
	.word	rw
	.word	.LC1
	.word	count
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.size	task1, .-task1
	.section	.rodata
	.align	2
.LC5:
	.ascii	"task2 rdlock start\000"
	.align	2
.LC6:
	.ascii	"task2 rdlock end\000"
	.align	2
.LC7:
	.ascii	"task2 count:%d\012\000"
	.align	2
.LC8:
	.ascii	"task2 unlock start\000"
	.align	2
.LC9:
	.ascii	"task2 unlock end\000"
	.text
	.align	2
	.global	task2
	.syntax unified
	.arm
	.fpu softvfp
	.type	task2, %function
task2:
	@ 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]
	mov	r0, #1
	bl	sleep
	nop
	ldr	r3, .L11
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L9
	ldr	r0, .L11+4
	bl	puts
	ldr	r0, .L11+8
	bl	pthread_rwlock_rdlock
	ldr	r0, .L11+12
	bl	puts
	ldr	r3, .L11+16
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L11+20
	bl	printf
	mov	r0, #5
	bl	sleep
	ldr	r0, .L11+24
	bl	puts
	ldr	r0, .L11+8
	bl	pthread_rwlock_unlock
	ldr	r0, .L11+28
	bl	puts
	nop
.L9:
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	running
	.word	.LC5
	.word	rw
	.word	.LC6
	.word	count
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.size	task2, .-task2
	.section	.rodata
	.align	2
.LC10:
	.ascii	"sleep %ds\012\000"
	.align	2
.LC11:
	.ascii	"task3 rdlock start\000"
	.align	2
.LC12:
	.ascii	"task3 rdlock end\000"
	.align	2
.LC13:
	.ascii	"task3 count:%d\012\000"
	.align	2
.LC14:
	.ascii	"task3 unlock start\000"
	.align	2
.LC15:
	.ascii	"task3 unlock end\000"
	.text
	.align	2
	.global	task3
	.syntax unified
	.arm
	.fpu softvfp
	.type	task3, %function
task3:
	@ 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]
	ldr	r3, [fp, #-16]
	str	r3, [fp, #-8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L17
	bl	printf
	mov	r0, #3
	bl	sleep
	nop
	ldr	r3, .L17+4
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L15
	ldr	r3, [fp, #-8]
	mov	r0, r3
	bl	sleep
	ldr	r0, .L17+8
	bl	puts
	ldr	r0, .L17+12
	bl	pthread_rwlock_rdlock
	ldr	r0, .L17+16
	bl	puts
	ldr	r3, .L17+20
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L17+24
	bl	printf
	mov	r0, #5
	bl	sleep
	ldr	r0, .L17+28
	bl	puts
	ldr	r0, .L17+12
	bl	pthread_rwlock_unlock
	ldr	r0, .L17+32
	bl	puts
	nop
.L15:
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	.LC10
	.word	running
	.word	.LC11
	.word	rw
	.word	.LC12
	.word	count
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.size	task3, .-task3
	.section	.rodata
	.align	2
.LC16:
	.ascii	"create thread fail\000"
	.align	2
.LC17:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	do1
	.syntax unified
	.arm
	.fpu softvfp
	.type	do1, %function
do1:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #52
	ldr	r3, .L30
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, sp
	mov	r4, r3
	mov	r3, #100
	str	r3, [fp, #-40]
	ldr	ip, [fp, #-40]
	sub	r3, ip, #1
	str	r3, [fp, #-36]
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r3, #7
	lsr	r3, r3, #3
	lsl	r3, r3, #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #3
	lsr	r3, r3, #2
	lsl	r3, r3, #2
	str	r3, [fp, #-32]
	mvn	r3, #0
	str	r3, [fp, #-28]
	sub	r3, fp, #24
	mov	r0, r3
	bl	pthread_rwlockattr_init
	sub	r3, fp, #24
	mov	r1, #2
	mov	r0, r3
	bl	pthread_rwlockattr_setkind_np
	sub	r3, fp, #24
	mov	r1, r3
	ldr	r0, .L30+4
	bl	pthread_rwlock_init
	sub	r0, fp, #56
	mov	r3, #0
	ldr	r2, .L30+8
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L20
	ldr	r0, .L30+12
	bl	puts
	b	.L21
.L20:
	sub	r0, fp, #52
	mov	r3, #0
	ldr	r2, .L30+16
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L22
	ldr	r0, .L30+12
	bl	puts
	b	.L21
.L22:
	mov	r3, #0
	str	r3, [fp, #-44]
	b	.L23
.L25:
	ldr	r3, [fp, #-44]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-32]
	add	r0, r2, r3
	ldr	r3, [fp, #-44]
	ldr	r2, .L30+20
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L24
	ldr	r0, .L30+12
	bl	puts
	b	.L21
.L24:
	ldr	r3, [fp, #-44]
	add	r3, r3, #1
	str	r3, [fp, #-44]
.L23:
	ldr	r2, [fp, #-44]
	ldr	r3, [fp, #-40]
	cmp	r2, r3
	blt	.L25
	ldr	r3, [fp, #-56]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-52]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, #0
	str	r3, [fp, #-48]
	b	.L26
.L27:
	ldr	r3, [fp, #-32]
	ldr	r2, [fp, #-48]
	ldr	r3, [r3, r2, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-48]
	add	r3, r3, #1
	str	r3, [fp, #-48]
.L26:
	ldr	r2, [fp, #-48]
	ldr	r3, [fp, #-40]
	cmp	r2, r3
	blt	.L27
	ldr	r0, .L30+4
	bl	pthread_rwlock_destroy
	mov	sp, r4
	b	.L19
.L21:
	mov	sp, r4
.L19:
	ldr	r3, .L30
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L29
	bl	__stack_chk_fail
.L29:
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L31:
	.align	2
.L30:
	.word	.LC17
	.word	rw
	.word	task1
	.word	.LC16
	.word	task2
	.word	task3
	.size	do1, .-do1
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ 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]
	str	r1, [fp, #-12]
	bl	do1
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
