	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function max17042_get_status
_max17042_get_status:                   ## @max17042_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	%rsi, %r14
	movq	%rdi, %rbx
	movl	12(%rdi), %edi
	callq	_power_supply_am_i_supplied
	testl	%eax, %eax
	js	LBB0_9
## %bb.1:
	je	LBB0_10
## %bb.2:
	movl	8(%rbx), %edi
	movq	_MAX17042_FullCAP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.3:
	movl	8(%rbx), %edi
	movq	_MAX17042_RepCap@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-24(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.4:
	movl	-28(%rbp), %eax
	subl	-24(%rbp), %eax
	movq	_MAX17042_FULL_THRESHOLD@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_11
## %bb.5:
	movq	(%rbx), %rax
	cmpl	$0, 4(%rax)
	je	LBB0_8
## %bb.6:
	movl	8(%rbx), %edi
	movq	_MAX17042_AvgCurrent@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-20(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.7:
	movl	-20(%rbp), %edi
	movl	$15, %esi
	callq	_sign_extend32
	movl	%eax, %ecx
	movq	(%rbx), %rsi
	movl	$1562500, %eax                  ## imm = 0x17D784
	xorl	%edx, %edx
	idivl	(%rsi)
	imull	%ecx, %eax
	testl	%eax, %eax
	jle	LBB0_10
LBB0_8:
	movq	_POWER_SUPPLY_STATUS_CHARGING@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_9:
	movq	_POWER_SUPPLY_STATUS_UNKNOWN@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_10:
	movq	_POWER_SUPPLY_STATUS_DISCHARGING@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_11:
	movq	_POWER_SUPPLY_STATUS_FULL@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	movl	%eax, (%r14)
	xorl	%eax, %eax
LBB0_13:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_POWER_SUPPLY_STATUS_UNKNOWN,4,2 ## @POWER_SUPPLY_STATUS_UNKNOWN
	.comm	_POWER_SUPPLY_STATUS_DISCHARGING,4,2 ## @POWER_SUPPLY_STATUS_DISCHARGING
	.comm	_MAX17042_FullCAP,4,2           ## @MAX17042_FullCAP
	.comm	_MAX17042_RepCap,4,2            ## @MAX17042_RepCap
	.comm	_MAX17042_FULL_THRESHOLD,4,2    ## @MAX17042_FULL_THRESHOLD
	.comm	_POWER_SUPPLY_STATUS_FULL,4,2   ## @POWER_SUPPLY_STATUS_FULL
	.comm	_POWER_SUPPLY_STATUS_CHARGING,4,2 ## @POWER_SUPPLY_STATUS_CHARGING
	.comm	_MAX17042_AvgCurrent,4,2        ## @MAX17042_AvgCurrent
	.no_dead_strip	_max17042_get_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function max17042_get_status
_max17042_get_status:                   ; @max17042_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, x1
	mov	x20, x0
	ldr	w0, [x0, #12]
	bl	_power_supply_am_i_supplied
	tbnz	w0, #31, LBB0_8
; %bb.1:
	cbz	w0, LBB0_9
; %bb.2:
	ldr	w0, [x20, #8]
Lloh0:
	adrp	x8, _MAX17042_FullCAP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX17042_FullCAP@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_regmap_read
	tbnz	w0, #31, LBB0_13
; %bb.3:
	ldr	w0, [x20, #8]
Lloh3:
	adrp	x8, _MAX17042_RepCap@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX17042_RepCap@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #8
	bl	_regmap_read
	tbnz	w0, #31, LBB0_13
; %bb.4:
	ldp	w9, w8, [sp, #8]
Lloh6:
	adrp	x10, _MAX17042_FULL_THRESHOLD@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MAX17042_FULL_THRESHOLD@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	sub	w8, w8, w9
	cmp	w8, w10
	b.le	LBB0_10
; %bb.5:
	ldr	x8, [x20]
	ldr	w8, [x8, #4]
	cbz	w8, LBB0_11
; %bb.6:
	ldr	w0, [x20, #8]
Lloh9:
	adrp	x8, _MAX17042_AvgCurrent@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MAX17042_AvgCurrent@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x2, sp, #4
	bl	_regmap_read
	tbnz	w0, #31, LBB0_13
; %bb.7:
	ldr	w0, [sp, #4]
	mov	w1, #15
	bl	_sign_extend32
	ldr	x8, [x20]
	ldr	w8, [x8]
	mov	w9, #55172
	movk	w9, #23, lsl #16
	sdiv	w8, w9, w8
Lloh12:
	adrp	x9, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGE
Lloh13:
	ldr	x9, [x9, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGEOFF]
	mul	w8, w8, w0
Lloh14:
	adrp	x10, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGE
Lloh15:
	ldr	x10, [x10, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGEOFF]
	cmp	w8, #0
	csel	x8, x9, x10, gt
	b	LBB0_12
LBB0_8:
Lloh16:
	adrp	x8, _POWER_SUPPLY_STATUS_UNKNOWN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_UNKNOWN@GOTPAGEOFF]
	b	LBB0_12
LBB0_9:
Lloh18:
	adrp	x8, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGE
Lloh19:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_DISCHARGING@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:
Lloh20:
	adrp	x8, _POWER_SUPPLY_STATUS_FULL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_FULL@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh22:
	adrp	x8, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGE
Lloh23:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	mov	w0, #0
	str	w8, [x19]
LBB0_13:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_POWER_SUPPLY_STATUS_UNKNOWN,4,2 ; @POWER_SUPPLY_STATUS_UNKNOWN
	.comm	_POWER_SUPPLY_STATUS_DISCHARGING,4,2 ; @POWER_SUPPLY_STATUS_DISCHARGING
	.comm	_MAX17042_FullCAP,4,2           ; @MAX17042_FullCAP
	.comm	_MAX17042_RepCap,4,2            ; @MAX17042_RepCap
	.comm	_MAX17042_FULL_THRESHOLD,4,2    ; @MAX17042_FULL_THRESHOLD
	.comm	_POWER_SUPPLY_STATUS_FULL,4,2   ; @POWER_SUPPLY_STATUS_FULL
	.comm	_POWER_SUPPLY_STATUS_CHARGING,4,2 ; @POWER_SUPPLY_STATUS_CHARGING
	.comm	_MAX17042_AvgCurrent,4,2        ; @MAX17042_AvgCurrent
	.no_dead_strip	_max17042_get_status
.subsections_via_symbols
