	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_serial_link_update             ## -- Begin function serial_link_update
	.p2align	4, 0x90
_serial_link_update:                    ## @serial_link_update
	.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	_read_serial_link_connected
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_serial_link_connected@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
LBB0_2:
	movq	_MATRIX_ROWS@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_7
## %bb.3:
	xorl	%eax, %eax
	callq	_chVTGetSystemTimeX
	movq	%rax, %r15
	movq	_last_update@GOTPCREL(%rip), %r14
	movq	%rax, %rbx
	subq	(%r14), %rbx
	movl	$5000, %edi                     ## imm = 0x1388
	callq	_US2ST
	cmpq	%rax, %rbx
	jle	LBB0_5
## %bb.4:
	movq	%r15, (%r14)
	xorl	%eax, %eax
	callq	_begin_write_keyboard_matrix
	xorl	%eax, %eax
	callq	_end_write_keyboard_matrix
	xorl	%eax, %eax
	callq	_begin_write_serial_link_connected
	movl	$1, (%rax)
	xorl	%eax, %eax
	callq	_end_write_serial_link_connected
LBB0_5:
	xorl	%edi, %edi
	callq	_read_keyboard_matrix
	testq	%rax, %rax
	je	LBB0_8
## %bb.6:
	movq	(%rax), %rdi
	xorl	%esi, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_matrix_set_remote              ## TAILCALL
LBB0_7:
	callq	_serial_link_update.cold.1
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function serial_link_update.cold.1
_serial_link_update.cold.1:             ## @serial_link_update.cold.1
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	xorl	%edi, %edi
	callq	_matrix_get_row
	ud2
	.cfi_endproc
                                        ## -- End function
	.comm	_serial_link_connected,4,2      ## @serial_link_connected
	.comm	_MATRIX_ROWS,8,3                ## @MATRIX_ROWS
	.comm	_last_matrix,8,3                ## @last_matrix
	.comm	_last_update,8,3                ## @last_update
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_serial_link_update             ; -- Begin function serial_link_update
	.p2align	2
_serial_link_update:                    ; @serial_link_update
	.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	_read_serial_link_connected
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _serial_link_connected@GOTPAGE
Lloh1:
	ldr	x8, [x8, _serial_link_connected@GOTPAGEOFF]
	mov	w9, #1
Lloh2:
	str	w9, [x8]
LBB0_2:
Lloh3:
	adrp	x8, _MATRIX_ROWS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MATRIX_ROWS@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cbnz	x8, LBB0_8
; %bb.3:
	bl	_chVTGetSystemTimeX
	mov	x19, x0
Lloh6:
	adrp	x20, _last_update@GOTPAGE
Lloh7:
	ldr	x20, [x20, _last_update@GOTPAGEOFF]
	ldr	x8, [x20]
	sub	x21, x0, x8
	mov	w0, #5000
	bl	_US2ST
	cmp	x21, x0
	b.le	LBB0_5
; %bb.4:
	str	x19, [x20]
	bl	_begin_write_keyboard_matrix
	bl	_end_write_keyboard_matrix
	bl	_begin_write_serial_link_connected
	mov	w8, #1
	str	w8, [x0]
	bl	_end_write_serial_link_connected
LBB0_5:
	mov	w0, #0
	bl	_read_keyboard_matrix
	cbz	x0, LBB0_7
; %bb.6:
	ldr	x0, [x0]
	mov	w1, #0
	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
	b	_matrix_set_remote
LBB0_7:
	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
LBB0_8:
	bl	_serial_link_update.cold.1
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function serial_link_update.cold.1
_serial_link_update.cold.1:             ; @serial_link_update.cold.1
	.cfi_startproc
; %bb.0:
	stp	x29, x30, [sp, #-16]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 16
	mov	x29, sp
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	mov	x0, #0
	bl	_matrix_get_row
	brk	#0x1
	.cfi_endproc
                                        ; -- End function
	.comm	_serial_link_connected,4,2      ; @serial_link_connected
	.comm	_MATRIX_ROWS,8,3                ; @MATRIX_ROWS
	.comm	_last_matrix,8,3                ; @last_matrix
	.comm	_last_update,8,3                ; @last_update
.subsections_via_symbols
