	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apm_battery_apm_get_power_status
_apm_battery_apm_get_power_status:      ## @apm_battery_apm_get_power_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	$32, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	_apm_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	xorl	%eax, %eax
	callq	_find_main_battery
	movq	_main_battery@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_26
## %bb.1:
	movq	_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-32(%rbp), %rsi
	callq	_MPSY_PROP
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	_POWER_SUPPLY_STATUS_UNKNOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	jmp	LBB0_4
LBB0_26:
	movq	_apm_mutex@GOTPCREL(%rip), %rdi
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
LBB0_2:
	movq	-32(%rbp), %rax
LBB0_4:
	movq	_POWER_SUPPLY_STATUS_CHARGING@GOTPCREL(%rip), %r14
	movq	_POWER_SUPPLY_STATUS_NOT_CHARGING@GOTPCREL(%rip), %rsi
	movq	_POWER_SUPPLY_STATUS_FULL@GOTPCREL(%rip), %rdi
	movq	_APM_AC_ONLINE@GOTPCREL(%rip), %rcx
	movq	%rcx, %rdx
	cmpq	(%rdi), %rax
	je	LBB0_6
## %bb.5:
	movq	_APM_AC_OFFLINE@GOTPCREL(%rip), %rdx
LBB0_6:
	cmpq	(%rsi), %rax
	cmoveq	%rcx, %rdx
	cmpq	(%r14), %rax
	cmoveq	%rcx, %rdx
	movl	(%rdx), %eax
	movl	%eax, 20(%rbx)
	movq	_CAPACITY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-40(%rbp), %rsi
	callq	_MPSY_PROP
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	_SOURCE_ENERGY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_calculate_capacity
	movl	%eax, (%rbx)
	cmpl	$-1, %eax
	jne	LBB0_12
## %bb.9:
	movq	_SOURCE_CHARGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_calculate_capacity
	movl	%eax, (%rbx)
	cmpl	$-1, %eax
	jne	LBB0_12
## %bb.10:
	movq	_SOURCE_VOLTAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_calculate_capacity
	jmp	LBB0_11
LBB0_7:
	movl	-40(%rbp), %eax
LBB0_11:
	movl	%eax, (%rbx)
LBB0_12:
	movq	-32(%rbp), %rcx
	cmpq	(%r14), %rcx
	jne	LBB0_13
## %bb.22:
	movq	_APM_BATTERY_STATUS_CHARGING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rbx)
	movl	%eax, 16(%rbx)
	movq	_APM_UNITS_MINS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_TIME_TO_FULL_AVG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-24(%rbp), %rsi
	callq	_MPSY_PROP
	testq	%rax, %rax
	je	LBB0_24
## %bb.23:
	movq	_TIME_TO_FULL_NOW@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_13:
	cmpl	$6, %eax
	jl	LBB0_14
## %bb.15:
	movq	_APM_BATTERY_STATUS_LOW@GOTPCREL(%rip), %rcx
	cmpl	$51, %eax
	jge	LBB0_17
	jmp	LBB0_18
LBB0_14:
	movq	_APM_BATTERY_STATUS_CRITICAL@GOTPCREL(%rip), %rcx
	cmpl	$51, %eax
	jl	LBB0_18
LBB0_17:
	movq	_APM_BATTERY_STATUS_HIGH@GOTPCREL(%rip), %rcx
LBB0_18:
	movl	(%rcx), %eax
	movl	%eax, 12(%rbx)
	movl	%eax, 16(%rbx)
	movq	_APM_UNITS_MINS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_TIME_TO_EMPTY_AVG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-24(%rbp), %rsi
	callq	_MPSY_PROP
	testq	%rax, %rax
	je	LBB0_24
## %bb.19:
	movq	_TIME_TO_EMPTY_NOW@GOTPCREL(%rip), %rax
LBB0_20:
	movl	(%rax), %edi
	leaq	-24(%rbp), %rsi
	callq	_MPSY_PROP
	testq	%rax, %rax
	je	LBB0_24
## %bb.21:
	movl	-32(%rbp), %edi
	callq	_calculate_time
	movq	%rax, %rdx
	jmp	LBB0_25
