	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ps2pp_detect                   ## -- Begin function ps2pp_detect
	.p2align	4, 0x90
_ps2pp_detect:                          ## @ps2pp_detect
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	16(%rdi), %rbx
	movl	$0, -64(%rbp)
	movq	_PSMOUSE_CMD_SETRES@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-64(%rbp), %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ps2_command
	movq	_PSMOUSE_CMD_SETSCALE11@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	xorl	%r14d, %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ps2_command
	movl	(%r13), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ps2_command
	movl	(%r13), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_ps2_command
	movl	$0, -60(%rbp)
	movq	_PSMOUSE_CMD_GETINFO@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_ps2_command
	movl	-64(%rbp), %r13d
	movl	%r13d, %eax
	shrl	$4, %eax
	andl	$7, %eax
	shll	$3, %r13d
	andl	$120, %r13d
	orl	%eax, %r13d
	je	LBB0_2
## %bb.1:
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	movl	%r13d, %edi
	callq	_get_model_info
	movq	%rax, %r15
	testq	%rax, %rax
	je	LBB0_11
## %bb.4:
	movq	(%r15), %rax
	movq	_PS2PP_KIND_TP3@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.5:
	movabsq	$17179869201, %rax              ## imm = 0x400000011
	movq	%rax, -64(%rbp)
	movl	$104, -56(%rbp)
	leaq	-64(%rbp), %r14
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$12497, %edx                    ## imm = 0x30D1
	callq	_ps2_command
	movabsq	$21474836497, %rax              ## imm = 0x500000011
	movq	%rax, -64(%rbp)
	movl	$11, -56(%rbp)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$12497, %edx                    ## imm = 0x30D1
	callq	_ps2_command
	movabsq	$38654705681, %rax              ## imm = 0x900000011
	movq	%rax, -64(%rbp)
	movl	$195, -56(%rbp)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$12497, %edx                    ## imm = 0x30D1
	callq	_ps2_command
	movl	$0, -64(%rbp)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$5073, %edx                     ## imm = 0x13D1
	callq	_ps2_command
	movl	-64(%rbp), %ecx
	movl	-56(%rbp), %edx
	xorl	$6, %ecx
	orl	%eax, %ecx
	orl	-60(%rbp), %ecx
	xorl	$20, %edx
	xorl	%r14d, %r14d
	orl	%ecx, %edx
	setne	%bl
	sete	%r14b
	jmp	LBB0_12
LBB0_2:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_11:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	movl	%r13d, %edx
	callq	_psmouse_warn
	xorl	%r14d, %r14d
	movb	$1, %bl
	jmp	LBB0_12
LBB0_6:
	movl	$0, -56(%rbp)
	movq	$0, -64(%rbp)
	leaq	-64(%rbp), %rbx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$57, %edx
	callq	_ps2pp_cmd
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$219, %edx
	callq	_ps2pp_cmd
	movl	-64(%rbp), %eax
	andl	$120, %eax
	xorl	%r14d, %r14d
	movb	$1, %bl
	cmpl	$72, %eax
	jne	LBB0_12
## %bb.7:
	movl	-60(%rbp), %eax
	movl	%eax, %ecx
	andl	$243, %ecx
	cmpl	$194, %ecx
	jne	LBB0_12
## %bb.8:
	shrl	$2, %eax
	xorl	-56(%rbp), %eax
	testb	$3, %al
	je	LBB0_9
LBB0_12:
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_20
## %bb.13:
	leaq	L_.str.1(%rip), %rax
	movq	%rax, (%r12)
	movl	%r13d, 8(%r12)
	testb	%bl, %bl
	movb	$1, %bl
	jne	LBB0_16
LBB0_14:
	movl	%r14d, %r13d
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_ps2pp_setup_protocol
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_23
## %bb.15:
	xorl	%ebx, %ebx
	movl	%r13d, %r14d
LBB0_16:
	cmpl	$3, -72(%rbp)                   ## 4-byte Folded Reload
	jl	LBB0_18
## %bb.17:
	movl	12(%r12), %edi
	movq	_EV_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_BTN_MIDDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_input_set_capability
LBB0_18:
	testq	%r15, %r15
	je	LBB0_20
## %bb.19:
	movq	%r12, %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	callq	_ps2pp_set_model_properties
