	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hi8435_write_event_value
_hi8435_write_event_value:              ## @hi8435_write_event_value
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $r9d killed $r9d def $r9
	movq	%r9, -56(%rbp)                  ## 8-byte Spill
	movl	%ecx, %r12d
	movq	%rsi, %r15
	callq	_iio_priv
	movq	%rax, %r13
	movq	_HI8435_PSEN_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	callq	_hi8435_readb
	testl	%eax, %eax
	js	LBB0_3
## %bb.1:
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movl	-48(%rbp), %r14d
	movl	(%r15), %eax
	leal	7(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	sarl	$3, %edi
	callq	_BIT
	movl	%eax, %ebx
	andl	%r14d, %ebx
	je	LBB0_4
## %bb.2:
	movq	_HI8435_SOCENHYS_REG@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_4:
	movq	_HI8435_GOCENHYS_REG@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r13, %rdi
	callq	_hi8435_readw
	testl	%eax, %eax
	js	LBB0_3
## %bb.6:
	movq	_IIO_EV_DIR_FALLING@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jne	LBB0_13
## %bb.7:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	leal	-22(%r15), %eax
	cmpl	$-20, %eax
	jb	LBB0_16
## %bb.8:
	xorl	%eax, %eax
	testl	%ebx, %ebx
	setne	%al
	leal	2(%r15), %edx
	movq	(%r13), %rcx
	cmpl	(%rcx,%rax,4), %edx
	jg	LBB0_16
## %bb.9:
	movq	8(%r13), %rdx
	xorl	%r14d, %r14d
	cmpl	%r15d, (%rdx,%rax,4)
	je	LBB0_30
## %bb.10:
	movl	%r15d, (%rdx,%rax,4)
	movl	(%rcx,%rax,4), %edx
	movl	%edx, %esi
	subl	%r15d, %esi
	testb	$1, %sil
	je	LBB0_21
## %bb.11:
	decl	%edx
	jmp	LBB0_20
LBB0_3:
	movl	%eax, %r14d
	jmp	LBB0_30
LBB0_13:
	movq	_IIO_EV_DIR_RISING@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jne	LBB0_21
## %bb.14:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	leal	-23(%r15), %eax
	cmpl	$-20, %eax
	jb	LBB0_16
## %bb.15:
	xorl	%eax, %eax
	testl	%ebx, %ebx
	setne	%al
	movq	8(%r13), %rcx
	movl	(%rcx,%rax,4), %edx
	addl	$2, %edx
	cmpl	%r15d, %edx
	jle	LBB0_17
LBB0_16:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_30
LBB0_17:
	movq	(%r13), %rdx
	xorl	%r14d, %r14d
	cmpl	%r15d, (%rdx,%rax,4)
	je	LBB0_30
## %bb.18:
	movl	%r15d, (%rdx,%rax,4)
	movl	(%rcx,%rax,4), %edx
	subl	%edx, %r15d
	testb	$1, %r15b
	je	LBB0_21
## %bb.19:
	incl	%edx
LBB0_20:
	movl	%edx, (%rcx,%rax,4)
LBB0_21:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	addq	$16, %rdi
	movq	%rdi, %r15
	callq	_mutex_lock
	testl	%ebx, %ebx
	je	LBB0_23
## %bb.22:
	movq	_HI8435_SOCENHYS_REG@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_23:
	movq	_HI8435_GOCENHYS_REG@GOTPCREL(%rip), %rax
LBB0_24:
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r13, %rdi
	callq	_hi8435_readw
	testl	%eax, %eax
	js	LBB0_29
## %bb.25:
	xorl	%eax, %eax
	movq	8(%r13), %rdx
	testl	%ebx, %ebx
	setne	%al
	movq	(%r13), %rdi
	movl	(%rdi,%rax,4), %ecx
	je	LBB0_27
## %bb.26:
	movq	_HI8435_SOCENHYS_REG@GOTPCREL(%rip), %rsi
	jmp	LBB0_28
LBB0_27:
	movq	_HI8435_GOCENHYS_REG@GOTPCREL(%rip), %rsi
LBB0_28:
	subl	(%rdx,%rax,4), %ecx
	shll	$8, %ecx
	movl	%ecx, -44(%rbp)
	movl	(%rdx,%rax,4), %edx
	addl	(%rdi,%rax,4), %edx
	orl	%ecx, %edx
	movl	%edx, -44(%rbp)
	movl	(%rsi), %esi
	movq	%r13, %rdi
	callq	_hi8435_writew
LBB0_29:
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_mutex_unlock
LBB0_30:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HI8435_PSEN_REG,4,2            ## @HI8435_PSEN_REG
	.comm	_HI8435_SOCENHYS_REG,4,2        ## @HI8435_SOCENHYS_REG
	.comm	_HI8435_GOCENHYS_REG,4,2        ## @HI8435_GOCENHYS_REG
	.comm	_IIO_EV_DIR_FALLING,4,2         ## @IIO_EV_DIR_FALLING
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IIO_EV_DIR_RISING,4,2          ## @IIO_EV_DIR_RISING
	.no_dead_strip	_hi8435_write_event_value
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hi8435_write_event_value
_hi8435_write_event_value:              ; @hi8435_write_event_value
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x5
	mov	x21, x3
	mov	x23, x1
	bl	_iio_priv
	mov	x19, x0
Lloh0:
	adrp	x8, _HI8435_PSEN_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HI8435_PSEN_REG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_hi8435_readb
	tbnz	w0, #31, LBB0_8
; %bb.1:
	ldr	w22, [sp, #12]
	ldr	w8, [x23]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #3
	bl	_BIT
	ands	w25, w0, w22
Lloh3:
	adrp	x23, _HI8435_SOCENHYS_REG@GOTPAGE
Lloh4:
	ldr	x23, [x23, _HI8435_SOCENHYS_REG@GOTPAGEOFF]
Lloh5:
	adrp	x24, _HI8435_GOCENHYS_REG@GOTPAGE
Lloh6:
	ldr	x24, [x24, _HI8435_GOCENHYS_REG@GOTPAGEOFF]
	csel	x8, x23, x24, ne
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x19
	bl	_hi8435_readw
	tbnz	w0, #31, LBB0_8
; %bb.2:
Lloh7:
	adrp	x8, _IIO_EV_DIR_FALLING@GOTPAGE
Lloh8:
	ldr	x8, [x8, _IIO_EV_DIR_FALLING@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_9
; %bb.3:
	sub	w8, w20, #22
	cmn	w8, #20
	b.lo	LBB0_12
; %bb.4:
	cmp	w25, #0
	cset	w8, ne
	add	w10, w20, #2
	ldr	x9, [x19]
	ldr	w11, [x9, w8, uxtw #2]
	cmp	w10, w11
	b.gt	LBB0_12
; %bb.5:
	ldr	x10, [x19, #8]
	ldr	w11, [x10, x8, lsl #2]
	cmp	w11, w20
	b.eq	LBB0_14
; %bb.6:
	lsl	x11, x8, #2
	str	w20, [x10, x11]
	ldr	w10, [x9, x11]
	sub	w11, w10, w20
	tbz	w11, #0, LBB0_18
; %bb.7:
	sub	w10, w10, #1
	b	LBB0_17
LBB0_8:
	mov	x22, x0
	b	LBB0_21
LBB0_9:
Lloh10:
	adrp	x8, _IIO_EV_DIR_RISING@GOTPAGE
Lloh11:
	ldr	x8, [x8, _IIO_EV_DIR_RISING@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_18
; %bb.10:
	sub	w8, w20, #23
	cmn	w8, #20
	b.lo	LBB0_12
; %bb.11:
	cmp	w25, #0
	cset	w8, ne
	ldr	x9, [x19, #8]
	ldr	w10, [x9, w8, uxtw #2]
	add	w10, w10, #2
	cmp	w10, w20
	b.le	LBB0_13
LBB0_12:
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_21
LBB0_13:
	ldr	x10, [x19]
	ldr	w11, [x10, x8, lsl #2]
	cmp	w11, w20
	b.ne	LBB0_15
LBB0_14:
	mov	w22, #0
	b	LBB0_21
LBB0_15:
	lsl	x11, x8, #2
	str	w20, [x10, x11]
	ldr	w10, [x9, x11]
	sub	w11, w20, w10
	tbz	w11, #0, LBB0_18
; %bb.16:
	add	w10, w10, #1
LBB0_17:
	str	w10, [x9, x8, lsl #2]
LBB0_18:
	add	x20, x19, #16
	mov	x0, x20
	bl	_mutex_lock
	cmp	w25, #0
	csel	x8, x23, x24, ne
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x19
	bl	_hi8435_readw
	tbnz	w0, #31, LBB0_20
; %bb.19:
	cmp	w25, #0
	cset	w8, ne
	lsl	x8, x8, #2
	ldp	x9, x10, [x19]
	ldr	w11, [x9, x8]
	ldr	w12, [x10, x8]
	csel	x13, x23, x24, ne
	sub	w11, w11, w12
	lsl	w11, w11, #8
	str	w11, [sp, #8]
	ldr	w9, [x9, x8]
	ldr	w8, [x10, x8]
	add	w8, w8, w9
	orr	w2, w8, w11
	str	w2, [sp, #8]
	ldr	w1, [x13]
	mov	x0, x19
	bl	_hi8435_writew
LBB0_20:
	mov	x22, x0
	mov	x0, x20
	bl	_mutex_unlock
LBB0_21:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_HI8435_PSEN_REG,4,2            ; @HI8435_PSEN_REG
	.comm	_HI8435_SOCENHYS_REG,4,2        ; @HI8435_SOCENHYS_REG
	.comm	_HI8435_GOCENHYS_REG,4,2        ; @HI8435_GOCENHYS_REG
	.comm	_IIO_EV_DIR_FALLING,4,2         ; @IIO_EV_DIR_FALLING
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IIO_EV_DIR_RISING,4,2          ; @IIO_EV_DIR_RISING
	.no_dead_strip	_hi8435_write_event_value
.subsections_via_symbols