LBB0_24:
	movq	-24(%rbp), %rcx
	movabsq	$-8608480567731124087, %rdx     ## imm = 0x8888888888888889
	movq	%rcx, %rax
	imulq	%rdx
	addq	%rcx, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	$5, %rdx
	addq	%rax, %rdx
LBB0_25:
	movl	%edx, 4(%rbx)
	movq	_apm_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	addq	$32, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_apm_mutex,4,2                  ## @apm_mutex
	.comm	_main_battery,4,2               ## @main_battery
	.comm	_STATUS,4,2                     ## @STATUS
	.comm	_POWER_SUPPLY_STATUS_UNKNOWN,8,3 ## @POWER_SUPPLY_STATUS_UNKNOWN
	.comm	_POWER_SUPPLY_STATUS_CHARGING,8,3 ## @POWER_SUPPLY_STATUS_CHARGING
	.comm	_POWER_SUPPLY_STATUS_NOT_CHARGING,8,3 ## @POWER_SUPPLY_STATUS_NOT_CHARGING
	.comm	_POWER_SUPPLY_STATUS_FULL,8,3   ## @POWER_SUPPLY_STATUS_FULL
	.comm	_APM_AC_ONLINE,4,2              ## @APM_AC_ONLINE
	.comm	_APM_AC_OFFLINE,4,2             ## @APM_AC_OFFLINE
	.comm	_CAPACITY,4,2                   ## @CAPACITY
	.comm	_SOURCE_ENERGY,4,2              ## @SOURCE_ENERGY
	.comm	_SOURCE_CHARGE,4,2              ## @SOURCE_CHARGE
	.comm	_SOURCE_VOLTAGE,4,2             ## @SOURCE_VOLTAGE
	.comm	_APM_BATTERY_STATUS_CHARGING,4,2 ## @APM_BATTERY_STATUS_CHARGING
	.comm	_APM_BATTERY_STATUS_HIGH,4,2    ## @APM_BATTERY_STATUS_HIGH
	.comm	_APM_BATTERY_STATUS_LOW,4,2     ## @APM_BATTERY_STATUS_LOW
	.comm	_APM_BATTERY_STATUS_CRITICAL,4,2 ## @APM_BATTERY_STATUS_CRITICAL
	.comm	_APM_UNITS_MINS,4,2             ## @APM_UNITS_MINS
	.comm	_TIME_TO_FULL_AVG,4,2           ## @TIME_TO_FULL_AVG
	.comm	_TIME_TO_FULL_NOW,4,2           ## @TIME_TO_FULL_NOW
	.comm	_TIME_TO_EMPTY_AVG,4,2          ## @TIME_TO_EMPTY_AVG
	.comm	_TIME_TO_EMPTY_NOW,4,2          ## @TIME_TO_EMPTY_NOW
	.no_dead_strip	_apm_battery_apm_get_power_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apm_battery_apm_get_power_status
_apm_battery_apm_get_power_status:      ; @apm_battery_apm_get_power_status
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
	mov	x19, x0
Lloh0:
	adrp	x0, _apm_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _apm_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	bl	_find_main_battery
Lloh2:
	adrp	x8, _main_battery@GOTPAGE
