	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wiimote_init_detect
_wiimote_init_detect:                   ## @wiimote_init_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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_WIIMOTE_EXT_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	callq	_wiimote_cmd_acquire_noint
	leaq	4(%rbx), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irq
	movq	_WIIMOTE_DEV_UNKNOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_WIIPROTO_REQ_SREQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_wiimote_cmd_set
	movq	%rbx, %rdi
	callq	_wiiproto_req_status
	movq	%r14, %rdi
	callq	_spin_unlock_irq
	movq	%rbx, %rdi
	callq	_wiimote_cmd_wait_noint
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	movq	%r14, %rdi
	callq	_spin_lock_irq
	movq	_WIIPROTO_FLAG_EXT_PLUGGED@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	andl	(%rbx), %r12d
	movq	%r14, %rdi
	callq	_spin_unlock_irq
	testl	%r12d, %r12d
	je	LBB0_3
## %bb.2:
	movq	%rbx, %rdi
	callq	_wiimote_cmd_init_ext
	leaq	-64(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_wiimote_cmd_read_ext
	movl	%eax, %r15d
LBB0_3:
	movq	%rbx, %rdi
	callq	_wiimote_cmd_release
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_wiimote_init_set_type
	movq	%r14, %rdi
	callq	_spin_lock_irq
	movl	(%rbx), %eax
	movq	_WIIPROTO_FLAG_BUILTIN_MP@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_6
## %bb.4:
	movq	_WIIPROTO_FLAG_NO_MP@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_6
## %bb.5:
	addq	$12, %rbx
	movq	_jiffies@GOTPCREL(%rip), %rax
	movq	_HZ@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rsi
	shlq	$2, %rsi
	addq	(%rax), %rsi
	movq	%rbx, %rdi
	callq	_mod_timer
LBB0_6:
	movq	%r14, %rdi
	callq	_spin_unlock_irq
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_8
## %bb.7:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_WIIMOTE_EXT_NONE,4,2           ## @WIIMOTE_EXT_NONE
	.comm	_WIIMOTE_DEV_UNKNOWN,4,2        ## @WIIMOTE_DEV_UNKNOWN
	.comm	_WIIPROTO_REQ_SREQ,4,2          ## @WIIPROTO_REQ_SREQ
	.comm	_WIIPROTO_FLAG_EXT_PLUGGED,4,2  ## @WIIPROTO_FLAG_EXT_PLUGGED
	.comm	_WIIPROTO_FLAG_BUILTIN_MP,4,2   ## @WIIPROTO_FLAG_BUILTIN_MP
	.comm	_WIIPROTO_FLAG_NO_MP,4,2        ## @WIIPROTO_FLAG_NO_MP
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_HZ,4,2                         ## @HZ
	.no_dead_strip	_wiimote_init_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wiimote_init_detect
_wiimote_init_detect:                   ; @wiimote_init_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
Lloh3:
	adrp	x8, _WIIMOTE_EXT_NONE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WIIMOTE_EXT_NONE@GOTPAGEOFF]
Lloh5:
	ldr	w21, [x8]
	bl	_wiimote_cmd_acquire_noint
	add	x19, x20, #4
	mov	x0, x19
	bl	_spin_lock_irq
Lloh6:
	adrp	x8, _WIIMOTE_DEV_UNKNOWN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _WIIMOTE_DEV_UNKNOWN@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	str	w8, [x20, #8]
Lloh9:
	adrp	x8, _WIIPROTO_REQ_SREQ@GOTPAGE
Lloh10:
	ldr	x8, [x8, _WIIPROTO_REQ_SREQ@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_wiimote_cmd_set
	mov	x0, x20
	bl	_wiiproto_req_status
	mov	x0, x19
	bl	_spin_unlock_irq
	mov	x0, x20
	bl	_wiimote_cmd_wait_noint
	cbnz	w0, LBB0_3
; %bb.1:
	mov	x0, x19
	bl	_spin_lock_irq
	ldr	w8, [x20]
Lloh12:
	adrp	x9, _WIIPROTO_FLAG_EXT_PLUGGED@GOTPAGE
Lloh13:
	ldr	x9, [x9, _WIIPROTO_FLAG_EXT_PLUGGED@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	and	w22, w9, w8
	mov	x0, x19
	bl	_spin_unlock_irq
	cbz	w22, LBB0_3
; %bb.2:
	mov	x0, x20
	bl	_wiimote_cmd_init_ext
	mov	x1, sp
	mov	x0, x20
	bl	_wiimote_cmd_read_ext
	mov	x21, x0
LBB0_3:
	mov	x0, x20
	bl	_wiimote_cmd_release
	mov	x0, x20
	mov	x1, x21
	bl	_wiimote_init_set_type
	mov	x0, x19
	bl	_spin_lock_irq
	ldr	w8, [x20]
Lloh15:
	adrp	x9, _WIIPROTO_FLAG_BUILTIN_MP@GOTPAGE
Lloh16:
	ldr	x9, [x9, _WIIPROTO_FLAG_BUILTIN_MP@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_6
; %bb.4:
Lloh18:
	adrp	x9, _WIIPROTO_FLAG_NO_MP@GOTPAGE
Lloh19:
	ldr	x9, [x9, _WIIPROTO_FLAG_NO_MP@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_6
; %bb.5:
Lloh21:
	adrp	x8, _jiffies@GOTPAGE
Lloh22:
	ldr	x8, [x8, _jiffies@GOTPAGEOFF]
	add	x0, x20, #12
Lloh23:
	ldr	x8, [x8]
Lloh24:
	adrp	x9, _HZ@GOTPAGE
Lloh25:
	ldr	x9, [x9, _HZ@GOTPAGEOFF]
Lloh26:
	ldrsw	x9, [x9]
	add	x1, x8, x9, lsl #2
	bl	_mod_timer
LBB0_6:
	mov	x0, x19
	bl	_spin_unlock_irq
	ldr	x8, [sp, #24]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_8
; %bb.7:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_8:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_WIIMOTE_EXT_NONE,4,2           ; @WIIMOTE_EXT_NONE
	.comm	_WIIMOTE_DEV_UNKNOWN,4,2        ; @WIIMOTE_DEV_UNKNOWN
	.comm	_WIIPROTO_REQ_SREQ,4,2          ; @WIIPROTO_REQ_SREQ
	.comm	_WIIPROTO_FLAG_EXT_PLUGGED,4,2  ; @WIIPROTO_FLAG_EXT_PLUGGED
	.comm	_WIIPROTO_FLAG_BUILTIN_MP,4,2   ; @WIIPROTO_FLAG_BUILTIN_MP
	.comm	_WIIPROTO_FLAG_NO_MP,4,2        ; @WIIPROTO_FLAG_NO_MP
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_HZ,4,2                         ; @HZ
	.no_dead_strip	_wiimote_init_detect
.subsections_via_symbols