LBB0_20:
	xorl	%r14d, %r14d
	testb	%bl, %bl
	je	LBB0_23
## %bb.21:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
LBB0_22:
	subl	(%rax), %r14d
LBB0_23:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_25
## %bb.24:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	xorl	%r14d, %r14d
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_ps2pp_set_smartscroll
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_23
## %bb.10:
	leaq	L_.str.1(%rip), %rax
	movq	%rax, (%r12)
	movl	%r13d, 8(%r12)
	movl	$1, %r14d
	jmp	LBB0_14
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PSMOUSE_CMD_SETRES,4,2         ## @PSMOUSE_CMD_SETRES
	.comm	_PSMOUSE_CMD_SETSCALE11,4,2     ## @PSMOUSE_CMD_SETSCALE11
	.comm	_PSMOUSE_CMD_GETINFO,4,2        ## @PSMOUSE_CMD_GETINFO
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_PS2PP_KIND_TP3,8,3             ## @PS2PP_KIND_TP3
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Detected unknown Logitech mouse model %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Logitech"

	.comm	_EV_KEY,4,2                     ## @EV_KEY
	.comm	_BTN_MIDDLE,4,2                 ## @BTN_MIDDLE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function ps2pp_detect
lCPI0_0:
	.long	17                              ; 0x11
	.long	4                               ; 0x4
lCPI0_1:
	.long	17                              ; 0x11
	.long	5                               ; 0x5
lCPI0_2:
	.long	9                               ; 0x9
	.long	195                             ; 0xc3
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_ps2pp_detect
	.p2align	2
