	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_matrix_master_scan             ## -- Begin function matrix_master_scan
	.p2align	4, 0x90
_matrix_master_scan:                    ## @matrix_master_scan
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%eax, %eax
	callq	__matrix_scan
	movl	%eax, %r15d
	movq	_ROWS_PER_HAND@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	testl	%eax, %eax
	jle	LBB0_18
## %bb.1:
	movq	_isLeftHand@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpq	$0, (%rcx)
	movq	_matrix@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r8
	movq	_serial_master_buffer@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	$0, %r9d
	cmoveq	%rax, %r9
	cmpl	$4, %eax
	jb	LBB0_12
## %bb.2:
	leaq	(%r8,%r9,8), %rdx
	movq	%rcx, %rsi
	subq	%rdx, %rsi
	cmpq	$32, %rsi
	jae	LBB0_4
## %bb.3:
	xorl	%edx, %edx
	jmp	LBB0_12
LBB0_4:
	movl	%eax, %edx
	andl	$-4, %edx
	leaq	-4(%rdx), %rsi
	movq	%rsi, %rbx
	shrq	$2, %rbx
	incq	%rbx
	movl	%ebx, %r10d
	andl	$3, %r10d
	cmpq	$12, %rsi
	jae	LBB0_6
## %bb.5:
	xorl	%edi, %edi
	jmp	LBB0_8
LBB0_6:
	andq	$-4, %rbx
	leaq	(%r8,%r9,8), %rsi
	addq	$112, %rsi
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movups	-112(%rsi,%rdi,8), %xmm0
	movups	-96(%rsi,%rdi,8), %xmm1
	movups	%xmm0, (%rcx,%rdi,8)
	movups	%xmm1, 16(%rcx,%rdi,8)
	movups	-80(%rsi,%rdi,8), %xmm0
	movups	-64(%rsi,%rdi,8), %xmm1
	movups	%xmm0, 32(%rcx,%rdi,8)
	movups	%xmm1, 48(%rcx,%rdi,8)
	movups	-48(%rsi,%rdi,8), %xmm0
	movups	-32(%rsi,%rdi,8), %xmm1
	movups	%xmm0, 64(%rcx,%rdi,8)
	movups	%xmm1, 80(%rcx,%rdi,8)
	movups	-16(%rsi,%rdi,8), %xmm0
	movups	(%rsi,%rdi,8), %xmm1
	movups	%xmm0, 96(%rcx,%rdi,8)
	movups	%xmm1, 112(%rcx,%rdi,8)
	addq	$16, %rdi
	addq	$-4, %rbx
	jne	LBB0_7
LBB0_8:
	testq	%r10, %r10
	je	LBB0_11
## %bb.9:
	leaq	(%rcx,%rdi,8), %rsi
	addq	$16, %rsi
	addq	%r9, %rdi
	leaq	(%r8,%rdi,8), %rdi
	addq	$16, %rdi
	shlq	$5, %r10
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movups	-16(%rdi,%rbx), %xmm0
	movups	(%rdi,%rbx), %xmm1
	movups	%xmm0, -16(%rsi,%rbx)
	movups	%xmm1, (%rsi,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %r10
	jne	LBB0_10
LBB0_11:
	cmpq	%rax, %rdx
	je	LBB0_18
LBB0_12:
	movq	%rdx, %r10
	notq	%r10
	addq	%rax, %r10
	movq	%rax, %rdi
	andq	$3, %rdi
	je	LBB0_15
## %bb.13:
	leaq	(%r8,%r9,8), %rbx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx,%rdx,8), %rsi
	movq	%rsi, (%rcx,%rdx,8)
	incq	%rdx
	decq	%rdi
	jne	LBB0_14
LBB0_15:
	cmpq	$3, %r10
	jb	LBB0_18
## %bb.16:
	leaq	(%r8,%r9,8), %rsi
	addq	$24, %rsi
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	-24(%rsi,%rdx,8), %rdi
	movq	%rdi, (%rcx,%rdx,8)
	movq	-16(%rsi,%rdx,8), %rdi
	movq	%rdi, 8(%rcx,%rdx,8)
	movq	-8(%rsi,%rdx,8), %rdi
	movq	%rdi, 16(%rcx,%rdx,8)
	movq	(%rsi,%rdx,8), %rdi
	movq	%rdi, 24(%rcx,%rdx,8)
	addq	$4, %rdx
	cmpq	%rdx, %rax
	jne	LBB0_17
LBB0_18:
	xorl	%eax, %eax
	callq	_serial_transaction
	testq	%rax, %rax
	je	LBB0_22
## %bb.19:
	movq	_error_count@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	1(%rcx), %rdx
	movq	%rdx, (%rax)
	movq	_ERROR_DISCONNECT_COUNT@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	jl	LBB0_23
## %bb.20:
	movl	(%r14), %esi
	testl	%esi, %esi
	jle	LBB0_23