Lloh3:
	ldr	x8, [x8, _main_battery@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cbz	w8, LBB0_3
; %bb.1:
Lloh5:
	adrp	x8, _STATUS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _STATUS@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	add	x1, sp, #24
	bl	_MPSY_PROP
	cbz	x0, LBB0_4
; %bb.2:
Lloh8:
	adrp	x8, _POWER_SUPPLY_STATUS_UNKNOWN@GOTPAGE
Lloh9:
	ldr	x8, [x8, _POWER_SUPPLY_STATUS_UNKNOWN@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	b	LBB0_5
LBB0_3:
Lloh11:
	adrp	x0, _apm_mutex@GOTPAGE
Lloh12:
	ldr	x0, [x0, _apm_mutex@GOTPAGEOFF]
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_mutex_unlock
LBB0_4:
	ldr	x8, [sp, #24]
LBB0_5:
Lloh13:
	adrp	x20, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGE
Lloh14:
	ldr	x20, [x20, _POWER_SUPPLY_STATUS_CHARGING@GOTPAGEOFF]
Lloh15:
	adrp	x9, _POWER_SUPPLY_STATUS_NOT_CHARGING@GOTPAGE
Lloh16:
	ldr	x9, [x9, _POWER_SUPPLY_STATUS_NOT_CHARGING@GOTPAGEOFF]
	ldr	x10, [x20]
Lloh17:
	ldr	x9, [x9]
Lloh18:
	adrp	x11, _POWER_SUPPLY_STATUS_FULL@GOTPAGE
Lloh19:
	ldr	x11, [x11, _POWER_SUPPLY_STATUS_FULL@GOTPAGEOFF]
Lloh20:
	ldr	x11, [x11]
	cmp	x8, x11
	ccmp	x8, x9, #4, ne
	ccmp	x8, x10, #4, ne
Lloh21:
	adrp	x8, _APM_AC_ONLINE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _APM_AC_ONLINE@GOTPAGEOFF]
Lloh23:
	adrp	x9, _APM_AC_OFFLINE@GOTPAGE
Lloh24:
	ldr	x9, [x9, _APM_AC_OFFLINE@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	str	w8, [x19, #20]
Lloh25:
	adrp	x8, _CAPACITY@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CAPACITY@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
	add	x1, sp, #16
	bl	_MPSY_PROP
	cbz	x0, LBB0_9
; %bb.6:
Lloh28:
	adrp	x8, _SOURCE_ENERGY@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SOURCE_ENERGY@GOTPAGEOFF]
Lloh30:
	ldr	w0, [x8]
	bl	_calculate_capacity
	str	w0, [x19]
	cmn	w0, #1
	b.ne	LBB0_10
; %bb.7:
Lloh31:
	adrp	x8, _SOURCE_CHARGE@GOTPAGE
Lloh32:
	ldr	x8, [x8, _SOURCE_CHARGE@GOTPAGEOFF]
Lloh33:
	ldr	w0, [x8]
	bl	_calculate_capacity
	mov	x8, x0
	str	w8, [x19]
	cmn	w8, #1
	b.ne	LBB0_10
; %bb.8:
Lloh34:
	adrp	x8, _SOURCE_VOLTAGE@GOTPAGE
Lloh35:
	ldr	x8, [x8, _SOURCE_VOLTAGE@GOTPAGEOFF]
Lloh36:
	ldr	w0, [x8]
	bl	_calculate_capacity
	str	w0, [x19]
                                        ; kill: def $w0 killed $w0 killed $x0 def $x0
	b	LBB0_10
LBB0_9:
	ldr	w0, [sp, #16]
	str	w0, [x19]
LBB0_10:
	ldr	x8, [sp, #24]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.11:
Lloh37:
	adrp	x8, _APM_BATTERY_STATUS_CHARGING@GOTPAGE
Lloh38:
	ldr	x8, [x8, _APM_BATTERY_STATUS_CHARGING@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	str	w8, [x19, #16]
Lloh40:
	adrp	x9, _APM_UNITS_MINS@GOTPAGE
Lloh41:
	ldr	x9, [x9, _APM_UNITS_MINS@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
Lloh43:
	adrp	x8, _TIME_TO_FULL_AVG@GOTPAGE
Lloh44:
	ldr	x8, [x8, _TIME_TO_FULL_AVG@GOTPAGEOFF]
Lloh45:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_MPSY_PROP
	cbz	x0, LBB0_17
; %bb.12:
Lloh46:
	adrp	x8, _TIME_TO_FULL_NOW@GOTPAGE
Lloh47:
	ldr	x8, [x8, _TIME_TO_FULL_NOW@GOTPAGEOFF]
	b	LBB0_15
LBB0_13:
Lloh48:
	adrp	x8, _APM_BATTERY_STATUS_HIGH@GOTPAGE
Lloh49:
	ldr	x8, [x8, _APM_BATTERY_STATUS_HIGH@GOTPAGEOFF]
Lloh50:
	adrp	x9, _APM_BATTERY_STATUS_LOW@GOTPAGE
Lloh51:
	ldr	x9, [x9, _APM_BATTERY_STATUS_LOW@GOTPAGEOFF]
Lloh52:
	adrp	x10, _APM_BATTERY_STATUS_CRITICAL@GOTPAGE
Lloh53:
	ldr	x10, [x10, _APM_BATTERY_STATUS_CRITICAL@GOTPAGEOFF]
	cmp	w0, #5
	csel	x9, x9, x10, gt
	cmp	w0, #50
	csel	x8, x8, x9, gt
	ldr	w8, [x8]
	str	w8, [x19, #16]
Lloh54:
	adrp	x9, _APM_UNITS_MINS@GOTPAGE
Lloh55:
	ldr	x9, [x9, _APM_UNITS_MINS@GOTPAGEOFF]
Lloh56:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
Lloh57:
	adrp	x8, _TIME_TO_EMPTY_AVG@GOTPAGE
Lloh58:
	ldr	x8, [x8, _TIME_TO_EMPTY_AVG@GOTPAGEOFF]
Lloh59:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_MPSY_PROP
	cbz	x0, LBB0_17
; %bb.14:
Lloh60:
	adrp	x8, _TIME_TO_EMPTY_NOW@GOTPAGE
Lloh61:
	ldr	x8, [x8, _TIME_TO_EMPTY_NOW@GOTPAGEOFF]
LBB0_15:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_MPSY_PROP
	cbz	x0, LBB0_17
; %bb.16:
	ldr	w0, [sp, #24]
	bl	_calculate_time
	b	LBB0_18
LBB0_17:
	ldr	x8, [sp, #8]
	mov	x9, #-8608480567731124088
	movk	x9, #34953
	smulh	x9, x8, x9
	add	x8, x9, x8
	asr	x9, x8, #5
	add	x0, x9, x8, lsr #63
LBB0_18:
	str	w0, [x19, #4]
Lloh62:
	adrp	x0, _apm_mutex@GOTPAGE
Lloh63:
	ldr	x0, [x0, _apm_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpLdrGot	Lloh60, Lloh61
	.loh AdrpLdrGot	Lloh62, Lloh63
	.cfi_endproc
                                        ; -- End function
	.comm	_apm_mutex,4,2                  ; @apm_mutex
	.comm	_main_battery,4,2               ; @main_battery
	.comm	_STATUS,4,2                     ; @STATUS
	.comm	_POWER_SUPPLY_STATUS_UNKNOWN,8,3 ; @POWER_SUPPLY_STATUS_UNKNOWN
	.comm	_POWER_SUPPLY_STATUS_CHARGING,8,3 ; @POWER_SUPPLY_STATUS_CHARGING
	.comm	_POWER_SUPPLY_STATUS_NOT_CHARGING,8,3 ; @POWER_SUPPLY_STATUS_NOT_CHARGING
	.comm	_POWER_SUPPLY_STATUS_FULL,8,3   ; @POWER_SUPPLY_STATUS_FULL
	.comm	_APM_AC_ONLINE,4,2              ; @APM_AC_ONLINE
	.comm	_APM_AC_OFFLINE,4,2             ; @APM_AC_OFFLINE
	.comm	_CAPACITY,4,2                   ; @CAPACITY
	.comm	_SOURCE_ENERGY,4,2              ; @SOURCE_ENERGY
	.comm	_SOURCE_CHARGE,4,2              ; @SOURCE_CHARGE
	.comm	_SOURCE_VOLTAGE,4,2             ; @SOURCE_VOLTAGE
	.comm	_APM_BATTERY_STATUS_CHARGING,4,2 ; @APM_BATTERY_STATUS_CHARGING
	.comm	_APM_BATTERY_STATUS_HIGH,4,2    ; @APM_BATTERY_STATUS_HIGH
	.comm	_APM_BATTERY_STATUS_LOW,4,2     ; @APM_BATTERY_STATUS_LOW
	.comm	_APM_BATTERY_STATUS_CRITICAL,4,2 ; @APM_BATTERY_STATUS_CRITICAL
	.comm	_APM_UNITS_MINS,4,2             ; @APM_UNITS_MINS
	.comm	_TIME_TO_FULL_AVG,4,2           ; @TIME_TO_FULL_AVG
	.comm	_TIME_TO_FULL_NOW,4,2           ; @TIME_TO_FULL_NOW
	.comm	_TIME_TO_EMPTY_AVG,4,2          ; @TIME_TO_EMPTY_AVG
	.comm	_TIME_TO_EMPTY_NOW,4,2          ; @TIME_TO_EMPTY_NOW
	.no_dead_strip	_apm_battery_apm_get_power_status
.subsections_via_symbols
