	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function meson_sar_adc_calib
_meson_sar_adc_calib:                   ## @meson_sar_adc_calib
	.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
	movq	%rdi, %r12
	callq	_iio_priv
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	16(%rax), %rax
	movb	(%rax), %cl
	movl	$1, %eax
	shll	%cl, %eax
	leal	3(%rax), %r13d
	testl	%eax, %eax
	cmovnsl	%eax, %r13d
	movl	$3, %eax
	shll	%cl, %eax
	leal	3(%rax), %r15d
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	movq	_CHAN7_MUX_VDD_DIV4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_meson_sar_adc_set_chan7_mux
	movl	$10, %edi
	movl	$20, %esi
	callq	_usleep_range
	movq	(%r12), %rsi
	addq	$28, %rsi
	movq	_MEAN_AVERAGING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_EIGHT_SAMPLES@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	leaq	-44(%rbp), %r8
	movq	%r12, %rdi
	callq	_meson_sar_adc_get_sample
	testl	%eax, %eax
	js	LBB0_5
## %bb.1:
	movq	_CHAN7_MUX_VDD_MUL3_DIV4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_meson_sar_adc_set_chan7_mux
	movl	$10, %edi
	movl	$20, %esi
	callq	_usleep_range
	movq	(%r12), %rsi
	addq	$28, %rsi
	movq	_MEAN_AVERAGING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	(%r14), %ecx
	leaq	-48(%rbp), %r8
	movq	%r12, %rdi
	callq	_meson_sar_adc_get_sample
	testl	%eax, %eax
	js	LBB0_5
## %bb.2:
	movl	-48(%rbp), %esi
	subl	-44(%rbp), %esi
	jle	LBB0_6
## %bb.3:
	sarl	$2, %r13d
	sarl	$2, %r15d
	subl	%r13d, %r15d
	movq	_MILLION@GOTPCREL(%rip), %r14
	imull	(%r14), %r15d
	movl	%r15d, %edi
	callq	_div_s64
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	%eax, (%rbx)
	imull	-44(%rbp), %eax
	movl	(%r14), %esi
	movl	%eax, %edi
	callq	_div_s64
	subl	%eax, %r13d
	movslq	%r13d, %rax
	movq	%rax, 8(%rbx)
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_5:
	movl	%eax, %ebx
	jmp	LBB0_7
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_7:
	movq	_CHAN7_MUX_CH7_INPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_meson_sar_adc_set_chan7_mux
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CHAN7_MUX_VDD_DIV4,4,2         ## @CHAN7_MUX_VDD_DIV4
	.comm	_MEAN_AVERAGING,4,2             ## @MEAN_AVERAGING
	.comm	_EIGHT_SAMPLES,4,2              ## @EIGHT_SAMPLES
	.comm	_CHAN7_MUX_VDD_MUL3_DIV4,4,2    ## @CHAN7_MUX_VDD_MUL3_DIV4
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MILLION,4,2                    ## @MILLION
	.comm	_CHAN7_MUX_CH7_INPUT,4,2        ## @CHAN7_MUX_CH7_INPUT
	.no_dead_strip	_meson_sar_adc_calib
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function meson_sar_adc_calib
_meson_sar_adc_calib:                   ; @meson_sar_adc_calib
	.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	x19, x0
	bl	_iio_priv
	mov	x20, x0
	ldr	x8, [x0, #16]
	ldr	w8, [x8]
	mov	w9, #1
	lsl	w9, w9, w8
	add	w10, w9, #3
	cmp	w9, #0
	csel	w22, w10, w9, lt
	mov	w9, #3
	lsl	w8, w9, w8
	add	w9, w8, #3
	cmp	w8, #0
	csel	w23, w9, w8, lt
Lloh0:
	adrp	x8, _CHAN7_MUX_VDD_DIV4@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CHAN7_MUX_VDD_DIV4@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_meson_sar_adc_set_chan7_mux
	mov	w0, #10
	mov	w1, #20
	bl	_usleep_range
	ldr	x8, [x19]
	add	x1, x8, #28
Lloh3:
	adrp	x24, _MEAN_AVERAGING@GOTPAGE
Lloh4:
	ldr	x24, [x24, _MEAN_AVERAGING@GOTPAGEOFF]
	ldr	w2, [x24]
Lloh5:
	adrp	x25, _EIGHT_SAMPLES@GOTPAGE
Lloh6:
	ldr	x25, [x25, _EIGHT_SAMPLES@GOTPAGEOFF]
	ldr	w3, [x25]
	add	x4, sp, #12
	mov	x0, x19
	bl	_meson_sar_adc_get_sample
	tbnz	w0, #31, LBB0_4
; %bb.1:
Lloh7:
	adrp	x8, _CHAN7_MUX_VDD_MUL3_DIV4@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CHAN7_MUX_VDD_MUL3_DIV4@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_meson_sar_adc_set_chan7_mux
	mov	w0, #10
	mov	w1, #20
	bl	_usleep_range
	ldr	x8, [x19]
	add	x1, x8, #28
	ldr	w2, [x24]
	ldr	w3, [x25]
	add	x4, sp, #8
	mov	x0, x19
	bl	_meson_sar_adc_get_sample
	tbnz	w0, #31, LBB0_4
; %bb.2:
	ldp	w8, w9, [sp, #8]
	subs	w1, w8, w9
	b.le	LBB0_5
; %bb.3:
	asr	w22, w22, #2
	asr	w8, w23, #2
	sub	w8, w8, w22
Lloh10:
	adrp	x21, _MILLION@GOTPAGE
Lloh11:
	ldr	x21, [x21, _MILLION@GOTPAGEOFF]
	ldr	w9, [x21]
	mul	w0, w9, w8
	bl	_div_s64
	str	w0, [x20]
	ldr	w8, [sp, #12]
	mul	w0, w8, w0
	ldr	w1, [x21]
	bl	_div_s64
	mov	w21, #0
	sub	w8, w22, w0
	sxtw	x8, w8
	str	x8, [x20, #8]
	b	LBB0_6
LBB0_4:
	mov	x21, x0
	b	LBB0_6
LBB0_5:
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
Lloh15:
	adrp	x8, _CHAN7_MUX_CH7_INPUT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _CHAN7_MUX_CH7_INPUT@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_meson_sar_adc_set_chan7_mux
	mov	x0, x21
	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 AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_CHAN7_MUX_VDD_DIV4,4,2         ; @CHAN7_MUX_VDD_DIV4
	.comm	_MEAN_AVERAGING,4,2             ; @MEAN_AVERAGING
	.comm	_EIGHT_SAMPLES,4,2              ; @EIGHT_SAMPLES
	.comm	_CHAN7_MUX_VDD_MUL3_DIV4,4,2    ; @CHAN7_MUX_VDD_MUL3_DIV4
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MILLION,4,2                    ; @MILLION
	.comm	_CHAN7_MUX_CH7_INPUT,4,2        ; @CHAN7_MUX_CH7_INPUT
	.no_dead_strip	_meson_sar_adc_calib
.subsections_via_symbols
