	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function applespi_got_data
_applespi_got_data:                     ## @applespi_got_data
	.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
	movq	%rdi, %r14
	movq	32(%rdi), %rsi
	movq	_APPLESPI_PACKET_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_applespi_verify_crc
	testl	%eax, %eax
	je	LBB0_4
## %bb.1:
	movq	32(%r14), %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_applespi_debug_print_read_packet
	movl	28(%rbx), %edi
	callq	_le16_to_cpu
	movl	%eax, %r12d
	movl	24(%rbx), %edi
	callq	_le16_to_cpu
	movl	%eax, %r15d
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movl	20(%rbx), %edi
	callq	_le16_to_cpu
	movl	%eax, %r13d
	cmpl	$5, %eax
	jb	LBB0_7
## %bb.2:
	movq	16(%r14), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
LBB0_3:
	xorl	%eax, %eax
	callq	_dev_warn_ratelimited
	jmp	LBB0_21
LBB0_4:
	leaq	40(%r14), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	cmpq	$0, 48(%r14)
	je	LBB0_6
## %bb.5:
	movq	$0, (%r14)
	addq	$44, %r14
	movq	%r14, %rdi
	callq	_wake_up_all
LBB0_6:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
LBB0_7:
	movl	%r15d, %eax
	orl	%r12d, %eax
	je	LBB0_12
## %bb.8:
	movl	8(%r14), %ecx
	cmpl	%ecx, %r12d
	jne	LBB0_18
## %bb.9:
	leal	(%r15,%r12), %edx
	movq	_MAX_PKTS_PER_MSG@GOTPCREL(%rip), %rcx
	movq	_APPLESPI_PACKET_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	imull	(%rcx), %eax
	cmpl	%eax, %edx
	ja	LBB0_11
## %bb.10:
	movl	%r13d, %edx
	addl	%r12d, %edx
	cmpl	%eax, %edx
	jbe	LBB0_23
LBB0_11:
	movq	16(%r14), %rdi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_3
LBB0_12:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leaq	16(%rbx), %r15
	movl	%r13d, %r12d
LBB0_13:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%r12d, %edx
	callq	_applespi_verify_crc
	testl	%eax, %eax
	je	LBB0_22
## %bb.14:
	movl	(%r15), %edi
	callq	_le16_to_cpu
	movq	_MSG_HEADER_SIZE@GOTPCREL(%rip), %rbx
	addl	$-2, %r12d
	movl	%r12d, %ecx
	subl	(%rbx), %ecx
	cmpl	%ecx, %eax
	jne	LBB0_19
## %bb.15:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx), %rax
	movq	_PACKET_TYPE_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_30
## %bb.16:
	movq	8(%rbx), %rcx
	movq	_PACKET_DEV_KEYB@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_25
## %bb.17:
	addq	$8, %r15
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_applespi_handle_keyboard_event
	jmp	LBB0_22
LBB0_18:
	movq	16(%r14), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%r12d, %edx
	jmp	LBB0_20
LBB0_19:
	movq	16(%r14), %r13
	movl	(%r15), %edi
	callq	_le16_to_cpu
	subl	(%rbx), %r12d
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdi
	movl	%eax, %edx
	movl	%r12d, %ecx
LBB0_20:
	xorl	%eax, %eax
	callq	_dev_warn_ratelimited
LBB0_21:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_22:
	movl	$0, 8(%r14)
	movq	(%rbx), %rax
	movq	_PACKET_TYPE_WRITE@GOTPCREL(%rip), %rcx
	xorl	%esi, %esi
	cmpq	(%rcx), %rax
	sete	%sil
	movq	%r14, %rdi
	movl	$1, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_applespi_msg_complete          ## TAILCALL
LBB0_23:
	movl	%r12d, %edi
	addq	24(%r14), %rdi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leaq	16(%rbx), %rsi
	movl	%r13d, %edx
	callq	_memcpy
	movl	8(%r14), %r12d
	addl	%r13d, %r12d
	movl	%r12d, 8(%r14)
	testl	%r15d, %r15d
	je	LBB0_32
## %bb.24:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	movq	_PACKET_DEV_TPAD@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_30
## %bb.26:
	leaq	4(%r15), %r12
	movq	_fingers@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	4(%r15), %edx
	movq	%r12, %rdi
	callq	_struct_size
	movq	%rax, %r13
	movl	(%r15), %edi
	callq	_le16_to_cpu
	addl	$2, %eax
	cltq
	cmpq	%rax, %r13
	jne	LBB0_33
## %bb.27:
	movl	(%r12), %edx
	movq	_MAX_FINGERS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	cmpl	%ecx, %edx
	jbe	LBB0_29
## %bb.28:
	movq	16(%r14), %rdi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_warn_ratelimited
	movl	(%rbx), %eax
	movl	%eax, (%r12)
LBB0_29:
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_report_tp_state
	jmp	LBB0_21
LBB0_30:
	movq	_PACKET_TYPE_WRITE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_22
