	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function act8945a_get_capacity_level
_act8945a_get_capacity_level:           ## @act8945a_get_capacity_level
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movl	(%rdi), %edi
	callq	_gpiod_get_value
	movl	%eax, %r15d
	movq	_ACT8945A_APCH_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_18
## %bb.1:
	movq	_ACT8945A_APCH_CFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-32(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_18
## %bb.2:
	movq	_ACT8945A_APCH_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-36(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_18
## %bb.3:
	movq	_APCH_STATE_CSTATE@GOTPCREL(%rip), %rcx
	movl	-36(%rbp), %eax
	andl	(%rcx), %eax
	movq	_APCH_STATE_CSTATE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shrl	%cl, %eax
	cmpl	$128, %eax
	je	LBB0_8
## %bb.4:
	cmpl	$130, %eax
	je	LBB0_9
## %bb.5:
	cmpl	$129, %eax
	jne	LBB0_11
## %bb.6:
	testl	%r15d, %r15d
	jne	LBB0_13
LBB0_8:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_LOW@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_9:
	movq	_APCH_STATUS_CHGDAT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -28(%rbp)
	jne	LBB0_14
## %bb.10:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_11:
	movq	_APCH_CFG_SUSCHG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, -32(%rbp)
	je	LBB0_15
## %bb.12:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_13:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_HIGH@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_14:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_FULL@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_15:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	movq	_APCH_STATUS_INDAT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	andl	-28(%rbp), %ecx
	xorl	%eax, %eax
	orl	%r15d, %ecx
	jne	LBB0_18
## %bb.16:
	movq	_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %eax
	movl	%eax, (%r14)
	xorl	%eax, %eax
LBB0_18:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ACT8945A_APCH_STATUS,4,2       ## @ACT8945A_APCH_STATUS
	.comm	_ACT8945A_APCH_CFG,4,2          ## @ACT8945A_APCH_CFG
	.comm	_ACT8945A_APCH_STATE,4,2        ## @ACT8945A_APCH_STATE
	.comm	_APCH_STATE_CSTATE,4,2          ## @APCH_STATE_CSTATE
	.comm	_APCH_STATE_CSTATE_SHIFT,4,2    ## @APCH_STATE_CSTATE_SHIFT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_LOW,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_LOW
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_HIGH,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_HIGH
	.comm	_APCH_STATUS_CHGDAT,4,2         ## @APCH_STATUS_CHGDAT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_FULL,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_FULL
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_NORMAL
	.comm	_APCH_CFG_SUSCHG,4,2            ## @APCH_CFG_SUSCHG
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN
	.comm	_APCH_STATUS_INDAT,4,2          ## @APCH_STATUS_INDAT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,4,2 ## @POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL
	.no_dead_strip	_act8945a_get_capacity_level
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function act8945a_get_capacity_level
_act8945a_get_capacity_level:           ; @act8945a_get_capacity_level
	.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	x19, x2
	mov	x21, x1
	ldr	w0, [x0]
	bl	_gpiod_get_value
	mov	x20, x0
Lloh0:
	adrp	x8, _ACT8945A_APCH_STATUS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ACT8945A_APCH_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x21
	bl	_regmap_read
	tbnz	w0, #31, LBB0_14
; %bb.1:
Lloh3:
	adrp	x8, _ACT8945A_APCH_CFG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ACT8945A_APCH_CFG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #4
	mov	x0, x21
	bl	_regmap_read
	tbnz	w0, #31, LBB0_14
; %bb.2:
Lloh6:
	adrp	x8, _ACT8945A_APCH_STATE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ACT8945A_APCH_STATE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x21
	bl	_regmap_read
	tbnz	w0, #31, LBB0_14
; %bb.3:
Lloh9:
	adrp	x8, _APCH_STATE_CSTATE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _APCH_STATE_CSTATE@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	ldr	w9, [sp, #8]
Lloh12:
	adrp	x10, _APCH_STATE_CSTATE_SHIFT@GOTPAGE
Lloh13:
	ldr	x10, [x10, _APCH_STATE_CSTATE_SHIFT@GOTPAGEOFF]
	and	w8, w9, w8
Lloh14:
	ldr	w9, [x10]
	lsr	w9, w8, w9
Lloh15:
	adrp	x8, _POWER_SUPPLY_CAPACITY_LEVEL_LOW@GOTPAGE
Lloh16:
	ldr	x8, [x8, _POWER_SUPPLY_CAPACITY_LEVEL_LOW@GOTPAGEOFF]
	cmp	w9, #128
	b.eq	LBB0_13
; %bb.4:
	cmp	w9, #130
	b.eq	LBB0_7
; %bb.5:
	cmp	w9, #129
	b.ne	LBB0_8
; %bb.6:
Lloh17:
	adrp	x9, _POWER_SUPPLY_CAPACITY_LEVEL_HIGH@GOTPAGE
Lloh18:
	ldr	x9, [x9, _POWER_SUPPLY_CAPACITY_LEVEL_HIGH@GOTPAGEOFF]
	cmp	w20, #0
	csel	x8, x8, x9, eq
	b	LBB0_13
LBB0_7:
	ldr	w8, [sp, #12]
Lloh19:
	adrp	x9, _APCH_STATUS_CHGDAT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _APCH_STATUS_CHGDAT@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
Lloh22:
	adrp	x10, _POWER_SUPPLY_CAPACITY_LEVEL_FULL@GOTPAGE
Lloh23:
	ldr	x10, [x10, _POWER_SUPPLY_CAPACITY_LEVEL_FULL@GOTPAGEOFF]
Lloh24:
	adrp	x11, _POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPAGE
Lloh25:
	ldr	x11, [x11, _POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x11, x10, eq
	b	LBB0_13
LBB0_8:
	ldr	w8, [sp, #4]
Lloh26:
	adrp	x9, _APCH_CFG_SUSCHG@GOTPAGE
Lloh27:
	ldr	x9, [x9, _APCH_CFG_SUSCHG@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.9:
Lloh29:
	adrp	x8, _POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN@GOTPAGE
Lloh30:
	ldr	x8, [x8, _POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN@GOTPAGEOFF]
	b	LBB0_13
LBB0_10:
Lloh31:
	adrp	x8, _POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPAGE
Lloh32:
	ldr	x8, [x8, _POWER_SUPPLY_CAPACITY_LEVEL_NORMAL@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	str	w8, [x19]
	ldr	w8, [sp, #12]
Lloh34:
	adrp	x9, _APCH_STATUS_INDAT@GOTPAGE
Lloh35:
	ldr	x9, [x9, _APCH_STATUS_INDAT@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	and	w8, w9, w8
	orr	w8, w8, w20
	cbz	w8, LBB0_12
; %bb.11:
	mov	w0, #0
	b	LBB0_14
LBB0_12:
Lloh37:
	adrp	x8, _POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL@GOTPAGE
Lloh38:
	ldr	x8, [x8, _POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL@GOTPAGEOFF]
LBB0_13:
	mov	w0, #0
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_14:
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_ACT8945A_APCH_STATUS,4,2       ; @ACT8945A_APCH_STATUS
	.comm	_ACT8945A_APCH_CFG,4,2          ; @ACT8945A_APCH_CFG
	.comm	_ACT8945A_APCH_STATE,4,2        ; @ACT8945A_APCH_STATE
	.comm	_APCH_STATE_CSTATE,4,2          ; @APCH_STATE_CSTATE
	.comm	_APCH_STATE_CSTATE_SHIFT,4,2    ; @APCH_STATE_CSTATE_SHIFT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_LOW,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_LOW
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_HIGH,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_HIGH
	.comm	_APCH_STATUS_CHGDAT,4,2         ; @APCH_STATUS_CHGDAT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_FULL,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_FULL
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_NORMAL
	.comm	_APCH_CFG_SUSCHG,4,2            ; @APCH_CFG_SUSCHG
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN
	.comm	_APCH_STATUS_INDAT,4,2          ; @APCH_STATUS_INDAT
	.comm	_POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,4,2 ; @POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL
	.no_dead_strip	_act8945a_get_capacity_level
.subsections_via_symbols
