	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function roccat_open
_roccat_open:                           ## @roccat_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	callq	_iminor
	movl	%eax, %ebx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	movq	_devices_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_devices@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, %ecx
	movq	(%rax,%rcx,8), %r12
	testq	%r12, %r12
	je	LBB0_3
## %bb.4:
	movq	%r12, %rdi
	callq	_mutex_lock
	movl	12(%r12), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 12(%r12)
	xorl	%ebx, %ebx
	testl	%eax, %eax
	je	LBB0_5
LBB0_9:
	movq	%r12, 8(%r15)
	movl	8(%r12), %eax
	movl	%eax, 4(%r15)
	leaq	4(%r12), %rsi
	movq	%r15, %rdi
	callq	_list_add_tail
	movq	%r15, (%r14)
LBB0_10:
	movq	%r12, %rdi
	callq	_mutex_unlock
	jmp	LBB0_11
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_3:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_pr_emerg
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movq	_devices_lock@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	testl	%ebx, %ebx
	je	LBB0_12
## %bb.13:
	movq	%r15, %rdi
	callq	_kfree
	jmp	LBB0_14
LBB0_12:
	xorl	%ebx, %ebx
LBB0_14:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	16(%r12), %edi
	movq	_PM_HINT_FULLON@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_hid_hw_power
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	movl	16(%r12), %edi
	callq	_hid_hw_open
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_9
## %bb.8:
	movl	16(%r12), %edi
	movq	_PM_HINT_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_hid_hw_power
	decl	12(%r12)
	jmp	LBB0_10
LBB0_6:
	movl	%eax, %ebx
	decl	12(%r12)
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_devices_lock,4,2               ## @devices_lock
	.comm	_devices,8,3                    ## @devices
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"roccat device with minor %d doesn't exist\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_PM_HINT_FULLON,4,2             ## @PM_HINT_FULLON
	.comm	_PM_HINT_NORMAL,4,2             ## @PM_HINT_NORMAL
	.no_dead_strip	_roccat_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function roccat_open
_roccat_open:                           ; @roccat_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	x20, x1
	bl	_iminor
	mov	x22, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x0, _devices_lock@GOTPAGE
Lloh4:
	ldr	x0, [x0, _devices_lock@GOTPAGEOFF]
	bl	_mutex_lock
Lloh5:
	adrp	x8, _devices@GOTPAGE
Lloh6:
	ldr	x8, [x8, _devices@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	ldr	x21, [x8, w22, uxtw #3]
	cbz	x21, LBB0_6
; %bb.2:
	mov	x0, x21
	bl	_mutex_lock
	ldr	w8, [x21, #12]
	add	w9, w8, #1
	str	w9, [x21, #12]
	cbz	w8, LBB0_7
; %bb.3:
	mov	w22, #0
LBB0_4:
	str	x21, [x19, #8]
	ldr	w8, [x21, #8]
	str	w8, [x19, #4]
	add	x1, x21, #4
	mov	x0, x19
	bl	_list_add_tail
	str	x19, [x20]
	b	LBB0_12
LBB0_5:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_15
LBB0_6:
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	bl	_pr_emerg
Lloh13:
	adrp	x8, _ENODEV@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_13
LBB0_7:
	ldr	w0, [x21, #16]
Lloh16:
	adrp	x8, _PM_HINT_FULLON@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PM_HINT_FULLON@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_hid_hw_power
	tbnz	w0, #31, LBB0_10
; %bb.8:
	ldr	w0, [x21, #16]
	bl	_hid_hw_open
	mov	x22, x0
	tbz	w0, #31, LBB0_4
; %bb.9:
	ldr	w0, [x21, #16]
Lloh19:
	adrp	x8, _PM_HINT_NORMAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _PM_HINT_NORMAL@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	bl	_hid_hw_power
	b	LBB0_11
LBB0_10:
	mov	x22, x0
LBB0_11:
	ldr	w8, [x21, #12]
	sub	w8, w8, #1
	str	w8, [x21, #12]
LBB0_12:
	mov	x0, x21
	bl	_mutex_unlock
LBB0_13:
Lloh22:
	adrp	x0, _devices_lock@GOTPAGE
Lloh23:
	ldr	x0, [x0, _devices_lock@GOTPAGEOFF]
	bl	_mutex_unlock
	cbz	w22, LBB0_15
; %bb.14:
	mov	x0, x19
	bl	_kfree
LBB0_15:
	mov	x0, x22
	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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_devices_lock,4,2               ; @devices_lock
	.comm	_devices,8,3                    ; @devices
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"roccat device with minor %d doesn't exist\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_PM_HINT_FULLON,4,2             ; @PM_HINT_FULLON
	.comm	_PM_HINT_NORMAL,4,2             ; @PM_HINT_NORMAL
	.no_dead_strip	_roccat_open
.subsections_via_symbols
