	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nunchuk_handshake              ## -- Begin function nunchuk_handshake
	.p2align	4, 0x90
_nunchuk_handshake:                     ## @nunchuk_handshake
	.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	%rdx, %rbx
	movq	%rsi, %r15
	movq	%rdi, %r14
	leaq	32(%rdi), %rax
	xorps	%xmm0, %xmm0
	movups	%xmm0, 56(%rsi)
	movq	$0, 72(%rsi)
	movq	%rax, 48(%rsi)
	movq	24(%rdi), %rax
	movq	%rax, 40(%rsi)
	movups	8(%rdi), %xmm0
	movups	%xmm0, 24(%rsi)
	movl	(%rdx), %r12d
	xorl	%eax, %eax
	cmpl	$255, %r12d
	jne	LBB0_3
## %bb.1:
	movl	64(%rbx), %r12d
	movl	$16, %eax
	cmpl	$255, %r12d
	jne	LBB0_3
## %bb.2:
	movq	_WM_EXP_MEM_CALIBR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_EXP_HANDSHAKE_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_wiiuse_handshake_expansion@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_wiiuse_read_data
	movl	(%rbx), %r12d
	xorl	%eax, %eax
LBB0_3:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	shll	$2, %r12d
	movl	%eax, %edx
	orl	$3, %edx
	movl	(%rbx,%rdx,4), %r13d
	shrl	$4, %r13d
	andl	$3, %r13d
	movl	%r13d, %esi
	orl	%r12d, %esi
	movl	%esi, 36(%r15)
	movl	%eax, %esi
	orl	$1, %esi
	movl	(%rbx,%rsi,4), %esi
	movl	(%rbx,%rdx,4), %ecx
	shrl	$2, %ecx
	andl	$3, %ecx
	leal	(%rcx,%rsi,4), %ecx
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movl	%ecx, 40(%r15)
	movl	%eax, %ecx
	orl	$2, %ecx
	movl	(%rbx,%rcx,4), %ecx
	movl	(%rbx,%rdx,4), %edx
	andl	$3, %edx
	leal	(%rdx,%rcx,4), %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, 44(%r15)
	movl	%eax, %ecx
	orl	$4, %ecx
	movl	(%rbx,%rcx,4), %ecx
	movl	%eax, %edx
	orl	$7, %edx
	movl	(%rbx,%rdx,4), %esi
	shrl	$4, %esi
	andl	$3, %esi
	leal	(%rsi,%rcx,4), %ecx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movl	%ecx, 24(%r15)
	movl	%eax, %ecx
	orl	$5, %ecx
	movl	(%rbx,%rcx,4), %ecx
	movl	(%rbx,%rdx,4), %esi
	shrl	$2, %esi
	andl	$3, %esi
	leal	(%rsi,%rcx,4), %r11d
	movl	%r11d, 28(%r15)
	movl	%eax, %ecx
	orl	$6, %ecx
	movl	(%rbx,%rdx,4), %edx
	andl	$3, %edx
	movl	%eax, %esi
	orl	$8, %esi
	movl	%eax, %edi
	orl	$9, %edi
	movl	%eax, %r8d
	orl	$10, %r8d
	movl	%eax, %r9d
	orl	$11, %r9d
	movl	%eax, %r10d
	orl	$12, %r10d
	orl	$13, %eax
	orl	%r12d, %r13d
	movl	(%rbx,%rcx,4), %ecx
	leal	(%rdx,%rcx,4), %r14d
	movl	%r14d, 32(%r15)
	movl	(%rbx,%rsi,4), %ecx
	movl	%ecx, 16(%r15)
	movl	(%rbx,%rdi,4), %esi
	movl	%esi, 8(%r15)
	movl	(%rbx,%r8,4), %edx
	movl	%edx, (%r15)
	movl	(%rbx,%r9,4), %r13d
	movl	%r13d, 20(%r15)
	movl	(%rbx,%r10,4), %r12d
	movl	%r12d, 12(%r15)
	movl	(%rbx,%rax,4), %eax
	movl	%eax, 4(%r15)
	je	LBB0_4
## %bb.5:
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_6
LBB0_7:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_8
LBB0_9:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_10
LBB0_11:
	testl	%r11d, %r11d
	je	LBB0_12
LBB0_13:
	testl	%r14d, %r14d
	jne	LBB0_15
LBB0_14:
	movl	$709, 32(%r15)                  ## imm = 0x2C5
LBB0_15:
	testl	%ecx, %ecx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	je	LBB0_16
## %bb.17:
	testl	%esi, %esi
	je	LBB0_18
LBB0_19:
	testl	%edx, %edx
	je	LBB0_20
