	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function check_batteries
_check_batteries:                       ## @check_batteries
	.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	%rdi, %r14
	movq	_MEMCTRLSTATUS_BATTERY@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r14), %rdi
	callq	_readb
	movl	%eax, %ebx
	movq	_debug@GOTPCREL(%rip), %rax
	movq	_DEBUG_BATTERY_POLLING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_2
## %bb.1:
	movq	_KERN_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r14), %rsi
	movq	_BATTERY_1_FAILURE@GOTPCREL(%rip), %rax
	movb	(%rax), %al
	andb	%bl, %al
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %r8
	movq	%r8, %rcx
	cmoveq	%rax, %rcx
	movq	_BATTERY_2_FAILURE@GOTPCREL(%rip), %rdx
	movb	(%rdx), %dl
	andb	%bl, %dl
	cmoveq	%rax, %r8
	leaq	L_.str(%rip), %rdx
	callq	_dev_printk
LBB0_2:
	movq	_BATTERY_1_FAILURE@GOTPCREL(%rip), %rax
	xorl	%edx, %edx
	movb	(%rax), %al
	andb	%bl, %al
	sete	%dl
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_check_battery
	movl	%eax, %r15d
	movq	_BATTERY_2_FAILURE@GOTPCREL(%rip), %rax
	xorl	%edx, %edx
	andb	(%rax), %bl
	sete	%dl
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_check_battery
	orl	%r15d, %eax
	je	LBB0_3
## %bb.4:
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_set_fault_to_battery_status    ## TAILCALL
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MEMCTRLSTATUS_BATTERY,8,3      ## @MEMCTRLSTATUS_BATTERY
	.comm	_debug,4,2                      ## @debug
	.comm	_DEBUG_BATTERY_POLLING,4,2      ## @DEBUG_BATTERY_POLLING
	.comm	_KERN_DEBUG,4,2                 ## @KERN_DEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"checking battery status, 1 = %s, 2 = %s\n"

	.comm	_BATTERY_1_FAILURE,1,0          ## @BATTERY_1_FAILURE
L_.str.1:                               ## @.str.1
	.asciz	"FAILURE"

L_.str.2:                               ## @.str.2
	.asciz	"OK"

	.comm	_BATTERY_2_FAILURE,1,0          ## @BATTERY_2_FAILURE
	.no_dead_strip	_check_batteries
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function check_batteries
_check_batteries:                       ; @check_batteries
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x0
	ldr	x8, [x0, #8]
Lloh0:
	adrp	x9, _MEMCTRLSTATUS_BATTERY@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MEMCTRLSTATUS_BATTERY@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readb
	mov	x20, x0
Lloh3:
	adrp	x8, _debug@GOTPAGE
Lloh4:
	ldr	x8, [x8, _debug@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _DEBUG_BATTERY_POLLING@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DEBUG_BATTERY_POLLING@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x21, _BATTERY_1_FAILURE@GOTPAGE
Lloh10:
	ldr	x21, [x21, _BATTERY_1_FAILURE@GOTPAGEOFF]
Lloh11:
	adrp	x22, _BATTERY_2_FAILURE@GOTPAGE
Lloh12:
	ldr	x22, [x22, _BATTERY_2_FAILURE@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
Lloh13:
	adrp	x8, _KERN_DEBUG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _KERN_DEBUG@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	ldr	x1, [x19]
Lloh16:
	adrp	x8, l_.str.1@PAGE
Lloh17:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh18:
	adrp	x9, l_.str.2@PAGE
Lloh19:
	add	x9, x9, l_.str.2@PAGEOFF
	ldrb	w10, [x21]
	tst	w10, w20
	csel	x3, x9, x8, eq
	ldrb	w10, [x22]
	tst	w10, w20
	csel	x4, x9, x8, eq
Lloh20:
	adrp	x2, l_.str@PAGE
Lloh21:
	add	x2, x2, l_.str@PAGEOFF
	bl	_dev_printk
LBB0_2:
	ldrb	w8, [x21]
	tst	w8, w20
	cset	w2, eq
	mov	x0, x19
	mov	w1, #0
	bl	_check_battery
	mov	x21, x0
	ldrb	w8, [x22]
	tst	w8, w20
	cset	w2, eq
	mov	x0, x19
	mov	w1, #1
	bl	_check_battery
	orr	w8, w21, w0
	cbz	w8, LBB0_4
; %bb.3:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_set_fault_to_battery_status
LBB0_4:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_MEMCTRLSTATUS_BATTERY,8,3      ; @MEMCTRLSTATUS_BATTERY
	.comm	_debug,4,2                      ; @debug
	.comm	_DEBUG_BATTERY_POLLING,4,2      ; @DEBUG_BATTERY_POLLING
	.comm	_KERN_DEBUG,4,2                 ; @KERN_DEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"checking battery status, 1 = %s, 2 = %s\n"

	.comm	_BATTERY_1_FAILURE,1,0          ; @BATTERY_1_FAILURE
l_.str.1:                               ; @.str.1
	.asciz	"FAILURE"

l_.str.2:                               ; @.str.2
	.asciz	"OK"

	.comm	_BATTERY_2_FAILURE,1,0          ; @BATTERY_2_FAILURE
	.no_dead_strip	_check_batteries
.subsections_via_symbols
