	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pm8xxx_calibrate_device
_pm8xxx_calibrate_device:               ## @pm8xxx_calibrate_device
	.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, %rbx
	movq	_VADC_ABSOLUTE_RANGE_UV@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movq	(%rdi), %rcx
	movq	_VADC_CALIB_ABSOLUTE@GOTPCREL(%rip), %r13
	movq	(%r13), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, 16(%rcx,%rdx,8)
	movq	_VADC_RATIOMETRIC_RANGE@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	_VADC_CALIB_RATIOMETRIC@GOTPCREL(%rip), %r12
	movq	(%r12), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, 16(%rcx,%rdx,8)
	movq	_PM8XXX_CHANNEL_125V@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_pm8xxx_get_channel
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	leaq	-72(%rbp), %rdx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_pm8xxx_read_channel
	testl	%eax, %eax
	je	LBB0_6
## %bb.2:
	movl	8(%rbx), %edi
	leaq	L_.str(%rip), %rsi
LBB0_3:
	callq	_dev_err
LBB0_4:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_5:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_PM8XXX_CHANNEL_INTERNAL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_pm8xxx_get_channel
	testq	%rax, %rax
	je	LBB0_4
## %bb.7:
	leaq	-56(%rbp), %rdx
	movq	%rbx, %rdi
	movq	%rax, %rsi
	callq	_pm8xxx_read_channel
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	8(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_3
LBB0_9:
	movq	-72(%rbp), %rax
	subq	-56(%rbp), %rax
	jne	LBB0_11
## %bb.10:
	movl	8(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_3
LBB0_11:
	movq	(%rbx), %rcx
	movq	(%r13), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, (%rcx,%rdx,8)
	movq	-56(%rbp), %rax
	movq	(%r13), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, 8(%rcx,%rdx,8)
	movl	8(%rbx), %edi
	movq	(%r14), %rdx
	movq	(%r13), %rax
	leaq	(%rax,%rax,2), %rax
	movq	(%rcx,%rax,8), %rcx
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_info
	movq	_PM8XXX_CHANNEL_MUXOFF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_pm8xxx_get_channel
	testq	%rax, %rax
	je	LBB0_4
## %bb.12:
	movq	%rax, %r14
	movq	_AMUX_RSV5@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-64(%rbp), %rcx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$1, %r8d
	callq	_pm8xxx_read_channel_rsv
	testl	%eax, %eax
	jne	LBB0_14
## %bb.13:
	movq	_AMUX_RSV4@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-48(%rbp), %rcx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$1, %r8d
	callq	_pm8xxx_read_channel_rsv
	testl	%eax, %eax
	je	LBB0_15
LBB0_14:
	movl	8(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_3
LBB0_15:
	movq	-64(%rbp), %rax
	subq	-48(%rbp), %rax
	movq	(%rbx), %rcx
	movq	(%r12), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, (%rcx,%rdx,8)
	movq	-48(%rbp), %rax
	movq	(%r12), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movq	%rax, 8(%rcx,%rdx,8)
	movl	8(%rbx), %edi
	movq	(%r15), %rdx
	movq	(%r12), %rax
	leaq	(%rax,%rax,2), %rax
	movq	(%rcx,%rax,8), %rcx
	leaq	L_.str.5(%rip), %rsi
	callq	_dev_info
	xorl	%eax, %eax
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_VADC_ABSOLUTE_RANGE_UV,8,3     ## @VADC_ABSOLUTE_RANGE_UV
	.comm	_VADC_CALIB_ABSOLUTE,8,3        ## @VADC_CALIB_ABSOLUTE
	.comm	_VADC_RATIOMETRIC_RANGE,8,3     ## @VADC_RATIOMETRIC_RANGE
	.comm	_VADC_CALIB_RATIOMETRIC,8,3     ## @VADC_CALIB_RATIOMETRIC
	.comm	_PM8XXX_CHANNEL_125V,4,2        ## @PM8XXX_CHANNEL_125V
	.comm	_ENODEV,4,2                     ## @ENODEV
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not read 1.25V reference channel\n"

	.comm	_PM8XXX_CHANNEL_INTERNAL,4,2    ## @PM8XXX_CHANNEL_INTERNAL
L_.str.1:                               ## @.str.1
	.asciz	"could not read 0.625V reference channel\n"

L_.str.2:                               ## @.str.2
	.asciz	"read same ADC code for 1.25V and 0.625V\n"

L_.str.3:                               ## @.str.3
	.asciz	"absolute calibration dx = %d uV, dy = %d units\n"

	.comm	_PM8XXX_CHANNEL_MUXOFF,4,2      ## @PM8XXX_CHANNEL_MUXOFF
	.comm	_AMUX_RSV5,4,2                  ## @AMUX_RSV5
L_.str.4:                               ## @.str.4
	.asciz	"could not read MUXOFF reference channel\n"

	.comm	_AMUX_RSV4,4,2                  ## @AMUX_RSV4
L_.str.5:                               ## @.str.5
	.asciz	"ratiometric calibration dx = %d, dy = %d units\n"

	.no_dead_strip	_pm8xxx_calibrate_device
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pm8xxx_calibrate_device
_pm8xxx_calibrate_device:               ; @pm8xxx_calibrate_device
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
Lloh0:
	adrp	x20, _VADC_ABSOLUTE_RANGE_UV@GOTPAGE
Lloh1:
	ldr	x20, [x20, _VADC_ABSOLUTE_RANGE_UV@GOTPAGEOFF]
	ldr	x8, [x20]
	ldr	x9, [x0]
Lloh2:
	adrp	x23, _VADC_CALIB_ABSOLUTE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _VADC_CALIB_ABSOLUTE@GOTPAGEOFF]
	ldr	x10, [x23]
	mov	w11, #24
	madd	x10, x10, x11, x9
	str	x8, [x10, #16]
Lloh4:
	adrp	x21, _VADC_RATIOMETRIC_RANGE@GOTPAGE
Lloh5:
	ldr	x21, [x21, _VADC_RATIOMETRIC_RANGE@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh6:
	adrp	x22, _VADC_CALIB_RATIOMETRIC@GOTPAGE
Lloh7:
	ldr	x22, [x22, _VADC_CALIB_RATIOMETRIC@GOTPAGEOFF]
	ldr	x10, [x22]
	madd	x9, x10, x11, x9
	str	x8, [x9, #16]
Lloh8:
	adrp	x8, _PM8XXX_CHANNEL_125V@GOTPAGE
Lloh9:
	ldr	x8, [x8, _PM8XXX_CHANNEL_125V@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_pm8xxx_get_channel
	cbz	x0, LBB0_4
; %bb.1:
	mov	x1, x0
	add	x2, sp, #24
	mov	x0, x19
	bl	_pm8xxx_read_channel
	cbz	w0, LBB0_6
; %bb.2:
	ldr	w0, [x19, #8]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
LBB0_3:
	bl	_dev_err
LBB0_4:
Lloh13:
	adrp	x8, _ENODEV@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
	add	sp, sp, #96
	ret
LBB0_6:
Lloh16:
	adrp	x8, _PM8XXX_CHANNEL_INTERNAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PM8XXX_CHANNEL_INTERNAL@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pm8xxx_get_channel
	cbz	x0, LBB0_4
; %bb.7:
	mov	x1, x0
	add	x2, sp, #16
	mov	x0, x19
	bl	_pm8xxx_read_channel
	cbz	w0, LBB0_9
; %bb.8:
	ldr	w0, [x19, #8]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_3
LBB0_9:
	ldp	x9, x8, [sp, #16]
	subs	x8, x8, x9
	b.ne	LBB0_11
; %bb.10:
	ldr	w0, [x19, #8]
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_11:
	ldr	x9, [x19]
	ldr	x10, [x23]
	mov	w11, #24
	mul	x10, x10, x11
	str	x8, [x9, x10]
	ldr	x8, [sp, #16]
	ldr	x10, [x23]
	madd	x10, x10, x11, x9
	str	x8, [x10, #8]
	ldr	w0, [x19, #8]
	ldr	x2, [x20]
	ldr	x8, [x23]
	mul	x8, x8, x11
	ldr	x3, [x9, x8]
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_info
Lloh25:
	adrp	x8, _PM8XXX_CHANNEL_MUXOFF@GOTPAGE
Lloh26:
	ldr	x8, [x8, _PM8XXX_CHANNEL_MUXOFF@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pm8xxx_get_channel
	cbz	x0, LBB0_4
; %bb.12:
	mov	x20, x0
Lloh28:
	adrp	x8, _AMUX_RSV5@GOTPAGE
Lloh29:
	ldr	x8, [x8, _AMUX_RSV5@GOTPAGEOFF]
Lloh30:
	ldr	w2, [x8]
	add	x3, sp, #8
	mov	x0, x19
	mov	x1, x20
	mov	w4, #1
	bl	_pm8xxx_read_channel_rsv
	cbnz	w0, LBB0_14
; %bb.13:
Lloh31:
	adrp	x8, _AMUX_RSV4@GOTPAGE
Lloh32:
	ldr	x8, [x8, _AMUX_RSV4@GOTPAGEOFF]
Lloh33:
	ldr	w2, [x8]
	mov	x3, sp
	mov	x0, x19
	mov	x1, x20
	mov	w4, #1
	bl	_pm8xxx_read_channel_rsv
	cbz	w0, LBB0_15
LBB0_14:
	ldr	w0, [x19, #8]
Lloh34:
	adrp	x1, l_.str.4@PAGE
Lloh35:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_3
LBB0_15:
	ldp	x9, x8, [sp]
	sub	x8, x8, x9
	ldr	x9, [x19]
	ldr	x10, [x22]
	mov	w11, #24
	mul	x10, x10, x11
	str	x8, [x9, x10]
	ldr	x8, [sp]
	ldr	x10, [x22]
	madd	x10, x10, x11, x9
	str	x8, [x10, #8]
	ldr	w0, [x19, #8]
	ldr	x2, [x21]
	ldr	x8, [x22]
	mul	x8, x8, x11
	ldr	x3, [x9, x8]
Lloh36:
	adrp	x1, l_.str.5@PAGE
Lloh37:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_info
	mov	w0, #0
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_VADC_ABSOLUTE_RANGE_UV,8,3     ; @VADC_ABSOLUTE_RANGE_UV
	.comm	_VADC_CALIB_ABSOLUTE,8,3        ; @VADC_CALIB_ABSOLUTE
	.comm	_VADC_RATIOMETRIC_RANGE,8,3     ; @VADC_RATIOMETRIC_RANGE
	.comm	_VADC_CALIB_RATIOMETRIC,8,3     ; @VADC_CALIB_RATIOMETRIC
	.comm	_PM8XXX_CHANNEL_125V,4,2        ; @PM8XXX_CHANNEL_125V
	.comm	_ENODEV,4,2                     ; @ENODEV
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not read 1.25V reference channel\n"

	.comm	_PM8XXX_CHANNEL_INTERNAL,4,2    ; @PM8XXX_CHANNEL_INTERNAL
l_.str.1:                               ; @.str.1
	.asciz	"could not read 0.625V reference channel\n"

l_.str.2:                               ; @.str.2
	.asciz	"read same ADC code for 1.25V and 0.625V\n"

l_.str.3:                               ; @.str.3
	.asciz	"absolute calibration dx = %d uV, dy = %d units\n"

	.comm	_PM8XXX_CHANNEL_MUXOFF,4,2      ; @PM8XXX_CHANNEL_MUXOFF
	.comm	_AMUX_RSV5,4,2                  ; @AMUX_RSV5
l_.str.4:                               ; @.str.4
	.asciz	"could not read MUXOFF reference channel\n"

	.comm	_AMUX_RSV4,4,2                  ; @AMUX_RSV4
l_.str.5:                               ; @.str.5
	.asciz	"ratiometric calibration dx = %d, dy = %d units\n"

	.no_dead_strip	_pm8xxx_calibrate_device
.subsections_via_symbols
