	.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	%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	_MATRIX_COLS@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jle	LBB0_8
## %bb.1:
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %r15
	movq	_DEBOUNCE@GOTPCREL(%rip), %r13
	movq	_debouncing@GOTPCREL(%rip), %r12
	xorl	%r14d, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_unselect_cols
	incq	%r14
	movq	_MATRIX_COLS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r14
	jge	LBB0_8
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movq	%r14, %rdi
	callq	_select_col
	movl	$3, %edi
	callq	__delay_us
	xorl	%eax, %eax
	callq	_read_rows
	movq	(%r15), %r9
	testq	%r9, %r9
	jle	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_matrix_debouncing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r8
	movl	$1, %edi
	movl	%r14d, %ecx
	shlq	%cl, %rdi
	xorl	%ecx, %ecx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=2
	incq	%rcx
	cmpq	%r9, %rcx
	jge	LBB0_7
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	$1, %edx
	shll	%cl, %edx
	movq	(%r8,%rcx,8), %rbx
	movl	%edi, %esi
	andl	%ebx, %esi
	andl	%eax, %edx
	cmpl	%esi, %edx
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	xorq	%rdi, %rbx
	movq	%rbx, (%r8,%rcx,8)
	movq	(%r13), %rdx
	movq	%rdx, (%r12)
	movq	(%r15), %r9
	jmp	LBB0_6
LBB0_8:
	movq	_debouncing@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.9:
	decq	%rcx
	movq	%rcx, (%rax)
	je	LBB0_10
## %bb.14:
	movl	$1, %edi
	callq	__delay_ms
	jmp	LBB0_13
LBB0_10:
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jle	LBB0_13
## %bb.11:
	movq	_matrix_debouncing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_matrix@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rcx,%rsi,8), %rdi
	movq	%rdi, (%rdx,%rsi,8)
	incq	%rsi
	cmpq	(%rax), %rsi
	jl	LBB0_12
LBB0_13:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
	movl	$1, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MATRIX_COLS,8,3                ## @MATRIX_COLS
	.comm	_MATRIX_ROWS,8,3                ## @MATRIX_ROWS
	.comm	_matrix_debouncing,8,3          ## @matrix_debouncing
	.comm	_DEBOUNCE,8,3                   ## @DEBOUNCE
	.comm	_debouncing,8,3                 ## @debouncing
	.comm	_matrix,8,3                     ## @matrix
.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	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
Lloh0:
	adrp	x21, _MATRIX_COLS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MATRIX_COLS@GOTPAGEOFF]
	ldr	x8, [x21]
Lloh2:
	adrp	x20, _debouncing@GOTPAGE
Lloh3:
	ldr	x20, [x20, _debouncing@GOTPAGEOFF]
	cmp	x8, #1
	b.lt	LBB0_8
; %bb.1:
	mov	x19, #0
Lloh4:
	adrp	x22, _MATRIX_ROWS@GOTPAGE
Lloh5:
	ldr	x22, [x22, _MATRIX_ROWS@GOTPAGEOFF]
Lloh6:
	adrp	x23, _matrix_debouncing@GOTPAGE
Lloh7:
	ldr	x23, [x23, _matrix_debouncing@GOTPAGEOFF]
	mov	w24, #1
Lloh8:
	adrp	x25, _DEBOUNCE@GOTPAGE
Lloh9:
	ldr	x25, [x25, _DEBOUNCE@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	bl	_unselect_cols
	add	x19, x19, #1
	ldr	x8, [x21]
	cmp	x19, x8
	b.ge	LBB0_8
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	mov	x0, x19
	bl	_select_col
	mov	w0, #3
	bl	__delay_us
	bl	_read_rows
	ldr	x9, [x22]
	cmp	x9, #1
	b.lt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x8, #0
	ldr	x10, [x23]
	lsl	x11, x24, x19
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=2
	add	x8, x8, #1
	cmp	x8, x9
	b.ge	LBB0_2
LBB0_6:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x12, [x10, x8, lsl #3]
	and	w13, w12, w11
	lsl	w14, w24, w8
	and	w14, w14, w0
	cmp	w14, w13
	b.eq	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	eor	x9, x12, x11
	str	x9, [x10, x8, lsl #3]
	ldr	x9, [x25]
	str	x9, [x20]
	ldr	x9, [x22]
	b	LBB0_5
LBB0_8:
	ldr	x8, [x20]
	cbz	x8, LBB0_14
; %bb.9:
	subs	x8, x8, #1
	str	x8, [x20]
	b.eq	LBB0_11
; %bb.10:
	mov	w0, #1
	bl	__delay_ms
	b	LBB0_14
LBB0_11:
Lloh10:
	adrp	x8, _MATRIX_ROWS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	x9, [x8]
	cmp	x9, #1
	b.lt	LBB0_14
; %bb.12:
	mov	x9, #0
Lloh12:
	adrp	x10, _matrix_debouncing@GOTPAGE
Lloh13:
	ldr	x10, [x10, _matrix_debouncing@GOTPAGEOFF]
Lloh14:
	ldr	x10, [x10]
Lloh15:
	adrp	x11, _matrix@GOTPAGE
Lloh16:
	ldr	x11, [x11, _matrix@GOTPAGEOFF]
Lloh17:
	ldr	x11, [x11]
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	lsl	x12, x9, #3
	ldr	x13, [x10, x12]
	str	x13, [x11, x12]
	add	x9, x9, #1
	ldr	x12, [x8]
	cmp	x9, x12
	b.lt	LBB0_13
LBB0_14:
	bl	_matrix_scan_quantum
	mov	w0, #1
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_MATRIX_COLS,8,3                ; @MATRIX_COLS
	.comm	_MATRIX_ROWS,8,3                ; @MATRIX_ROWS
	.comm	_matrix_debouncing,8,3          ; @matrix_debouncing
	.comm	_DEBOUNCE,8,3                   ; @DEBOUNCE
	.comm	_debouncing,8,3                 ; @debouncing
	.comm	_matrix,8,3                     ; @matrix
.subsections_via_symbols