LBB0_21:
	testl	%r13d, %r13d
	je	LBB0_22
LBB0_23:
	testl	%r12d, %r12d
	je	LBB0_24
LBB0_25:
	testl	%eax, %eax
	jne	LBB0_27
LBB0_26:
	movl	$131, 4(%r15)
LBB0_27:
	movq	_WIIUSE_NUNCHUK_INSERTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rcx)
	movq	_EXP_NUNCHUK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rcx)
	movl	$1, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	$499, 36(%r15)                  ## imm = 0x1F3
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_7
LBB0_6:
	movl	$509, 40(%r15)                  ## imm = 0x1FD
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_9
LBB0_8:
	movl	$507, 44(%r15)                  ## imm = 0x1FB
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_11
LBB0_10:
	leaq	24(%r15), %rdi
	movl	$703, (%rdi)                    ## imm = 0x2BF
	testl	%r11d, %r11d
	jne	LBB0_13
LBB0_12:
	movl	$709, 28(%r15)                  ## imm = 0x2C5
	testl	%r14d, %r14d
	jne	LBB0_15
	jmp	LBB0_14
LBB0_16:
	movl	$223, 16(%r15)
	testl	%esi, %esi
	jne	LBB0_19
LBB0_18:
	movl	$27, 8(%r15)
	testl	%edx, %edx
	jne	LBB0_21
LBB0_20:
	movl	$126, (%r15)
	testl	%r13d, %r13d
	jne	LBB0_23
LBB0_22:
	movl	$222, 20(%r15)
	testl	%r12d, %r12d
	jne	LBB0_25
LBB0_24:
	movl	$30, 12(%r15)
	testl	%eax, %eax
	jne	LBB0_27
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_WM_EXP_MEM_CALIBR,4,2          ## @WM_EXP_MEM_CALIBR
	.comm	_EXP_HANDSHAKE_LEN,4,2          ## @EXP_HANDSHAKE_LEN
	.comm	_wiiuse_handshake_expansion,4,2 ## @wiiuse_handshake_expansion
	.comm	_WIIUSE_NUNCHUK_INSERTED,4,2    ## @WIIUSE_NUNCHUK_INSERTED
	.comm	_EXP_NUNCHUK,4,2                ## @EXP_NUNCHUK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nunchuk_handshake              ; -- Begin function nunchuk_handshake
	.p2align	2
