	.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), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_9
## %bb.1:
	leaq	l_switch.table.matrix_scan.3(%rip), %r12
	leaq	l_switch.table.matrix_scan.2(%rip), %r13
	xorl	%r15d, %r15d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r15
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rbx
	movslq	(%rbx), %rax
	addq	$4, %r12
	addq	$8, %r13
	cmpq	%rax, %r15
	jge	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$9, %r15d
	ja	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r13), %rax
	movl	(%r12), %esi
	movl	(%rax), %edi
	callq	_palSetPad
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	$20, %edi
	callq	_wait_us
	movq	_GPIOC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palReadPort
	movl	%eax, %r14d
	andl	$254, %r14d
	movq	_GPIOD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palReadPort
	movl	%eax, %ebx
	shrl	$5, %ebx
	andl	$7, %ebx
	cmpl	$9, %r15d
	ja	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r13), %rax
	movl	(%r12), %esi
	movl	(%rax), %edi
	callq	_palClearPad
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	leal	(%rbx,%r14,4), %eax
	movq	_matrix_debouncing@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	%eax, (%rcx,%r15,4)
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, (%rcx,%r15,4)
	movq	_debouncing@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%eax, %eax
	callq	_timer_read
	movq	_debouncing_time@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	jmp	LBB0_8
LBB0_9:
	movq	_debouncing@GOTPCREL(%rip), %r14
	cmpl	$0, (%r14)
	je	LBB0_15
## %bb.10:
	movq	_debouncing_time@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_timer_elapsed
	movq	_DEBOUNCE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_15
## %bb.11:
	cmpl	$0, (%rbx)
	jle	LBB0_14
## %bb.12:
	movq	_matrix_debouncing@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_matrix@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax,%rdx,4), %esi
	movl	%esi, (%rcx,%rdx,4)
	incq	%rdx
	movslq	(%rbx), %rsi
	cmpq	%rsi, %rdx
	jl	LBB0_13
LBB0_14:
	movl	$0, (%r14)
LBB0_15:
	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_ROWS,4,2                ## @MATRIX_ROWS
	.comm	_GPIOB,4,2                      ## @GPIOB
	.comm	_GPIOC,4,2                      ## @GPIOC
	.comm	_GPIOD,4,2                      ## @GPIOD
	.comm	_matrix_debouncing,8,3          ## @matrix_debouncing
	.comm	_debouncing,4,2                 ## @debouncing
	.comm	_debouncing_time,4,2            ## @debouncing_time
	.comm	_DEBOUNCE,8,3                   ## @DEBOUNCE
	.comm	_matrix,8,3                     ## @matrix
	.section	__DATA,__const
	.p2align	3                               ## @switch.table.matrix_scan.2
l_switch.table.matrix_scan.2:
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOC
	.quad	_GPIOC
	.quad	_GPIOC
	.quad	_GPIOD
	.quad	_GPIOD
	.quad	_GPIOD

	.section	__TEXT,__const
	.p2align	2                               ## @switch.table.matrix_scan.3
l_switch.table.matrix_scan.3:
	.long	2                               ## 0x2
	.long	3                               ## 0x3
	.long	18                              ## 0x12
	.long	19                              ## 0x13
	.long	0                               ## 0x0
	.long	8                               ## 0x8
	.long	9                               ## 0x9
	.long	0                               ## 0x0
	.long	1                               ## 0x1
	.long	4                               ## 0x4

.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	x21, _MATRIX_ROWS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.1:
	mov	x24, #0
Lloh2:
	adrp	x25, l_switch.table.matrix_scan.2@PAGE
Lloh3:
	add	x25, x25, l_switch.table.matrix_scan.2@PAGEOFF
Lloh4:
	adrp	x26, _GPIOC@GOTPAGE
Lloh5:
	ldr	x26, [x26, _GPIOC@GOTPAGEOFF]
Lloh6:
	adrp	x27, _GPIOD@GOTPAGE
Lloh7:
	ldr	x27, [x27, _GPIOD@GOTPAGEOFF]
Lloh8:
	adrp	x28, _matrix_debouncing@GOTPAGE
Lloh9:
	ldr	x28, [x28, _matrix_debouncing@GOTPAGEOFF]
	mov	w22, #1
Lloh10:
	adrp	x23, l_switch.table.matrix_scan.3@PAGE
