	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm32h7_adc_restore_selfcalib
_stm32h7_adc_restore_selfcalib:         ## @stm32h7_adc_restore_selfcalib
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_iio_priv_to_dev
	movq	_STM32H7_CALFACT_S_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	(%r15), %esi
	movl	4(%r15), %edx
	shll	%cl, %esi
	movq	_STM32H7_CALFACT_D_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %edx
	movq	%rax, %rbx
	orl	%esi, %edx
	movq	_STM32H7_ADC_CALFACT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_stm32_adc_writel
	movq	_STM32H7_LINCALFACT_NUM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	LBB0_10
## %bb.1:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	_STM32H7_LINCALRDYW6@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	8(%r15), %rdx
	movq	_STM32H7_LINCALFACT_SHIFT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	incq	%rsi
	movq	_STM32H7_ADC_CALFACT2@GOTPCREL(%rip), %rbx
	movq	_STM32H7_ADC_CR@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	leal	-2(%rsi), %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	(%rdx,%rax,4), %r14d
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %r14d
	movl	(%rbx), %esi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_stm32_adc_writel
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	_stm32_adc_set_bits
	movl	(%r12), %edi
	movl	%r14d, %ebx
	andl	%r13d, %ebx
	movq	_STM32_ADC_TIMEOUT_US@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	%r14d, %esi
	movl	%ebx, %edx
	movl	$100, %ecx
	callq	_stm32_adc_readl_poll_timeout
	testl	%eax, %eax
	jne	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r13d, %edx
	movq	%r15, %r13
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	callq	_stm32_adc_clr_bits
	movl	(%r12), %edi
	xorl	%edx, %edx
	testl	%ebx, %ebx
	sete	%dl
	movq	_STM32_ADC_TIMEOUT_US@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movl	%r14d, %esi
	movl	$100, %ecx
	callq	_stm32_adc_readl_poll_timeout
	testl	%eax, %eax
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %r15
	movq	_STM32H7_ADC_CALFACT2@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r13, %rdi
	callq	_stm32_adc_readl
	movq	8(%r13), %rdx
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rdx,%rcx,4), %esi
	movq	_STM32H7_LINCALFACT_SHIFT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	shll	%cl, %esi
	cmpl	%esi, %eax
	jne	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	sarl	%r13d
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	decq	%rsi
	cmpq	$2, %rsi
	movq	_STM32H7_ADC_CR@GOTPCREL(%rip), %r12
	jae	LBB0_2
## %bb.5:
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_3:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movl	%r15d, %eax
	jmp	LBB0_10
LBB0_7:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movl	%ebx, %eax
	jmp	LBB0_10
LBB0_9:
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STM32H7_CALFACT_S_SHIFT,4,2    ## @STM32H7_CALFACT_S_SHIFT
	.comm	_STM32H7_CALFACT_D_SHIFT,4,2    ## @STM32H7_CALFACT_D_SHIFT
	.comm	_STM32H7_ADC_CALFACT,4,2        ## @STM32H7_ADC_CALFACT
	.comm	_STM32H7_LINCALRDYW6,4,2        ## @STM32H7_LINCALRDYW6
	.comm	_STM32H7_LINCALFACT_NUM,4,2     ## @STM32H7_LINCALFACT_NUM
	.comm	_STM32H7_LINCALFACT_SHIFT,4,2   ## @STM32H7_LINCALFACT_SHIFT
	.comm	_STM32H7_ADC_CALFACT2,4,2       ## @STM32H7_ADC_CALFACT2
	.comm	_STM32H7_ADC_CR,4,2             ## @STM32H7_ADC_CR
	.comm	_STM32_ADC_TIMEOUT_US,4,2       ## @STM32_ADC_TIMEOUT_US
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to write calfact\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to read calfact\n"

L_.str.2:                               ## @.str.2
	.asciz	"calfact not consistent\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_stm32h7_adc_restore_selfcalib
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm32h7_adc_restore_selfcalib
_stm32h7_adc_restore_selfcalib:         ; @stm32h7_adc_restore_selfcalib
	.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
	mov	x20, x0
	bl	_iio_priv_to_dev
	mov	x19, x0
Lloh0:
	adrp	x8, _STM32H7_CALFACT_S_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STM32H7_CALFACT_S_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldp	w9, w10, [x20]
	lsl	w8, w9, w8
Lloh3:
	adrp	x9, _STM32H7_CALFACT_D_SHIFT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _STM32H7_CALFACT_D_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	lsl	w9, w10, w9
	orr	w2, w9, w8
Lloh6:
	adrp	x8, _STM32H7_ADC_CALFACT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _STM32H7_ADC_CALFACT@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_stm32_adc_writel
Lloh9:
	adrp	x8, _STM32H7_LINCALFACT_NUM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _STM32H7_LINCALFACT_NUM@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x8]
	cmp	w10, #1
	b.lt	LBB0_6
