	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fuel_gauge_get_status
_fuel_gauge_get_status:                 ## @fuel_gauge_get_status
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movq	_AXP20X_PWR_INPUT_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_fuel_gauge_reg_readb
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_1
## %bb.3:
	movq	_PS_STAT_VBUS_VALID@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_14
## %bb.4:
	movq	_AXP20X_FG_RES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_fuel_gauge_reg_readb
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movq	_FG_REP_CAP_VALID@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_14
## %bb.7:
	notl	%ecx
	andl	%ecx, %eax
	cmpl	$100, %eax
	jne	LBB0_9
LBB0_8:
	movq	_POWER_SUPPLY_STATUS_FULL@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_1:
	movq	8(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	jmp	LBB0_2
LBB0_5:
	movq	8(%r14), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
LBB0_2:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_9:
	cmpl	$90, %eax
	jb	LBB0_14
## %bb.10:
	movq	_PS_STAT_BAT_CHRG_DIR@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_11
LBB0_14:
	movq	_PS_STAT_BAT_CHRG_DIR@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_16
## %bb.15:
	movq	_POWER_SUPPLY_STATUS_CHARGING@GOTPCREL(%rip), %rax
	jmp	LBB0_17
LBB0_16:
	movq	_POWER_SUPPLY_STATUS_DISCHARGING@GOTPCREL(%rip), %rax
LBB0_17:
	movq	(%rax), %rax
	movq	%rax, (%r14)
LBB0_18:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_11:
	movq	16(%r14), %rax
	movq	_BAT_D_CURR@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	leaq	-20(%rbp), %rsi
	callq	_iio_read_channel_raw
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:
	cmpl	$0, -20(%rbp)
	jne	LBB0_14
	jmp	LBB0_8
LBB0_12:
	movq	8(%r14), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_err
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_AXP20X_PWR_INPUT_STATUS,4,2    ## @AXP20X_PWR_INPUT_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"PWR STAT read failed:%d\n"

	.comm	_PS_STAT_VBUS_VALID,4,2         ## @PS_STAT_VBUS_VALID
	.comm	_AXP20X_FG_RES,4,2              ## @AXP20X_FG_RES
L_.str.1:                               ## @.str.1
	.asciz	"FG RES read failed: %d\n"

	.comm	_FG_REP_CAP_VALID,4,2           ## @FG_REP_CAP_VALID
	.comm	_POWER_SUPPLY_STATUS_FULL,8,3   ## @POWER_SUPPLY_STATUS_FULL
	.comm	_PS_STAT_BAT_CHRG_DIR,4,2       ## @PS_STAT_BAT_CHRG_DIR
	.comm	_BAT_D_CURR,8,3                 ## @BAT_D_CURR
L_.str.2:                               ## @.str.2
	.asciz	"FG get current failed: %d\n"

	.comm	_POWER_SUPPLY_STATUS_CHARGING,8,3 ## @POWER_SUPPLY_STATUS_CHARGING
	.comm	_POWER_SUPPLY_STATUS_DISCHARGING,8,3 ## @POWER_SUPPLY_STATUS_DISCHARGING
	.no_dead_strip	_fuel_gauge_get_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fuel_gauge_get_status
_fuel_gauge_get_status:                 ; @fuel_gauge_get_status
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _AXP20X_PWR_INPUT_STATUS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AXP20X_PWR_INPUT_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_fuel_gauge_reg_readb
	mov	x20, x0
	tbnz	w0, #31, LBB0_6
; %bb.1:
Lloh3:
	adrp	x8, _PS_STAT_VBUS_VALID@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PS_STAT_VBUS_VALID@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_11
; %bb.2:
Lloh6:
	adrp	x8, _AXP20X_FG_RES@GOTPAGE
Lloh7:
	ldr	x8, [x8, _AXP20X_FG_RES@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fuel_gauge_reg_readb
	mov	x2, x0
	tbnz	w0, #31, LBB0_7
; %bb.3:
Lloh9:
	adrp	x8, _FG_REP_CAP_VALID@GOTPAGE
Lloh10:
	ldr	x8, [x8, _FG_REP_CAP_VALID@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_11
; %bb.4:
	bic	w8, w2, w8
	cmp	w8, #100
	b.ne	LBB0_9
LBB0_5:
Lloh12:
	adrp	x8, _POWER_SUPPLY_STATUS_FULL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_FULL@GOTPAGEOFF]
	b	LBB0_14
LBB0_6:
	ldr	x0, [x19, #8]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	b	LBB0_8
LBB0_7:
	ldr	x0, [x19, #8]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	b	_dev_err
LBB0_9:
	cmp	w8, #90
	b.lo	LBB0_11
; %bb.10:
Lloh18:
	adrp	x8, _PS_STAT_BAT_CHRG_DIR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PS_STAT_BAT_CHRG_DIR@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_16
LBB0_11:
Lloh21:
	adrp	x8, _PS_STAT_BAT_CHRG_DIR@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PS_STAT_BAT_CHRG_DIR@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	tst	w8, w20
	b.eq	LBB0_13
; %bb.12:
Lloh24:
	adrp	x8, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGE
Lloh25:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGEOFF]
	b	LBB0_14
LBB0_13:
Lloh26:
	adrp	x8, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGE
Lloh27:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGEOFF]
LBB0_14:
	ldr	x8, [x8]
	str	x8, [x19]
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_16:
	ldr	x8, [x19, #16]
Lloh28:
	adrp	x9, _BAT_D_CURR@GOTPAGE
Lloh29:
	ldr	x9, [x9, _BAT_D_CURR@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	add	x1, sp, #12
	bl	_iio_read_channel_raw
	tbnz	w0, #31, LBB0_18
; %bb.17:
	ldr	w8, [sp, #12]
	cbnz	w8, LBB0_11
	b	LBB0_5
LBB0_18:
	mov	x2, x0
	ldr	x0, [x19, #8]
Lloh31:
	adrp	x1, l_.str.2@PAGE
Lloh32:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_AXP20X_PWR_INPUT_STATUS,4,2    ; @AXP20X_PWR_INPUT_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"PWR STAT read failed:%d\n"

	.comm	_PS_STAT_VBUS_VALID,4,2         ; @PS_STAT_VBUS_VALID
	.comm	_AXP20X_FG_RES,4,2              ; @AXP20X_FG_RES
l_.str.1:                               ; @.str.1
	.asciz	"FG RES read failed: %d\n"

	.comm	_FG_REP_CAP_VALID,4,2           ; @FG_REP_CAP_VALID
	.comm	_POWER_SUPPLY_STATUS_FULL,8,3   ; @POWER_SUPPLY_STATUS_FULL
	.comm	_PS_STAT_BAT_CHRG_DIR,4,2       ; @PS_STAT_BAT_CHRG_DIR
	.comm	_BAT_D_CURR,8,3                 ; @BAT_D_CURR
l_.str.2:                               ; @.str.2
	.asciz	"FG get current failed: %d\n"

	.comm	_POWER_SUPPLY_STATUS_CHARGING,8,3 ; @POWER_SUPPLY_STATUS_CHARGING
	.comm	_POWER_SUPPLY_STATUS_DISCHARGING,8,3 ; @POWER_SUPPLY_STATUS_DISCHARGING
	.no_dead_strip	_fuel_gauge_get_status
.subsections_via_symbols
