	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ps2_mouse_task                 ## -- Begin function ps2_mouse_task
	.p2align	4, 0x90
_ps2_mouse_task:                        ## @ps2_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
	movq	_PS2_MOUSE_READ_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ps2_host_send
	movq	_PS2_ACK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.1:
	xorl	%eax, %eax
	callq	_ps2_host_recv_response
	movq	_tp_buttons@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_mouse_report@GOTPCREL(%rip), %rbx
	movl	%eax, (%rbx)
	xorl	%eax, %eax
	callq	_ps2_host_recv_response
	movq	_PS2_MOUSE_X_MULTIPLIER@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	movl	%eax, 4(%rbx)
	xorl	%eax, %eax
	callq	_ps2_host_recv_response
	movq	_PS2_MOUSE_Y_MULTIPLIER@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	movl	%eax, 8(%rbx)
	cmpl	$0, 4(%rbx)
	movslq	(%rbx), %rcx
	jne	LBB0_5
## %bb.2:
	testl	%eax, %eax
	jne	LBB0_5
## %bb.3:
	cmpl	$0, 12(%rbx)
	jne	LBB0_5
## %bb.4:
	movq	_ps2_mouse_task.buttons_prev(%rip), %rax
	xorq	%rcx, %rax
	movq	_PS2_MOUSE_BTN_MASK@GOTPCREL(%rip), %rdx
	testq	%rax, (%rdx)
	je	LBB0_6
LBB0_5:
	movq	%rcx, _ps2_mouse_task.buttons_prev(%rip)
	movq	_mouse_report@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_ps2_mouse_convert_report_to_hid
	movq	%rbx, %rdi
	callq	_host_mouse_send
LBB0_6:
	movq	_mouse_report@GOTPCREL(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_ps2_mouse_clear_report         ## TAILCALL
LBB0_7:
	movq	_debug_mouse@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_8
## %bb.9:
	leaq	L_.str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	jmp	_print                          ## TAILCALL
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_ps2_mouse_task.buttons_prev,8,3 ## @ps2_mouse_task.buttons_prev
	.comm	_PS2_MOUSE_READ_DATA,4,2        ## @PS2_MOUSE_READ_DATA
	.comm	_PS2_ACK,8,3                    ## @PS2_ACK
	.comm	_mouse_report,16,2              ## @mouse_report
	.comm	_PS2_MOUSE_X_MULTIPLIER,4,2     ## @PS2_MOUSE_X_MULTIPLIER
	.comm	_PS2_MOUSE_Y_MULTIPLIER,4,2     ## @PS2_MOUSE_Y_MULTIPLIER
	.comm	_debug_mouse,8,3                ## @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ps2_mouse: fail to get mouse packet\n"

	.comm	_PS2_MOUSE_BTN_MASK,8,3         ## @PS2_MOUSE_BTN_MASK
	.comm	_PS2_MOUSE_SCROLL_MASK,4,2      ## @PS2_MOUSE_SCROLL_MASK
	.comm	_PS2_MOUSE_V_MULTIPLIER,4,2     ## @PS2_MOUSE_V_MULTIPLIER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ps2_mouse_task                 ; -- Begin function ps2_mouse_task
	.p2align	2
_ps2_mouse_task:                        ; @ps2_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
Lloh0:
	adrp	x8, _PS2_MOUSE_READ_DATA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PS2_MOUSE_READ_DATA@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_ps2_host_send
Lloh3:
	adrp	x8, _PS2_ACK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PS2_ACK@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_5
; %bb.1:
	bl	_ps2_host_recv_response
Lloh6:
	adrp	x8, _tp_buttons@GOTPAGE
Lloh7:
	ldr	x8, [x8, _tp_buttons@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	orr	w8, w8, w0
Lloh9:
	adrp	x19, _mouse_report@GOTPAGE
Lloh10:
	ldr	x19, [x19, _mouse_report@GOTPAGEOFF]
	str	w8, [x19]
	bl	_ps2_host_recv_response
Lloh11:
	adrp	x8, _PS2_MOUSE_X_MULTIPLIER@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PS2_MOUSE_X_MULTIPLIER@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	mul	w8, w8, w0
	str	w8, [x19, #4]
	bl	_ps2_host_recv_response
Lloh14:
	adrp	x8, _PS2_MOUSE_Y_MULTIPLIER@GOTPAGE
Lloh15:
	ldr	x8, [x8, _PS2_MOUSE_Y_MULTIPLIER@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	mul	w9, w8, w0
	str	w9, [x19, #8]
	ldr	w10, [x19, #12]
	ldp	w8, w11, [x19]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	cmp	w11, #0
	ccmp	w9, #0, #0, eq
	ccmp	w10, #0, #0, eq
	adrp	x9, _ps2_mouse_task.buttons_prev@PAGE
	b.ne	LBB0_3
; %bb.2:
	ldr	x10, [x9, _ps2_mouse_task.buttons_prev@PAGEOFF]
	eor	x10, x10, x8
Lloh17:
	adrp	x11, _PS2_MOUSE_BTN_MASK@GOTPAGE
Lloh18:
	ldr	x11, [x11, _PS2_MOUSE_BTN_MASK@GOTPAGEOFF]
Lloh19:
	ldr	x11, [x11]
	tst	x10, x11
	b.eq	LBB0_4
LBB0_3:
	str	x8, [x9, _ps2_mouse_task.buttons_prev@PAGEOFF]
Lloh20:
	adrp	x19, _mouse_report@GOTPAGE
Lloh21:
	ldr	x19, [x19, _mouse_report@GOTPAGEOFF]
	mov	x0, x19
	bl	_ps2_mouse_convert_report_to_hid
	mov	x0, x19
	bl	_host_mouse_send
LBB0_4:
Lloh22:
	adrp	x0, _mouse_report@GOTPAGE
Lloh23:
	ldr	x0, [x0, _mouse_report@GOTPAGEOFF]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_ps2_mouse_clear_report
LBB0_5:
Lloh24:
	adrp	x8, _debug_mouse@GOTPAGE
Lloh25:
	ldr	x8, [x8, _debug_mouse@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.6:
Lloh27:
	adrp	x0, l_.str@PAGE
Lloh28:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_print
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_ps2_mouse_task.buttons_prev,8,3 ; @ps2_mouse_task.buttons_prev
	.comm	_PS2_MOUSE_READ_DATA,4,2        ; @PS2_MOUSE_READ_DATA
	.comm	_PS2_ACK,8,3                    ; @PS2_ACK
	.comm	_mouse_report,16,2              ; @mouse_report
	.comm	_PS2_MOUSE_X_MULTIPLIER,4,2     ; @PS2_MOUSE_X_MULTIPLIER
	.comm	_PS2_MOUSE_Y_MULTIPLIER,4,2     ; @PS2_MOUSE_Y_MULTIPLIER
	.comm	_debug_mouse,8,3                ; @debug_mouse
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ps2_mouse: fail to get mouse packet\n"

	.comm	_PS2_MOUSE_BTN_MASK,8,3         ; @PS2_MOUSE_BTN_MASK
	.comm	_PS2_MOUSE_SCROLL_MASK,4,2      ; @PS2_MOUSE_SCROLL_MASK
	.comm	_PS2_MOUSE_V_MULTIPLIER,4,2     ; @PS2_MOUSE_V_MULTIPLIER
.subsections_via_symbols
