	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_serial_mouse_task              ## -- Begin function serial_mouse_task
	.p2align	4, 0x90
_serial_mouse_task:                     ## @serial_mouse_task
	.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
	subq	$64, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	xorps	%xmm0, %xmm0
	movups	%xmm0, -32(%rbp)
	movups	%xmm0, -48(%rbp)
	movups	%xmm0, -64(%rbp)
	xorl	%eax, %eax
	callq	_serial_recv2
	testl	%eax, %eax
	js	LBB0_14
## %bb.1:
	movl	%eax, %ebx
	movq	_debug_mouse@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_xprintf
LBB0_3:
	movslq	_serial_mouse_task.buffer_cur(%rip), %rax
	testq	%rax, %rax
	jne	LBB0_5
## %bb.4:
	movl	%ebx, %ecx
	andl	$-8, %ecx
	cmpl	$128, %ecx
	jne	LBB0_14
LBB0_5:
	leal	1(%rax), %ecx
	movl	%ecx, _serial_mouse_task.buffer_cur(%rip)
	leaq	_serial_mouse_task.buffer(%rip), %rcx
	movl	%ebx, (%rcx,%rax,4)
	cmpl	$4, %eax
	jl	LBB0_14
## %bb.6:
	movl	$0, _serial_mouse_task.buffer_cur(%rip)
	movl	_serial_mouse_task.buffer(%rip), %ecx
	xorl	%eax, %eax
	testb	$4, %cl
	je	LBB0_7
## %bb.8:
	testb	$2, %cl
	je	LBB0_9
LBB0_10:
	testb	$1, %cl
	jne	LBB0_12
LBB0_11:
	movq	_MOUSE_BTN2@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -64(%rbp)
