	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ab8500_fg_check_capacity_limits
_ab8500_fg_check_capacity_limits:       ## @ab8500_fg_check_capacity_limits
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movl	96(%rdi), %edi
	movl	$10, %esi
	callq	_DIV_ROUND_CLOSEST
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_ab8500_fg_capacity_level
	movq	%rax, 48(%rbx)
	movq	56(%rbx), %rdx
	movb	$1, %r12b
	cmpq	%rdx, %rax
	je	LBB0_6
## %bb.1:
	cmpl	$0, 24(%rbx)
	je	LBB0_2
LBB0_4:
	movl	40(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	48(%rbx), %rax
	movq	%rax, 56(%rbx)
LBB0_6:
	cmpq	$0, 32(%rbx)
	je	LBB0_8
LBB0_7:
	movl	40(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$0, 64(%rbx)
	movl	$0, 96(%rbx)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 104(%rbx)
LBB0_25:
	movq	120(%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_27
## %bb.26:
	movq	%rbx, %rdi
	callq	_ab8500_fg_calculate_scaled_capacity
	movl	%eax, 92(%rbx)
	movl	40(%rbx), %edi
	movl	64(%rbx), %edx
	leaq	L_.str.6(%rip), %rsi
	movl	%eax, %ecx
	callq	_dev_info
LBB0_27:
	movl	44(%rbx), %edi
	callq	_power_supply_changed
	cmpq	$0, 16(%rbx)
	je	LBB0_30
## %bb.28:
	cmpl	$0, 8(%rbx)
	je	LBB0_30
## %bb.29:
	movl	40(%rbx), %edi
	leaq	L_.str.7(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	$0, 8(%rbx)
	leaq	L_.str.8(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_sysfs_notify
LBB0_30:
	leaq	L_.str.9(%rip), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sysfs_notify                   ## TAILCALL
LBB0_2:
	testl	%r15d, %r15d
	jne	LBB0_4
## %bb.3:
	cmpq	%rdx, %rax
	jle	LBB0_4
## %bb.5:
	movl	40(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%rax, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg
	cmpq	$0, 32(%rbx)
	jne	LBB0_7
LBB0_8:
	cmpq	$0, 16(%rbx)
	je	LBB0_16
## %bb.9:
	cmpl	$0, 8(%rbx)
	je	LBB0_13
## %bb.10:
	movl	%r14d, 64(%rbx)
	movq	104(%rbx), %rax
	movq	%rax, 112(%rbx)
	cmpl	$0, 72(%rbx)
	jne	LBB0_25
## %bb.11:
	movq	120(%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_25
## %bb.12:
	movl	$1, 72(%rbx)
	movq	80(%rbx), %rax
	movl	$100, (%rax)
	movl	64(%rbx), %ecx
	movl	%ecx, 4(%rax)
	movl	$100, 88(%rbx)
	jmp	LBB0_25
LBB0_16:
	movl	64(%rbx), %edx
	cmpl	%r14d, %edx
	je	LBB0_24
## %bb.17:
	testl	%r14d, %r14d
	je	LBB0_18
## %bb.19:
	cmpl	$0, 24(%rbx)
	je	LBB0_20
LBB0_22:
	movl	40(%rbx), %edi
	movl	96(%rbx), %r8d
	leaq	L_.str.4(%rip), %rsi
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_15
LBB0_13:
	cmpl	%r14d, 64(%rbx)
	jne	LBB0_14
LBB0_24:
	testb	%r12b, %r12b
	je	LBB0_25
LBB0_31:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movl	40(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_15:
	movl	%r14d, 64(%rbx)
	movq	104(%rbx), %rax
	movq	%rax, 112(%rbx)
	jmp	LBB0_25
LBB0_18:
	movl	$1, 64(%rbx)
	jmp	LBB0_25
LBB0_20:
	testl	%r15d, %r15d
	jne	LBB0_22
## %bb.21:
	cmpl	%edx, %r14d
	jle	LBB0_22
## %bb.23:
	movl	40(%rbx), %edi
	movl	96(%rbx), %r8d
	leaq	L_.str.5(%rip), %rsi
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	testb	%r12b, %r12b
	je	LBB0_25
	jmp	LBB0_31
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"level changed from %d to %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"level not allowed to go up since no charger is connected: %d to %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Battery low, set capacity to 0\n"

L_.str.3:                               ## @.str.3
	.asciz	"battery reported full but capacity dropping: %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"capacity changed from %d to %d (%d)\n"

L_.str.5:                               ## @.str.5
	.asciz	"capacity not allowed to go up since no charger is connected: %d to %d (%d)\n"

L_.str.6:                               ## @.str.6
	.asciz	"capacity=%d (%d)\n"

L_.str.7:                               ## @.str.7
	.asciz	"Battery full, notifying.\n"

L_.str.8:                               ## @.str.8
	.asciz	"charge_full"

L_.str.9:                               ## @.str.9
	.asciz	"charge_now"

	.no_dead_strip	_ab8500_fg_check_capacity_limits
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ab8500_fg_check_capacity_limits
_ab8500_fg_check_capacity_limits:       ; @ab8500_fg_check_capacity_limits
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	ldr	w0, [x0, #96]
	mov	w1, #10
	bl	_DIV_ROUND_CLOSEST
	mov	x20, x0
	mov	x0, x19
	bl	_ab8500_fg_capacity_level
	str	x0, [x19, #48]
	ldr	x9, [x19, #56]
	cmp	x0, x9
	b.ne	LBB0_9
LBB0_1:
	mov	w22, #1
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_11
LBB0_2:
	ldr	w0, [x19, #40]
Lloh0:
	adrp	x1, l_.str.2@PAGE
Lloh1:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	str	wzr, [x19, #64]
	str	wzr, [x19, #96]
	stp	xzr, xzr, [x19, #104]
LBB0_3:
	ldr	x8, [x19, #120]
	ldr	x8, [x8]
	cbz	x8, LBB0_5
; %bb.4:
	mov	x0, x19
	bl	_ab8500_fg_calculate_scaled_capacity
	mov	x3, x0
	str	w0, [x19, #92]
	ldr	w0, [x19, #40]
	ldr	w2, [x19, #64]
Lloh2:
	adrp	x1, l_.str.6@PAGE
Lloh3:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_dev_info
LBB0_5:
	ldr	w0, [x19, #44]
	bl	_power_supply_changed
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_8
; %bb.6:
	ldr	w8, [x19, #8]
	cbz	w8, LBB0_8
; %bb.7:
	ldr	w0, [x19, #40]
Lloh4:
	adrp	x1, l_.str.7@PAGE
Lloh5:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_dev_dbg
	str	wzr, [x19, #8]
Lloh6:
	adrp	x2, l_.str.8@PAGE
Lloh7:
	add	x2, x2, l_.str.8@PAGEOFF
	mov	x0, x19
	mov	x1, #0
	bl	_sysfs_notify
LBB0_8:
Lloh8:
	adrp	x2, l_.str.9@PAGE
Lloh9:
	add	x2, x2, l_.str.9@PAGEOFF
	mov	x0, x19
	mov	x1, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_sysfs_notify
LBB0_9:
	ldr	w8, [x19, #24]
	cmp	w8, #0
	ccmp	w21, #0, #0, eq
	ccmp	x0, x9, #4, eq
	b.gt	LBB0_20
; %bb.10:
	ldr	w8, [x19, #40]
	stp	x9, x0, [sp]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	bl	_dev_dbg
	mov	w22, #0
	ldr	x8, [x19, #48]
	str	x8, [x19, #56]
	ldr	x8, [x19, #32]
	cbnz	x8, LBB0_2
LBB0_11:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_16
; %bb.12:
	ldr	w8, [x19, #8]
	cbz	w8, LBB0_21
; %bb.13:
	str	w20, [x19, #64]
	ldr	x8, [x19, #104]
	str	x8, [x19, #112]
	ldr	w8, [x19, #72]
	cbnz	w8, LBB0_3
; %bb.14:
	ldr	x8, [x19, #120]
	ldr	x8, [x8]
	cbz	x8, LBB0_3
; %bb.15:
	mov	w8, #1
	str	w8, [x19, #72]
	ldr	x8, [x19, #80]
	mov	w9, #100
	str	w9, [x8]
	ldr	w10, [x19, #64]
	str	w10, [x8, #4]
	str	w9, [x19, #88]
	b	LBB0_3
LBB0_16:
	ldr	w8, [x19, #64]
	cmp	w8, w20
	b.eq	LBB0_22
; %bb.17:
	cbz	w20, LBB0_26
; %bb.18:
	ldr	w9, [x19, #24]
	cbz	w9, LBB0_27
LBB0_19:
	ldr	w0, [x19, #40]
	ldr	w9, [x19, #96]
	stp	x20, x9, [sp, #8]
	str	x8, [sp]
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_25
LBB0_20:
	ldr	w8, [x19, #40]
	stp	x9, x0, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x8
	bl	_dev_dbg
	b	LBB0_1
LBB0_21:
	ldr	w8, [x19, #64]
	cmp	w8, w20
	b.ne	LBB0_24
LBB0_22:
	tbz	w22, #0, LBB0_3
LBB0_23:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_24:
	ldr	w0, [x19, #40]
	mov	x8, x20
	str	x8, [sp]
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_25:
	bl	_dev_dbg
	str	w20, [x19, #64]
	ldr	x8, [x19, #104]
	str	x8, [x19, #112]
	b	LBB0_3
LBB0_26:
	mov	w8, #1
	str	w8, [x19, #64]
	b	LBB0_3
LBB0_27:
	cbnz	w21, LBB0_19
; %bb.28:
	cmp	w20, w8
	b.le	LBB0_19
; %bb.29:
	ldr	w0, [x19, #40]
	ldr	w9, [x19, #96]
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	stp	x20, x9, [sp, #8]
	str	x8, [sp]
Lloh18:
	adrp	x1, l_.str.5@PAGE
Lloh19:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_dbg
	tbz	w22, #0, LBB0_3
	b	LBB0_23
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"level changed from %d to %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"level not allowed to go up since no charger is connected: %d to %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Battery low, set capacity to 0\n"

l_.str.3:                               ; @.str.3
	.asciz	"battery reported full but capacity dropping: %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"capacity changed from %d to %d (%d)\n"

l_.str.5:                               ; @.str.5
	.asciz	"capacity not allowed to go up since no charger is connected: %d to %d (%d)\n"

l_.str.6:                               ; @.str.6
	.asciz	"capacity=%d (%d)\n"

l_.str.7:                               ; @.str.7
	.asciz	"Battery full, notifying.\n"

l_.str.8:                               ; @.str.8
	.asciz	"charge_full"

l_.str.9:                               ; @.str.9
	.asciz	"charge_now"

	.no_dead_strip	_ab8500_fg_check_capacity_limits
.subsections_via_symbols
