	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function check_sysfs_capacity
_check_sysfs_capacity:                  ## @check_sysfs_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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r13
	movl	4(%rdi), %r15d
	movl	%r15d, %esi
	callq	_ab8500_fg_convert_mah_to_permille
	movl	%eax, %r12d
	movl	(%r13), %edi
	movl	8(%r13), %eax
	movq	16(%r13), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx), %ecx
	addl	%ecx, %ecx
	leal	(%rcx,%rcx,4), %ecx
	movl	%eax, %r14d
	subl	%ecx, %r14d
	addl	%eax, %ecx
	xorl	%eax, %eax
	testl	%r14d, %r14d
	cmovlel	%eax, %r14d
	cmpl	$1000, %ecx                     ## imm = 0x3E8
	movl	$1000, %ebx                     ## imm = 0x3E8
	cmovll	%ecx, %ebx
	movl	12(%r13), %eax
	movl	%eax, (%rsp)
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	movl	%r12d, %ecx
	movl	%ebx, %r8d
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movl	%r15d, %r9d
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	(%r13), %edi
	cmpl	%r14d, %r12d
	jle	LBB0_3
## %bb.1:
	cmpl	%ebx, %r12d
	jge	LBB0_3
## %bb.2:
	leaq	L_.str.1(%rip), %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%r13, %rdi
	callq	_force_capacity
	movl	$1, %eax
	jmp	LBB0_4
LBB0_3:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	xorl	%eax, %eax
LBB0_4:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Capacity limits: (Lower: %d User: %d Upper: %d) [user: %d, was: %d]\n"

L_.str.1:                               ## @.str.1
	.asciz	"OK! Using users cap %d uAh now\n"

L_.str.2:                               ## @.str.2
	.asciz	"Capacity from user out of limits, ignoring"

	.no_dead_strip	_check_sysfs_capacity
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function check_sysfs_capacity
_check_sysfs_capacity:                  ; @check_sysfs_capacity
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	ldr	w20, [x0, #4]
	mov	x1, x20
	bl	_ab8500_fg_convert_mah_to_permille
	mov	x21, x0
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	ldr	w8, [x8]
	add	w8, w8, w8, lsl #2
	lsl	w8, w8, #1
	ldp	w9, w10, [x19, #8]
	sub	w11, w9, w8
	add	w8, w8, w9
	cmp	w11, #0
	csel	w22, w11, wzr, gt
	mov	w9, #1000
	cmp	w8, #1000
	csel	w23, w8, w9, lt
	ldr	w0, [x19]
	stp	x20, x10, [sp, #24]
	stp	x21, x23, [sp, #8]
	str	x22, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w0, [x19]
	cmp	w21, w22
	ccmp	w21, w23, #0, gt
	b.lt	LBB0_2
; %bb.1:
Lloh2:
	adrp	x1, l_.str.2@PAGE
Lloh3:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	mov	w0, #0
	b	LBB0_3
LBB0_2:
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	str	x20, [sp]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	mov	x0, x19
	bl	_force_capacity
	mov	w0, #1
LBB0_3:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Capacity limits: (Lower: %d User: %d Upper: %d) [user: %d, was: %d]\n"

l_.str.1:                               ; @.str.1
	.asciz	"OK! Using users cap %d uAh now\n"

l_.str.2:                               ; @.str.2
	.asciz	"Capacity from user out of limits, ignoring"

	.no_dead_strip	_check_sysfs_capacity
.subsections_via_symbols
