	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_register_battery_handlers      ## -- Begin function register_battery_handlers
	.p2align	4, 0x90
_register_battery_handlers:             ## @register_battery_handlers
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %eax
	negl	%eax
	cmovsl	%esi, %eax
	movl	$-1, %r15d
	cmpl	$100, %edi
	jg	LBB0_12
## %bb.1:
	cmpl	$1, %eax
	jne	LBB0_12
## %bb.2:
	movq	%rdx, %r14
	xorl	%r15d, %r15d
	testq	%rdx, %rdx
	je	LBB0_12
## %bb.3:
	movl	%esi, %r13d
	movl	%edi, %ebx
	movl	$32, %edi
	callq	_malloc
	movq	%rax, %r12
	testq	%rax, %rax
	jne	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_5:
	movq	_battery_watch_list@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%rcx, 24(%r12)
	movq	%r12, (%rax)
	movl	%ebx, %eax
	negl	%eax
	cmovsl	%ebx, %eax
	movl	%eax, (%r12)
	testl	%ebx, %ebx
	jns	LBB0_6
## %bb.7:
	movq	_BATTERY_MINUTES@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_6:
	movq	_BATTERY_PERCENT@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %eax
	movl	%eax, 20(%r12)
	testl	%r13d, %r13d
	jns	LBB0_9
## %bb.10:
	movq	_BATTERY_DISCHARGING@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_9:
	movq	_BATTERY_CHARGING@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %eax
	movl	%eax, 16(%r12)
	movq	$0, 8(%r12)
	movq	%r14, %rdi
	callq	_clone_event_cmd_list
	movl	%eax, 4(%r12)
LBB0_12:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of memory"

	.comm	_battery_watch_list,8,3         ## @battery_watch_list
	.comm	_BATTERY_MINUTES,4,2            ## @BATTERY_MINUTES
	.comm	_BATTERY_PERCENT,4,2            ## @BATTERY_PERCENT
	.comm	_BATTERY_DISCHARGING,4,2        ## @BATTERY_DISCHARGING
	.comm	_BATTERY_CHARGING,4,2           ## @BATTERY_CHARGING
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_register_battery_handlers      ; -- Begin function register_battery_handlers
	.p2align	2
_register_battery_handlers:             ; @register_battery_handlers
	.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	x22, x0
	cmp	w1, #0
	cneg	w8, w1, mi
	mov	w0, #-1
	cmp	w22, #100
	b.gt	LBB0_7
; %bb.1:
	cmp	w8, #1
	b.ne	LBB0_7
; %bb.2:
	mov	x19, x2
	cbz	x2, LBB0_6
; %bb.3:
	mov	x20, x1
	mov	w0, #32
	bl	_malloc
	mov	x21, x0
	cbnz	x0, LBB0_5
; %bb.4:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_5:
Lloh2:
	adrp	x8, _battery_watch_list@GOTPAGE
Lloh3:
	ldr	x8, [x8, _battery_watch_list@GOTPAGEOFF]
	ldr	x9, [x8]
	str	x9, [x21, #24]
	str	x21, [x8]
	cmp	w22, #0
	cneg	w8, w22, mi
	str	w8, [x21]
Lloh4:
	adrp	x8, _BATTERY_MINUTES@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BATTERY_MINUTES@GOTPAGEOFF]
Lloh6:
	adrp	x9, _BATTERY_PERCENT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _BATTERY_PERCENT@GOTPAGEOFF]
	csel	x8, x8, x9, lt
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _BATTERY_DISCHARGING@GOTPAGE
Lloh9:
	ldr	x9, [x9, _BATTERY_DISCHARGING@GOTPAGEOFF]
Lloh10:
	adrp	x10, _BATTERY_CHARGING@GOTPAGE
Lloh11:
	ldr	x10, [x10, _BATTERY_CHARGING@GOTPAGEOFF]
	str	w8, [x21, #20]
	cmp	w20, #0
	csel	x8, x9, x10, lt
	ldr	w8, [x8]
	str	w8, [x21, #16]
	str	xzr, [x21, #8]
	mov	x0, x19
	bl	_clone_event_cmd_list
	mov	x8, x0
	mov	w0, #0
	str	w8, [x21, #4]
	b	LBB0_7
LBB0_6:
	mov	w0, #0
LBB0_7:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of memory"

	.comm	_battery_watch_list,8,3         ; @battery_watch_list
	.comm	_BATTERY_MINUTES,4,2            ; @BATTERY_MINUTES
	.comm	_BATTERY_PERCENT,4,2            ; @BATTERY_PERCENT
	.comm	_BATTERY_DISCHARGING,4,2        ; @BATTERY_DISCHARGING
	.comm	_BATTERY_CHARGING,4,2           ; @BATTERY_CHARGING
.subsections_via_symbols
