	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function classic_ctrl_handshake
LCPI0_0:
	.long	128                             ## 0x80
	.long	128                             ## 0x80
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_classic_ctrl_handshake
	.p2align	4, 0x90
_classic_ctrl_handshake:                ## @classic_ctrl_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	xorps	%xmm0, %xmm0
	movups	%xmm0, 56(%rsi)
	movq	$0, 72(%rsi)
	cmpl	$224, %ecx
	jl	LBB0_3
## %bb.1:
	cmpl	$32, 892(%r15)
	jne	LBB0_3
## %bb.2:
	movabsq	$1095216660735, %rax            ## imm = 0xFF000000FF
	movq	%rax, 44(%rbx)
	movaps	LCPI0_0(%rip), %xmm0            ## xmm0 = [128,128,0,0]
	movups	%xmm0, 28(%rbx)
	movq	%rax, 20(%rbx)
	movups	28(%rbx), %xmm0
	movups	%xmm0, 4(%rbx)
	movl	$2, (%rbx)
	jmp	LBB0_26
LBB0_3:
	xorl	%eax, %eax
	cmpl	$255, (%r15)
	jne	LBB0_6
## %bb.4:
	movl	$16, %eax
	cmpl	$255, 64(%r15)
	jne	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	callq	_WIIUSE_DEBUG
	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	%r15, %rsi
	callq	_wiiuse_read_data
	xorl	%eax, %eax
LBB0_6:
	cmpl	$219, %r12d
	jl	LBB0_8
## %bb.7:
	movl	$1, %ecx
	cmpl	$0, 872(%r15)
	jne	LBB0_9
LBB0_8:
	xorl	%ecx, %ecx
LBB0_9:
	movl	%ecx, (%rbx)
	movl	%eax, %ecx
	movl	(%r15,%rcx,4), %edx
	leal	3(%rdx), %ecx
	movl	$64, %esi
	cmpl	$7, %ecx
	jb	LBB0_11
## %bb.10:
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$2, %ecx
	movl	%ecx, %esi
