	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hgpk_toggle_powersave
_hgpk_toggle_powersave:                 ## @hgpk_toggle_powersave
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %rax
	movq	_HGPK_MODEL_D@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	cmpq	(%rcx), %rax
	jl	LBB0_12
## %bb.1:
	movq	%rdi, %r14
	leaq	8(%rdi), %r12
	testl	%esi, %esi
	je	LBB0_8
## %bb.2:
	movq	_PSMOUSE_INITIALIZING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_psmouse_set_state
	movl	$21, %ebx
	movq	_PSMOUSE_CMD_DISABLE@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %esi
	movq	%r12, %rdi
	movl	$20, %edx
	callq	_ps2_sendbyte
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	$25, %edi
	callq	_msleep
	decl	%ebx
	cmpl	$1, %ebx
	ja	LBB0_3
LBB0_5:
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_hgpk_reset_device
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_psmouse_err
	movl	%ebx, %r15d
	jmp	LBB0_12
LBB0_8:
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_psmouse_dbg
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$236, %edx
	callq	_ps2_command
	movl	$-1, %r15d
	testq	%rax, %rax
	jne	LBB0_12
## %bb.9:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$236, %edx
	callq	_ps2_command
	testq	%rax, %rax
	jne	LBB0_12
## %bb.10:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$234, %edx
	callq	_ps2_command
	testq	%rax, %rax
	jne	LBB0_12
## %bb.11:
	movq	_PSMOUSE_IGNORE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_psmouse_set_state
	movq	%r12, %rdi
	movl	$236, %esi
	movl	$20, %edx
	callq	_ps2_sendbyte
	xorl	%r15d, %r15d
	jmp	LBB0_12
LBB0_7:
	movq	%r14, %rdi
	callq	_psmouse_activate
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	callq	_psmouse_dbg
LBB0_12:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HGPK_MODEL_D,8,3               ## @HGPK_MODEL_D
	.comm	_PSMOUSE_INITIALIZING,4,2       ## @PSMOUSE_INITIALIZING
	.comm	_PSMOUSE_CMD_DISABLE,4,2        ## @PSMOUSE_CMD_DISABLE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to reset device!\n"

L_.str.1:                               ## @.str.1
	.asciz	"Touchpad powered up.\n"

L_.str.2:                               ## @.str.2
	.asciz	"Powering off touchpad.\n"

	.comm	_PSMOUSE_IGNORE,4,2             ## @PSMOUSE_IGNORE
	.no_dead_strip	_hgpk_toggle_powersave
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hgpk_toggle_powersave
_hgpk_toggle_powersave:                 ; @hgpk_toggle_powersave
	.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	x20, x0
	ldr	x8, [x20], #8
Lloh0:
	adrp	x9, _HGPK_MODEL_D@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HGPK_MODEL_D@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_2
LBB0_1:
	mov	w20, #0
	b	LBB0_13
LBB0_2:
	mov	x19, x0
	cbz	w1, LBB0_8
; %bb.3:
Lloh3:
	adrp	x8, _PSMOUSE_INITIALIZING@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PSMOUSE_INITIALIZING@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_psmouse_set_state
	mov	w21, #21
Lloh6:
	adrp	x22, _PSMOUSE_CMD_DISABLE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _PSMOUSE_CMD_DISABLE@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x22]
	mov	x0, x20
	mov	w2, #20
	bl	_ps2_sendbyte
	cbz	w0, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w0, #25
	bl	_msleep
	sub	w21, w21, #1
	cmp	w21, #1
	b.hi	LBB0_4
LBB0_6:
	mov	x0, x19
	mov	w1, #0
	bl	_hgpk_reset_device
	mov	x20, x0
	cbz	w0, LBB0_12
; %bb.7:
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_psmouse_err
	b	LBB0_13
LBB0_8:
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_psmouse_dbg
	mov	x0, x20
	mov	x1, #0
	mov	w2, #236
	bl	_ps2_command
	cbnz	x0, LBB0_11
; %bb.9:
	mov	x0, x20
	mov	x1, #0
	mov	w2, #236
	bl	_ps2_command
	cbnz	x0, LBB0_11
; %bb.10:
	mov	x0, x20
	mov	x1, #0
	mov	w2, #234
	bl	_ps2_command
	cbz	x0, LBB0_14
LBB0_11:
	mov	w20, #-1
	b	LBB0_13
LBB0_12:
	mov	x0, x19
	bl	_psmouse_activate
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_psmouse_dbg
LBB0_13:
	mov	x0, x20
	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
LBB0_14:
Lloh14:
	adrp	x8, _PSMOUSE_IGNORE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PSMOUSE_IGNORE@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_psmouse_set_state
	mov	x0, x20
	mov	w1, #236
	mov	w2, #20
	bl	_ps2_sendbyte
	b	LBB0_1
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_HGPK_MODEL_D,8,3               ; @HGPK_MODEL_D
	.comm	_PSMOUSE_INITIALIZING,4,2       ; @PSMOUSE_INITIALIZING
	.comm	_PSMOUSE_CMD_DISABLE,4,2        ; @PSMOUSE_CMD_DISABLE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to reset device!\n"

l_.str.1:                               ; @.str.1
	.asciz	"Touchpad powered up.\n"

l_.str.2:                               ; @.str.2
	.asciz	"Powering off touchpad.\n"

	.comm	_PSMOUSE_IGNORE,4,2             ; @PSMOUSE_IGNORE
	.no_dead_strip	_hgpk_toggle_powersave
.subsections_via_symbols
