	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mousedev_open
_mousedev_open:                         ## @mousedev_open
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	callq	_iminor
	movq	_MOUSEDEV_MINOR_BASE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	movslq	%eax, %rbx
	subq	%rcx, %rbx
	movq	_MOUSEDEV_MINORS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_1
## %bb.2:
	xorl	%eax, %eax
	callq	_lock_kernel
	movq	_mousedev_table_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock_interruptible
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r13d
	jmp	LBB0_11
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_12
LBB0_4:
	movq	_mousedev_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %r14
	testq	%r14, %r14
	je	LBB0_13
## %bb.5:
	movq	%r14, %rdi
	callq	_get_device
	movq	_mousedev_table_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movq	%rax, %r12
	movq	%rax, %rdi
	addq	$16, %rdi
	callq	_spin_lock_init
	movq	_xres@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movl	%ecx, (%r12)
	movq	_yres@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movl	%ecx, 4(%r12)
	movq	%r14, 8(%r12)
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_mousedev_attach_client
	movq	%r14, %rdi
	callq	_mousedev_open_device
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%eax, %r13d
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_mousedev_detach_client
	movq	%r12, %rdi
	callq	_kfree
	jmp	LBB0_10
LBB0_13:
	movq	_mousedev_table_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_unlock_kernel
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_12
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_10:
	movq	%r14, %rdi
	callq	_put_device
	jmp	LBB0_11
LBB0_8:
	movq	%r12, (%r15)
	xorl	%r13d, %r13d
LBB0_11:
	xorl	%eax, %eax
	callq	_unlock_kernel
LBB0_12:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MOUSEDEV_MINOR_BASE,4,2        ## @MOUSEDEV_MINOR_BASE
	.comm	_MOUSEDEV_MINORS,4,2            ## @MOUSEDEV_MINORS
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_mousedev_table_mutex,4,2       ## @mousedev_table_mutex
	.comm	_mousedev_table,8,3             ## @mousedev_table
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_xres,4,2                       ## @xres
	.comm	_yres,4,2                       ## @yres
	.comm	_MISC_MAJOR,8,3                 ## @MISC_MAJOR
	.comm	_MOUSEDEV_MIX,4,2               ## @MOUSEDEV_MIX
	.no_dead_strip	_mousedev_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mousedev_open
_mousedev_open:                         ; @mousedev_open
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	bl	_iminor
Lloh0:
	adrp	x8, _MOUSEDEV_MINOR_BASE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MOUSEDEV_MINOR_BASE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _MOUSEDEV_MINORS@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MOUSEDEV_MINORS@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	sub	w20, w0, w8
	cmp	w20, w9
	b.ge	LBB0_8
; %bb.1:
	bl	_lock_kernel
Lloh6:
	adrp	x0, _mousedev_table_mutex@GOTPAGE
Lloh7:
	ldr	x0, [x0, _mousedev_table_mutex@GOTPAGEOFF]
	bl	_mutex_lock_interruptible
	cbz	w0, LBB0_3
; %bb.2:
	mov	x21, x0
	b	LBB0_12
LBB0_3:
Lloh8:
	adrp	x8, _mousedev_table@GOTPAGE
Lloh9:
	ldr	x8, [x8, _mousedev_table@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	ldr	x20, [x8, w20, sxtw #3]
	cbz	x20, LBB0_7
; %bb.4:
	mov	x0, x20
	bl	_get_device
Lloh11:
	adrp	x0, _mousedev_table_mutex@GOTPAGE
Lloh12:
	ldr	x0, [x0, _mousedev_table_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
Lloh13:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.5:
	mov	x22, x0
	add	x0, x0, #16
	bl	_spin_lock_init
Lloh16:
	adrp	x8, _xres@GOTPAGE
Lloh17:
	ldr	x8, [x8, _xres@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w8, w8, #1
	str	w8, [x22]
Lloh19:
	adrp	x8, _yres@GOTPAGE
Lloh20:
	ldr	x8, [x8, _yres@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	cmp	w8, #0
	cinc	w8, w8, lt
	asr	w8, w8, #1
	str	w8, [x22, #4]
	str	x20, [x22, #8]
	mov	x0, x20
	mov	x1, x22
	bl	_mousedev_attach_client
	mov	x0, x20
	bl	_mousedev_open_device
	mov	x21, x0
	cbz	w0, LBB0_11
; %bb.6:
	mov	x0, x20
	mov	x1, x22
	bl	_mousedev_detach_client
	mov	x0, x22
	bl	_kfree
	b	LBB0_10
LBB0_7:
Lloh22:
	adrp	x0, _mousedev_table_mutex@GOTPAGE
Lloh23:
	ldr	x0, [x0, _mousedev_table_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	bl	_unlock_kernel
LBB0_8:
Lloh24:
	adrp	x8, _ENODEV@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_13
LBB0_9:
Lloh27:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_10:
	mov	x0, x20
	bl	_put_device
	b	LBB0_12
LBB0_11:
	str	x22, [x19]
LBB0_12:
	bl	_unlock_kernel
LBB0_13:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_MOUSEDEV_MINOR_BASE,4,2        ; @MOUSEDEV_MINOR_BASE
	.comm	_MOUSEDEV_MINORS,4,2            ; @MOUSEDEV_MINORS
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_mousedev_table_mutex,4,2       ; @mousedev_table_mutex
	.comm	_mousedev_table,8,3             ; @mousedev_table
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_xres,4,2                       ; @xres
	.comm	_yres,4,2                       ; @yres
	.comm	_MISC_MAJOR,8,3                 ; @MISC_MAJOR
	.comm	_MOUSEDEV_MIX,4,2               ; @MOUSEDEV_MIX
	.no_dead_strip	_mousedev_open
.subsections_via_symbols
