	.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), %r14
	cmpl	$0, (%r14)
	jle	LBB0_9
## %bb.1:
	leaq	l_switch.table.matrix_scan.1(%rip), %r12
	xorl	%r13d, %r13d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r13
	movslq	(%r14), %rax
	addq	$4, %r12
	cmpq	%rax, %r13
	jge	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$4, %r13d
	ja	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r12), %esi
	movq	_GPIOB@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palSetPad
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	$20, %edi
	callq	_wait_us
	movq	_GPIOA@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_palReadPort
	movl	%eax, %r14d
	shrl	$15, %r14d
	andl	$1, %r14d
	movq	_GPIOC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palReadPort
	movl	%eax, %ebx
	shrl	$9, %ebx
	andl	$14, %ebx
	orl	%r14d, %ebx
	movq	_GPIOD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palReadPort
                                        ## kill: def $eax killed $eax def $rax
	andl	$4, %eax
	leal	(%rbx,%rax,4), %ebx
	movq	_GPIOB@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palReadPort
                                        ## kill: def $eax killed $eax def $rax
	andl	$1016, %eax                     ## imm = 0x3F8
	leal	(%rbx,%rax,4), %r14d
	movl	(%r15), %edi
	callq	_palReadPort
	movl	%eax, %ebx
	andl	$12, %ebx
	shll	$10, %ebx
	orl	%r14d, %ebx
	cmpl	$4, %r13d
	ja	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r12), %esi
	movq	_GPIOB@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_palClearPad
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_matrix_debouncing@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpl	%ebx, (%rax,%r13,4)
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %r14
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%ebx, (%rax,%r13,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), %rbx
	cmpl	$0, (%rbx)
	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, (%r14)
	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	(%r14), %rsi
	cmpq	%rsi, %rdx
	jl	LBB0_13
LBB0_14:
	movl	$0, (%rbx)
LBB0_15:
	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	_GPIOA,4,2                      ## @GPIOA
	.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	__TEXT,__const
	.p2align	2                               ## @switch.table.matrix_scan.1
l_switch.table.matrix_scan.1:
	.long	11                              ## 0xb
	.long	10                              ## 0xa
	.long	2                               ## 0x2
	.long	1                               ## 0x1
	.long	0                               ## 0x0

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

.subsections_via_symbols
