	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function DetectSerialMouse
_DetectSerialMouse:                     ## @DetectSerialMouse
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	leaq	4(%rdi), %r15
	movq	%r15, %rdi
	callq	_READ_PORT_UCHAR
                                        ## kill: def $eax killed $eax def $rax
	andl	$-4, %eax
	leal	1(%rax), %esi
	movq	%r15, %rdi
	callq	_WRITE_PORT_UCHAR
	movl	$100000, %edi                   ## imm = 0x186A0
	callq	_StallExecutionProcessor
	leaq	5(%r14), %r13
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	je	LBB0_5
## %bb.1:
	movl	$-200, %ebx
	movq	_MOUSE_TYPE_NONE@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	je	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rdi
	callq	_READ_PORT_UCHAR
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	jne	LBB0_2
LBB0_5:
	movq	%r15, %rdi
	movl	$11, %esi
	callq	_WRITE_PORT_UCHAR
	movl	$10000, %edi                    ## imm = 0x2710
	callq	_StallExecutionProcessor
	movl	$-20, %r12d
	movq	_MOUSE_TYPE_NONE@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$100, %edi
	callq	_StallExecutionProcessor
	incl	%r12d
	jne	LBB0_6
	jmp	LBB0_28
LBB0_8:
	movq	%r14, %rdi
	callq	_READ_PORT_UCHAR
	movl	%eax, %r15d
	movb	%r15b, -44(%rbp)
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	jne	LBB0_10
## %bb.18:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	$100, %edi
	callq	_StallExecutionProcessor
	incl	%r12d
	jne	LBB0_9
	jmp	LBB0_28
LBB0_3:
	movq	%r12, %rbx
	jmp	LBB0_28
LBB0_10:
	movq	%r14, %rdi
	callq	_READ_PORT_UCHAR
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movb	%al, -43(%rbp)
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	jne	LBB0_12
## %bb.19:                              ##   in Loop: Header=BB0_11 Depth=1
	movl	$100, %edi
	callq	_StallExecutionProcessor
	incl	%r12d
	jne	LBB0_11
	jmp	LBB0_28
LBB0_12:
	movq	%r14, %rdi
	callq	_READ_PORT_UCHAR
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movb	%al, -42(%rbp)
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_READ_PORT_UCHAR
	testb	$1, %al
	jne	LBB0_14
## %bb.20:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	$100, %edi
	callq	_StallExecutionProcessor
	incl	%r12d
	jne	LBB0_13
	jmp	LBB0_28
LBB0_14:
	movq	%r14, %rdi
	callq	_READ_PORT_UCHAR
	movb	%al, -41(%rbp)
	movsbl	%r15b, %esi
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	movsbl	%r14b, %edx
	movl	-48(%rbp), %r12d                ## 4-byte Reload
	movsbl	%r12b, %ecx
	movsbl	%al, %r8d
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_TRACE
	cmpb	$66, %r15b
	je	LBB0_28
## %bb.15:
	movl	$1, %eax
	cmpb	$77, %r15b
	je	LBB0_16
## %bb.23:
	cmpb	$66, %r14b
	je	LBB0_28
## %bb.24:
	movl	$2, %eax
	cmpb	$77, %r14b
	je	LBB0_16
## %bb.25:
	movl	$3, %eax
	cmpb	$77, %r12b
	jne	LBB0_28
LBB0_16:
	movsbl	-44(%rbp,%rax), %eax
	cmpl	$51, %eax
	je	LBB0_17
## %bb.21:
	cmpl	$90, %eax
	jne	LBB0_26
## %bb.22:
	movq	_MOUSE_TYPE_WHEELZ@GOTPCREL(%rip), %rbx
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_27
LBB0_17:
	movq	_MOUSE_TYPE_LOGITECH@GOTPCREL(%rip), %rbx
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_27
LBB0_26:
	movq	_MOUSE_TYPE_MICROSOFT@GOTPCREL(%rip), %rbx
	leaq	L_.str.3(%rip), %rdi
LBB0_27:
	xorl	%eax, %eax
	callq	_TRACE
LBB0_28:
	movl	(%rbx), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MOUSE_TYPE_NONE,4,2            ## @MOUSE_TYPE_NONE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Mouse data: %x %x %x %x\n"

L_.str.1:                               ## @.str.1
	.asciz	"Microsoft Mouse with 3-buttons detected\n"

	.comm	_MOUSE_TYPE_LOGITECH,4,2        ## @MOUSE_TYPE_LOGITECH
L_.str.2:                               ## @.str.2
	.asciz	"Microsoft Wheel Mouse detected\n"

	.comm	_MOUSE_TYPE_WHEELZ,4,2          ## @MOUSE_TYPE_WHEELZ
L_.str.3:                               ## @.str.3
	.asciz	"Microsoft Mouse with 2-buttons detected\n"

	.comm	_MOUSE_TYPE_MICROSOFT,4,2       ## @MOUSE_TYPE_MICROSOFT
	.no_dead_strip	_DetectSerialMouse
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function DetectSerialMouse
_DetectSerialMouse:                     ; @DetectSerialMouse
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	add	x21, x0, #4
	mov	x0, x21
	bl	_READ_PORT_UCHAR
	and	w8, w0, #0xfffffffc
	orr	w1, w8, #0x1
	mov	x0, x21
	bl	_WRITE_PORT_UCHAR
	mov	w0, #34464
	movk	w0, #1, lsl #16
	bl	_StallExecutionProcessor
	add	x20, x19, #5
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbz	w0, #0, LBB0_4
; %bb.1:
	mov	w22, #-200
