	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function psmouse_attr_set_protocol
_psmouse_attr_set_protocol:             ## @psmouse_attr_set_protocol
	.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	%rcx, %r14
	movq	%rdi, %rbx
	movq	40(%rdi), %r13
	movq	%rdx, %rdi
	movq	%rcx, %rsi
	callq	_psmouse_protocol_by_name
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%rax, %r12
	cmpq	%rax, 24(%rbx)
	je	LBB0_39
## %bb.4:
	xorl	%eax, %eax
	callq	_input_allocate_device
	testq	%rax, %rax
	je	LBB0_40
## %bb.5:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	leaq	24(%r13), %r15
	movq	%r15, %rdi
	callq	_list_empty
	testl	%eax, %eax
	je	LBB0_6
LBB0_18:
	movq	(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_19
## %bb.20:
	movq	8(%r13), %rax
	movq	_SERIO_PS_PSTHRU@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	jne	LBB0_21
## %bb.22:
	callq	_serio_get_drvdata
	movq	%rax, %r13
	movq	32(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_24
## %bb.23:
	movq	%r13, %rdi
	callq	*%rcx
	jmp	LBB0_24
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_40:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	%r13, %rdi
	callq	_serio_unregister_child_port
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	16(%r13), %rax
	cmpq	_psmouse_drv@GOTPCREL(%rip), %rax
	je	LBB0_8
LBB0_7:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_free_device
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r14d, %r14d
	subq	(%rax), %r14
LBB0_39:
	movq	%r14, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	xorl	%r13d, %r13d
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_24
LBB0_21:
	xorl	%r13d, %r13d
LBB0_24:
	movq	8(%rbx), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	16(%rbx), %rax
	movq	24(%rbx), %rcx
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_26
## %bb.25:
	movq	%rbx, %rdi
	callq	*%rax
LBB0_26:
	movq	_PSMOUSE_IGNORE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movq	%r15, 8(%rbx)
	movq	_PSMOUSE_INITIALIZING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_psmouse_switch_protocol
	testq	%rax, %rax
	jns	LBB0_28
## %bb.27:
	movq	%rbx, %rdi
	callq	_psmouse_reset
	movq	_psmouse_protocols@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_psmouse_switch_protocol
LBB0_28:
	movq	%rbx, %rdi
	callq	_psmouse_initialize
	movq	_PSMOUSE_CMD_MODE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movq	8(%rbx), %rdi
	movq	24(%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_35
## %bb.29:
	callq	_input_free_device
	movq	$0, 8(%rbx)
LBB0_30:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	testq	%rdi, %rdi
	je	LBB0_32
## %bb.31:
	callq	_input_unregister_device
LBB0_32:
	testq	%r13, %r13
	je	LBB0_39
## %bb.33:
	movq	(%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_39
## %bb.34:
	movq	%r13, %rdi
	callq	*%rcx
	jmp	LBB0_39
LBB0_35:
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_30
## %bb.36:
	movl	%eax, %r15d
	movq	16(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_38
## %bb.37:
	movq	%rbx, %rdi
	callq	*%rax
LBB0_38:
	movq	_PSMOUSE_IGNORE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_free_device
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 8(%rbx)
	movq	_PSMOUSE_INITIALIZING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movq	%rbx, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_psmouse_switch_protocol
	movq	%rbx, %rdi
	callq	_psmouse_initialize
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_psmouse_set_state
	movslq	%r15d, %r14
	jmp	LBB0_39
LBB0_8:
	cmpq	%r12, 24(%rbx)
	je	LBB0_17
## %bb.9:
	movq	%r15, %rdi
	callq	_list_empty
	testl	%eax, %eax
	jne	LBB0_18
## %bb.10:
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	%r13, %rdi
	callq	_serio_unregister_child_port
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	16(%r13), %rax
	cmpq	_psmouse_drv@GOTPCREL(%rip), %rax
	jne	LBB0_7
## %bb.11:
	cmpq	%r12, 24(%rbx)
	je	LBB0_17
## %bb.12:
	movq	%r15, %rdi
	callq	_list_empty
	testl	%eax, %eax
	jne	LBB0_18
## %bb.13:
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	%r13, %rdi
	callq	_serio_unregister_child_port
	movq	_psmouse_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	16(%r13), %rax
	cmpq	_psmouse_drv@GOTPCREL(%rip), %rax
	jne	LBB0_7
## %bb.14:
	cmpq	%r12, 24(%rbx)
	je	LBB0_17
## %bb.15:
	movq	%r15, %rdi
	callq	_list_empty
	testl	%eax, %eax
	jne	LBB0_18
## %bb.16:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_psmouse_warn
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_free_device
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_17:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_input_free_device
	jmp	LBB0_39
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,8,3                     ## @EINVAL
	.comm	_ENOMEM,8,3                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to destroy children ports, protocol change aborted.\n"

	.comm	_EIO,8,3                        ## @EIO
	.comm	_psmouse_mutex,4,2              ## @psmouse_mutex
	.comm	_psmouse_drv,4,2                ## @psmouse_drv
	.comm	_ENODEV,8,3                     ## @ENODEV
	.comm	_SERIO_PS_PSTHRU,8,3            ## @SERIO_PS_PSTHRU
	.comm	_PSMOUSE_IGNORE,4,2             ## @PSMOUSE_IGNORE
	.comm	_PSMOUSE_INITIALIZING,4,2       ## @PSMOUSE_INITIALIZING
	.comm	_psmouse_protocols,8,3          ## @psmouse_protocols
	.comm	_PSMOUSE_CMD_MODE,4,2           ## @PSMOUSE_CMD_MODE
	.no_dead_strip	_psmouse_attr_set_protocol
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function psmouse_attr_set_protocol
_psmouse_attr_set_protocol:             ; @psmouse_attr_set_protocol
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x3
	mov	x20, x0
	ldr	x23, [x0, #40]
	mov	x0, x2
	mov	x1, x3
	bl	_psmouse_protocol_by_name
	cbz	x0, LBB0_8
; %bb.1:
	mov	x22, x0
	ldr	x8, [x20, #24]
	cmp	x8, x0
	b.eq	LBB0_25
; %bb.2:
	bl	_input_allocate_device
	cbz	x0, LBB0_9
; %bb.3:
	mov	x21, x0
	add	x24, x23, #24
	mov	x0, x24
	bl	_list_empty
	cbz	w0, LBB0_22
LBB0_4:
	ldr	x0, [x23]
	cbz	x0, LBB0_10
; %bb.5:
	ldr	x8, [x23, #8]
Lloh0:
	adrp	x9, _SERIO_PS_PSTHRU@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SERIO_PS_PSTHRU@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.6:
	bl	_serio_get_drvdata
	mov	x23, x0
	ldr	x8, [x0, #32]
	cbz	x8, LBB0_11
; %bb.7:
	mov	x0, x23
	blr	x8
	b	LBB0_11
LBB0_8:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_24
LBB0_9:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_24
LBB0_10:
	mov	x23, #0
LBB0_11:
	ldp	x8, x25, [x20, #16]
	ldr	x24, [x20, #8]
	cbz	x8, LBB0_13
; %bb.12:
	mov	x0, x20
	blr	x8
LBB0_13:
Lloh7:
	adrp	x27, _PSMOUSE_IGNORE@GOTPAGE
Lloh8:
	ldr	x27, [x27, _PSMOUSE_IGNORE@GOTPAGEOFF]
	ldr	w1, [x27]
	mov	x0, x20
	bl	_psmouse_set_state
	str	x21, [x20, #8]
Lloh9:
	adrp	x26, _PSMOUSE_INITIALIZING@GOTPAGE
Lloh10:
	ldr	x26, [x26, _PSMOUSE_INITIALIZING@GOTPAGEOFF]
	ldr	w1, [x26]
	mov	x0, x20
	bl	_psmouse_set_state
	mov	x0, x20
	mov	x1, x22
	bl	_psmouse_switch_protocol
	tbz	x0, #63, LBB0_15
; %bb.14:
	mov	x0, x20
	bl	_psmouse_reset
Lloh11:
	adrp	x8, _psmouse_protocols@GOTPAGE
Lloh12:
	ldr	x8, [x8, _psmouse_protocols@GOTPAGEOFF]
Lloh13:
	ldr	x1, [x8]
	mov	x0, x20
	bl	_psmouse_switch_protocol
LBB0_15:
	mov	x0, x20
	bl	_psmouse_initialize
Lloh14:
	adrp	x28, _PSMOUSE_CMD_MODE@GOTPAGE
Lloh15:
	ldr	x28, [x28, _PSMOUSE_CMD_MODE@GOTPAGEOFF]
	ldr	w1, [x28]
	mov	x0, x20
	bl	_psmouse_set_state
	ldr	x8, [x20, #24]
	ldr	x8, [x8]
	ldr	x0, [x20, #8]
	cbz	x8, LBB0_26
; %bb.16:
	bl	_input_free_device
	str	xzr, [x20, #8]
LBB0_17:
	cbz	x24, LBB0_19
; %bb.18:
	mov	x0, x24
	bl	_input_unregister_device
LBB0_19:
	cbz	x23, LBB0_25
; %bb.20:
	ldr	x8, [x23]
	cbz	x8, LBB0_25
; %bb.21:
	mov	x0, x23
	blr	x8
	b	LBB0_25
LBB0_22:
Lloh16:
	adrp	x25, _psmouse_mutex@GOTPAGE
Lloh17:
	ldr	x25, [x25, _psmouse_mutex@GOTPAGEOFF]
	mov	x0, x25
	bl	_mutex_unlock
	mov	x0, x23
	bl	_serio_unregister_child_port
	mov	x0, x25
	bl	_mutex_lock
	ldr	x8, [x23, #16]
Lloh18:
	adrp	x26, _psmouse_drv@GOTPAGE
Lloh19:
	ldr	x26, [x26, _psmouse_drv@GOTPAGEOFF]
	cmp	x8, x26
	b.eq	LBB0_30
LBB0_23:
	mov	x0, x21
	bl	_input_free_device
Lloh20:
	adrp	x8, _ENODEV@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_24:
	ldr	x8, [x8]
	neg	x19, x8
LBB0_25:
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_26:
	bl	_input_register_device
	cbz	w0, LBB0_17
; %bb.27:
	mov	x22, x0
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_29
; %bb.28:
	mov	x0, x20
	blr	x8
LBB0_29:
	ldr	w1, [x27]
	mov	x0, x20
	bl	_psmouse_set_state
	mov	x0, x21
	bl	_input_free_device
	str	x24, [x20, #8]
	ldr	w1, [x26]
	mov	x0, x20
	bl	_psmouse_set_state
	mov	x0, x20
	mov	x1, x25
	bl	_psmouse_switch_protocol
	mov	x0, x20
	bl	_psmouse_initialize
	ldr	w1, [x28]
	mov	x0, x20
	bl	_psmouse_set_state
	sxtw	x19, w22
	b	LBB0_25
LBB0_30:
	ldr	x8, [x20, #24]
	cmp	x8, x22
	b.eq	LBB0_39
; %bb.31:
	mov	x0, x24
	bl	_list_empty
	cbnz	w0, LBB0_4
; %bb.32:
Lloh22:
	adrp	x25, _psmouse_mutex@GOTPAGE
Lloh23:
	ldr	x25, [x25, _psmouse_mutex@GOTPAGEOFF]
	mov	x0, x25
	bl	_mutex_unlock
	mov	x0, x23
	bl	_serio_unregister_child_port
	mov	x0, x25
	bl	_mutex_lock
	ldr	x8, [x23, #16]
	cmp	x8, x26
	b.ne	LBB0_23
; %bb.33:
	ldr	x8, [x20, #24]
	cmp	x8, x22
	b.eq	LBB0_39
; %bb.34:
	mov	x0, x24
	bl	_list_empty
	cbnz	w0, LBB0_4
; %bb.35:
Lloh24:
	adrp	x25, _psmouse_mutex@GOTPAGE
Lloh25:
	ldr	x25, [x25, _psmouse_mutex@GOTPAGEOFF]
	mov	x0, x25
	bl	_mutex_unlock
	mov	x0, x23
	bl	_serio_unregister_child_port
	mov	x0, x25
	bl	_mutex_lock
	ldr	x8, [x23, #16]
	cmp	x8, x26
	b.ne	LBB0_23
; %bb.36:
	ldr	x8, [x20, #24]
	cmp	x8, x22
	b.eq	LBB0_39
; %bb.37:
	mov	x0, x24
	bl	_list_empty
	cbnz	w0, LBB0_4
; %bb.38:
Lloh26:
	adrp	x1, l_.str@PAGE
Lloh27:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_psmouse_warn
	mov	x0, x21
	bl	_input_free_device
Lloh28:
	adrp	x8, _EIO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_24
LBB0_39:
	mov	x0, x21
	bl	_input_free_device
	b	LBB0_25
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,8,3                     ; @EINVAL
	.comm	_ENOMEM,8,3                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to destroy children ports, protocol change aborted.\n"

	.comm	_EIO,8,3                        ; @EIO
	.comm	_psmouse_mutex,4,2              ; @psmouse_mutex
	.comm	_psmouse_drv,4,2                ; @psmouse_drv
	.comm	_ENODEV,8,3                     ; @ENODEV
	.comm	_SERIO_PS_PSTHRU,8,3            ; @SERIO_PS_PSTHRU
	.comm	_PSMOUSE_IGNORE,4,2             ; @PSMOUSE_IGNORE
	.comm	_PSMOUSE_INITIALIZING,4,2       ; @PSMOUSE_INITIALIZING
	.comm	_psmouse_protocols,8,3          ; @psmouse_protocols
	.comm	_PSMOUSE_CMD_MODE,4,2           ; @PSMOUSE_CMD_MODE
	.no_dead_strip	_psmouse_attr_set_protocol
.subsections_via_symbols
