	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function twl4030_madc_bat_voltscale
_twl4030_madc_bat_voltscale:            ## @twl4030_madc_bat_voltscale
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	callq	_twl4030_madc_bat_get_charging_status
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movq	(%r14), %rax
	movq	(%rax,%rcx,8), %rdx
	cmpl	%ebx, (%rdx)
	jge	LBB0_1
## %bb.7:
	movl	4(%rdx), %r8d
	jmp	LBB0_6
LBB0_1:
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%rdx,%rax,8), %esi
	testl	%esi, %esi
	js	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rdx,%rax,8), %ecx
	incq	%rax
	movl	%ecx, %edi
	subl	%ebx, %edi
	jl	LBB0_2
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%ebx, %esi
	jg	LBB0_2
## %bb.5:
	movl	%eax, %ebx
	decl	%eax
	movl	4(%rdx,%rax,8), %r8d
	movl	%r8d, %eax
	subl	4(%rdx,%rbx,8), %eax
	imull	%edi, %eax
	subl	%esi, %ecx
	cltd
	idivl	%ecx
	subl	%eax, %r8d
LBB0_6:
	movl	%r8d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_twl4030_madc_bat_voltscale
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function twl4030_madc_bat_voltscale
_twl4030_madc_bat_voltscale:            ; @twl4030_madc_bat_voltscale
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.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
	bl	_twl4030_madc_bat_get_charging_status
	cmp	x0, #0
	cset	w8, ne
	ldr	x9, [x20]
	ldr	x8, [x9, w8, uxtw #3]
	ldr	w9, [x8]
	cmp	w9, w19
	b.ge	LBB0_2
; %bb.1:
	ldr	w0, [x8, #4]
	b	LBB0_7
LBB0_2:
	add	x10, x8, #8
	mov	x9, #-1
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10]
	tbnz	w11, #31, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldur	w12, [x10, #-8]
	add	x9, x9, #1
	add	x10, x10, #8
	subs	w13, w12, w19
	ccmp	w11, w19, #0, ge
	b.gt	LBB0_3
; %bb.5:
	add	w10, w9, #1
	add	x9, x8, w9, uxtw #3
	ldr	w9, [x9, #4]
	add	x8, x8, w10, uxtw #3
	ldr	w8, [x8, #4]
	sub	w8, w9, w8
	mul	w8, w8, w13
	sub	w10, w12, w11
	sdiv	w8, w8, w10
	sub	w0, w9, w8
	b	LBB0_7
LBB0_6:
	mov	w0, #0
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_twl4030_madc_bat_voltscale
.subsections_via_symbols
