	.file	"extr_us5182d.c_us5182d_write_thresh.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	us5182d_write_thresh, @function
us5182d_write_thresh:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12d, ecx
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	ebx, r9d
	call	iio_priv@PLT
	test	ebx, ebx
	js	.L14
	cmp	DWORD PTR USHRT_MAX[rip], ebx
	jl	.L14
	mov	ecx, DWORD PTR 48[rsp]
	test	ecx, ecx
	jne	.L14
	mov	r13, rax
	cmp	r12d, 128
	je	.L6
	cmp	r12d, 129
	je	.L7
	.p2align 4,,10
	.p2align 3
.L14:
	mov	r12d, DWORD PTR EINVAL[rip]
	neg	r12d
.L1:
	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
.L7:
	.cfi_restore_state
	lea	r14, 8[rax]
	mov	rdi, r14
	call	mutex_lock@PLT
	mov	eax, DWORD PTR 12[r13]
	test	eax, eax
	je	.L13
	mov	edx, ebx
	mov	esi, 129
	mov	rdi, rbp
	call	us5182d_setup_prox@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L10
.L13:
	mov	DWORD PTR 4[r13], ebx
	mov	rdi, r14
	xor	r12d, r12d
	call	mutex_unlock@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	lea	r14, 8[rax]
	mov	rdi, r14
	call	mutex_lock@PLT
	mov	edx, DWORD PTR 16[r13]
	test	edx, edx
	je	.L11
	mov	edx, ebx
	mov	esi, 128
	mov	rdi, rbp
	call	us5182d_setup_prox@PLT
	mov	r12d, eax
	test	eax, eax
	js	.L10
.L11:
	mov	DWORD PTR 0[r13], ebx
	mov	rdi, r14
	xor	r12d, r12d
	call	mutex_unlock@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L10:
	mov	rdi, r14
	call	mutex_unlock@PLT
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	us5182d_write_thresh, .-us5182d_write_thresh
	.comm	USHRT_MAX,4,4
	.comm	EINVAL,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_us5182d.c_us5182d_write_thresh.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	us5182d_write_thresh, %function
us5182d_write_thresh:
	@ args = 12, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r7, [sp, #28]
	mov	r6, r3
	mov	r4, r0
	bl	iio_priv
	cmp	r7, #0
	blt	.L13
	ldr	r3, .L16
	ldr	r2, [sp, #32]
	ldr	r3, [r3]
	cmp	r3, r7
	cmpge	r2, #0
	beq	.L3
.L13:
	ldr	r3, .L16+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, pc}
.L3:
	cmp	r6, #128
	mov	r5, r0
	beq	.L5
	cmp	r6, #129
	bne	.L13
	add	r8, r0, #8
	mov	r0, r8
	bl	mutex_lock
	ldr	r3, [r5, #12]
	cmp	r3, #0
	beq	.L12
	mov	r0, r4
	mov	r1, r6
	mov	r2, r7
	bl	us5182d_setup_prox
	subs	r4, r0, #0
	blt	.L9
.L12:
	mov	r0, r8
	str	r7, [r5, #4]
	bl	mutex_unlock
	mov	r4, #0
	b	.L1
.L5:
	add	r8, r0, #8
	mov	r0, r8
	bl	mutex_lock
	ldr	r3, [r5, #16]
	cmp	r3, #0
	beq	.L10
	mov	r0, r4
	mov	r1, r6
	mov	r2, r7
	bl	us5182d_setup_prox
	subs	r4, r0, #0
	blt	.L9
.L10:
	mov	r0, r8
	str	r7, [r5]
	bl	mutex_unlock
	mov	r4, #0
	b	.L1
.L9:
	mov	r0, r8
	bl	mutex_unlock
	b	.L1
.L17:
	.align	2
.L16:
	.word	USHRT_MAX
	.word	EINVAL
	.size	us5182d_write_thresh, .-us5182d_write_thresh
	.comm	USHRT_MAX,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
