	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function max17042_get_battery_health
_max17042_get_battery_health:           ## @max17042_get_battery_health
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movl	8(%rdi), %edi
	movq	_MAX17042_AvgVCELL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.1:
	movl	-28(%rbp), %r15d
	movl	8(%rbx), %edi
	movq	_MAX17042_VCELL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	js	LBB0_13
## %bb.2:
	imull	$625, %r15d, %eax               ## imm = 0x271
	cltq
	imulq	$274877907, %rax, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$41, %rcx
	addl	%eax, %ecx
	movq	(%rbx), %rax
	cmpl	(%rax), %ecx
	jge	LBB0_4
## %bb.3:
	movq	_POWER_SUPPLY_HEALTH_DEAD@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_4:
	imull	$625, -28(%rbp), %ecx           ## imm = 0x271
	movslq	%ecx, %rcx
	imulq	$274877907, %rcx, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$41, %rcx
	addl	%edx, %ecx
	movq	_MAX17042_VMAX_TOLERANCE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	addl	4(%rax), %edx
	cmpl	%edx, %ecx
	jle	LBB0_6
## %bb.5:
	movq	_POWER_SUPPLY_HEALTH_OVERVOLTAGE@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_6:
	leaq	-32(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_max17042_get_temperature
	testl	%eax, %eax
	js	LBB0_13
## %bb.7:
	movl	-32(%rbp), %eax
	movq	(%rbx), %rcx
	cmpl	8(%rcx), %eax
	jge	LBB0_9
## %bb.8:
	movq	_POWER_SUPPLY_HEALTH_COLD@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_9:
	cmpl	12(%rcx), %eax
	jle	LBB0_10
## %bb.11:
	movq	_POWER_SUPPLY_HEALTH_OVERHEAT@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_10:
	movq	_POWER_SUPPLY_HEALTH_GOOD@GOTPCREL(%rip), %rax
LBB0_12:
	movl	(%rax), %eax
	movl	%eax, (%r14)
	xorl	%eax, %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX17042_AvgVCELL,4,2          ## @MAX17042_AvgVCELL
	.comm	_MAX17042_VCELL,4,2             ## @MAX17042_VCELL
	.comm	_POWER_SUPPLY_HEALTH_DEAD,4,2   ## @POWER_SUPPLY_HEALTH_DEAD
	.comm	_MAX17042_VMAX_TOLERANCE,4,2    ## @MAX17042_VMAX_TOLERANCE
	.comm	_POWER_SUPPLY_HEALTH_OVERVOLTAGE,4,2 ## @POWER_SUPPLY_HEALTH_OVERVOLTAGE
	.comm	_POWER_SUPPLY_HEALTH_COLD,4,2   ## @POWER_SUPPLY_HEALTH_COLD
	.comm	_POWER_SUPPLY_HEALTH_OVERHEAT,4,2 ## @POWER_SUPPLY_HEALTH_OVERHEAT
	.comm	_POWER_SUPPLY_HEALTH_GOOD,4,2   ## @POWER_SUPPLY_HEALTH_GOOD
	.no_dead_strip	_max17042_get_battery_health
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function max17042_get_battery_health
_max17042_get_battery_health:           ; @max17042_get_battery_health
	.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, x1
	mov	x20, x0
	ldr	w0, [x0, #8]
Lloh0:
	adrp	x8, _MAX17042_AvgVCELL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX17042_AvgVCELL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #8
	bl	_regmap_read
	tbnz	w0, #31, LBB0_11
; %bb.1:
	ldr	w21, [sp, #8]
	ldr	w0, [x20, #8]
Lloh3:
	adrp	x8, _MAX17042_VCELL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX17042_VCELL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #8
	bl	_regmap_read
	tbnz	w0, #31, LBB0_11
; %bb.2:
	mov	w8, #625
	mul	w10, w21, w8
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	smull	x10, w10, w9
	lsr	x11, x10, #63
	asr	x12, x10, #41
	ldr	x10, [x20]
	ldr	w13, [x10]
	add	w11, w12, w11
	cmp	w11, w13
	b.ge	LBB0_4
; %bb.3:
Lloh6:
	adrp	x8, _POWER_SUPPLY_HEALTH_DEAD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _POWER_SUPPLY_HEALTH_DEAD@GOTPAGEOFF]
	b	LBB0_10
LBB0_4:
	ldr	w11, [sp, #8]
	mul	w8, w11, w8
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #41
	add	w8, w8, w9
	ldr	w9, [x10, #4]
Lloh8:
	adrp	x10, _MAX17042_VMAX_TOLERANCE@GOTPAGE
Lloh9:
	ldr	x10, [x10, _MAX17042_VMAX_TOLERANCE@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	add	w9, w10, w9
	cmp	w8, w9
	b.le	LBB0_6
; %bb.5:
Lloh11:
	adrp	x8, _POWER_SUPPLY_HEALTH_OVERVOLTAGE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _POWER_SUPPLY_HEALTH_OVERVOLTAGE@GOTPAGEOFF]
	b	LBB0_10
LBB0_6:
	add	x1, sp, #12
	mov	x0, x20
	bl	_max17042_get_temperature
	tbnz	w0, #31, LBB0_11
; %bb.7:
	ldr	w8, [sp, #12]
	ldr	x9, [x20]
	ldr	w10, [x9, #8]
	cmp	w8, w10
	b.ge	LBB0_9
; %bb.8:
Lloh13:
	adrp	x8, _POWER_SUPPLY_HEALTH_COLD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _POWER_SUPPLY_HEALTH_COLD@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
	ldr	w9, [x9, #12]
Lloh15:
	adrp	x10, _POWER_SUPPLY_HEALTH_GOOD@GOTPAGE
Lloh16:
	ldr	x10, [x10, _POWER_SUPPLY_HEALTH_GOOD@GOTPAGEOFF]
Lloh17:
	adrp	x11, _POWER_SUPPLY_HEALTH_OVERHEAT@GOTPAGE
Lloh18:
	ldr	x11, [x11, _POWER_SUPPLY_HEALTH_OVERHEAT@GOTPAGEOFF]
	cmp	w8, w9
	csel	x8, x11, x10, gt
LBB0_10:
	mov	w0, #0
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_11:
	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 AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX17042_AvgVCELL,4,2          ; @MAX17042_AvgVCELL
	.comm	_MAX17042_VCELL,4,2             ; @MAX17042_VCELL
	.comm	_POWER_SUPPLY_HEALTH_DEAD,4,2   ; @POWER_SUPPLY_HEALTH_DEAD
	.comm	_MAX17042_VMAX_TOLERANCE,4,2    ; @MAX17042_VMAX_TOLERANCE
	.comm	_POWER_SUPPLY_HEALTH_OVERVOLTAGE,4,2 ; @POWER_SUPPLY_HEALTH_OVERVOLTAGE
	.comm	_POWER_SUPPLY_HEALTH_COLD,4,2   ; @POWER_SUPPLY_HEALTH_COLD
	.comm	_POWER_SUPPLY_HEALTH_OVERHEAT,4,2 ; @POWER_SUPPLY_HEALTH_OVERHEAT
	.comm	_POWER_SUPPLY_HEALTH_GOOD,4,2   ; @POWER_SUPPLY_HEALTH_GOOD
	.no_dead_strip	_max17042_get_battery_health
.subsections_via_symbols