; %bb.1:
	str	x19, [sp, #8]                   ; 8-byte Folded Spill
Lloh12:
	adrp	x8, _STM32H7_LINCALRDYW6@GOTPAGE
Lloh13:
	ldr	x8, [x8, _STM32H7_LINCALRDYW6@GOTPAGEOFF]
Lloh14:
	ldr	w21, [x8]
	ldr	x8, [x20, #8]
Lloh15:
	adrp	x9, _STM32H7_LINCALFACT_SHIFT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _STM32H7_LINCALFACT_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	add	x26, x10, #1
Lloh18:
	adrp	x27, _STM32H7_ADC_CALFACT2@GOTPAGE
Lloh19:
	ldr	x27, [x27, _STM32H7_ADC_CALFACT2@GOTPAGEOFF]
Lloh20:
	adrp	x28, _STM32H7_ADC_CR@GOTPAGE
Lloh21:
	ldr	x28, [x28, _STM32H7_ADC_CR@GOTPAGEOFF]
Lloh22:
	adrp	x19, _STM32_ADC_TIMEOUT_US@GOTPAGE
Lloh23:
	ldr	x19, [x19, _STM32_ADC_TIMEOUT_US@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	sub	w25, w26, #2
	ldr	w8, [x8, w25, uxtw #2]
	lsl	w22, w8, w9
	ldr	w1, [x27]
	mov	x0, x20
	mov	x2, x22
	bl	_stm32_adc_writel
	ldr	w1, [x28]
	mov	x0, x20
	mov	x2, x21
	bl	_stm32_adc_set_bits
	ldr	w0, [x28]
	and	w24, w22, w21
	ldr	w4, [x19]
	mov	x1, x22
	mov	x2, x24
	mov	w3, #100
	bl	_stm32_adc_readl_poll_timeout
	cbnz	w0, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x28]
	mov	x0, x20
	mov	x2, x21
	bl	_stm32_adc_clr_bits
	ldr	w0, [x28]
	cmp	w24, #0
	cset	w2, eq
	ldr	w4, [x19]
	mov	x1, x22
	mov	w3, #100
	bl	_stm32_adc_readl_poll_timeout
	cbnz	w0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x27]
	mov	x0, x20
	bl	_stm32_adc_readl
	ldr	x8, [x20, #8]
	ldr	w10, [x8, x25, lsl #2]
Lloh24:
	adrp	x9, _STM32H7_LINCALFACT_SHIFT@GOTPAGE
Lloh25:
	ldr	x9, [x9, _STM32H7_LINCALFACT_SHIFT@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	lsl	w10, w10, w9
	cmp	w0, w10
	b.ne	LBB0_10
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	asr	w21, w21, #1
	sub	x26, x26, #1
	cmp	x26, #2
	b.hs	LBB0_2
LBB0_6:
	mov	w23, #0
	b	LBB0_11
LBB0_7:
	mov	x23, x0
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_9
LBB0_8:
	mov	x23, x0
Lloh29:
	adrp	x1, l_.str.1@PAGE
Lloh30:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_9:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_dev_err
	b	LBB0_11
LBB0_10:
Lloh31:
	adrp	x1, l_.str.2@PAGE
Lloh32:
	add	x1, x1, l_.str.2@PAGEOFF
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_dev_err
Lloh33:
	adrp	x8, _EIO@GOTPAGE
Lloh34:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_11:
	mov	x0, x23
	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 AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_STM32H7_CALFACT_S_SHIFT,4,2    ; @STM32H7_CALFACT_S_SHIFT
	.comm	_STM32H7_CALFACT_D_SHIFT,4,2    ; @STM32H7_CALFACT_D_SHIFT
	.comm	_STM32H7_ADC_CALFACT,4,2        ; @STM32H7_ADC_CALFACT
	.comm	_STM32H7_LINCALRDYW6,4,2        ; @STM32H7_LINCALRDYW6
	.comm	_STM32H7_LINCALFACT_NUM,4,2     ; @STM32H7_LINCALFACT_NUM
	.comm	_STM32H7_LINCALFACT_SHIFT,4,2   ; @STM32H7_LINCALFACT_SHIFT
	.comm	_STM32H7_ADC_CALFACT2,4,2       ; @STM32H7_ADC_CALFACT2
	.comm	_STM32H7_ADC_CR,4,2             ; @STM32H7_ADC_CR
	.comm	_STM32_ADC_TIMEOUT_US,4,2       ; @STM32_ADC_TIMEOUT_US
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to write calfact\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to read calfact\n"

l_.str.2:                               ; @.str.2
	.asciz	"calfact not consistent\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_stm32h7_adc_restore_selfcalib
.subsections_via_symbols
