	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	xorl	%eax, %eax
	callq	_ps2_host_recv
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_debug
	movl	%ebx, %edi
	callq	_debug_hex
	leaq	L_.str.1(%rip), %rdi
	callq	_debug
LBB0_2:
	movl	_matrix_scan.state(%rip), %eax
	cmpq	$6, %rax
	ja	LBB0_29
## %bb.3:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_4:
	leaq	L_.str.2(%rip), %rdi
	callq	_debug
	movl	$255, %edi
	callq	_ps2_host_send
	cmpl	$250, %eax
	jne	LBB0_29
## %bb.5:
	leaq	L_.str.3(%rip), %rdi
	callq	_debug
	movl	$1, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_6:
	cmpl	$170, %ebx
	jne	LBB0_8
## %bb.7:
	leaq	L_.str.4(%rip), %rdi
	callq	_debug
	movl	$2, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_10:
	testl	%ebx, %ebx
	je	LBB0_29
## %bb.11:
	movl	$3, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_12:
	testl	%ebx, %ebx
	je	LBB0_29
## %bb.13:
	leaq	L_.str.6(%rip), %rdi
	callq	_debug
	movl	$4, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_14:
	leaq	L_.str.7(%rip), %rdi
	callq	_debug
	movl	$248, %edi
	callq	_ps2_host_send
	cmpl	$250, %eax
	jne	LBB0_29
## %bb.15:
	leaq	L_.str.8(%rip), %rdi
	callq	_debug
	movl	$5, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_16:
	testl	%ebx, %ebx
	je	LBB0_29
## %bb.17:
	cmpl	$240, %ebx
	jne	LBB0_19
## %bb.18:
	movl	$6, _matrix_scan.state(%rip)
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_28
LBB0_22:
	testl	%ebx, %ebx
	je	LBB0_29
## %bb.23:
	cmpl	$135, %ebx
	jg	LBB0_25
## %bb.24:
	movl	%ebx, %edi
	callq	_matrix_break
	jmp	LBB0_27
LBB0_8:
	testl	%ebx, %ebx
	je	LBB0_29
## %bb.9:
	leaq	L_.str.5(%rip), %rdi
	callq	_debug
	movl	$0, _matrix_scan.state(%rip)
	jmp	LBB0_29
LBB0_19:
	cmpl	$135, %ebx
	jg	LBB0_21
## %bb.20:
	movl	%ebx, %edi
	callq	_matrix_make
	jmp	LBB0_27
LBB0_25:
	leaq	L_.str.11(%rip), %rdi
	jmp	LBB0_26
LBB0_21:
	leaq	L_.str.9(%rip), %rdi
LBB0_26:
	callq	_debug
	movl	%ebx, %edi
	callq	_debug_hex
	leaq	L_.str.10(%rip), %rdi
	callq	_debug
LBB0_27:
	movl	$5, _matrix_scan.state(%rip)
	leaq	L_.str.10(%rip), %rdi
LBB0_28:
	callq	_debug
LBB0_29:
	movl	$1, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_14, LBB0_14-LJTI0_0
.set L0_0_set_16, LBB0_16-LJTI0_0
.set L0_0_set_22, LBB0_22-LJTI0_0
LJTI0_0:
	.long	L0_0_set_4
	.long	L0_0_set_6
	.long	L0_0_set_10
	.long	L0_0_set_12
	.long	L0_0_set_14
	.long	L0_0_set_16
	.long	L0_0_set_22
	.end_data_region
                                        ## -- End function
.zerofill __DATA,__bss,_matrix_scan.state,4,2 ## @matrix_scan.state
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"r"

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

L_.str.2:                               ## @.str.2
	.asciz	"wFF "

L_.str.3:                               ## @.str.3
	.asciz	"[ack]\nRESET_RESPONSE: "

L_.str.4:                               ## @.str.4
	.asciz	"[ok]\nKBD_ID: "

L_.str.5:                               ## @.str.5
	.asciz	"err\nRESET: "

L_.str.6:                               ## @.str.6
	.asciz	"\nCONFIG: "

L_.str.7:                               ## @.str.7
	.asciz	"wF8 "

L_.str.8:                               ## @.str.8
	.asciz	"[ack]\nREADY\n"

L_.str.9:                               ## @.str.9
	.asciz	"unexpected scan code at READY: "

L_.str.10:                              ## @.str.10
	.asciz	"\n"

L_.str.11:                              ## @.str.11
	.asciz	"unexpected scan code at F0: "

.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	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	bl	_ps2_host_recv
	mov	x19, x0
	cbz	w0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_debug
	mov	x0, x19
	bl	_debug_hex
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_debug
LBB0_2:
	adrp	x20, _matrix_scan.state@PAGE
	ldr	w8, [x20, _matrix_scan.state@PAGEOFF]
	cmp	w8, #6
	b.hi	LBB0_29