## %bb.31:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	callq	_applespi_handle_cmd_response
	jmp	LBB0_22
LBB0_32:
	movq	24(%r14), %r15
	jmp	LBB0_13
LBB0_33:
	movq	16(%r14), %r12
	movl	(%r15), %edi
	callq	_le16_to_cpu
	movl	4(%r15), %ecx
	leaq	L_.str.4(%rip), %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	movq	%r13, %r8
	xorl	%eax, %eax
	callq	_dev_warn_ratelimited
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_APPLESPI_PACKET_SIZE,4,2       ## @APPLESPI_PACKET_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Received corrupted packet (invalid packet length %u)\n"

L_.str.1:                               ## @.str.1
	.asciz	"Received unexpected offset (got %u, expected %u)\n"

	.comm	_MAX_PKTS_PER_MSG,4,2           ## @MAX_PKTS_PER_MSG
L_.str.2:                               ## @.str.2
	.asciz	"Received message too large (size %u)\n"

	.comm	_MSG_HEADER_SIZE,4,2            ## @MSG_HEADER_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"Received corrupted packet (invalid message length %u - expected %u)\n"

	.comm	_PACKET_TYPE_READ,8,3           ## @PACKET_TYPE_READ
	.comm	_PACKET_DEV_KEYB,8,3            ## @PACKET_DEV_KEYB
	.comm	_PACKET_DEV_TPAD,8,3            ## @PACKET_DEV_TPAD
	.comm	_fingers,4,2                    ## @fingers
L_.str.4:                               ## @.str.4
	.asciz	"Received corrupted packet (invalid message length %u - num-fingers %u, tp-len %zu)\n"

	.comm	_MAX_FINGERS,4,2                ## @MAX_FINGERS
