	.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_12
## %bb.1:
	movq	_debouncing@GOTPCREL(%rip), %r14
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_unselect_cols
	incq	%r12
	movq	_MATRIX_COLS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	jge	LBB0_12
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	movq	%r12, %rdi
	callq	_select_col
	movl	$3, %edi
	callq	__delay_us
	xorl	%eax, %eax
	callq	_read_rows
	movq	%rax, %r13
	testq	%r12, %r12
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_read_fwkey
	orq	%rax, %r13
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	movq	_matrix_debouncing@GOTPCREL(%rip), %r8
	jle	LBB0_11
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$1, %r15d
	movl	%r12d, %ecx
	shlq	%cl, %r15
	xorl	%ebx, %ebx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=2
	movq	_DEBOUNCE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r14)
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=2
	incq	%rbx
	cmpq	%rax, %rbx
	jge	LBB0_11
LBB0_6:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%r8), %rdx
	movl	$1, %esi
	movl	%ebx, %ecx
	shll	%cl, %esi
	movq	(%rdx,%rbx,8), %rcx
	movl	%r15d, %edi
	andl	%ecx, %edi
	andl	%r13d, %esi
	cmpl	%edi, %esi
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	xorq	%r15, %rcx
	movq	%rcx, (%rdx,%rbx,8)
	cmpq	$0, (%r14)
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=2
	leaq	L_.str(%rip), %rdi
	callq	_dprint
	movq	(%r14), %rsi
	leaq	L_.str.1(%rip), %rdi
	callq	_dprintf
	xorl	%eax, %eax
	callq	_dprintln
	movq	_matrix_debouncing@GOTPCREL(%rip), %r8
	jmp	LBB0_9
LBB0_12:
	movq	_debouncing@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.13:
	decq	%rcx
	movq	%rcx, (%rax)
	je	LBB0_14
## %bb.18:
	movl	$1, %edi
	callq	__delay_ms
	jmp	LBB0_17
LBB0_14:
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jle	LBB0_17
## %bb.15:
	movq	_matrix_debouncing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	_matrix@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rcx,%rsi,8), %rdi
	movq	%rdi, (%rdx,%rsi,8)
	incq	%rsi
	cmpq	(%rax), %rsi
	jl	LBB0_16
LBB0_17:
	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	_debouncing,8,3                 ## @debouncing
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bounce!: "

L_.str.1:                               ## @.str.1
	.asciz	"%02X"

	.comm	_DEBOUNCE,8,3                   ## @DEBOUNCE
	.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	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _MATRIX_COLS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MATRIX_COLS@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x23, _debouncing@GOTPAGE
Lloh4:
	ldr	x23, [x23, _debouncing@GOTPAGEOFF]
	cmp	x8, #1
	b.lt	LBB0_12
; %bb.1:
	mov	x19, #0
Lloh5:
	adrp	x25, _MATRIX_ROWS@GOTPAGE
Lloh6:
	ldr	x25, [x25, _MATRIX_ROWS@GOTPAGEOFF]
	mov	w26, #1
Lloh7:
	adrp	x27, _matrix_debouncing@GOTPAGE
Lloh8:
	ldr	x27, [x27, _matrix_debouncing@GOTPAGEOFF]
Lloh9:
	adrp	x28, _DEBOUNCE@GOTPAGE
Lloh10:
	ldr	x28, [x28, _DEBOUNCE@GOTPAGEOFF]
Lloh11:
	adrp	x21, l_.str.1@PAGE
Lloh12:
	add	x21, x21, l_.str.1@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	bl	_unselect_cols
	add	x19, x19, #1
Lloh13:
	adrp	x8, _MATRIX_COLS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MATRIX_COLS@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cmp	x19, x8
	b.ge	LBB0_12
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	mov	x0, x19
	bl	_select_col
	mov	w0, #3
	bl	__delay_us
	bl	_read_rows
	mov	x22, x0
	cbnz	x19, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_read_fwkey
	orr	x22, x0, x22
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x25]
	cmp	x8, #1
	b.lt	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x24, #0
	lsl	x20, x26, x19
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=2
	ldr	x8, [x28]
	str	x8, [x23]
	ldr	x8, [x25]
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=2
	add	x24, x24, #1
	cmp	x24, x8
	b.ge	LBB0_2
LBB0_9:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x9, [x27]
	ldr	x10, [x9, x24, lsl #3]
	and	w11, w10, w20
	lsl	w12, w26, w24
	and	w12, w12, w22
	cmp	w12, w11
	b.eq	LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=2
	eor	x8, x10, x20
	str	x8, [x9, x24, lsl #3]
	ldr	x8, [x23]
	cbz	x8, LBB0_7
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=2
Lloh16:
	adrp	x0, l_.str@PAGE
Lloh17:
	add	x0, x0, l_.str@PAGEOFF
	bl	_dprint
	ldr	x1, [x23]
	mov	x0, x21
	bl	_dprintf
	bl	_dprintln
	b	LBB0_7
LBB0_12:
	ldr	x8, [x23]
	cbz	x8, LBB0_18
; %bb.13:
	subs	x8, x8, #1
	str	x8, [x23]
	b.eq	LBB0_15
; %bb.14:
	mov	w0, #1
	bl	__delay_ms
	b	LBB0_18
LBB0_15:
Lloh18:
	adrp	x8, _MATRIX_ROWS@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	x9, [x8]
	cmp	x9, #1
	b.lt	LBB0_18
; %bb.16:
	mov	x9, #0
Lloh20:
	adrp	x10, _matrix_debouncing@GOTPAGE
Lloh21:
	ldr	x10, [x10, _matrix_debouncing@GOTPAGEOFF]
Lloh22:
	ldr	x10, [x10]
Lloh23:
	adrp	x11, _matrix@GOTPAGE
Lloh24:
	ldr	x11, [x11, _matrix@GOTPAGEOFF]
Lloh25:
	ldr	x11, [x11]
LBB0_17:                                ; =>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_17
LBB0_18:
	bl	_matrix_scan_quantum
	mov	w0, #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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.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	_debouncing,8,3                 ; @debouncing
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bounce!: "

l_.str.1:                               ; @.str.1
	.asciz	"%02X"

	.comm	_DEBOUNCE,8,3                   ; @DEBOUNCE
	.comm	_matrix,8,3                     ; @matrix
.subsections_via_symbols
