	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	xorl	%eax, %eax
	callq	_serial_recv2
	testl	%eax, %eax
	js	LBB0_16
## %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:
	testb	$64, %bl
	jne	LBB0_4
## %bb.5:
	movl	_serial_mouse_task.buffer_cur(%rip), %ecx
	jmp	LBB0_6
LBB0_4:
	movl	$0, _serial_mouse_task.buffer_cur(%rip)
	xorl	%ecx, %ecx
LBB0_6:
	movslq	%ecx, %rdx
	leaq	_serial_mouse_task.buffer(%rip), %rax
	movl	%ebx, (%rax,%rdx,4)
	movl	_serial_mouse_task.buffer(%rip), %eax
	testl	%edx, %edx
	jne	LBB0_9
## %bb.7:
	cmpl	$32, %eax
	jne	LBB0_9
## %bb.8:
	movq	_MOUSE_BTN3@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, _serial_mouse_task.report+8(%rip)
	movq	$0, _serial_mouse_task.report(%rip)
	jmp	LBB0_15
LBB0_9:
	leal	1(%rcx), %edx
	movl	%edx, _serial_mouse_task.buffer_cur(%rip)
	cmpl	$2, %ecx
	jge	LBB0_10
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
LBB0_10:
	movl	$0, _serial_mouse_task.buffer_cur(%rip)
	movl	$0, _serial_mouse_task.report+8(%rip)
	xorl	%ecx, %ecx
	testb	$32, %al
	je	LBB0_12
## %bb.11:
	movq	_MOUSE_BTN1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, _serial_mouse_task.report+8(%rip)
LBB0_12:
	testb	$16, %al
	je	LBB0_14
## %bb.13:
	movq	_MOUSE_BTN2@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movl	%ecx, _serial_mouse_task.report+8(%rip)
LBB0_14:
	movl	%eax, %edi
	shll	$6, %edi
	orl	_serial_mouse_task.buffer+4(%rip), %edi
	movl	%edi, _serial_mouse_task.report(%rip)
	andl	$12, %eax
	shll	$4, %eax
	orl	_serial_mouse_task.buffer+8(%rip), %eax
	movl	%eax, _serial_mouse_task.report+4(%rip)
	movl	$-127, %esi
	callq	_MAX
	movl	%eax, _serial_mouse_task.report(%rip)
	movl	_serial_mouse_task.report+4(%rip), %edi
	movl	$-127, %esi
	callq	_MAX
	movl	%eax, _serial_mouse_task.report+4(%rip)
LBB0_15:
	leaq	_serial_mouse_task.report(%rip), %rbx
	movq	%rbx, %rdi
	callq	_print_usb_data
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_host_mouse_send                ## TAILCALL
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_serial_mouse_task.buffer,12,2 ## @serial_mouse_task.buffer
.zerofill __DATA,__bss,_serial_mouse_task.buffer_cur,4,2 ## @serial_mouse_task.buffer_cur
.zerofill __DATA,__bss,_serial_mouse_task.report,12,2 ## @serial_mouse_task.report
	.comm	_debug_mouse,8,3                ## @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"serial_mouse: byte: %04X\n"

	.comm	_MOUSE_BTN3,4,2                 ## @MOUSE_BTN3
	.comm	_MOUSE_BTN1,4,2                 ## @MOUSE_BTN1
	.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:
	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	_serial_recv2
	tbnz	w0, #31, LBB0_10
; %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
	tbnz	w19, #6, LBB0_5
; %bb.4:
	ldr	w10, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
	b	LBB0_6
LBB0_5:
	mov	w10, #0
	str	wzr, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
LBB0_6:
Lloh5:
	adrp	x8, _serial_mouse_task.buffer@PAGE
Lloh6:
	add	x8, x8, _serial_mouse_task.buffer@PAGEOFF
	str	w19, [x8, w10, sxtw #2]
	ldr	w8, [x8]
	cbnz	w10, LBB0_9
; %bb.7:
	cmp	w8, #32
	b.ne	LBB0_9
; %bb.8:
Lloh7:
	adrp	x8, _MOUSE_BTN3@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MOUSE_BTN3@GOTPAGEOFF]
Lloh9:
	adrp	x9, _serial_mouse_task.report@PAGE
Lloh10:
	add	x9, x9, _serial_mouse_task.report@PAGEOFF
Lloh11:
	ldr	w8, [x8]
	ldr	w10, [x9, #8]
	orr	w8, w10, w8
	str	w8, [x9, #8]
	str	xzr, [x9]
	b	LBB0_16
LBB0_9:
	add	w11, w10, #1
	str	w11, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
	cmp	w10, #2
	b.ge	LBB0_11
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_11:
	mov	w10, #0
	str	wzr, [x9, _serial_mouse_task.buffer_cur@PAGEOFF]
	adrp	x9, _serial_mouse_task.report@PAGE+8
	str	wzr, [x9, _serial_mouse_task.report@PAGEOFF+8]
	tbz	w8, #5, LBB0_13
; %bb.12:
Lloh12:
	adrp	x10, _MOUSE_BTN1@GOTPAGE
Lloh13:
	ldr	x10, [x10, _MOUSE_BTN1@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	str	w10, [x9, _serial_mouse_task.report@PAGEOFF+8]
LBB0_13:
	tbz	w8, #4, LBB0_15
; %bb.14:
Lloh15:
	adrp	x11, _MOUSE_BTN2@GOTPAGE
Lloh16:
	ldr	x11, [x11, _MOUSE_BTN2@GOTPAGEOFF]
Lloh17:
	ldr	w11, [x11]
	orr	w10, w10, w11
	str	w10, [x9, _serial_mouse_task.report@PAGEOFF+8]
LBB0_15:
Lloh18:
	adrp	x9, _serial_mouse_task.buffer@PAGE+4
Lloh19:
	add	x9, x9, _serial_mouse_task.buffer@PAGEOFF+4
Lloh20:
	adrp	x19, _serial_mouse_task.report@PAGE
Lloh21:
	add	x19, x19, _serial_mouse_task.report@PAGEOFF
	ldp	w10, w9, [x9]
	orr	w0, w10, w8, lsl #6
	lsl	w8, w8, #4
	and	w8, w8, #0xc0
	orr	w8, w9, w8
	stp	w0, w8, [x19]
	mov	w1, #-127
	bl	_MAX
	str	w0, [x19]
	ldr	w0, [x19, #4]
	mov	w1, #-127
	bl	_MAX
	str	w0, [x19, #4]
LBB0_16:
Lloh22:
	adrp	x19, _serial_mouse_task.report@PAGE
Lloh23:
	add	x19, x19, _serial_mouse_task.report@PAGEOFF
	mov	x0, x19
	bl	_print_usb_data
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_host_mouse_send
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_serial_mouse_task.buffer,12,2 ; @serial_mouse_task.buffer
.zerofill __DATA,__bss,_serial_mouse_task.buffer_cur,4,2 ; @serial_mouse_task.buffer_cur
.zerofill __DATA,__bss,_serial_mouse_task.report,12,3 ; @serial_mouse_task.report
	.comm	_debug_mouse,8,3                ; @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"serial_mouse: byte: %04X\n"

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