; %bb.3:
Lloh4:
	adrp	x9, lJTI0_0@PAGE
Lloh5:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_4
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_4:
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_debug
	mov	w0, #255
	bl	_ps2_host_send
	cmp	w0, #250
	b.ne	LBB0_29
; %bb.5:
Lloh8:
	adrp	x0, l_.str.3@PAGE
Lloh9:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_debug
	mov	w8, #1
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_6:
	cmp	w19, #170
	b.ne	LBB0_20
; %bb.7:
Lloh10:
	adrp	x0, l_.str.4@PAGE
Lloh11:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_debug
	mov	w8, #2
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_8:
	cbz	w19, LBB0_29
; %bb.9:
	mov	w8, #3
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_10:
	cbz	w19, LBB0_29
; %bb.11:
Lloh12:
	adrp	x0, l_.str.6@PAGE
Lloh13:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_debug
	mov	w8, #4
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_12:
Lloh14:
	adrp	x0, l_.str.7@PAGE
Lloh15:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_debug
	mov	w0, #248
	bl	_ps2_host_send
	cmp	w0, #250
	b.ne	LBB0_29
; %bb.13:
Lloh16:
	adrp	x0, l_.str.8@PAGE
Lloh17:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_debug
	mov	w8, #5
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_14:
	cbz	w19, LBB0_29
; %bb.15:
	cmp	w19, #240
	b.ne	LBB0_22
; %bb.16:
	mov	w8, #6
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_28
LBB0_17:
	cbz	w19, LBB0_29
; %bb.18:
	cmp	w19, #135
	b.gt	LBB0_24
; %bb.19:
	mov	x0, x19
	bl	_matrix_break
	b	LBB0_27
LBB0_20:
	cbz	w19, LBB0_29
; %bb.21:
Lloh20:
	adrp	x0, l_.str.5@PAGE
Lloh21:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_debug
	str	wzr, [x20, _matrix_scan.state@PAGEOFF]
	b	LBB0_29
LBB0_22:
	cmp	w19, #135
	b.gt	LBB0_25
; %bb.23:
	mov	x0, x19
	bl	_matrix_make
	b	LBB0_27
LBB0_24:
Lloh22:
	adrp	x0, l_.str.11@PAGE
Lloh23:
	add	x0, x0, l_.str.11@PAGEOFF
	b	LBB0_26
LBB0_25:
Lloh24:
	adrp	x0, l_.str.9@PAGE
Lloh25:
	add	x0, x0, l_.str.9@PAGEOFF
LBB0_26:
	bl	_debug
	mov	x0, x19
	bl	_debug_hex
Lloh26:
	adrp	x0, l_.str.10@PAGE
Lloh27:
	add	x0, x0, l_.str.10@PAGEOFF
	bl	_debug
LBB0_27:
	mov	w8, #5
	str	w8, [x20, _matrix_scan.state@PAGEOFF]
Lloh28:
	adrp	x0, l_.str.10@PAGE
Lloh29:
	add	x0, x0, l_.str.10@PAGEOFF
LBB0_28:
	bl	_debug
LBB0_29:
	mov	w0, #1
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_4-LBB0_4)>>2
	.byte	(LBB0_6-LBB0_4)>>2
	.byte	(LBB0_8-LBB0_4)>>2
	.byte	(LBB0_10-LBB0_4)>>2
	.byte	(LBB0_12-LBB0_4)>>2
	.byte	(LBB0_14-LBB0_4)>>2
	.byte	(LBB0_17-LBB0_4)>>2
                                        ; -- End function
.zerofill __DATA,__bss,_matrix_scan.state,4,2 ; @matrix_scan.state
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"r"

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

l_.str.2:                               ; @.str.2
	.asciz	"wFF "

l_.str.3:                               ; @.str.3
	.asciz	"[ack]\nRESET_RESPONSE: "

l_.str.4:                               ; @.str.4
	.asciz	"[ok]\nKBD_ID: "

l_.str.5:                               ; @.str.5
	.asciz	"err\nRESET: "

l_.str.6:                               ; @.str.6
	.asciz	"\nCONFIG: "

l_.str.7:                               ; @.str.7
	.asciz	"wF8 "

l_.str.8:                               ; @.str.8
	.asciz	"[ack]\nREADY\n"

l_.str.9:                               ; @.str.9
	.asciz	"unexpected scan code at READY: "

l_.str.10:                              ; @.str.10
	.asciz	"\n"

l_.str.11:                              ; @.str.11
	.asciz	"unexpected scan code at F0: "

.subsections_via_symbols
