	.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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	_matrix_scan.extra_key(%rip), %ebx
	movl	$65535, _matrix_scan.extra_key(%rip) ## imm = 0xFFFF
	cmpl	$65535, %ebx                    ## imm = 0xFFFF
	jne	LBB0_3
## %bb.1:
	movl	_matrix_scan.tick_ms(%rip), %edi
	callq	_timer_elapsed
	xorl	%r14d, %r14d
	cmpl	$12, %eax
	jl	LBB0_22
## %bb.2:
	xorl	%eax, %eax
	callq	_timer_read
	movl	%eax, _matrix_scan.tick_ms(%rip)
	xorl	%eax, %eax
	callq	_adb_host_kbd_recv
	movl	%eax, %ebx
LBB0_3:
	movq	_debug_matrix@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
## %bb.4:
	testl	%ebx, %ebx
	je	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	callq	_print
	movl	%ebx, %edi
	callq	_phex16
	leaq	L_.str.1(%rip), %rdi
	callq	_print
LBB0_6:
	testl	%ebx, %ebx
	je	LBB0_7
## %bb.8:
	cmpl	$65535, %ebx                    ## imm = 0xFFFF
	je	LBB0_11
## %bb.9:
	cmpl	$32639, %ebx                    ## imm = 0x7F7F
	jne	LBB0_12
## %bb.10:
	movl	$127, %edi
	callq	_register_key
	jmp	LBB0_21
LBB0_7:
	movl	%ebx, %r14d
	jmp	LBB0_22
LBB0_11:
	movl	$255, %edi
	callq	_register_key
	jmp	LBB0_21
LBB0_12:
	movl	%ebx, %edi
	sarl	$8, %edi
	movzbl	%bl, %r14d
	cmpl	$255, %edi
	jne	LBB0_14
## %bb.13:
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	callq	_xprintf
	xorl	%eax, %eax
	callq	_matrix_init
	jmp	LBB0_22
LBB0_14:
	movq	_is_iso_layout@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_19
## %bb.15:
	movl	%edi, %eax
	andl	$127, %eax
	cmpl	$10, %eax
	je	LBB0_18
## %bb.16:
	cmpl	$50, %eax
	jne	LBB0_19
## %bb.17:
	andl	$128, %edi
	orl	$10, %edi
	jmp	LBB0_19
LBB0_18:
	andl	$128, %edi
	orl	$50, %edi
LBB0_19:
	callq	_register_key
	cmpl	$255, %r14d
	je	LBB0_21
## %bb.20:
	shll	$8, %r14d
	orl	$255, %r14d
	movl	%r14d, _matrix_scan.extra_key(%rip)
LBB0_21:
	xorl	%eax, %eax
	callq	_matrix_scan_quantum
	movl	$1, %r14d
LBB0_22:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__DATA,__data
	.p2align	2                               ## @matrix_scan.extra_key
_matrix_scan.extra_key:
	.long	65535                           ## 0xffff

.zerofill __DATA,__bss,_matrix_scan.tick_ms,4,2 ## @matrix_scan.tick_ms
	.comm	_debug_matrix,8,3               ## @debug_matrix
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"adb_host_kbd_recv: "

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

L_.str.2:                               ## @.str.2
	.asciz	"adb_host_kbd_recv: ERROR(%d)\n"

	.comm	_is_iso_layout,8,3              ## @is_iso_layout
.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
	adrp	x20, _matrix_scan.extra_key@PAGE
	ldr	w19, [x20, _matrix_scan.extra_key@PAGEOFF]
	mov	w8, #65535
	str	w8, [x20, _matrix_scan.extra_key@PAGEOFF]
	cmp	w19, w8
	b.ne	LBB0_4
; %bb.1:
	adrp	x19, _matrix_scan.tick_ms@PAGE
	ldr	w0, [x19, _matrix_scan.tick_ms@PAGEOFF]
	bl	_timer_elapsed
	cmp	w0, #12
	b.ge	LBB0_3
; %bb.2:
	mov	w19, #0
	b	LBB0_16
LBB0_3:
	bl	_timer_read
	str	w0, [x19, _matrix_scan.tick_ms@PAGEOFF]
	bl	_adb_host_kbd_recv
	mov	x19, x0
LBB0_4:
Lloh0:
	adrp	x8, _debug_matrix@GOTPAGE
Lloh1:
	ldr	x8, [x8, _debug_matrix@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, #0
	ccmp	w19, #0, #4, ne
	b.eq	LBB0_6
; %bb.5:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_print
	mov	x0, x19
	bl	_phex16
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_print
LBB0_6:
	cbz	w19, LBB0_16
; %bb.7:
	mov	w8, #65535
	cmp	w19, w8
	b.eq	LBB0_10
; %bb.8:
	mov	w8, #32639
	cmp	w19, w8
	b.ne	LBB0_11
; %bb.9:
	mov	w0, #127
	bl	_register_key
	b	LBB0_15
LBB0_10:
	mov	w0, #255
	bl	_register_key
	b	LBB0_15
LBB0_11:
	and	w21, w19, #0xff
	asr	w8, w19, #8
	cmp	w8, #255
	b.ne	LBB0_13
; %bb.12:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	bl	_xprintf
	bl	_matrix_init
	mov	x19, x21
	b	LBB0_16
LBB0_13:
Lloh9:
	adrp	x9, _is_iso_layout@GOTPAGE
Lloh10:
	ldr	x9, [x9, _is_iso_layout@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	ubfx	w10, w19, #8, #7
	and	w11, w8, #0x80
	mov	w12, #50
	orr	w12, w11, w12
	mov	w13, #10
	orr	w11, w11, w13
	cmp	w10, #50
	csel	w11, w8, w11, ne
	cmp	w10, #10
	csel	w10, w12, w11, eq
	cmp	x9, #0
	csel	w0, w8, w10, eq
	bl	_register_key
	cmp	w21, #255
	b.eq	LBB0_15
; %bb.14:
	mov	w8, #255
	bfi	w8, w21, #8, #8
	str	w8, [x20, _matrix_scan.extra_key@PAGEOFF]
LBB0_15:
	bl	_matrix_scan_quantum
	mov	w19, #1
LBB0_16:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__DATA,__data
	.p2align	2                               ; @matrix_scan.extra_key
_matrix_scan.extra_key:
	.long	65535                           ; 0xffff

.zerofill __DATA,__bss,_matrix_scan.tick_ms,4,2 ; @matrix_scan.tick_ms
	.comm	_debug_matrix,8,3               ; @debug_matrix
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"adb_host_kbd_recv: "

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

l_.str.2:                               ; @.str.2
	.asciz	"adb_host_kbd_recv: ERROR(%d)\n"

	.comm	_is_iso_layout,8,3              ; @is_iso_layout
.subsections_via_symbols
