	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%eax, %eax
	callq	_serial_recv
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_debug_hex
	leaq	L_.str(%rip), %rdi
	callq	_debug
	cmpl	$253, %ebx
	jg	LBB0_8
## %bb.3:
	cmpl	$126, %ebx
	je	LBB0_14
## %bb.4:
	cmpl	$127, %ebx
	jne	LBB0_15
## %bb.5:
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movl	$0, %ebx
	jle	LBB0_21
## %bb.6:
	movq	_matrix@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	$0, (%rcx,%rdx,4)
	incq	%rdx
	movslq	(%rax), %rsi
	cmpq	%rsi, %rdx
	jl	LBB0_7
	jmp	LBB0_21
LBB0_1:
	xorl	%ebx, %ebx
	jmp	LBB0_21
LBB0_8:
	cmpl	$254, %ebx
	je	LBB0_12
## %bb.9:
	cmpl	$255, %ebx
	jne	LBB0_15
## %bb.10:
	leaq	L_.str.1(%rip), %rdi
	callq	_print
	movl	$500, %edi                      ## imm = 0x1F4
	callq	__delay_ms
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_serial_recv
	movl	%eax, %r14d
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	callq	_xprintf
	cmpl	$4, %r14d
	jne	LBB0_21
## %bb.11:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_host_keyboard_leds
	movl	%eax, %edi
	callq	_led_set
	jmp	LBB0_21
LBB0_14:
	leaq	L_.str.4(%rip), %rdi
	jmp	LBB0_13
LBB0_12:
	leaq	L_.str.3(%rip), %rdi
LBB0_13:
	callq	_print
	movl	$500, %edi                      ## imm = 0x1F4
	callq	__delay_ms
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_serial_recv
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	callq	_xprintf
	jmp	LBB0_21
LBB0_15:
	movl	%ebx, %edi
	callq	_ROW
	movq	%rax, %r14
	movl	%ebx, %edi
	callq	_COL
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_matrix_is_on
	testb	$-128, %bl
	jne	LBB0_16
## %bb.18:
	testq	%rax, %rax
	jne	LBB0_20
## %bb.19:
	movl	%ebx, %edi
	callq	_COL
	movl	$1, %r14d
	movl	%eax, %ecx
	shll	%cl, %r14d
	movq	_matrix@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movl	%ebx, %edi
	callq	_ROW
	orl	%r14d, (%r15,%rax,4)
	jmp	LBB0_20
LBB0_16:
	testq	%rax, %rax
	je	LBB0_20
## %bb.17:
	movl	%ebx, %edi
	callq	_COL
	movl	$-2, %r14d
	movl	%eax, %ecx
	roll	%cl, %r14d
	movq	_matrix@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movl	%ebx, %edi
	callq	_ROW
	andl	%r14d, (%r15,%rax,4)
LBB0_20:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
LBB0_21:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" "

L_.str.1:                               ## @.str.1
	.asciz	"reset: "

L_.str.2:                               ## @.str.2
	.asciz	"%02X\n"

L_.str.3:                               ## @.str.3
	.asciz	"layout: "

L_.str.4:                               ## @.str.4
	.asciz	"reset fail: "

	.comm	_MATRIX_ROWS,4,2                ## @MATRIX_ROWS
	.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	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	bl	_serial_recv
	mov	x19, x0
	cbz	w0, LBB0_22
; %bb.1:
	mov	x0, x19
	bl	_debug_hex
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_debug
	cmp	w19, #253
	b.gt	LBB0_7
; %bb.2:
	cmp	w19, #126
	b.eq	LBB0_11
; %bb.3:
	cmp	w19, #127
	b.ne	LBB0_15
; %bb.4:
Lloh2:
	adrp	x8, _MATRIX_ROWS@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MATRIX_ROWS@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_14
; %bb.5:
	mov	x9, #0
Lloh4:
	adrp	x10, _matrix@GOTPAGE
Lloh5:
	ldr	x10, [x10, _matrix@GOTPAGEOFF]
Lloh6:
	ldr	x10, [x10]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	str	wzr, [x10, x9, lsl #2]
	add	x9, x9, #1
	ldrsw	x11, [x8]
	cmp	x9, x11
	b.lt	LBB0_6
	b	LBB0_14
LBB0_7:
	cmp	w19, #254
	b.eq	LBB0_12
; %bb.8:
	cmp	w19, #255
	b.ne	LBB0_15
; %bb.9:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_print
	mov	w0, #500
	bl	__delay_ms
	bl	_serial_recv
	mov	x19, x0
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	bl	_xprintf
	cmp	w19, #4
	b.ne	LBB0_14
; %bb.10:
	bl	_host_keyboard_leds
	bl	_led_set
	b	LBB0_14
LBB0_11:
Lloh11:
	adrp	x0, l_.str.4@PAGE
Lloh12:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_13
LBB0_12:
Lloh13:
	adrp	x0, l_.str.3@PAGE
Lloh14:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_13:
	bl	_print
	mov	w0, #500
	bl	__delay_ms
	bl	_serial_recv
	mov	x1, x0
Lloh15:
	adrp	x0, l_.str.2@PAGE
Lloh16:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_xprintf
LBB0_14:
	mov	w19, #0
	b	LBB0_22
LBB0_15:
	mov	x0, x19
	bl	_ROW
	mov	x20, x0
	mov	x0, x19
	bl	_COL
	mov	x1, x0
	mov	x0, x20
	bl	_matrix_is_on
	tbnz	w19, #7, LBB0_18
; %bb.16:
	cbnz	x0, LBB0_21
; %bb.17:
	mov	x0, x19
	bl	_COL
	mov	w8, #1
	lsl	w20, w8, w0
Lloh17:
	adrp	x8, _matrix@GOTPAGE
Lloh18:
	ldr	x8, [x8, _matrix@GOTPAGEOFF]
Lloh19:
	ldr	x21, [x8]
	mov	x0, x19
	bl	_ROW
	lsl	x8, x0, #2
	ldr	w9, [x21, x8]
	orr	w9, w9, w20
	b	LBB0_20
LBB0_18:
	cbz	x0, LBB0_21
; %bb.19:
	mov	x0, x19
	bl	_COL
	mov	w8, #1
	lsl	w20, w8, w0
Lloh20:
	adrp	x8, _matrix@GOTPAGE
Lloh21:
	ldr	x8, [x8, _matrix@GOTPAGEOFF]
Lloh22:
	ldr	x21, [x8]
	mov	x0, x19
	bl	_ROW
	lsl	x8, x0, #2
	ldr	w9, [x21, x8]
	bic	w9, w9, w20
LBB0_20:
	str	w9, [x21, x8]
LBB0_21:
	bl	_matrix_scan_quantum
LBB0_22:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" "

l_.str.1:                               ; @.str.1
	.asciz	"reset: "

l_.str.2:                               ; @.str.2
	.asciz	"%02X\n"

l_.str.3:                               ; @.str.3
	.asciz	"layout: "

l_.str.4:                               ; @.str.4
	.asciz	"reset fail: "

	.comm	_MATRIX_ROWS,4,2                ; @MATRIX_ROWS
	.comm	_matrix,8,3                     ; @matrix
.subsections_via_symbols