_nunchuk_handshake:                     ; @nunchuk_handshake
	.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	x21, x2
	mov	x20, x1
	mov	x19, x0
	add	x8, x0, #32
	stp	xzr, xzr, [x1, #64]
	stp	x8, xzr, [x1, #48]
	ldur	q0, [x0, #8]
	ldr	x8, [x0, #24]
	str	x8, [x1, #40]
	stur	q0, [x1, #24]
	ldr	w9, [x2]
	cmp	w9, #255
	b.ne	LBB0_3
; %bb.1:
	ldr	w9, [x21, #64]
	cmp	w9, #255
	b.ne	LBB0_4
; %bb.2:
Lloh0:
	adrp	x8, _WM_EXP_MEM_CALIBR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _WM_EXP_MEM_CALIBR@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
Lloh3:
	adrp	x8, _EXP_HANDSHAKE_LEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EXP_HANDSHAKE_LEN@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
Lloh6:
	adrp	x8, _wiiuse_handshake_expansion@GOTPAGE
Lloh7:
	ldr	x8, [x8, _wiiuse_handshake_expansion@GOTPAGEOFF]
Lloh8:
	ldr	w4, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_wiiuse_read_data
	mov	w8, #0
	ldr	w9, [x21]
	b	LBB0_5
LBB0_3:
	mov	w8, #0
	b	LBB0_5
LBB0_4:
	mov	w8, #16
LBB0_5:
	orr	w10, w8, #0x3
	lsl	x10, x10, #2
	ldr	w11, [x21, x10]
	lsl	w17, w9, #2
	bfxil	w17, w11, #4, #2
	str	w17, [x20, #36]
	orr	w9, w8, #0x1
	ldr	w9, [x21, w9, uxtw #2]
	lsl	w13, w9, #2
	ldr	w9, [x21, x10]
	bfxil	w13, w9, #2, #2
	str	w13, [x20, #40]
	orr	w9, w8, #0x2
	ldr	w9, [x21, w9, uxtw #2]
	ldr	w16, [x21, x10]
	bfi	w16, w9, #2, #30
	str	w16, [x20, #44]
	orr	w9, w8, #0x4
	ldr	w9, [x21, w9, uxtw #2]
	lsl	w14, w9, #2
	orr	w9, w8, #0x7
	lsl	x9, x9, #2
	ldr	w10, [x21, x9]
	bfxil	w14, w10, #4, #2
	str	w14, [x20, #24]
	mov	w10, #5
	orr	w10, w8, w10
	ldr	w10, [x21, w10, uxtw #2]
	lsl	w0, w10, #2
	ldr	w10, [x21, x9]
	bfxil	w0, w10, #2, #2
	str	w0, [x20, #28]
	orr	w10, w8, #0x6
	ldr	w10, [x21, w10, uxtw #2]
	ldr	w1, [x21, x9]
	bfi	w1, w10, #2, #30
	str	w1, [x20, #32]
	orr	w9, w8, #0x8
	ldr	w15, [x21, w9, uxtw #2]
	str	w15, [x20, #16]
	mov	w9, #9
	orr	w9, w8, w9
	ldr	w12, [x21, w9, uxtw #2]
	str	w12, [x20, #8]
	mov	w9, #10
	orr	w9, w8, w9
	ldr	w11, [x21, w9, uxtw #2]
	str	w11, [x20]
	mov	w9, #11
	orr	w9, w8, w9
	ldr	w10, [x21, w9, uxtw #2]
	str	w10, [x20, #20]
	orr	w9, w8, #0xc
	ldr	w9, [x21, w9, uxtw #2]
	str	w9, [x20, #12]
	mov	w2, #13
	orr	w8, w8, w2
	ldr	w8, [x21, w8, uxtw #2]
	str	w8, [x20, #4]
	cbz	w17, LBB0_18
; %bb.6:
	cbz	w13, LBB0_19
LBB0_7:
	cbz	w16, LBB0_20
LBB0_8:
	cbz	w14, LBB0_21
LBB0_9:
	cbz	w0, LBB0_22
LBB0_10:
	cbz	w1, LBB0_23
LBB0_11:
	cbz	w15, LBB0_24
LBB0_12:
	cbz	w12, LBB0_25
LBB0_13:
	cbz	w11, LBB0_26
LBB0_14:
	cbz	w10, LBB0_27
LBB0_15:
	cbz	w9, LBB0_28
LBB0_16:
	cbz	w8, LBB0_29
LBB0_17:
Lloh9:
	adrp	x8, _WIIUSE_NUNCHUK_INSERTED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _WIIUSE_NUNCHUK_INSERTED@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _EXP_NUNCHUK@GOTPAGE
Lloh13:
	ldr	x9, [x9, _EXP_NUNCHUK@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	stp	w9, w8, [x19]
	mov	w0, #1
	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
LBB0_18:
	mov	w17, #499
	str	w17, [x20, #36]
	cbnz	w13, LBB0_7
LBB0_19:
	mov	w13, #509
	str	w13, [x20, #40]
	cbnz	w16, LBB0_8
LBB0_20:
	mov	w13, #507
	str	w13, [x20, #44]
	cbnz	w14, LBB0_9
LBB0_21:
	add	x13, x20, #24
	mov	w14, #703
	str	w14, [x13]
	cbnz	w0, LBB0_10
LBB0_22:
	mov	w13, #709
	str	w13, [x20, #28]
	cbnz	w1, LBB0_11
LBB0_23:
	mov	w13, #709
	str	w13, [x20, #32]
	cbnz	w15, LBB0_12
LBB0_24:
	mov	w13, #223
	str	w13, [x20, #16]
	cbnz	w12, LBB0_13
LBB0_25:
	mov	w12, #27
	str	w12, [x20, #8]
	cbnz	w11, LBB0_14
LBB0_26:
	mov	w11, #126
	str	w11, [x20]
	cbnz	w10, LBB0_15
LBB0_27:
	mov	w10, #222
	str	w10, [x20, #20]
	cbnz	w9, LBB0_16
LBB0_28:
	mov	w9, #30
	str	w9, [x20, #12]
	cbnz	w8, LBB0_17
LBB0_29:
	mov	w8, #131
	str	w8, [x20, #4]
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_WM_EXP_MEM_CALIBR,4,2          ; @WM_EXP_MEM_CALIBR
	.comm	_EXP_HANDSHAKE_LEN,4,2          ; @EXP_HANDSHAKE_LEN
	.comm	_wiiuse_handshake_expansion,4,2 ; @wiiuse_handshake_expansion
	.comm	_WIIUSE_NUNCHUK_INSERTED,4,2    ; @WIIUSE_NUNCHUK_INSERTED
	.comm	_EXP_NUNCHUK,4,2                ; @EXP_NUNCHUK
.subsections_via_symbols
