	.file	"extr_ttm_lock.c_ttm_write_lock.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"ttmwi"
.LC1:
	.string	"ttmw"
	.text
	.p2align 4
	.globl	ttm_write_lock
	.type	ttm_write_lock, @function
ttm_write_lock:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	mov	r14, rdi
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	mov	r13d, DWORD PTR PCATCH[rip]
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	lea	rbp, .LC0[rip]
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	ebx, esi
	test	esi, esi
	jne	.L2
	xor	r13d, r13d
	lea	rbp, .LC1[rip]
.L2:
	mov	rdi, r14
	xor	r12d, r12d
	call	mtx_lock@PLT
	.p2align 4,,10
	.p2align 3
.L11:
	mov	rdi, r14
	call	__ttm_write_lock@PLT
	test	eax, eax
	jne	.L6
	xor	r8d, r8d
	mov	rcx, rbp
	mov	edx, r13d
	mov	rsi, r14
	mov	rdi, r14
	call	msleep@PLT
	cmp	eax, DWORD PTR EINTR[rip]
	je	.L4
	cmp	eax, DWORD PTR ERESTART[rip]
	je	.L4
	neg	eax
	mov	r12d, eax
.L5:
	test	ebx, ebx
	je	.L11
	test	r12d, r12d
	je	.L11
	mov	eax, DWORD PTR TTM_WRITE_LOCK_PENDING[rip]
	mov	rdi, r14
	not	eax
	and	DWORD PTR 4[r14], eax
	call	wakeup@PLT
.L6:
	mov	rdi, r14
	call	mtx_unlock@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	mov	r12d, DWORD PTR ERESTARTSYS[rip]
	neg	r12d
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	ttm_write_lock, .-ttm_write_lock
	.comm	TTM_WRITE_LOCK_PENDING,4,4
	.comm	PCATCH,4,4
	.comm	ERESTARTSYS,4,4
	.comm	ERESTART,4,4
	.comm	EINTR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.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, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_ttm_lock.c_ttm_write_lock.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"ttmwi\000"
	.align	2
.LC1:
	.ascii	"ttmw\000"
	.text
	.align	2
	.global	ttm_write_lock
	.syntax unified
	.arm
	.fpu softvfp
	.type	ttm_write_lock, %function
ttm_write_lock:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	subs	r4, r1, #0
	ldrne	r3, .L15
	sub	sp, sp, #12
	mov	r10, r0
	moveq	r7, r4
	ldrne	r6, .L15+4
	ldrne	r7, [r3]
	ldreq	r6, .L15+8
	mov	fp, #0
	bl	mtx_lock
	ldr	r5, .L15+12
	ldr	r9, .L15+16
	ldr	r8, .L15+20
	b	.L3
.L14:
	ldr	r3, [r8]
	cmp	r0, r3
	beq	.L4
	cmp	r4, #0
	cmpne	fp, #0
	bne	.L13
.L3:
	mov	r0, r10
	bl	__ttm_write_lock
	cmp	r0, #0
	bne	.L6
	mov	r3, r6
	str	r0, [sp]
	mov	r2, r7
	mov	r1, r10
	mov	r0, r10
	bl	msleep
	ldr	r3, [r5]
	rsb	fp, r0, #0
	cmp	r0, r3
	bne	.L14
.L4:
	ldr	fp, [r9]
	rsb	fp, fp, #0
	cmp	r4, #0
	cmpne	fp, #0
	beq	.L3
.L13:
	ldr	r2, .L15+24
	ldr	r3, [r10, #4]
	ldr	r2, [r2]
	mov	r0, r10
	bic	r3, r3, r2
	str	r3, [r10, #4]
	bl	wakeup
.L6:
	mov	r0, r10
	bl	mtx_unlock
	mov	r0, fp
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L16:
	.align	2
.L15:
	.word	PCATCH
	.word	.LC0
	.word	.LC1
	.word	EINTR
	.word	ERESTARTSYS
	.word	ERESTART
	.word	TTM_WRITE_LOCK_PENDING
	.size	ttm_write_lock, .-ttm_write_lock
	.comm	TTM_WRITE_LOCK_PENDING,4,4
	.comm	PCATCH,4,4
	.comm	ERESTARTSYS,4,4
	.comm	ERESTART,4,4
	.comm	EINTR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