LBB0_12:
	movl	_serial_mouse_task.buffer+4(%rip), %edi
	movl	$-127, %esi
	callq	_MAX
	movq	%rax, -72(%rbp)
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	subl	_serial_mouse_task.buffer+8(%rip), %edi
	movl	$-127, %esi
	callq	_MAX
	movq	%rax, -80(%rbp)
	leaq	-80(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_print_usb_data
	movq	%rbx, %rdi
	callq	_host_mouse_send
	movl	_serial_mouse_task.buffer+12(%rip), %edi
	movl	_serial_mouse_task.buffer+16(%rip), %eax
	orl	%edi, %eax
	je	LBB0_14
## %bb.13:
	movl	$-127, %esi
	callq	_MAX
	movq	%rax, -72(%rbp)
	subl	_serial_mouse_task.buffer+16(%rip), %r14d
	movl	%r14d, %edi
	movl	$-127, %esi
	callq	_MAX
	movq	%rax, -80(%rbp)
	leaq	-80(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_print_usb_data
	movq	%rbx, %rdi
	callq	_host_mouse_send
LBB0_14:
	addq	$64, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	movq	_MOUSE_BTN1@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	testb	$2, %cl
	jne	LBB0_10
LBB0_9:
	movq	_MOUSE_BTN3@GOTPCREL(%rip), %rdx
	orl	(%rdx), %eax
	movl	%eax, -64(%rbp)
	testb	$1, %cl
	je	LBB0_11
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_serial_mouse_task.buffer,20,4 ## @serial_mouse_task.buffer
.zerofill __DATA,__bss,_serial_mouse_task.buffer_cur,4,2 ## @serial_mouse_task.buffer_cur
	.comm	_debug_mouse,8,3                ## @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"serial_mouse: byte: %04X\n"

	.comm	_MOUSE_BTN1,4,2                 ## @MOUSE_BTN1
	.comm	_MOUSE_BTN3,4,2                 ## @MOUSE_BTN3
	.comm	_MOUSE_BTN2,4,2                 ## @MOUSE_BTN2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_serial_mouse_task              ; -- Begin function serial_mouse_task
	.p2align	2
_serial_mouse_task:                     ; @serial_mouse_task
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp, #32]
	str	q0, [sp, #16]
	bl	_serial_recv2
	tbnz	w0, #31, LBB0_12
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _debug_mouse@GOTPAGE
Lloh1:
	ldr	x8, [x8, _debug_mouse@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_3
; %bb.2:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	bl	_xprintf
LBB0_3:
	adrp	x9, _serial_mouse_task.buffer_cur@PAGE
	ldrsw	x8, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
	cbnz	w8, LBB0_5
; %bb.4:
	and	w10, w19, #0xfffffff8
	cmp	w10, #128
	b.ne	LBB0_12
LBB0_5:
	add	w10, w8, #1
	str	w10, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
Lloh5:
	adrp	x10, _serial_mouse_task.buffer@PAGE
Lloh6:
	add	x10, x10, _serial_mouse_task.buffer@PAGEOFF
	str	w19, [x10, x8, lsl #2]
	cmp	w8, #4
	b.lt	LBB0_12
; %bb.6:
	mov	w8, #0
	str	wzr, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
Lloh7:
	adrp	x9, _serial_mouse_task.buffer@PAGE
Lloh8:
	ldr	w9, [x9, _serial_mouse_task.buffer@PAGEOFF]
	tbz	w9, #2, LBB0_13
; %bb.7:
	tbz	w9, #1, LBB0_14
LBB0_8:
	tbnz	w9, #0, LBB0_10
LBB0_9:
Lloh9:
	adrp	x9, _MOUSE_BTN2@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MOUSE_BTN2@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w8, w9
	str	w8, [sp, #16]
LBB0_10:
Lloh12:
	adrp	x19, _serial_mouse_task.buffer@PAGE+4
Lloh13:
	add	x19, x19, _serial_mouse_task.buffer@PAGEOFF+4
	ldr	w0, [x19]
	mov	w1, #-127
	bl	_MAX
	str	x0, [sp, #8]
	ldr	w8, [x19, #4]
	neg	w0, w8
	mov	w1, #-127
	bl	_MAX
	str	x0, [sp]
	mov	x0, sp
	bl	_print_usb_data
	mov	x0, sp
	bl	_host_mouse_send
	ldp	w0, w8, [x19, #8]
	orr	w8, w0, w8
	cbz	w8, LBB0_12
; %bb.11:
	mov	w1, #-127
	bl	_MAX
	str	x0, [sp, #8]
Lloh14:
	adrp	x8, _serial_mouse_task.buffer@PAGE+16
Lloh15:
	ldr	w8, [x8, _serial_mouse_task.buffer@PAGEOFF+16]
	neg	w0, w8
	mov	w1, #-127
	bl	_MAX
	str	x0, [sp]
	mov	x0, sp
	bl	_print_usb_data
	mov	x0, sp
	bl	_host_mouse_send
LBB0_12:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_13:
Lloh16:
	adrp	x8, _MOUSE_BTN1@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MOUSE_BTN1@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [sp, #16]
	tbnz	w9, #1, LBB0_8
LBB0_14:
Lloh19:
	adrp	x10, _MOUSE_BTN3@GOTPAGE
Lloh20:
	ldr	x10, [x10, _MOUSE_BTN3@GOTPAGEOFF]
Lloh21:
	ldr	w10, [x10]
	orr	w8, w8, w10
	str	w8, [sp, #16]
	tbz	w9, #0, LBB0_9
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdr	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_serial_mouse_task.buffer,20,2 ; @serial_mouse_task.buffer
.zerofill __DATA,__bss,_serial_mouse_task.buffer_cur,4,2 ; @serial_mouse_task.buffer_cur
	.comm	_debug_mouse,8,3                ; @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"serial_mouse: byte: %04X\n"

	.comm	_MOUSE_BTN1,4,2                 ; @MOUSE_BTN1
	.comm	_MOUSE_BTN3,4,2                 ; @MOUSE_BTN3
	.comm	_MOUSE_BTN2,4,2                 ; @MOUSE_BTN2
.subsections_via_symbols
