	.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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	testq	%rdi, %rdi
	jle	LBB0_3
## %bb.1:
	xorl	%ebx, %ebx
	movq	_matrix@GOTPCREL(%rip), %r15
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rdi
	movq	%rbx, %rsi
	callq	_read_cols_on_row
	incq	%rbx
	movq	(%r14), %rdi
	cmpq	%rdi, %rbx
	jl	LBB0_2
LBB0_3:
	movq	_USB_DeviceState@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_DEVICE_STATE_Configured@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_20
## %bb.4:
	movq	_i2c_slave_reg@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movl	$85, 4(%rcx)
	testq	%rdi, %rdi
	jle	LBB0_20
## %bb.5:
	movq	_matrix@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	cmpq	$8, %rdi
	jb	LBB0_6
## %bb.7:
	movq	%rcx, %rax
	subq	%rdx, %rax
	addq	$8, %rax
	cmpq	$32, %rax
	jae	LBB0_9
LBB0_6:
	xorl	%esi, %esi
LBB0_16:
	movq	%rsi, %r8
	notq	%r8
	addq	%rdi, %r8
	movq	%rdi, %rax
	andq	$3, %rax
	je	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdx,%rsi,4), %ebx
	movl	%ebx, 8(%rcx,%rsi,4)
	incq	%rsi
	decq	%rax
	jne	LBB0_17
LBB0_18:
	cmpq	$3, %r8
	jb	LBB0_20
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdx,%rsi,4), %eax
	movl	%eax, 8(%rcx,%rsi,4)
	movl	4(%rdx,%rsi,4), %eax
	movl	%eax, 12(%rcx,%rsi,4)
	movl	8(%rdx,%rsi,4), %eax
	movl	%eax, 16(%rcx,%rsi,4)
	movl	12(%rdx,%rsi,4), %eax
	movl	%eax, 20(%rcx,%rsi,4)
	addq	$4, %rsi
	cmpq	%rsi, %rdi
	jne	LBB0_19
	jmp	LBB0_20
LBB0_9:
	movq	%rdi, %rsi
	andq	$-8, %rsi
	leaq	-8(%rsi), %rbx
	movq	%rbx, %rax
	shrq	$3, %rax
	incq	%rax
	movl	%eax, %r8d
	andl	$3, %r8d
	cmpq	$24, %rbx
	jae	LBB0_11
## %bb.10:
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_11:
	andq	$-4, %rax
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movups	(%rdx,%rbx,4), %xmm0
	movups	16(%rdx,%rbx,4), %xmm1
	movups	%xmm0, 8(%rcx,%rbx,4)
	movups	%xmm1, 24(%rcx,%rbx,4)
	movups	32(%rdx,%rbx,4), %xmm0
	movups	48(%rdx,%rbx,4), %xmm1
	movups	%xmm0, 40(%rcx,%rbx,4)
	movups	%xmm1, 56(%rcx,%rbx,4)
	movups	64(%rdx,%rbx,4), %xmm0
	movups	80(%rdx,%rbx,4), %xmm1
	movups	%xmm0, 72(%rcx,%rbx,4)
	movups	%xmm1, 88(%rcx,%rbx,4)
	movups	96(%rdx,%rbx,4), %xmm0
	movups	112(%rdx,%rbx,4), %xmm1
	movups	%xmm0, 104(%rcx,%rbx,4)
	movups	%xmm1, 120(%rcx,%rbx,4)
	addq	$32, %rbx
	addq	$-4, %rax
	jne	LBB0_12
LBB0_13:
	testq	%r8, %r8
	je	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movups	(%rdx,%rbx,4), %xmm0
	movups	16(%rdx,%rbx,4), %xmm1
	leaq	(,%rbx,4), %rax
	orq	$8, %rax
	movups	%xmm0, (%rcx,%rax)
	movups	%xmm1, 16(%rcx,%rax)
	addq	$8, %rbx
	decq	%r8
	jne	LBB0_14
LBB0_15:
	cmpq	%rsi, %rdi
	jne	LBB0_16