LBB0_11:
	movl	%esi, 44(%rbx)
	movl	%eax, %ecx
	orl	$1, %ecx
	movl	(%r15,%rcx,4), %ecx
	leal	3(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$2, %edx
	movl	%edx, 36(%rbx)
	movl	%eax, %ecx
	orl	$2, %ecx
	movl	(%r15,%rcx,4), %edx
	leal	3(%rdx), %ecx
	movl	$32, %esi
	cmpl	$7, %ecx
	jb	LBB0_13
## %bb.12:
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$2, %ecx
	movl	%ecx, %esi
LBB0_13:
	movl	%esi, 28(%rbx)
	movl	%eax, %ecx
	orl	$3, %ecx
	movl	(%r15,%rcx,4), %edx
	leal	3(%rdx), %ecx
	movl	$64, %esi
	cmpl	$7, %ecx
	jb	LBB0_15
## %bb.14:
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$2, %ecx
	movl	%ecx, %esi
LBB0_15:
	movl	%esi, 48(%rbx)
	movl	%eax, %ecx
	orl	$4, %ecx
	movl	(%r15,%rcx,4), %ecx
	leal	3(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$2, %edx
	movl	%edx, 40(%rbx)
	movl	%eax, %ecx
	orl	$5, %ecx
	movl	(%r15,%rcx,4), %esi
	leal	3(%rsi), %edx
	movl	$32, %ecx
	movl	$32, %edi
	cmpl	$7, %edx
	jb	LBB0_17
## %bb.16:
	testl	%esi, %esi
	cmovnsl	%esi, %edx
	sarl	$2, %edx
	movl	%edx, %edi
LBB0_17:
	movl	%edi, 32(%rbx)
	movl	%eax, %edx
	orl	$6, %edx
	movl	(%r15,%rdx,4), %esi
	leal	7(%rsi), %edx
	cmpl	$15, %edx
	jb	LBB0_19
## %bb.18:
	testl	%esi, %esi
	cmovnsl	%esi, %edx
	sarl	$3, %edx
	movl	%edx, %ecx
LBB0_19:
	movl	%ecx, 20(%rbx)
	movl	%eax, %ecx
	orl	$7, %ecx
	movl	(%r15,%rcx,4), %ecx
	leal	7(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$3, %edx
	movl	%edx, 12(%rbx)
	movl	%eax, %ecx
	orl	$8, %ecx
	movl	(%r15,%rcx,4), %edx
	leal	7(%rdx), %ecx
	movl	$16, %esi
	cmpl	$15, %ecx
	jb	LBB0_21
## %bb.20:
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$3, %ecx
	movl	%ecx, %esi
LBB0_21:
	movl	%esi, 4(%rbx)
	movl	%eax, %ecx
	orl	$9, %ecx
	movl	(%r15,%rcx,4), %edx
	leal	7(%rdx), %ecx
	movl	$32, %esi
	cmpl	$15, %ecx
	jb	LBB0_23
## %bb.22:
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$3, %ecx
	movl	%ecx, %esi
LBB0_23:
	movl	%esi, 24(%rbx)
	movl	%eax, %ecx
	orl	$10, %ecx
	movl	(%r15,%rcx,4), %ecx
	leal	7(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$3, %edx
	movl	%edx, 16(%rbx)
	orl	$11, %eax
	movl	(%r15,%rax,4), %ecx
	leal	7(%rcx), %eax
	movl	$16, %edx
	cmpl	$15, %eax
	jb	LBB0_25
## %bb.24:
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	movl	%eax, %edx
LBB0_25:
	movl	%edx, 8(%rbx)
LBB0_26:
	movq	_WIIUSE_CLASSIC_CTRL_INSERTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	movq	_EXP_CLASSIC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%r14)
	movl	$1, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Classic controller handshake appears invalid, trying again."

	.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_CLASSIC_CTRL_INSERTED,4,2 ## @WIIUSE_CLASSIC_CTRL_INSERTED
	.comm	_EXP_CLASSIC,4,2                ## @EXP_CLASSIC
	.comm	_WIIMOTE_DEFAULT_TIMEOUT,4,2    ## @WIIMOTE_DEFAULT_TIMEOUT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; -- Begin function classic_ctrl_handshake
lCPI0_0:
	.long	128                             ; 0x80
	.long	128                             ; 0x80
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_classic_ctrl_handshake
	.p2align	2
_classic_ctrl_handshake:                ; @classic_ctrl_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	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	stp	xzr, xzr, [x1, #56]
	str	xzr, [x1, #72]
	cmp	w3, #224
	b.lt	LBB0_3
; %bb.1:
	ldr	w8, [x21, #892]
	cmp	w8, #32
	b.ne	LBB0_3
; %bb.2:
	movi	d0, #0x0000ff000000ff
	stur	d0, [x20, #44]
Lloh0:
	adrp	x8, lCPI0_0@PAGE
Lloh1:
	ldr	q0, [x8, lCPI0_0@PAGEOFF]
	stur	q0, [x20, #28]
	ldur	x8, [x20, #44]
	stur	x8, [x20, #20]
	ldur	q0, [x20, #28]
	stur	q0, [x20, #4]
	mov	w8, #2
	str	w8, [x20]
	b	LBB0_12
LBB0_3:
	ldr	w8, [x21]
	cmp	w8, #255
	b.ne	LBB0_6
; %bb.4:
	ldr	w8, [x21, #64]
	cmp	w8, #255
	b.ne	LBB0_7
; %bb.5:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WIIUSE_DEBUG
Lloh4:
	adrp	x8, _WM_EXP_MEM_CALIBR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _WM_EXP_MEM_CALIBR@GOTPAGEOFF]
Lloh6:
	ldr	w2, [x8]
Lloh7:
	adrp	x8, _EXP_HANDSHAKE_LEN@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EXP_HANDSHAKE_LEN@GOTPAGEOFF]
Lloh9:
	ldr	w3, [x8]
Lloh10:
	adrp	x8, _wiiuse_handshake_expansion@GOTPAGE
Lloh11:
	ldr	x8, [x8, _wiiuse_handshake_expansion@GOTPAGEOFF]
Lloh12:
	ldr	w4, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_wiiuse_read_data
LBB0_6:
	mov	w8, #0
	cmp	w22, #219
	b.ge	LBB0_8
	b	LBB0_10
LBB0_7:
	mov	w8, #16
	cmp	w22, #219
	b.lt	LBB0_10
LBB0_8:
	ldr	w9, [x21, #872]
	cbz	w9, LBB0_10
; %bb.9:
	mov	w9, #1
	b	LBB0_11
LBB0_10:
	mov	w9, #0
LBB0_11:
	str	w9, [x20]
	ldr	w9, [x21, w8, uxtw #2]
	add	w10, w9, #3
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #2
	mov	w11, #64
	cmp	w10, #7
	csel	w9, w11, w9, lo
	str	w9, [x20, #44]
	orr	w9, w8, #0x1
	ldr	w9, [x21, w9, uxtw #2]
	add	w10, w9, #3
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #2
	str	w9, [x20, #36]
	orr	w9, w8, #0x2
	ldr	w9, [x21, w9, uxtw #2]
	add	w10, w9, #3
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w12, w9, #2
	mov	w9, #32
	cmp	w10, #7
	csel	w10, w9, w12, lo
	str	w10, [x20, #28]
	orr	w10, w8, #0x3
	ldr	w10, [x21, w10, uxtw #2]
	add	w12, w10, #3
	cmp	w10, #0
	csel	w10, w12, w10, lt
	asr	w10, w10, #2
	cmp	w12, #7
	csel	w10, w11, w10, lo
	str	w10, [x20, #48]
	orr	w10, w8, #0x4
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #3
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #2
	str	w10, [x20, #40]
	mov	w10, #5
	orr	w10, w8, w10
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #3
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #2
	cmp	w11, #7
	csel	w10, w9, w10, lo
	str	w10, [x20, #32]
	orr	w10, w8, #0x6
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #7
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #3
	cmp	w11, #15
	csel	w10, w9, w10, lo
	str	w10, [x20, #20]
	orr	w10, w8, #0x7
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #7
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #3
	str	w10, [x20, #12]
	orr	w10, w8, #0x8
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #7
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #3
	mov	w12, #16
	cmp	w11, #15
	csel	w10, w12, w10, lo
	str	w10, [x20, #4]
	mov	w10, #9
	orr	w10, w8, w10
	ldr	w10, [x21, w10, uxtw #2]
	add	w11, w10, #7
	cmp	w10, #0
	csel	w10, w11, w10, lt
	asr	w10, w10, #3
	cmp	w11, #15
	csel	w9, w9, w10, lo
	str	w9, [x20, #24]
	mov	w9, #10
	orr	w9, w8, w9
	ldr	w9, [x21, w9, uxtw #2]
	add	w10, w9, #7
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #3
	str	w9, [x20, #16]
	mov	w9, #11
	orr	w8, w8, w9
	ldr	w8, [x21, w8, uxtw #2]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #3
	cmp	w9, #15
	csel	w8, w12, w8, lo
	str	w8, [x20, #8]
LBB0_12:
Lloh13:
	adrp	x8, _WIIUSE_CLASSIC_CTRL_INSERTED@GOTPAGE
Lloh14:
	ldr	x8, [x8, _WIIUSE_CLASSIC_CTRL_INSERTED@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _EXP_CLASSIC@GOTPAGE
Lloh17:
	ldr	x9, [x9, _EXP_CLASSIC@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #4]
	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
	.loh AdrpLdr	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Classic controller handshake appears invalid, trying again."

	.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_CLASSIC_CTRL_INSERTED,4,2 ; @WIIUSE_CLASSIC_CTRL_INSERTED
	.comm	_EXP_CLASSIC,4,2                ; @EXP_CLASSIC
	.comm	_WIIMOTE_DEFAULT_TIMEOUT,4,2    ; @WIIMOTE_DEFAULT_TIMEOUT
.subsections_via_symbols
