	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cpcap_adc_calibrate_one
_cpcap_adc_calibrate_one:               ## @cpcap_adc_calibrate_one
	.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
	movl	%r8d, -60(%rbp)                 ## 4-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_CPCAP_ADC_MAX_RETRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_10
## %bb.1:
	movl	%ecx, %r12d
	movl	%edx, %r13d
	movl	%esi, %r14d
	movq	%rdi, %rbx
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	$0, -56(%rbp)
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_cpcap_adc_setup_calibrate
	movl	12(%rbx), %edi
	movl	%r13d, %esi
	leaq	-56(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_cpcap_adc_setup_calibrate
	movl	12(%rbx), %edi
	movl	%r13d, %esi
	leaq	-52(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-52(%rbp), %eax
	cmpl	%r12d, %eax
	jb	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	-60(%rbp), %eax                 ## 4-byte Folded Reload
	ja	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-56(%rbp), %ecx
	movl	%eax, %edx
	subl	%ecx, %edx
	negl	%edx
	movl	%eax, %esi
	subl	%ecx, %esi
	cmovbl	%edx, %esi
	movzwl	%si, %ecx
	movq	_ST_ADC_CALIBRATE_DIFF_THRESHOLD@GOTPCREL(%rip), %rdx
	movzwl	(%rdx), %edx
	cmpl	%edx, %ecx
	jbe	LBB0_8
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movq	_CPCAP_VENDOR_TI@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$10000, %esi                    ## imm = 0x2710
	callq	_usleep_range
	incl	%r15d
	movq	_CPCAP_ADC_MAX_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jl	LBB0_2
	jmp	LBB0_10
LBB0_8:
	movl	$512, %ecx                      ## imm = 0x200
	subl	%eax, %ecx
	movq	_bank_conversion@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%r14d, %rdx
	movw	%cx, (%rax,%rdx,2)
	movl	8(%rbx), %edi
	movswl	%cx, %ecx
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_dbg
LBB0_10:
	xorl	%eax, %eax
LBB0_11:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_13
## %bb.12:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_CPCAP_ADC_MAX_RETRIES,4,2      ## @CPCAP_ADC_MAX_RETRIES
	.comm	_ST_ADC_CALIBRATE_DIFF_THRESHOLD,2,1 ## @ST_ADC_CALIBRATE_DIFF_THRESHOLD
	.comm	_CPCAP_VENDOR_TI,8,3            ## @CPCAP_VENDOR_TI
	.comm	_bank_conversion,8,3            ## @bank_conversion
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ch%i calibration complete: %i\n"

	.no_dead_strip	_cpcap_adc_calibrate_one
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cpcap_adc_calibrate_one
_cpcap_adc_calibrate_one:               ; @cpcap_adc_calibrate_one
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x25, _CPCAP_ADC_MAX_RETRIES@GOTPAGE
Lloh1:
	ldr	x25, [x25, _CPCAP_ADC_MAX_RETRIES@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.1:
	mov	x21, x4
	mov	x22, x3
	mov	x23, x2
	mov	x19, x1
	mov	x20, x0
	mov	w26, #0
	add	x8, sp, #8
	orr	x24, x8, #0x4
Lloh2:
	adrp	x27, _CPCAP_VENDOR_TI@GOTPAGE
Lloh3:
	ldr	x27, [x27, _CPCAP_VENDOR_TI@GOTPAGEOFF]
Lloh4:
	adrp	x28, _ST_ADC_CALIBRATE_DIFF_THRESHOLD@GOTPAGE
Lloh5:
	ldr	x28, [x28, _ST_ADC_CALIBRATE_DIFF_THRESHOLD@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	str	xzr, [sp, #8]
	mov	x0, x20
	mov	x1, x19
	bl	_cpcap_adc_setup_calibrate
	ldr	w0, [x20, #12]
	add	x2, sp, #8
	mov	x1, x23
	bl	_regmap_read
	cbnz	w0, LBB0_11
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x20
	mov	x1, x19
	bl	_cpcap_adc_setup_calibrate
	ldr	w0, [x20, #12]
	mov	x1, x23
	mov	x2, x24
	bl	_regmap_read
	cbnz	w0, LBB0_11
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [sp, #12]
	cmp	w8, w22
	b.lo	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w8, w21
	b.hi	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w9, [sp, #8]
	sub	w10, w8, w9
	subs	w9, w9, w8
	csel	w9, w9, w10, hi
	ldrh	w10, [x28]
	cmp	w10, w9, uxth
	b.hs	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	x9, [x20]
	ldr	x10, [x27]
	cmp	x9, x10
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #5000
	mov	w1, #10000
	bl	_usleep_range
	add	w26, w26, #1
	ldr	w8, [x25]
	cmp	w26, w8
	b.lt	LBB0_2
	b	LBB0_10
LBB0_9:
	mov	w9, #512
Lloh6:
	adrp	x10, _bank_conversion@GOTPAGE
Lloh7:
	ldr	x10, [x10, _bank_conversion@GOTPAGEOFF]
	sub	w8, w9, w8
Lloh8:
	ldr	x9, [x10]
	strh	w8, [x9, w19, sxtw #1]
	ldr	w0, [x20, #8]
	sxth	w3, w8
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
LBB0_10:
	mov	w0, #0
LBB0_11:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_CPCAP_ADC_MAX_RETRIES,4,2      ; @CPCAP_ADC_MAX_RETRIES
	.comm	_ST_ADC_CALIBRATE_DIFF_THRESHOLD,2,1 ; @ST_ADC_CALIBRATE_DIFF_THRESHOLD
	.comm	_CPCAP_VENDOR_TI,8,3            ; @CPCAP_VENDOR_TI
	.comm	_bank_conversion,8,3            ; @bank_conversion
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ch%i calibration complete: %i\n"

	.no_dead_strip	_cpcap_adc_calibrate_one
.subsections_via_symbols
