	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sc27xx_fgu_get_boot_capacity
_sc27xx_fgu_get_boot_capacity:          ## @sc27xx_fgu_get_boot_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_sc27xx_fgu_is_first_poweron
	testl	%eax, %eax
	je	LBB0_1
## %bb.3:
	movl	24(%rbx), %edi
	movq	_SC27XX_FGU_CLBCNT_QMAXL@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%rbx), %rsi
	leaq	-28(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_7
## %bb.4:
	movl	-28(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -28(%rbp)
	movslq	%eax, %rsi
	movq	_SC27XX_FGU_CUR_BASIC_ADC@GOTPCREL(%rip), %rax
	subq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_sc27xx_fgu_adc_to_current
	movl	%eax, %r15d
	movl	24(%rbx), %edi
	movq	_SC27XX_FGU_POCV@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%rbx), %rsi
	leaq	-32(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	jne	LBB0_7
## %bb.5:
	movl	-32(%rbp), %esi
	movq	%rbx, %rdi
	callq	_sc27xx_fgu_adc_to_voltage
	movl	%eax, -32(%rbp)
	imull	(%rbx), %r15d
	imull	$1000, %eax, %edx               ## imm = 0x3E8
	subl	%r15d, %edx
	movl	4(%rbx), %esi
	movl	8(%rbx), %edi
	callq	_power_supply_ocv2cap_simple
	movl	%eax, (%r14)
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_sc27xx_fgu_save_last_cap
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	movq	_SC27XX_FGU_NORMAIL_POWERTON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_sc27xx_fgu_save_boot_mode
	jmp	LBB0_7
LBB0_1:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_sc27xx_fgu_read_last_cap
	testl	%eax, %eax
	je	LBB0_2
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	_SC27XX_FGU_NORMAIL_POWERTON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sc27xx_fgu_save_boot_mode      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SC27XX_FGU_NORMAIL_POWERTON,4,2 ## @SC27XX_FGU_NORMAIL_POWERTON
	.comm	_SC27XX_FGU_CLBCNT_QMAXL,8,3    ## @SC27XX_FGU_CLBCNT_QMAXL
	.comm	_SC27XX_FGU_CUR_BASIC_ADC,8,3   ## @SC27XX_FGU_CUR_BASIC_ADC
	.comm	_SC27XX_FGU_POCV,8,3            ## @SC27XX_FGU_POCV
	.no_dead_strip	_sc27xx_fgu_get_boot_capacity
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sc27xx_fgu_get_boot_capacity
_sc27xx_fgu_get_boot_capacity:          ; @sc27xx_fgu_get_boot_capacity
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x1
	mov	x19, x0
	bl	_sc27xx_fgu_is_first_poweron
	cbz	w0, LBB0_5
; %bb.1:
	ldr	w0, [x19, #24]
	ldr	x8, [x19, #16]
Lloh0:
	adrp	x9, _SC27XX_FGU_CLBCNT_QMAXL@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SC27XX_FGU_CLBCNT_QMAXL@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	add	x2, sp, #8
	bl	_regmap_read
	cbnz	w0, LBB0_6
; %bb.2:
	ldr	w8, [sp, #8]
	lsl	w8, w8, #1
	str	w8, [sp, #8]
	sxtw	x8, w8
Lloh3:
	adrp	x9, _SC27XX_FGU_CUR_BASIC_ADC@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SC27XX_FGU_CUR_BASIC_ADC@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	sub	x1, x8, x9
	mov	x0, x19
	bl	_sc27xx_fgu_adc_to_current
	mov	x21, x0
	ldr	w0, [x19, #24]
	ldr	x8, [x19, #16]
Lloh6:
	adrp	x9, _SC27XX_FGU_POCV@GOTPAGE
Lloh7:
	ldr	x9, [x9, _SC27XX_FGU_POCV@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	add	x2, sp, #12
	bl	_regmap_read
	cbnz	w0, LBB0_6
; %bb.3:
	ldr	w1, [sp, #12]
	mov	x0, x19
	bl	_sc27xx_fgu_adc_to_voltage
	str	w0, [sp, #12]
	mov	w8, #1000
	mul	w8, w0, w8
	ldp	w9, w1, [x19]
	msub	w2, w9, w21, w8
	ldr	w0, [x19, #8]
	bl	_power_supply_ocv2cap_simple
	mov	x1, x0
	str	w0, [x20]
	mov	x0, x19
	bl	_sc27xx_fgu_save_last_cap
	cbnz	w0, LBB0_6
; %bb.4:
Lloh9:
	adrp	x8, _SC27XX_FGU_NORMAIL_POWERTON@GOTPAGE
Lloh10:
	ldr	x8, [x8, _SC27XX_FGU_NORMAIL_POWERTON@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_sc27xx_fgu_save_boot_mode
	b	LBB0_6
LBB0_5:
	mov	x0, x19
	mov	x1, x20
	bl	_sc27xx_fgu_read_last_cap
	cbz	w0, LBB0_7
LBB0_6:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_7:
Lloh12:
	adrp	x8, _SC27XX_FGU_NORMAIL_POWERTON@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SC27XX_FGU_NORMAIL_POWERTON@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_sc27xx_fgu_save_boot_mode
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_SC27XX_FGU_NORMAIL_POWERTON,4,2 ; @SC27XX_FGU_NORMAIL_POWERTON
	.comm	_SC27XX_FGU_CLBCNT_QMAXL,8,3    ; @SC27XX_FGU_CLBCNT_QMAXL
	.comm	_SC27XX_FGU_CUR_BASIC_ADC,8,3   ; @SC27XX_FGU_CUR_BASIC_ADC
	.comm	_SC27XX_FGU_POCV,8,3            ; @SC27XX_FGU_POCV
	.no_dead_strip	_sc27xx_fgu_get_boot_capacity
.subsections_via_symbols
