	.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_ROWS@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	testq	%rax, %rax
	jle	LBB0_5
## %bb.1:
	xorl	%ebx, %ebx
	movq	_PIND7@GOTPCREL(%rip), %r14
	movq	_matrix_debouncing@GOTPCREL(%rip), %r15
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	movq	(%r13), %rax
	cmpq	%rax, %rbx
	jge	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_matrix_set_row_status
	movl	$5, %edi
	callq	__delay_us
	movq	_PINA@GOTPCREL(%rip), %rax
	movzbl	(%rax), %r12d
	movq	_PINC@GOTPCREL(%rip), %rax
	movzbl	(%rax), %edi
	xorl	$255, %edi
	callq	_bit_reverse
	shll	$8, %eax
	orl	%r12d, %eax
	xorl	$255, %eax
	movq	_PIND@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movzbl	(%r14), %ecx
	movl	$1, %esi
	shll	%cl, %esi
	notl	%edx
	andl	%edx, %esi
	shll	$7, %esi
	orl	%eax, %esi
	movslq	%esi, %rax
	movq	(%r15), %rcx
	cmpq	%rax, (%rcx,%rbx,8)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, (%rcx,%rbx,8)
	movq	_DEBOUNCE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_debouncing@GOTPCREL(%rip), %rcx
	movq	%rax, (%rcx)
	jmp	LBB0_4
LBB0_5:
	movq	_debouncing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	testq	%rdx, %rdx
	je	LBB0_10
## %bb.6:
	decq	%rdx
	movq	%rdx, (%rcx)
	je	LBB0_7
## %bb.11:
	movl	$1, %edi
	callq	__delay_ms
	jmp	LBB0_10
LBB0_7:
	testq	%rax, %rax
	jle	LBB0_10
## %bb.8:
	movq	_matrix_debouncing@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_matrix@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rax,%rdx,8), %rsi
	movq	%rsi, (%rcx,%rdx,8)
	incq	%rdx
	cmpq	(%r13), %rdx
	jl	LBB0_9
LBB0_10:
	xorl	%eax, %eax
	callq	_matrix_scan_kb
	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_ROWS,8,3                ## @MATRIX_ROWS
	.comm	_PINA,4,2                       ## @PINA
	.comm	_PINC,4,2                       ## @PINC
	.comm	_PIND,4,2                       ## @PIND
	.comm	_PIND7,4,2                      ## @PIND7
	.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	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	x20, _MATRIX_ROWS@GOTPAGE
Lloh1:
	ldr	x20, [x20, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	x8, [x20]
Lloh2:
	adrp	x10, _debouncing@GOTPAGE
Lloh3:
	ldr	x10, [x10, _debouncing@GOTPAGEOFF]
	cmp	x8, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x19, #0
Lloh4:
	adrp	x22, _PINA@GOTPAGE
Lloh5:
	ldr	x22, [x22, _PINA@GOTPAGEOFF]
Lloh6:
	adrp	x23, _PINC@GOTPAGE
Lloh7:
	ldr	x23, [x23, _PINC@GOTPAGEOFF]
Lloh8:
	adrp	x24, _PIND@GOTPAGE
Lloh9:
	ldr	x24, [x24, _PIND@GOTPAGEOFF]
Lloh10:
	adrp	x25, _PIND7@GOTPAGE
Lloh11:
	ldr	x25, [x25, _PIND7@GOTPAGEOFF]
	mov	w26, #1
Lloh12:
	adrp	x27, _matrix_debouncing@GOTPAGE
Lloh13:
	ldr	x27, [x27, _matrix_debouncing@GOTPAGEOFF]
Lloh14:
	adrp	x28, _DEBOUNCE@GOTPAGE
Lloh15:
	ldr	x28, [x28, _DEBOUNCE@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x19, x19, #1
	ldr	x8, [x20]
	cmp	x19, x8
	b.ge	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_matrix_set_row_status
	mov	w0, #5
	bl	__delay_us
	ldrb	w21, [x22]
	ldrb	w8, [x23]
	eor	w0, w8, #0xff
	bl	_bit_reverse
	bfi	w21, w0, #8, #24
	eor	w8, w21, #0xff
	ldr	w9, [x24]
	ldr	w10, [x25]
	lsl	w10, w26, w10
	bic	w9, w10, w9
	orr	w8, w8, w9, lsl #7
	sxtw	x8, w8
	ldr	x9, [x27]
	ldr	x10, [x9, x19, lsl #3]
	cmp	x10, x8
	b.eq	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x8, [x9, x19, lsl #3]
	ldr	x8, [x28]
Lloh16:
	adrp	x9, _debouncing@GOTPAGE
Lloh17:
	ldr	x9, [x9, _debouncing@GOTPAGEOFF]
Lloh18:
	str	x8, [x9]
	b	LBB0_2
LBB0_5:
Lloh19:
	adrp	x10, _debouncing@GOTPAGE
Lloh20:
	ldr	x10, [x10, _debouncing@GOTPAGEOFF]
LBB0_6:
	ldr	x9, [x10]
	cbz	x9, LBB0_12
; %bb.7:
	subs	x9, x9, #1
	str	x9, [x10]
	b.eq	LBB0_9
; %bb.8:
	mov	w0, #1
	bl	__delay_ms
	b	LBB0_12
LBB0_9:
	cmp	x8, #1
	b.lt	LBB0_12
; %bb.10:
	mov	x8, #0
Lloh21:
	adrp	x9, _matrix_debouncing@GOTPAGE
Lloh22:
	ldr	x9, [x9, _matrix_debouncing@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
Lloh24:
	adrp	x10, _matrix@GOTPAGE
Lloh25:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh26:
	ldr	x10, [x10]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	lsl	x11, x8, #3
	ldr	x12, [x9, x11]
	str	x12, [x10, x11]
	add	x8, x8, #1
	ldr	x11, [x20]
	cmp	x8, x11
	b.lt	LBB0_11
LBB0_12:
	bl	_matrix_scan_kb
	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	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_MATRIX_ROWS,8,3                ; @MATRIX_ROWS
	.comm	_PINA,4,2                       ; @PINA
	.comm	_PINC,4,2                       ; @PINC
	.comm	_PIND,4,2                       ; @PIND
	.comm	_PIND7,4,2                      ; @PIND7
	.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