LBB0_20:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
	movl	$1, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MATRIX_ROWS,8,3                ## @MATRIX_ROWS
	.comm	_matrix,8,3                     ## @matrix
	.comm	_USB_DeviceState,8,3            ## @USB_DeviceState
	.comm	_DEVICE_STATE_Configured,8,3    ## @DEVICE_STATE_Configured
	.comm	_i2c_slave_reg,8,3              ## @i2c_slave_reg
	.comm	_DEBOUNCE,8,3                   ## @DEBOUNCE
	.comm	_MATRIX_COLS,8,3                ## @MATRIX_COLS
	.comm	_debouncing,4,2                 ## @debouncing
	.comm	_debouncing_time,4,2            ## @debouncing_time
	.comm	_matrix_debouncing,8,3          ## @matrix_debouncing
.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	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
Lloh0:
	adrp	x20, _MATRIX_ROWS@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	x19, #0
Lloh2:
	adrp	x21, _matrix@GOTPAGE
Lloh3:
	ldr	x21, [x21, _matrix@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x21]
	mov	x1, x19
	bl	_read_cols_on_row
	add	x19, x19, #1
	ldr	x8, [x20]
	cmp	x19, x8
	b.lt	LBB0_2
LBB0_3:
Lloh4:
	adrp	x9, _USB_DeviceState@GOTPAGE
Lloh5:
	ldr	x9, [x9, _USB_DeviceState@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
Lloh7:
	adrp	x10, _DEVICE_STATE_Configured@GOTPAGE
Lloh8:
	ldr	x10, [x10, _DEVICE_STATE_Configured@GOTPAGEOFF]
Lloh9:
	ldr	x10, [x10]
	cmp	x9, x10
	b.eq	LBB0_10
; %bb.4:
Lloh10:
	adrp	x9, _i2c_slave_reg@GOTPAGE
Lloh11:
	ldr	x9, [x9, _i2c_slave_reg@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	mov	w10, #85
	str	w10, [x9, #4]
	cmp	x8, #1
	b.lt	LBB0_10
; %bb.5:
Lloh13:
	adrp	x10, _matrix@GOTPAGE
Lloh14:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh15:
	ldr	x10, [x10]
	cmp	x8, #16
	b.lo	LBB0_7
; %bb.6:
	sub	x11, x9, x10
	add	x11, x11, #8
	cmp	x11, #64
	b.hs	LBB0_11
LBB0_7:
	mov	x11, #0
LBB0_8:
	sub	x8, x8, x11
	lsl	x11, x11, #2
	add	x9, x11, x9
	add	x9, x9, #8
	add	x10, x10, x11
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10], #4
	str	w11, [x9], #4
	subs	x8, x8, #1
	b.ne	LBB0_9
LBB0_10:
	bl	_matrix_scan_quantum
	mov	w0, #1
	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_11:
	and	x11, x8, #0xfffffffffffffff0
	add	x12, x9, #40
	add	x13, x10, #32
	mov	x14, x11
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x13, #-32]
	ldp	q2, q3, [x13], #64
	stp	q0, q1, [x12, #-32]
	stp	q2, q3, [x12], #64
	subs	x14, x14, #16
	b.ne	LBB0_12
; %bb.13:
	cmp	x8, x11
	b.eq	LBB0_10
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_MATRIX_ROWS,8,3                ; @MATRIX_ROWS
	.comm	_matrix,8,3                     ; @matrix
	.comm	_USB_DeviceState,8,3            ; @USB_DeviceState
	.comm	_DEVICE_STATE_Configured,8,3    ; @DEVICE_STATE_Configured
	.comm	_i2c_slave_reg,8,3              ; @i2c_slave_reg
	.comm	_DEBOUNCE,8,3                   ; @DEBOUNCE
	.comm	_MATRIX_COLS,8,3                ; @MATRIX_COLS
	.comm	_debouncing,4,2                 ; @debouncing
	.comm	_debouncing_time,4,2            ; @debouncing_time
	.comm	_matrix_debouncing,8,3          ; @matrix_debouncing
.subsections_via_symbols
