	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_matrix_scan                    ## -- Begin function matrix_scan
	.p2align	4, 0x90
_matrix_scan:                           ## @matrix_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	xorl	%eax, %eax
	callq	__matrix_scan
	movl	%eax, %ebx
	xorl	%eax, %eax
	callq	_serial_transaction
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	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_5
## %bb.2:
	movq	_ROWS_PER_HAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	testl	%esi, %esi
	jle	LBB0_5
## %bb.3:
	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_5
LBB0_4:
	movq	_error_count@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
LBB0_5:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TXLED1,4,2                     ## @TXLED1
	.comm	_error_count,8,3                ## @error_count
	.comm	_ERROR_DISCONNECT_COUNT,8,3     ## @ERROR_DISCONNECT_COUNT
	.comm	_isLeftHand,8,3                 ## @isLeftHand
	.comm	_ROWS_PER_HAND,4,2              ## @ROWS_PER_HAND
	.comm	_matrix,8,3                     ## @matrix
	.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_scan                    ; -- Begin function matrix_scan
	.p2align	2
_matrix_scan:                           ; @matrix_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
	bl	_serial_transaction
Lloh0:
	adrp	x8, _error_count@GOTPAGE
Lloh1:
	ldr	x8, [x8, _error_count@GOTPAGEOFF]
	cbz	x0, LBB0_4
; %bb.1:
	ldr	x9, [x8]
	add	x10, x9, #1
	str	x10, [x8]
Lloh2:
	adrp	x8, _ERROR_DISCONNECT_COUNT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ERROR_DISCONNECT_COUNT@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x9, x8
	b.lt	LBB0_5
; %bb.2:
Lloh5:
	adrp	x8, _ROWS_PER_HAND@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ROWS_PER_HAND@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.3:
Lloh8:
	adrp	x9, _isLeftHand@GOTPAGE
Lloh9:
	ldr	x9, [x9, _isLeftHand@GOTPAGEOFF]
Lloh10:
	adrp	x10, _matrix@GOTPAGE
Lloh11:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
Lloh13:
	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_5
LBB0_4:
	str	xzr, [x8]
LBB0_5:
	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	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_TXLED1,4,2                     ; @TXLED1
	.comm	_error_count,8,3                ; @error_count
	.comm	_ERROR_DISCONNECT_COUNT,8,3     ; @ERROR_DISCONNECT_COUNT
	.comm	_isLeftHand,8,3                 ; @isLeftHand
	.comm	_ROWS_PER_HAND,4,2              ; @ROWS_PER_HAND
	.comm	_matrix,8,3                     ; @matrix
	.comm	_TXLED0,4,2                     ; @TXLED0
.subsections_via_symbols
