	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ab8500_fg_calculate_scaled_capacity
_ab8500_fg_calculate_scaled_capacity:   ## @ab8500_fg_calculate_scaled_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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	8(%rdi), %r14d
	cmpl	$0, 16(%rdi)
	je	LBB0_13
## %bb.1:
	movq	%rdi, %rbx
	cmpq	$0, 40(%rdi)
	je	LBB0_3
## %bb.2:
	movq	24(%rbx), %rax
	movl	$100, (%rax)
	movq	56(%rbx), %rax
	movq	(%rax), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_max
	movq	24(%rbx), %rcx
	movl	%eax, 4(%rcx)
	movl	(%rbx), %edi
	movl	(%rcx), %edx
	leaq	L_.str(%rip), %rsi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_3:
	movq	24(%rbx), %rax
	movl	(%rax), %edi
	movl	4(%rax), %esi
	cmpl	%esi, %edi
	je	LBB0_6
## %bb.4:
	testl	%esi, %esi
	jle	LBB0_6
## %bb.5:
	imull	8(%rbx), %edi
	callq	_DIV_ROUND_CLOSEST
	movl	$100, %edi
	movl	%eax, %esi
	callq	_min
	movl	%eax, %r14d
LBB0_6:
	cmpq	$0, 48(%rbx)
	je	LBB0_13
## %bb.7:
	movl	32(%rbx), %edx
	cmpl	%edx, %r14d
	jge	LBB0_9
## %bb.8:
	movl	%r14d, 32(%rbx)
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_13
LBB0_9:
	cmpq	$0, 40(%rbx)
	jne	LBB0_13
## %bb.10:
	movl	(%rbx), %edi
	cmpl	%edx, 8(%rbx)
	jge	LBB0_11
## %bb.12:
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	32(%rbx), %r14d
	jmp	LBB0_13
LBB0_11:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$0, 16(%rbx)
	movl	8(%rbx), %r14d
LBB0_13:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Scale cap with %d/%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Cap to stop scale lowered %d%%\n"

L_.str.2:                               ## @.str.2
	.asciz	"Disabling scaled capacity\n"

L_.str.3:                               ## @.str.3
	.asciz	"Waiting in cap to level %d%%\n"

	.no_dead_strip	_ab8500_fg_calculate_scaled_capacity
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ab8500_fg_calculate_scaled_capacity
_ab8500_fg_calculate_scaled_capacity:   ; @ab8500_fg_calculate_scaled_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
	ldr	w20, [x0, #8]
	ldr	w8, [x0, #16]
	cbz	w8, LBB0_12
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0, #40]
	cbz	x8, LBB0_3
; %bb.2:
	ldr	x8, [x19, #24]
	mov	w9, #100
	str	w9, [x8]
	ldr	x8, [x19, #56]
	ldr	x8, [x8]
	ldr	w1, [x8]
	mov	x0, x20
	bl	_max
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x9, [x19, #24]
	str	w0, [x9, #4]
	ldr	w8, [x19]
	ldr	w9, [x9]
	stp	x9, x0, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	bl	_dev_dbg
LBB0_3:
	ldr	x9, [x19, #24]
	ldp	w8, w1, [x9]
	cmp	w8, w1
	ccmp	w1, #1, #8, ne
	b.lt	LBB0_5
; %bb.4:
	ldr	w9, [x19, #8]
	mul	w0, w9, w8
	bl	_DIV_ROUND_CLOSEST
	mov	x1, x0
	mov	w0, #100
	bl	_min
	mov	x20, x0
LBB0_5:
	ldr	x8, [x19, #48]
	cbz	x8, LBB0_12
; %bb.6:
	ldr	w8, [x19, #32]
	cmp	w20, w8
	b.ge	LBB0_8
; %bb.7:
	str	w20, [x19, #32]
	ldr	w0, [x19]
	str	x20, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	b	LBB0_12
LBB0_8:
	ldr	x9, [x19, #40]
	cbnz	x9, LBB0_12
; %bb.9:
	ldr	w9, [x19, #8]
	ldr	w0, [x19]
	cmp	w9, w8
	b.ge	LBB0_11
; %bb.10:
	str	x8, [sp]
Lloh4:
	adrp	x1, l_.str.3@PAGE
Lloh5:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
	ldr	w20, [x19, #32]
	b	LBB0_12
LBB0_11:
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	str	wzr, [x19, #16]
	ldr	w20, [x19, #8]
LBB0_12:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Scale cap with %d/%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Cap to stop scale lowered %d%%\n"

l_.str.2:                               ; @.str.2
	.asciz	"Disabling scaled capacity\n"

l_.str.3:                               ; @.str.3
	.asciz	"Waiting in cap to level %d%%\n"

	.no_dead_strip	_ab8500_fg_calculate_scaled_capacity
.subsections_via_symbols