Lloh11:
	add	x23, x23, l_switch.table.matrix_scan.3@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x24, x24, #1
	ldrsw	x8, [x21]
	cmp	x24, x8
	b.ge	LBB0_9
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w24, #9
	b.hi	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x25, x24, lsl #3]
	ldr	w1, [x23, x24, lsl #2]
	ldr	w0, [x8]
	bl	_palSetPad
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	w0, #20
	bl	_wait_us
	ldr	w0, [x26]
	bl	_palReadPort
	mov	x19, x0
	ldr	w0, [x27]
	bl	_palReadPort
	mov	x20, x0
	cmp	w24, #9
	b.hi	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x25, x24, lsl #3]
	ldr	w1, [x23, x24, lsl #2]
	ldr	w0, [x8]
	bl	_palClearPad
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	lsl	w8, w19, #2
	and	w8, w8, #0x3f8
	bfxil	w8, w20, #5, #3
	ldr	x9, [x28]
	ldr	w10, [x9, x24, lsl #2]
	cmp	w10, w8
	b.eq	LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	str	w8, [x9, x24, lsl #2]
Lloh12:
	adrp	x8, _debouncing@GOTPAGE
Lloh13:
	ldr	x8, [x8, _debouncing@GOTPAGEOFF]
Lloh14:
	str	w22, [x8]
	bl	_timer_read
Lloh15:
	adrp	x8, _debouncing_time@GOTPAGE
Lloh16:
	ldr	x8, [x8, _debouncing_time@GOTPAGEOFF]
Lloh17:
	str	w0, [x8]
	b	LBB0_2
LBB0_9:
Lloh18:
	adrp	x8, _debouncing@GOTPAGE
Lloh19:
	ldr	x8, [x8, _debouncing@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cbz	w8, LBB0_15
; %bb.10:
Lloh21:
	adrp	x8, _debouncing_time@GOTPAGE
Lloh22:
	ldr	x8, [x8, _debouncing_time@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_timer_elapsed
Lloh24:
	adrp	x8, _DEBOUNCE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _DEBOUNCE@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	cmp	x0, x8
	b.le	LBB0_15
; %bb.11:
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.12:
	mov	x8, #0
Lloh27:
	adrp	x9, _matrix_debouncing@GOTPAGE
Lloh28:
	ldr	x9, [x9, _matrix_debouncing@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
Lloh30:
	adrp	x10, _matrix@GOTPAGE
Lloh31:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh32:
	ldr	x10, [x10]
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	lsl	x11, x8, #2
	ldr	w12, [x9, x11]
	str	w12, [x10, x11]
	add	x8, x8, #1
	ldrsw	x11, [x21]
	cmp	x8, x11
	b.lt	LBB0_13
LBB0_14:
Lloh33:
	adrp	x8, _debouncing@GOTPAGE
Lloh34:
	ldr	x8, [x8, _debouncing@GOTPAGEOFF]
Lloh35:
	str	wzr, [x8]
LBB0_15:
	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	Lloh0, Lloh1
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotStr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotStr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotStr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_MATRIX_ROWS,4,2                ; @MATRIX_ROWS
	.comm	_GPIOB,4,2                      ; @GPIOB
	.comm	_GPIOC,4,2                      ; @GPIOC
	.comm	_GPIOD,4,2                      ; @GPIOD
	.comm	_matrix_debouncing,8,3          ; @matrix_debouncing
	.comm	_debouncing,4,2                 ; @debouncing
	.comm	_debouncing_time,4,2            ; @debouncing_time
	.comm	_DEBOUNCE,8,3                   ; @DEBOUNCE
	.comm	_matrix,8,3                     ; @matrix
	.section	__DATA,__const
	.p2align	3                               ; @switch.table.matrix_scan.2
l_switch.table.matrix_scan.2:
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOB
	.quad	_GPIOC
	.quad	_GPIOC
	.quad	_GPIOC
	.quad	_GPIOD
	.quad	_GPIOD
	.quad	_GPIOD

	.section	__TEXT,__const
	.p2align	2                               ; @switch.table.matrix_scan.3
l_switch.table.matrix_scan.3:
	.long	2                               ; 0x2
	.long	3                               ; 0x3
	.long	18                              ; 0x12
	.long	19                              ; 0x13
	.long	0                               ; 0x0
	.long	8                               ; 0x8
	.long	9                               ; 0x9
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.long	4                               ; 0x4

.subsections_via_symbols
