	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sc27xx_fgu_get_capacity
_sc27xx_fgu_get_capacity:               ## @sc27xx_fgu_get_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, %r15
	movq	%rdi, %rbx
	leaq	-28(%rbp), %rsi
	callq	_sc27xx_fgu_get_clbcnt
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	movl	-28(%rbp), %eax
	subl	(%rbx), %eax
	addl	%eax, %eax
	leal	(%rax,%rax,4), %edi
	movq	_SC27XX_FGU_SAMPLE_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$2, %eax
	leal	(%rax,%rax,8), %esi
	callq	_DIV_ROUND_CLOSEST
	cltq
	imulq	$274877907, %rax, %rsi          ## imm = 0x10624DD3
	movq	%rsi, %rax
	shrq	$63, %rax
	sarq	$38, %rsi
	addl	%eax, %esi
	movq	%rbx, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_sc27xx_fgu_adc_to_current
	imull	$100, %eax, %edi
	movl	4(%rbx), %esi
	callq	_DIV_ROUND_CLOSEST
	addl	8(%rbx), %eax
	movl	%eax, (%r15)
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_sc27xx_fgu_capacity_calibration
LBB0_2:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SC27XX_FGU_SAMPLE_HZ,4,2       ## @SC27XX_FGU_SAMPLE_HZ
	.no_dead_strip	_sc27xx_fgu_get_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_capacity
_sc27xx_fgu_get_capacity:               ; @sc27xx_fgu_get_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	x21, x1
	mov	x19, x0
	add	x1, sp, #12
	bl	_sc27xx_fgu_get_clbcnt
	mov	x20, x0
	cbnz	w0, LBB0_2
; %bb.1:
	ldr	w8, [sp, #12]
	ldr	w9, [x19]
	sub	w8, w8, w9
	add	w8, w8, w8, lsl #2
	lsl	w0, w8, #1
Lloh0:
	adrp	x8, _SC27XX_FGU_SAMPLE_HZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SC27XX_FGU_SAMPLE_HZ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	add	w8, w8, w8, lsl #3
	lsl	w1, w8, #2
	bl	_DIV_ROUND_CLOSEST
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w0, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w1, w8, w9
	mov	x0, x19
	bl	_sc27xx_fgu_adc_to_current
	mov	w8, #100
	mul	w0, w0, w8
	ldr	w1, [x19, #4]
	bl	_DIV_ROUND_CLOSEST
	ldr	w8, [x19, #8]
	add	w1, w8, w0
	str	w1, [x21]
	mov	x0, x19
	mov	w2, #0
	bl	_sc27xx_fgu_capacity_calibration
LBB0_2:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_SC27XX_FGU_SAMPLE_HZ,4,2       ; @SC27XX_FGU_SAMPLE_HZ
	.no_dead_strip	_sc27xx_fgu_get_capacity
.subsections_via_symbols
