	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_handshake_expansion     ## -- Begin function wiiuse_handshake_expansion
	.p2align	4, 0x90
_wiiuse_handshake_expansion:            ## @wiiuse_handshake_expansion
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	(%rdi), %eax
	cmpq	$3, %rax
	ja	LBB0_13
## %bb.1:
	movq	%rdi, %rbx
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_2:
	movl	$1, (%rbx)
	movl	$85, -28(%rbp)
	movq	_WM_EXP_MEM_ENABLE1@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_4:
	movl	$2, (%rbx)
	movl	$0, -28(%rbp)
	movq	_WM_EXP_MEM_ENABLE2@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %esi
	leaq	_wiiuse_handshake_expansion(%rip), %r8
	leaq	-28(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$1, %ecx
	callq	_wiiuse_write_data
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	$3, (%rbx)
	movq	_EXP_HANDSHAKE_LEN@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	shll	$2, %edi
	callq	___lwp_wkspace_allocate
	movq	_WM_EXP_MEM_CALIBR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	(%r14), %ecx
	leaq	_wiiuse_handshake_expansion(%rip), %r8
	movq	%rbx, %rdi
	movq	%rax, %rsi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_wiiuse_read_data               ## TAILCALL
LBB0_6:
	movq	%rsi, %r14
	testq	%rsi, %rsi
	je	LBB0_13
## %bb.7:
	movl	%edx, %r15d
	testl	%edx, %edx
	je	LBB0_13
## %bb.8:
	movl	880(%r14), %edi
	callq	_BIG_ENDIAN_LONG
                                        ## kill: def $eax killed $eax def $rax
	leal	-129(%rax), %ecx
	cmpl	$10, %ecx
	jae	LBB0_9
LBB0_11:
	leaq	4(%rbx), %rsi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	%r15d, %ecx
	callq	_classic_ctrl_handshake
	testl	%eax, %eax
	je	LBB0_13
LBB0_14:
	movq	%r14, %rdi
	callq	___lwp_wkspace_free
	movq	_WIIMOTE_STATE_EXP_HANDSHAKE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_DISABLE_STATE
	movq	_WIIMOTE_STATE_EXP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_ENABLE_STATE
	movq	%rbx, %rdi
	callq	_wiiuse_set_ir_mode
	movq	%rbx, %rdi
	xorl	%esi, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_wiiuse_status                  ## TAILCALL
LBB0_9:
	cmpl	$128, %eax
	jne	LBB0_11
## %bb.10:
	leaq	8(%rbx), %rsi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	%r15d, %ecx
	callq	_nunchuk_handshake
	testl	%eax, %eax
	jne	LBB0_14
	jmp	LBB0_13
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_2, LBB0_2-LJTI0_0
.set L0_0_set_4, LBB0_4-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_6, LBB0_6-LJTI0_0
LJTI0_0:
	.long	L0_0_set_2
	.long	L0_0_set_4
	.long	L0_0_set_5
	.long	L0_0_set_6
	.end_data_region
                                        ## -- End function
	.comm	_WM_EXP_MEM_ENABLE1,4,2         ## @WM_EXP_MEM_ENABLE1
	.comm	_WM_EXP_MEM_ENABLE2,4,2         ## @WM_EXP_MEM_ENABLE2
	.comm	_EXP_HANDSHAKE_LEN,4,2          ## @EXP_HANDSHAKE_LEN
	.comm	_WM_EXP_MEM_CALIBR,4,2          ## @WM_EXP_MEM_CALIBR
	.comm	_WIIMOTE_STATE_EXP_HANDSHAKE,4,2 ## @WIIMOTE_STATE_EXP_HANDSHAKE
	.comm	_WIIMOTE_STATE_EXP,4,2          ## @WIIMOTE_STATE_EXP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_handshake_expansion     ; -- Begin function wiiuse_handshake_expansion
	.p2align	2
_wiiuse_handshake_expansion:            ; @wiiuse_handshake_expansion
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	w8, [x0]
	cmp	w8, #3
	b.hi	LBB0_5
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_2
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_2:
	mov	w8, #1
	str	w8, [x19]
	mov	w8, #85
	str	w8, [sp, #12]
Lloh2:
	adrp	x8, _WM_EXP_MEM_ENABLE1@GOTPAGE
Lloh3:
	ldr	x8, [x8, _WM_EXP_MEM_ENABLE1@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
	mov	w8, #2
	str	w8, [x19]
	str	wzr, [sp, #12]
Lloh4:
	adrp	x8, _WM_EXP_MEM_ENABLE2@GOTPAGE
Lloh5:
	ldr	x8, [x8, _WM_EXP_MEM_ENABLE2@GOTPAGEOFF]
LBB0_4:
	ldr	w1, [x8]
Lloh6:
	adrp	x4, _wiiuse_handshake_expansion@PAGE
Lloh7:
	add	x4, x4, _wiiuse_handshake_expansion@PAGEOFF
	add	x2, sp, #12
	mov	x0, x19
	mov	w3, #1
	bl	_wiiuse_write_data
LBB0_5:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_6:
	mov	w8, #3
	str	w8, [x19]
Lloh8:
	adrp	x20, _EXP_HANDSHAKE_LEN@GOTPAGE
Lloh9:
	ldr	x20, [x20, _EXP_HANDSHAKE_LEN@GOTPAGEOFF]
	ldr	w8, [x20]
	lsl	w0, w8, #2
	bl	___lwp_wkspace_allocate
	mov	x1, x0
Lloh10:
	adrp	x8, _WM_EXP_MEM_CALIBR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _WM_EXP_MEM_CALIBR@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
Lloh13:
	adrp	x4, _wiiuse_handshake_expansion@PAGE
Lloh14:
	add	x4, x4, _wiiuse_handshake_expansion@PAGEOFF
	ldr	w3, [x20]
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_wiiuse_read_data
LBB0_7:
	mov	x20, x1
	cbz	x1, LBB0_5
; %bb.8:
	mov	x21, x2
	cbz	w2, LBB0_5
; %bb.9:
	ldr	w0, [x20, #880]
	bl	_BIG_ENDIAN_LONG
	sub	w8, w0, #129
	cmp	w8, #10
	b.hs	LBB0_12
LBB0_10:
	add	x1, x19, #4
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	bl	_classic_ctrl_handshake
	cbz	w0, LBB0_5
LBB0_11:
	mov	x0, x20
	bl	___lwp_wkspace_free
Lloh15:
	adrp	x8, _WIIMOTE_STATE_EXP_HANDSHAKE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _WIIMOTE_STATE_EXP_HANDSHAKE@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_DISABLE_STATE
Lloh18:
	adrp	x8, _WIIMOTE_STATE_EXP@GOTPAGE
Lloh19:
	ldr	x8, [x8, _WIIMOTE_STATE_EXP@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_ENABLE_STATE
	mov	x0, x19
	bl	_wiiuse_set_ir_mode
	mov	x0, x19
	mov	x1, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_wiiuse_status
LBB0_12:
	cmp	w0, #128
	b.ne	LBB0_10
; %bb.13:
	add	x1, x19, #8
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	bl	_nunchuk_handshake
	cbnz	w0, LBB0_11
	b	LBB0_5
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_2-LBB0_2)>>2
	.byte	(LBB0_3-LBB0_2)>>2
	.byte	(LBB0_6-LBB0_2)>>2
	.byte	(LBB0_7-LBB0_2)>>2
                                        ; -- End function
	.comm	_WM_EXP_MEM_ENABLE1,4,2         ; @WM_EXP_MEM_ENABLE1
	.comm	_WM_EXP_MEM_ENABLE2,4,2         ; @WM_EXP_MEM_ENABLE2
	.comm	_EXP_HANDSHAKE_LEN,4,2          ; @EXP_HANDSHAKE_LEN
	.comm	_WM_EXP_MEM_CALIBR,4,2          ; @WM_EXP_MEM_CALIBR
	.comm	_WIIMOTE_STATE_EXP_HANDSHAKE,4,2 ; @WIIMOTE_STATE_EXP_HANDSHAKE
	.comm	_WIIMOTE_STATE_EXP,4,2          ; @WIIMOTE_STATE_EXP
.subsections_via_symbols
