	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wiimote_write_data
_wiimote_write_data:                    ## @wiimote_write_data
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -80(%rbp)
	movaps	%xmm0, -96(%rbp)
	movaps	%xmm0, -112(%rbp)
	movaps	%xmm0, -128(%rbp)
	movaps	%xmm0, -144(%rbp)
	movl	$0, -64(%rbp)
	xorl	%r12d, %r12d
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.1:
	movl	%ecx, %r14d
	movq	%rdx, %r15
	movl	%esi, %r13d
	movq	%rdi, %rbx
	callq	_wiimote_is_connected
	testl	%eax, %eax
	je	LBB0_5
## %bb.2:
	testq	%r15, %r15
	je	LBB0_5
## %bb.3:
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.4:
	movl	%r13d, %edi
	callq	_swap_if_little32
	movl	%eax, -144(%rbp)
	movl	%r14d, -128(%rbp)
	leaq	-124(%rbp), %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	callq	_memcpy
	movq	_WM_CMD_WRITE_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-144(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$21, %ecx
	callq	_wiimote_send
	movl	$1, %r12d
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_7
## %bb.6:
	movl	%r12d, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_WM_CMD_WRITE_DATA,4,2          ## @WM_CMD_WRITE_DATA
	.no_dead_strip	_wiimote_write_data
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wiimote_write_data
_wiimote_write_data:                    ; @wiimote_write_data
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
	movi.2d	v0, #0000000000000000
	stur	q0, [sp, #72]
	stur	q0, [sp, #56]
	stur	q0, [sp, #40]
	stur	q0, [sp, #24]
	stur	q0, [sp, #8]
	cbz	x0, LBB0_5
; %bb.1:
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	_wiimote_is_connected
	cbz	w0, LBB0_5
; %bb.2:
	mov	w0, #0
	cbz	x21, LBB0_5
; %bb.3:
	cbz	w20, LBB0_5
; %bb.4:
	mov	x0, x22
	bl	_swap_if_little32
	str	w0, [sp, #4]
	str	w20, [sp, #20]
	add	x8, sp, #4
	add	x0, x8, #20
	mov	x1, x21
	mov	x2, x20
	bl	_memcpy
Lloh3:
	adrp	x8, _WM_CMD_WRITE_DATA@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WM_CMD_WRITE_DATA@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #4
	mov	x0, x19
	mov	w3, #21
	bl	_wiimote_send
	mov	w0, #1
LBB0_5:
	ldur	x8, [x29, #-40]
Lloh6:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh7:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_7
; %bb.6:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_7:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_WM_CMD_WRITE_DATA,4,2          ; @WM_CMD_WRITE_DATA
	.no_dead_strip	_wiimote_write_data
.subsections_via_symbols
