	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function da9052_bat_read_capacity
_da9052_bat_read_capacity:              ## @da9052_bat_read_capacity
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	leaq	-20(%rbp), %rsi
	callq	_da9052_bat_read_volt
	testl	%eax, %eax
	js	LBB0_14
## %bb.1:
	movl	(%rbx), %edi
	callq	_da9052_adc_read_temp
	testl	%eax, %eax
	js	LBB0_14
## %bb.2:
	movl	%eax, %edi
	callq	_da9052_determine_vc_tbl_index
	movl	-20(%rbp), %r8d
	movq	_vc_tbl@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cltq
	movq	(%rcx,%rax,8), %rax
	movq	(%rax), %rcx
	movl	(%rcx), %esi
	cmpl	%esi, %r8d
	jge	LBB0_3
## %bb.4:
	movq	_DA9052_VC_TBL_SZ@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %rdx
	movq	-8(%rax,%rdx,8), %rdi
	cmpl	(%rdi), %r8d
	jle	LBB0_15
## %bb.5:
	cmpl	$2, %edx
	jl	LBB0_11
## %bb.6:
	decq	%rdx
	movl	%edx, %r9d
	movl	$1, %ebx
	cmpl	%esi, %r8d
	jg	LBB0_9
	.p2align	4, 0x90
LBB0_8:
	movq	(%rax,%rbx,8), %rdx
	movl	(%rdx), %edi
	cmpl	%edi, %r8d
	jge	LBB0_12
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rbx, %r9
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movq	(%rax,%rbx,8), %rcx
	movl	(%rcx), %esi
	incq	%rbx
	cmpl	%esi, %r8d
	jle	LBB0_8
	jmp	LBB0_9
LBB0_3:
	movl	$100, (%r14)
	jmp	LBB0_13
LBB0_15:
	movl	$0, (%r14)
LBB0_13:
	xorl	%eax, %eax
	jmp	LBB0_14
LBB0_11:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_14:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_12:
	movl	4(%rcx), %ecx
	movl	4(%rdx), %edx
	callq	_da9052_bat_interpolate
	movl	%eax, (%r14)
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_vc_tbl,8,3                     ## @vc_tbl
	.comm	_DA9052_VC_TBL_SZ,4,2           ## @DA9052_VC_TBL_SZ
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_da9052_bat_read_capacity
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function da9052_bat_read_capacity
_da9052_bat_read_capacity:              ; @da9052_bat_read_capacity
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x1
	mov	x20, x0
	add	x1, sp, #12
	bl	_da9052_bat_read_volt
	tbnz	w0, #31, LBB0_14
; %bb.1:
	ldr	w0, [x20]
	bl	_da9052_adc_read_temp
	tbnz	w0, #31, LBB0_14
; %bb.2:
	bl	_da9052_determine_vc_tbl_index
	ldr	w4, [sp, #12]
Lloh0:
	adrp	x8, _vc_tbl@GOTPAGE
Lloh1:
	ldr	x8, [x8, _vc_tbl@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x9, [x8, w0, sxtw #3]
	ldr	x8, [x9]
	ldr	w1, [x8]
	cmp	w4, w1
	b.ge	LBB0_10
; %bb.3:
Lloh3:
	adrp	x10, _DA9052_VC_TBL_SZ@GOTPAGE
Lloh4:
	ldr	x10, [x10, _DA9052_VC_TBL_SZ@GOTPAGEOFF]
Lloh5:
	ldr	w11, [x10]
	sub	w10, w11, #1
	ldr	x12, [x9, w10, sxtw #3]
	ldr	w12, [x12]
	cmp	w4, w12
	b.le	LBB0_12
; %bb.4:
	cmp	w11, #2
	b.lt	LBB0_13
; %bb.5:
	add	x9, x9, #8
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	x10, x10, #1
	cmp	w4, w1
	b.gt	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x11, [x9]
	ldr	w0, [x11]
	cmp	w4, w0
	b.ge	LBB0_15
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	cbz	x10, LBB0_13
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x9], #8
	ldr	w1, [x8]
	b	LBB0_6
LBB0_10:
	mov	w0, #0
	mov	w8, #100
LBB0_11:
	str	w8, [x19]
	b	LBB0_14
LBB0_12:
	mov	w0, #0
	str	wzr, [x19]
	b	LBB0_14
LBB0_13:
Lloh6:
	adrp	x8, _EIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_14:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_15:
	ldr	w3, [x8, #4]
	ldr	w2, [x11, #4]
	bl	_da9052_bat_interpolate
	mov	x8, x0
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_vc_tbl,8,3                     ; @vc_tbl
	.comm	_DA9052_VC_TBL_SZ,4,2           ; @DA9052_VC_TBL_SZ
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_da9052_bat_read_capacity
.subsections_via_symbols