_ps2pp_detect:                          ; @ps2pp_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	add	x23, x0, #16
	str	wzr, [sp, #8]
Lloh3:
	adrp	x8, _PSMOUSE_CMD_SETRES@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PSMOUSE_CMD_SETRES@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	add	x1, sp, #8
	mov	x0, x23
	bl	_ps2_command
Lloh6:
	adrp	x21, _PSMOUSE_CMD_SETSCALE11@GOTPAGE
Lloh7:
	ldr	x21, [x21, _PSMOUSE_CMD_SETSCALE11@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x23
	mov	x1, #0
	bl	_ps2_command
	ldr	w2, [x21]
	mov	x0, x23
	mov	x1, #0
	bl	_ps2_command
	ldr	w2, [x21]
	mov	x0, x23
	mov	x1, #0
	bl	_ps2_command
	str	wzr, [sp, #12]
Lloh8:
	adrp	x8, _PSMOUSE_CMD_GETINFO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _PSMOUSE_CMD_GETINFO@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	add	x1, sp, #8
	mov	x0, x23
	bl	_ps2_command
	ldr	w8, [sp, #8]
	ubfiz	w22, w8, #3, #4
	bfxil	w22, w8, #4, #3
	cbz	w22, LBB0_16
; %bb.1:
	ldr	w24, [sp, #12]
	cbz	w24, LBB0_16
; %bb.2:
	mov	x0, x22
	bl	_get_model_info
	mov	x21, x0
	cbz	x0, LBB0_5
; %bb.3:
	ldr	x8, [x21]
Lloh11:
	adrp	x9, _PS2PP_KIND_TP3@GOTPAGE
Lloh12:
	ldr	x9, [x9, _PS2PP_KIND_TP3@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.4:
Lloh14:
	adrp	x8, lCPI0_0@PAGE
Lloh15:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [sp, #8]
	mov	w8, #104
	str	w8, [sp, #16]
	add	x1, sp, #8
	mov	x0, x23
	mov	w2, #12497
	bl	_ps2_command
Lloh16:
	adrp	x8, lCPI0_1@PAGE
Lloh17:
	ldr	d0, [x8, lCPI0_1@PAGEOFF]
	str	d0, [sp, #8]
	mov	w8, #11
	str	w8, [sp, #16]
	add	x1, sp, #8
	mov	x0, x23
	mov	w2, #12497
	bl	_ps2_command
	mov	w8, #17
	str	w8, [sp, #8]
Lloh18:
	adrp	x8, lCPI0_2@PAGE
Lloh19:
	ldr	d0, [x8, lCPI0_2@PAGEOFF]
	stur	d0, [sp, #12]
	add	x1, sp, #8
	mov	x0, x23
	mov	w2, #12497
	bl	_ps2_command
	str	wzr, [sp, #8]
	add	x1, sp, #8
	mov	x0, x23
	mov	w2, #5073
	bl	_ps2_command
	cmp	w0, #0
	ldp	w8, w9, [sp, #8]
	ccmp	w8, #6, #0, eq
	ccmp	w9, #0, #0, eq
	ldr	w8, [sp, #16]
	ccmp	w8, #20, #0, eq
	cset	w23, eq
	eor	w25, w23, #0x1
	cbnz	w20, LBB0_10
	b	LBB0_15
LBB0_5:
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_psmouse_warn
	b	LBB0_9
LBB0_6:
	str	wzr, [sp, #16]
	str	xzr, [sp, #8]
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #57
	bl	_ps2pp_cmd
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #219
	bl	_ps2pp_cmd
	ldr	w8, [sp, #8]
	and	w8, w8, #0x78
	cmp	w8, #72
	b.ne	LBB0_9
; %bb.7:
	ldr	w8, [sp, #12]
	mov	w9, #243
	and	w9, w8, w9
	cmp	w9, #194
	b.ne	LBB0_9
; %bb.8:
	ldr	w9, [sp, #16]
	eor	w8, w9, w8, lsr #2
	tst	w8, #0x3
	b.eq	LBB0_17
LBB0_9:
	mov	w23, #0
	mov	w25, #1
	cbz	w20, LBB0_15
LBB0_10:
Lloh22:
	adrp	x8, l_.str.1@PAGE
Lloh23:
	add	x8, x8, l_.str.1@PAGEOFF
	str	x8, [x19]
	str	w22, [x19, #8]
	tbz	w25, #0, LBB0_19
; %bb.11:
	mov	w25, #1
	cmp	w24, #3
	b.lt	LBB0_13
LBB0_12:
	ldr	w0, [x19, #12]
Lloh24:
	adrp	x8, _EV_KEY@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EV_KEY@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
Lloh27:
	adrp	x8, _BTN_MIDDLE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _BTN_MIDDLE@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	bl	_input_set_capability
LBB0_13:
	cbz	x21, LBB0_15
; %bb.14:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x23
	bl	_ps2pp_set_model_properties
	tbz	w25, #0, LBB0_21
	b	LBB0_16
LBB0_15:
	cbz	w25, LBB0_21
LBB0_16:
Lloh30:
	adrp	x8, _ENXIO@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_22
LBB0_17:
	mov	x0, x19
	mov	w1, #0
	bl	_ps2pp_set_smartscroll
	cbz	w20, LBB0_21
; %bb.18:
Lloh33:
	adrp	x8, l_.str.1@PAGE
Lloh34:
	add	x8, x8, l_.str.1@PAGEOFF
	str	x8, [x19]
	str	w22, [x19, #8]
	mov	w23, #1
LBB0_19:
	mov	x0, x19
	mov	x1, x21
	bl	_ps2pp_setup_protocol
	cbnz	w0, LBB0_22
; %bb.20:
	mov	w25, #0
	cmp	w24, #3
	b.ge	LBB0_12
	b	LBB0_13
LBB0_21:
	mov	w0, #0
LBB0_22:
	ldr	x8, [sp, #24]
Lloh35:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh36:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh37:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_24
; %bb.23:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_24:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdr	Lloh18, Lloh19
	.loh AdrpLdr	Lloh16, Lloh17
	.loh AdrpLdr	Lloh14, Lloh15
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_PSMOUSE_CMD_SETRES,4,2         ; @PSMOUSE_CMD_SETRES
	.comm	_PSMOUSE_CMD_SETSCALE11,4,2     ; @PSMOUSE_CMD_SETSCALE11
	.comm	_PSMOUSE_CMD_GETINFO,4,2        ; @PSMOUSE_CMD_GETINFO
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_PS2PP_KIND_TP3,8,3             ; @PS2PP_KIND_TP3
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Detected unknown Logitech mouse model %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Logitech"

	.comm	_EV_KEY,4,2                     ; @EV_KEY
	.comm	_BTN_MIDDLE,4,2                 ; @BTN_MIDDLE
.subsections_via_symbols
