	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hgpk_process_advanced_packet
_hgpk_process_advanced_packet:          ## @hgpk_process_advanced_packet
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	16(%rdi), %rdx
	movq	(%rdi), %rax
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %rdi
	movzbl	2(%rax), %r13d
	movl	%r13d, %r14d
	andl	$2, %r14d
	movl	%r14d, -80(%rbp)                ## 4-byte Spill
	shrl	%r14d
	movzbl	3(%rax), %ebx
	movl	%ebx, %ecx
	andl	$1, %ecx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %r15d
	shrl	%r15d
	andl	$1, %r15d
	movzbl	1(%rax), %ecx
	movl	%r13d, %r12d
	andl	$120, %r12d
	shll	$4, %r12d
	orl	%ecx, %r12d
	movzbl	4(%rax), %ecx
	andl	$112, %ebx
	shll	$3, %ebx
	orl	%ecx, %ebx
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdx), %rcx
	movq	_HGPK_MODE_GLIDESENSOR@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	jne	LBB0_3
## %bb.1:
	movzbl	5(%rax), %edx
	movq	_ABS_PRESSURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%edx, -76(%rbp)                 ## 4-byte Spill
	callq	_input_report_abs
	movq	_tpdebug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.2:
	andl	$1, %r13d
	leaq	L_.str(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %edx
	movl	%r14d, %ecx
	movl	-76(%rbp), %r8d                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_psmouse_dbg
	jmp	LBB0_5
LBB0_3:
	movq	_tpdebug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.4:
	leaq	L_.str.1(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_psmouse_dbg
LBB0_5:
	movq	_tpdebug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.6:
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%r15d, %ecx
	movl	%r12d, %r8d
	movl	%ebx, %r9d
	xorl	%eax, %eax
	callq	_psmouse_dbg
LBB0_7:
	movq	_BTN_TOUCH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rdi
	movl	%r14d, %edx
	callq	_input_report_key
	movq	_BTN_LEFT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	callq	_input_report_key
	movq	_BTN_RIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%r15d, %edx
	callq	_input_report_key
	cmpl	$0, -80(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_9
## %bb.8:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_hgpk_reset_hack_state
	jmp	LBB0_22
LBB0_9:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	8(%rsi), %eax
	movl	%eax, %r14d
	subl	%r12d, %r14d
	jne	LBB0_15
## %bb.10:
	cmpl	12(%rsi), %ebx
	jne	LBB0_15
## %bb.11:
	movq	16(%rsi), %rax
	leaq	1(%rax), %rcx
	movq	%rcx, 16(%rsi)
	movq	_SPEW_WATCH_COUNT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_22
## %bb.12:
	movq	_tpdebug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_14
## %bb.13:
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_psmouse_dbg
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
LBB0_14:
	movq	_RECALIBRATING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rsi)
	addq	$24, %rsi
	movq	_spew_delay@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rsi, %rbx
	callq	_msecs_to_jiffies
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_psmouse_queue_work
	jmp	LBB0_22
LBB0_15:
	movq	$0, 16(%rsi)
	movq	(%rsi), %rcx
	movq	_HGPK_MODE_PENTABLET@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_21
## %bb.16:
	cmpl	$-1, %eax
	je	LBB0_21
## %bb.17:
	movl	12(%rsi), %r13d
	subl	%ebx, %r13d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %esi
	movl	%r13d, %edx
	callq	_hgpk_discard_decay_hack
	testq	%rax, %rax
	je	LBB0_20
## %bb.18:
	movq	_tpdebug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	je	LBB0_22
## %bb.19:
	leaq	L_.str.4(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_psmouse_dbg
	jmp	LBB0_22
LBB0_20:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movl	%r15d, %edx
	movl	%r14d, %ecx
	movl	%r13d, %r8d
	callq	_hgpk_spewing_hack
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
LBB0_21:
	movq	_ABS_X@GOTPCREL(%rip), %rax
	movq	%rsi, %r14
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%r12d, %edx
	callq	_input_report_abs
	movq	_ABS_Y@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_input_report_abs
	movl	%r12d, 8(%r14)
	movl	%ebx, 12(%r14)
LBB0_22:
	movq	%r13, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_input_sync                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_HGPK_MODE_GLIDESENSOR,8,3      ## @HGPK_MODE_GLIDESENSOR
	.comm	_ABS_PRESSURE,4,2               ## @ABS_PRESSURE
	.comm	_tpdebug,8,3                    ## @tpdebug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pd=%d fd=%d z=%d"

L_.str.1:                               ## @.str.1
	.asciz	"pd=%d "

L_.str.2:                               ## @.str.2
	.asciz	"l=%d r=%d x=%d y=%d\n"

	.comm	_BTN_TOUCH,4,2                  ## @BTN_TOUCH
	.comm	_BTN_LEFT,4,2                   ## @BTN_LEFT
	.comm	_BTN_RIGHT,4,2                  ## @BTN_RIGHT
	.comm	_SPEW_WATCH_COUNT,8,3           ## @SPEW_WATCH_COUNT
L_.str.3:                               ## @.str.3
	.asciz	"hard spew detected\n"

	.comm	_RECALIBRATING,4,2              ## @RECALIBRATING
	.comm	_spew_delay,4,2                 ## @spew_delay
	.comm	_HGPK_MODE_PENTABLET,8,3        ## @HGPK_MODE_PENTABLET
L_.str.4:                               ## @.str.4
	.asciz	"discarding\n"

	.comm	_ABS_X,4,2                      ## @ABS_X
	.comm	_ABS_Y,4,2                      ## @ABS_Y
	.no_dead_strip	_hgpk_process_advanced_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hgpk_process_advanced_packet
_hgpk_process_advanced_packet:          ; @hgpk_process_advanced_packet
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x0
	ldp	x19, x27, [x0, #8]
	ldr	x8, [x0]
	ldrb	w22, [x8, #2]
	and	w28, w22, #0x2
	ubfx	w25, w22, #1, #1
	ldrb	w9, [x8, #3]
	and	w23, w9, #0x1
	ubfx	w24, w9, #1, #1
	ldrb	w10, [x8, #1]
	lsl	w11, w22, #4
	and	w11, w11, #0x780
	orr	w10, w11, w10
	str	x10, [sp, #40]                  ; 8-byte Folded Spill
	ldrb	w10, [x8, #4]
	lsl	w9, w9, #3
	and	w9, w9, #0x380
	orr	w9, w9, w10
	str	x9, [sp, #32]                   ; 8-byte Folded Spill
	ldr	x9, [x27]
Lloh0:
	adrp	x10, _HGPK_MODE_GLIDESENSOR@GOTPAGE
Lloh1:
	ldr	x10, [x10, _HGPK_MODE_GLIDESENSOR@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
Lloh3:
	adrp	x21, _tpdebug@GOTPAGE
Lloh4:
	ldr	x21, [x21, _tpdebug@GOTPAGEOFF]
	cmp	x9, x10
	b.ne	LBB0_3
; %bb.1:
	ldrb	w26, [x8, #5]
Lloh5:
	adrp	x8, _ABS_PRESSURE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ABS_PRESSURE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x26
	bl	_input_report_abs
	ldr	x8, [x21]
	cbz	x8, LBB0_7
; %bb.2:
	and	w8, w22, #0x1
	stp	x25, x26, [sp, #8]
	str	x8, [sp]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_5
LBB0_3:
	ldr	x8, [x21]
	cbz	x8, LBB0_7
; %bb.4:
	mov	x8, x25
	str	x8, [sp]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_5:
	mov	x0, x20
	bl	_psmouse_dbg
Lloh12:
	adrp	x8, _tpdebug@GOTPAGE
Lloh13:
	ldr	x8, [x8, _tpdebug@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.6:
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	ldr	x8, [sp, #40]                   ; 8-byte Folded Reload
	stp	x8, x9, [sp, #16]
	stp	x23, x24, [sp]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_psmouse_dbg
LBB0_7:
Lloh17:
	adrp	x8, _BTN_TOUCH@GOTPAGE
Lloh18:
	ldr	x8, [x8, _BTN_TOUCH@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x25
	bl	_input_report_key
Lloh20:
	adrp	x8, _BTN_LEFT@GOTPAGE
Lloh21:
	ldr	x8, [x8, _BTN_LEFT@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_input_report_key
Lloh23:
	adrp	x8, _BTN_RIGHT@GOTPAGE
Lloh24:
	ldr	x8, [x8, _BTN_RIGHT@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x24
	bl	_input_report_key
	cbnz	w28, LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_hgpk_reset_hack_state
	b	LBB0_22
LBB0_9:
	ldr	w8, [x27, #8]
	ldp	x22, x9, [sp, #32]              ; 16-byte Folded Reload
	subs	w25, w8, w9
	b.ne	LBB0_15
; %bb.10:
	ldr	w9, [x27, #12]
	cmp	w22, w9
	b.ne	LBB0_15
; %bb.11:
	ldr	x8, [x27, #16]
	add	x9, x8, #1
	str	x9, [x27, #16]
Lloh26:
	adrp	x9, _SPEW_WATCH_COUNT@GOTPAGE
Lloh27:
	ldr	x9, [x9, _SPEW_WATCH_COUNT@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_22
; %bb.12:
Lloh29:
	adrp	x8, _tpdebug@GOTPAGE
Lloh30:
	ldr	x8, [x8, _tpdebug@GOTPAGEOFF]
Lloh31:
	ldr	x8, [x8]
	cbz	x8, LBB0_14
; %bb.13:
Lloh32:
	adrp	x1, l_.str.3@PAGE
Lloh33:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_psmouse_dbg
LBB0_14:
Lloh34:
	adrp	x8, _RECALIBRATING@GOTPAGE
Lloh35:
	ldr	x8, [x8, _RECALIBRATING@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	str	w8, [x27, #28]
	add	x21, x27, #24
Lloh37:
	adrp	x8, _spew_delay@GOTPAGE
Lloh38:
	ldr	x8, [x8, _spew_delay@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	mov	x2, x0
	mov	x0, x20
	mov	x1, x21
	bl	_psmouse_queue_work
	b	LBB0_22
LBB0_15:
	str	xzr, [x27, #16]
	ldr	x9, [x27]
Lloh40:
	adrp	x10, _HGPK_MODE_PENTABLET@GOTPAGE
Lloh41:
	ldr	x10, [x10, _HGPK_MODE_PENTABLET@GOTPAGEOFF]
Lloh42:
	ldr	x10, [x10]
	cmp	x9, x10
	b.eq	LBB0_21
; %bb.16:
	cmn	w8, #1
	b.eq	LBB0_21
; %bb.17:
	ldr	w8, [x27, #12]
	sub	w26, w8, w22
	mov	x0, x20
	mov	x1, x25
	mov	x2, x26
	bl	_hgpk_discard_decay_hack
	cbz	x0, LBB0_20
; %bb.18:
Lloh43:
	adrp	x8, _tpdebug@GOTPAGE
Lloh44:
	ldr	x8, [x8, _tpdebug@GOTPAGEOFF]
Lloh45:
	ldr	x8, [x8]
	cbz	x8, LBB0_22
; %bb.19:
Lloh46:
	adrp	x1, l_.str.4@PAGE
Lloh47:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	bl	_psmouse_dbg
	b	LBB0_22
LBB0_20:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x24
	mov	x3, x25
	mov	x4, x26
	bl	_hgpk_spewing_hack
LBB0_21:
Lloh48:
	adrp	x8, _ABS_X@GOTPAGE
Lloh49:
	ldr	x8, [x8, _ABS_X@GOTPAGEOFF]
Lloh50:
	ldr	w1, [x8]
	mov	x0, x19
	ldr	x20, [sp, #40]                  ; 8-byte Folded Reload
	mov	x2, x20
	bl	_input_report_abs
Lloh51:
	adrp	x8, _ABS_Y@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ABS_Y@GOTPAGEOFF]
Lloh53:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	bl	_input_report_abs
	stp	w20, w22, [x27, #8]
LBB0_22:
	mov	x0, x19
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	b	_input_sync
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.cfi_endproc
                                        ; -- End function
	.comm	_HGPK_MODE_GLIDESENSOR,8,3      ; @HGPK_MODE_GLIDESENSOR
	.comm	_ABS_PRESSURE,4,2               ; @ABS_PRESSURE
	.comm	_tpdebug,8,3                    ; @tpdebug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pd=%d fd=%d z=%d"

l_.str.1:                               ; @.str.1
	.asciz	"pd=%d "

l_.str.2:                               ; @.str.2
	.asciz	"l=%d r=%d x=%d y=%d\n"

	.comm	_BTN_TOUCH,4,2                  ; @BTN_TOUCH
	.comm	_BTN_LEFT,4,2                   ; @BTN_LEFT
	.comm	_BTN_RIGHT,4,2                  ; @BTN_RIGHT
	.comm	_SPEW_WATCH_COUNT,8,3           ; @SPEW_WATCH_COUNT
l_.str.3:                               ; @.str.3
	.asciz	"hard spew detected\n"

	.comm	_RECALIBRATING,4,2              ; @RECALIBRATING
	.comm	_spew_delay,4,2                 ; @spew_delay
	.comm	_HGPK_MODE_PENTABLET,8,3        ; @HGPK_MODE_PENTABLET
l_.str.4:                               ; @.str.4
	.asciz	"discarding\n"

	.comm	_ABS_X,4,2                      ; @ABS_X
	.comm	_ABS_Y,4,2                      ; @ABS_Y
	.no_dead_strip	_hgpk_process_advanced_packet
.subsections_via_symbols