L_.str.5:                               ## @.str.5
	.asciz	"Number of reported fingers (%u) exceeds max (%u))\n"

	.comm	_PACKET_TYPE_WRITE,8,3          ## @PACKET_TYPE_WRITE
	.no_dead_strip	_applespi_got_data
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function applespi_got_data
_applespi_got_data:                     ; @applespi_got_data
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x0
	ldr	x1, [x0, #32]
Lloh0:
	adrp	x25, _APPLESPI_PACKET_SIZE@GOTPAGE
Lloh1:
	ldr	x25, [x25, _APPLESPI_PACKET_SIZE@GOTPAGEOFF]
	ldr	w2, [x25]
	bl	_applespi_verify_crc
	cbz	w0, LBB0_5
; %bb.1:
	ldr	x20, [x19, #32]
	mov	x0, x19
	mov	x1, x20
	bl	_applespi_debug_print_read_packet
	ldr	w0, [x20, #28]
	bl	_le16_to_cpu
	mov	x21, x0
	ldr	w0, [x20, #24]
	bl	_le16_to_cpu
	mov	x23, x0
	ldr	w0, [x20, #20]
	bl	_le16_to_cpu
	mov	x22, x0
Lloh2:
	adrp	x24, _PACKET_TYPE_WRITE@GOTPAGE
Lloh3:
	ldr	x24, [x24, _PACKET_TYPE_WRITE@GOTPAGEOFF]
	cmp	w0, #5
	b.lo	LBB0_8
; %bb.2:
	ldr	x0, [x19, #16]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
LBB0_3:
	bl	_dev_warn_ratelimited
LBB0_4:
	str	wzr, [x19, #8]
	ldr	x8, [x20]
	ldr	x9, [x24]
	cmp	x8, x9
	cset	w1, eq
	mov	x0, x19
	mov	w2, #1
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_applespi_msg_complete
LBB0_5:
	add	x20, x19, #40
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #48]
	cbz	x8, LBB0_7
; %bb.6:
	str	xzr, [x19]
	add	x0, x19, #44
	bl	_wake_up_all
LBB0_7:
	mov	x0, x20
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_spin_unlock_irqrestore
LBB0_8:
	orr	w8, w23, w21
	cbz	w8, LBB0_13
; %bb.9:
	ldr	w8, [x19, #8]
	cmp	w21, w8
	b.ne	LBB0_19
; %bb.10:
Lloh6:
	adrp	x8, _MAX_PKTS_PER_MSG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAX_PKTS_PER_MSG@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x25]
	mul	w8, w9, w8
	add	w2, w23, w21
	cmp	w2, w8
	b.hi	LBB0_12
; %bb.11:
	add	w2, w22, w21
	cmp	w2, w8
	b.ls	LBB0_22
LBB0_12:
	ldr	x0, [x19, #16]
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_13:
	add	x21, x20, #16
LBB0_14:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_applespi_verify_crc
	cbz	w0, LBB0_4
; %bb.15:
	ldr	w0, [x21]
	bl	_le16_to_cpu
Lloh11:
	adrp	x23, _MSG_HEADER_SIZE@GOTPAGE
Lloh12:
	ldr	x23, [x23, _MSG_HEADER_SIZE@GOTPAGEOFF]
	ldr	w8, [x23]
	sub	w25, w22, #2
	sub	w8, w25, w8
	cmp	w0, w8
	b.ne	LBB0_20
; %bb.16:
	ldr	x8, [x20]
Lloh13:
	adrp	x9, _PACKET_TYPE_READ@GOTPAGE
Lloh14:
	ldr	x9, [x9, _PACKET_TYPE_READ@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_29
; %bb.17:
	ldr	x9, [x20, #8]
Lloh16:
	adrp	x10, _PACKET_DEV_KEYB@GOTPAGE
Lloh17:
	ldr	x10, [x10, _PACKET_DEV_KEYB@GOTPAGEOFF]
Lloh18:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_24
; %bb.18:
	add	x1, x21, #8
	mov	x0, x19
	bl	_applespi_handle_keyboard_event
	b	LBB0_4
LBB0_19:
	ldr	x0, [x19, #16]
	str	x8, [sp]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	b	LBB0_3
LBB0_20:
	ldr	x22, [x19, #16]
	ldr	w0, [x21]
	bl	_le16_to_cpu
	mov	x2, x0
	ldr	w8, [x23]
	sub	w8, w25, w8
	str	x8, [sp]
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_21:
	mov	x0, x22
	b	LBB0_3
LBB0_22:
	ldr	x8, [x19, #24]
	add	x0, x8, w21, uxtw
	add	x1, x20, #16
	mov	x2, x22
	bl	_memcpy
	ldr	w8, [x19, #8]
	add	w22, w8, w22
	str	w22, [x19, #8]
	cbz	w23, LBB0_31
; %bb.23:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_24:
Lloh23:
	adrp	x10, _PACKET_DEV_TPAD@GOTPAGE
Lloh24:
	ldr	x10, [x10, _PACKET_DEV_TPAD@GOTPAGEOFF]
Lloh25:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_29
; %bb.25:
	mov	x22, x21
	ldr	w2, [x22, #4]!
Lloh26:
	adrp	x8, _fingers@GOTPAGE
Lloh27:
	ldr	x8, [x8, _fingers@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_struct_size
	mov	x23, x0
	ldr	w0, [x21]
	bl	_le16_to_cpu
	add	w8, w0, #2
	cmp	x23, w8, sxtw
	b.ne	LBB0_32
; %bb.26:
	ldr	w2, [x22]
Lloh29:
	adrp	x21, _MAX_FINGERS@GOTPAGE
Lloh30:
	ldr	x21, [x21, _MAX_FINGERS@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w2, w8
	b.ls	LBB0_28
; %bb.27:
	ldr	x0, [x19, #16]
	str	x8, [sp]
Lloh31:
	adrp	x1, l_.str.5@PAGE
Lloh32:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_warn_ratelimited
	ldr	w8, [x21]
	str	w8, [x22]
LBB0_28:
	mov	x0, x19
	mov	x1, x22
	bl	_report_tp_state
	b	LBB0_4
LBB0_29:
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.30:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_applespi_handle_cmd_response
	b	LBB0_4
LBB0_31:
	ldr	x21, [x19, #24]
	b	LBB0_14
LBB0_32:
	ldr	x22, [x19, #16]
	ldr	w0, [x21]
	bl	_le16_to_cpu
	mov	x2, x0
	ldr	w8, [x21, #4]
	stp	x8, x23, [sp]
Lloh33:
	adrp	x1, l_.str.4@PAGE
Lloh34:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_21
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_APPLESPI_PACKET_SIZE,4,2       ; @APPLESPI_PACKET_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Received corrupted packet (invalid packet length %u)\n"

l_.str.1:                               ; @.str.1
	.asciz	"Received unexpected offset (got %u, expected %u)\n"

	.comm	_MAX_PKTS_PER_MSG,4,2           ; @MAX_PKTS_PER_MSG
l_.str.2:                               ; @.str.2
	.asciz	"Received message too large (size %u)\n"

	.comm	_MSG_HEADER_SIZE,4,2            ; @MSG_HEADER_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"Received corrupted packet (invalid message length %u - expected %u)\n"

	.comm	_PACKET_TYPE_READ,8,3           ; @PACKET_TYPE_READ
	.comm	_PACKET_DEV_KEYB,8,3            ; @PACKET_DEV_KEYB
	.comm	_PACKET_DEV_TPAD,8,3            ; @PACKET_DEV_TPAD
	.comm	_fingers,4,2                    ; @fingers
l_.str.4:                               ; @.str.4
	.asciz	"Received corrupted packet (invalid message length %u - num-fingers %u, tp-len %zu)\n"

	.comm	_MAX_FINGERS,4,2                ; @MAX_FINGERS
l_.str.5:                               ; @.str.5
	.asciz	"Number of reported fingers (%u) exceeds max (%u))\n"

	.comm	_PACKET_TYPE_WRITE,8,3          ; @PACKET_TYPE_WRITE
	.no_dead_strip	_applespi_got_data
.subsections_via_symbols