## %bb.21:
	movq	_isLeftHand@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	movq	_matrix@GOTPCREL(%rip), %rax
	cmovneq	%rsi, %rdi
	shlq	$3, %rdi
	addq	(%rax), %rdi
	shlq	$3, %rsi
	callq	___bzero
	jmp	LBB0_23
LBB0_22:
	movq	_error_count@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
LBB0_23:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_isLeftHand,8,3                 ## @isLeftHand
	.comm	_ROWS_PER_HAND,4,2              ## @ROWS_PER_HAND
	.comm	_matrix,8,3                     ## @matrix
	.comm	_serial_master_buffer,8,3       ## @serial_master_buffer
	.comm	_TXLED1,4,2                     ## @TXLED1
	.comm	_error_count,8,3                ## @error_count
	.comm	_ERROR_DISCONNECT_COUNT,8,3     ## @ERROR_DISCONNECT_COUNT
	.comm	_TXLED0,4,2                     ## @TXLED0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_matrix_master_scan             ; -- Begin function matrix_master_scan
	.p2align	2
_matrix_master_scan:                    ; @matrix_master_scan
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	bl	__matrix_scan
	mov	x19, x0
Lloh0:
	adrp	x20, _ROWS_PER_HAND@GOTPAGE
Lloh1:
	ldr	x20, [x20, _ROWS_PER_HAND@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.1:
	mov	x11, #0
Lloh2:
	adrp	x9, _isLeftHand@GOTPAGE
Lloh3:
	ldr	x9, [x9, _isLeftHand@GOTPAGEOFF]
Lloh4:
	ldr	x12, [x9]
Lloh5:
	adrp	x9, _matrix@GOTPAGE
Lloh6:
	ldr	x9, [x9, _matrix@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
Lloh8:
	adrp	x10, _serial_master_buffer@GOTPAGE
Lloh9:
	ldr	x10, [x10, _serial_master_buffer@GOTPAGEOFF]
Lloh10:
	ldr	x10, [x10]
	cmp	x12, #0
	csel	x12, x8, xzr, eq
	cmp	w8, #8
	b.lo	LBB0_7
; %bb.2:
	add	x14, x9, x12, lsl #3
	sub	x11, x10, x14
	cmp	x11, #64
	b.hs	LBB0_4
; %bb.3:
	mov	x11, #0
	b	LBB0_7
LBB0_4:
	and	x11, x8, #0xfffffff8
	add	x13, x10, #32
	add	x14, x14, #32
	mov	x15, x11
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x14, #-32]
	ldp	q2, q3, [x14], #64
	stp	q0, q1, [x13, #-32]
	stp	q2, q3, [x13], #64
	subs	x15, x15, #8
	b.ne	LBB0_5
; %bb.6:
	cmp	x11, x8
	b.eq	LBB0_9
LBB0_7:
	add	x12, x12, x11
	add	x9, x9, x12, lsl #3
	add	x10, x10, x11, lsl #3
	sub	x8, x8, x11
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x9], #8
	str	x11, [x10], #8
	subs	x8, x8, #1
	b.ne	LBB0_8
LBB0_9:
	bl	_serial_transaction
Lloh11:
	adrp	x8, _error_count@GOTPAGE
Lloh12:
	ldr	x8, [x8, _error_count@GOTPAGEOFF]
	cbz	x0, LBB0_13
; %bb.10:
	ldr	x9, [x8]
	add	x10, x9, #1
	str	x10, [x8]
Lloh13:
	adrp	x8, _ERROR_DISCONNECT_COUNT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ERROR_DISCONNECT_COUNT@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cmp	x9, x8
	b.lt	LBB0_14
; %bb.11:
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.12:
Lloh16:
	adrp	x9, _isLeftHand@GOTPAGE
Lloh17:
	ldr	x9, [x9, _isLeftHand@GOTPAGEOFF]
Lloh18:
	adrp	x10, _matrix@GOTPAGE
Lloh19:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
Lloh21:
	ldr	x10, [x10]
	cmp	x9, #0
	csel	x9, xzr, x8, eq
	add	x0, x10, x9, lsl #3
	lsl	x1, x8, #3
	bl	_bzero
	b	LBB0_14
LBB0_13:
	str	xzr, [x8]
LBB0_14:
	bl	_matrix_scan_quantum
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_isLeftHand,8,3                 ; @isLeftHand
	.comm	_ROWS_PER_HAND,4,2              ; @ROWS_PER_HAND
	.comm	_matrix,8,3                     ; @matrix
	.comm	_serial_master_buffer,8,3       ; @serial_master_buffer
	.comm	_TXLED1,4,2                     ; @TXLED1
	.comm	_error_count,8,3                ; @error_count
	.comm	_ERROR_DISCONNECT_COUNT,8,3     ; @ERROR_DISCONNECT_COUNT
	.comm	_TXLED0,4,2                     ; @TXLED0
.subsections_via_symbols