Lloh0:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	adds	w22, w22, #1
	b.hs	LBB0_26
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x19
	bl	_READ_PORT_UCHAR
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbnz	w0, #0, LBB0_2
LBB0_4:
	mov	x0, x21
	mov	w1, #11
	bl	_WRITE_PORT_UCHAR
	mov	w0, #10000
	bl	_StallExecutionProcessor
	mov	w25, #-20
Lloh2:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh3:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbnz	w0, #0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #100
	bl	_StallExecutionProcessor
	adds	w25, w25, #1
	b.lo	LBB0_5
	b	LBB0_26
LBB0_7:
	mov	x0, x19
	bl	_READ_PORT_UCHAR
	mov	x21, x0
	strb	w0, [sp, #44]
Lloh4:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh5:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbnz	w0, #0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	w0, #100
	bl	_StallExecutionProcessor
	adds	w25, w25, #1
	b.lo	LBB0_8
	b	LBB0_26
LBB0_10:
	mov	x0, x19
	bl	_READ_PORT_UCHAR
	mov	x22, x0
	strb	w0, [sp, #45]
Lloh6:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh7:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbnz	w0, #0, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w0, #100
	bl	_StallExecutionProcessor
	adds	w25, w25, #1
	b.lo	LBB0_11
	b	LBB0_26
LBB0_13:
	mov	x0, x19
	bl	_READ_PORT_UCHAR
	mov	x23, x0
	strb	w0, [sp, #46]
Lloh8:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh9:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_READ_PORT_UCHAR
	tbnz	w0, #0, LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	w0, #100
	bl	_StallExecutionProcessor
	adds	w25, w25, #1
	b.lo	LBB0_14
	b	LBB0_26
LBB0_16:
	mov	x0, x19
	bl	_READ_PORT_UCHAR
	sxtb	w8, w21
	strb	w0, [sp, #47]
	sxtb	w9, w22
	sxtb	w10, w23
	sxtb	w11, w0
	stp	x10, x11, [sp, #16]
	stp	x8, x9, [sp]
Lloh10:
	adrp	x0, l_.str@PAGE
Lloh11:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	and	w8, w21, #0xff
	cmp	w8, #66
	b.eq	LBB0_25
; %bb.17:
	cmp	w8, #77
	b.ne	LBB0_19
; %bb.18:
	mov	w8, #1
	b	LBB0_24
LBB0_19:
	and	w8, w22, #0xff
	cmp	w8, #66
	b.eq	LBB0_25
; %bb.20:
	cmp	w8, #77
	b.ne	LBB0_22
; %bb.21:
	mov	w8, #2
	b	LBB0_24
LBB0_22:
	and	w8, w23, #0xff
	cmp	w8, #77
	b.ne	LBB0_25
; %bb.23:
	mov	w8, #3
LBB0_24:
	add	x9, sp, #44
	ldrsb	w8, [x9, x8]
Lloh12:
	adrp	x9, _MOUSE_TYPE_LOGITECH@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MOUSE_TYPE_LOGITECH@GOTPAGEOFF]
Lloh14:
	adrp	x10, l_.str.1@PAGE
Lloh15:
	add	x10, x10, l_.str.1@PAGEOFF
Lloh16:
	adrp	x11, _MOUSE_TYPE_MICROSOFT@GOTPAGE
Lloh17:
	ldr	x11, [x11, _MOUSE_TYPE_MICROSOFT@GOTPAGEOFF]
Lloh18:
	adrp	x12, l_.str.3@PAGE
Lloh19:
	add	x12, x12, l_.str.3@PAGEOFF
Lloh20:
	adrp	x13, _MOUSE_TYPE_WHEELZ@GOTPAGE
Lloh21:
	ldr	x13, [x13, _MOUSE_TYPE_WHEELZ@GOTPAGEOFF]
Lloh22:
	adrp	x14, l_.str.2@PAGE
Lloh23:
	add	x14, x14, l_.str.2@PAGEOFF
	cmp	w8, #90
	csel	x12, x12, x14, ne
	csel	x11, x11, x13, ne
	cmp	w8, #51
	csel	x0, x10, x12, eq
	csel	x24, x9, x11, eq
	bl	_TRACE
	b	LBB0_26
LBB0_25:
Lloh24:
	adrp	x24, _MOUSE_TYPE_NONE@GOTPAGE
Lloh25:
	ldr	x24, [x24, _MOUSE_TYPE_NONE@GOTPAGEOFF]
LBB0_26:
	ldr	w0, [x24]
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_MOUSE_TYPE_NONE,4,2            ; @MOUSE_TYPE_NONE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Mouse data: %x %x %x %x\n"

l_.str.1:                               ; @.str.1
	.asciz	"Microsoft Mouse with 3-buttons detected\n"

	.comm	_MOUSE_TYPE_LOGITECH,4,2        ; @MOUSE_TYPE_LOGITECH
l_.str.2:                               ; @.str.2
	.asciz	"Microsoft Wheel Mouse detected\n"

	.comm	_MOUSE_TYPE_WHEELZ,4,2          ; @MOUSE_TYPE_WHEELZ
l_.str.3:                               ; @.str.3
	.asciz	"Microsoft Mouse with 2-buttons detected\n"

	.comm	_MOUSE_TYPE_MICROSOFT,4,2       ; @MOUSE_TYPE_MICROSOFT
	.no_dead_strip	_DetectSerialMouse
.subsections_via_symbols
