	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function palmas_gpadc_calibrate
_palmas_gpadc_calibrate:                ## @palmas_gpadc_calibrate
	.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, %r15
	movq	(%rdi), %rax
	movslq	%esi, %rcx
	leaq	(%rcx,%rcx,8), %rbx
	movl	(%rax,%rbx,4), %ecx
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	movl	4(%rax,%rbx,4), %r13d
	movl	8(%rax,%rbx,4), %ecx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movl	12(%rax,%rbx,4), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	12(%rdi), %edi
	movq	_PALMAS_TRIM_GPADC_BASE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movl	32(%rax,%rbx,4), %edx
	leaq	-44(%rbp), %rcx
	callq	_palmas_read
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	12(%r15), %edi
	movl	(%r12), %esi
	movq	(%r15), %rax
	movl	28(%rax,%rbx,4), %edx
	leaq	-60(%rbp), %rcx
	callq	_palmas_read
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	-60(%rbp), %eax
	subl	-44(%rbp), %eax
	imull	$1000, %eax, %eax               ## imm = 0x3E8
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	subl	%edi, %r13d
	cltd
	idivl	%r13d
	movl	%eax, %ecx
	leal	1000(%rcx), %esi
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	subl	-52(%rbp), %eax                 ## 4-byte Folded Reload
	imull	$1000, %eax, %eax               ## imm = 0x3E8
	cltd
	idivl	%r13d
	movq	(%r15), %rdx
	movl	%esi, 16(%rdx,%rbx,4)
	movl	%eax, 20(%rdx,%rbx,4)
	imull	$1000, -44(%rbp), %eax          ## imm = 0x3E8
	imull	%edi, %ecx
	subl	%ecx, %eax
	movl	%eax, 24(%rdx,%rbx,4)
	jmp	LBB0_5
LBB0_1:
	movl	%eax, %r14d
LBB0_3:
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
LBB0_5:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PALMAS_TRIM_GPADC_BASE,4,2     ## @PALMAS_TRIM_GPADC_BASE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"TRIM read failed: %d\n"

	.no_dead_strip	_palmas_gpadc_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function palmas_gpadc_calibrate
_palmas_gpadc_calibrate:                ; @palmas_gpadc_calibrate
	.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	x21, x1
	mov	x19, x0
	ldr	x8, [x0]
	mov	w9, #36
	smaddl	x8, w1, w9, x8
	ldp	w22, w25, [x8]
	ldp	w23, w24, [x8, #8]
	ldr	w0, [x0, #12]
Lloh0:
	adrp	x26, _PALMAS_TRIM_GPADC_BASE@GOTPAGE
Lloh1:
	ldr	x26, [x26, _PALMAS_TRIM_GPADC_BASE@GOTPAGEOFF]
	ldr	w1, [x26]
	ldr	w2, [x8, #32]
	add	x3, sp, #12
	bl	_palmas_read
	tbnz	w0, #31, LBB0_3
; %bb.1:
	sxtw	x21, w21
	ldr	w0, [x19, #12]
	ldr	w1, [x26]
	ldr	x8, [x19]
	mov	w9, #36
	madd	x8, x21, x9, x8
	ldr	w2, [x8, #28]
	add	x3, sp, #8
	bl	_palmas_read
	mov	x20, x0
	tbnz	w0, #31, LBB0_4
; %bb.2:
	ldp	w8, w9, [sp, #8]
	sub	w8, w8, w9
	mov	w9, #1000
	mul	w8, w8, w9
	sub	w10, w25, w22
	sdiv	w8, w8, w10
	add	w11, w8, #1000
	sub	w12, w24, w23
	mul	w12, w12, w9
	sdiv	w10, w12, w10
	ldr	x12, [x19]
	mov	w13, #36
	madd	x12, x21, x13, x12
	stp	w11, w10, [x12, #16]
	ldr	w10, [sp, #12]
	mul	w9, w10, w9
	msub	w8, w8, w22, w9
	str	w8, [x12, #24]
	b	LBB0_5
LBB0_3:
	mov	x20, x0
LBB0_4:
	ldr	w0, [x19, #8]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
LBB0_5:
	mov	x0, x20
	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	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_PALMAS_TRIM_GPADC_BASE,4,2     ; @PALMAS_TRIM_GPADC_BASE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"TRIM read failed: %d\n"

	.no_dead_strip	_palmas_gpadc_calibrate
.subsections_via_symbols
