	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_set_ir                  ## -- Begin function wiiuse_set_ir
	.p2align	4, 0x90
_wiiuse_set_ir:                         ## @wiiuse_set_ir
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	testq	%rdi, %rdi
	je	LBB0_17
## %bb.1:
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WIIMOTE_IS_SET
	testq	%rax, %rax
	je	LBB0_2
## %bb.4:
	leaq	-48(%rbp), %rsi
	leaq	-40(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_get_ir_sens
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movq	_WIIMOTE_STATE_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_IS_SET
	testl	%r14d, %r14d
	je	LBB0_9
## %bb.7:
	testq	%rax, %rax
	jne	LBB0_16
## %bb.8:
	movl	$4, %ecx
	jmp	LBB0_10
LBB0_2:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_WIIUSE_DEBUG
	movq	_WIIMOTE_STATE_IR_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	addq	$24, %rsp
	testl	%r14d, %r14d
	je	LBB0_3
## %bb.18:
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_WIIMOTE_ENABLE_STATE           ## TAILCALL
LBB0_5:
	leaq	L_.str.1(%rip), %rdi
	callq	_WIIUSE_ERROR
	jmp	LBB0_17
LBB0_9:
	xorl	%ecx, %ecx
	testq	%rax, %rax
	je	LBB0_16
LBB0_10:
	movl	%ecx, -28(%rbp)
	movq	_WM_CMD_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %r15
	movq	%rbx, %rdi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_sendcmd
	movq	_WM_CMD_IR_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movq	%r15, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_sendcmd
	testl	%r14d, %r14d
	je	LBB0_11
## %bb.12:
	movl	$8, -28(%rbp)
	movq	_WM_REG_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %r14
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_write_data
	movq	_WM_REG_IR_BLOCK1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$9, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_write_data
	movq	_WM_REG_IR_BLOCK2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-40(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_write_data
	movq	_WIIMOTE_STATE_EXP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_IS_SET
	testq	%rax, %rax
	jne	LBB0_13
## %bb.14:
	movq	_WM_IR_TYPE_EXTENDED@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_3:
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_WIIMOTE_DISABLE_STATE          ## TAILCALL
LBB0_11:
	movl	(%rbx), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_WIIUSE_DEBUG
	jmp	LBB0_16
LBB0_13:
	movq	_WM_IR_TYPE_BASIC@GOTPCREL(%rip), %rax
LBB0_15:
	movl	(%rax), %eax
	movl	%eax, -28(%rbp)
	movq	_WM_REG_IR_MODENUM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_write_data
LBB0_16:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_wiiuse_status
LBB0_17:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_WIIMOTE_STATE_HANDSHAKE_COMPLETE,4,2 ## @WIIMOTE_STATE_HANDSHAKE_COMPLETE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Tried to enable IR, will wait until handshake finishes.\n"

	.comm	_WIIMOTE_STATE_IR_INIT,4,2      ## @WIIMOTE_STATE_IR_INIT
L_.str.1:                               ## @.str.1
	.asciz	"No IR sensitivity setting selected."

	.comm	_WIIMOTE_STATE_IR,4,2           ## @WIIMOTE_STATE_IR
	.comm	_WM_CMD_IR,4,2                  ## @WM_CMD_IR
	.comm	_WM_CMD_IR_2,4,2                ## @WM_CMD_IR_2
L_.str.2:                               ## @.str.2
	.asciz	"Disabled IR cameras for wiimote id %i."

	.comm	_WM_REG_IR,4,2                  ## @WM_REG_IR
	.comm	_WM_REG_IR_BLOCK1,4,2           ## @WM_REG_IR_BLOCK1
	.comm	_WM_REG_IR_BLOCK2,4,2           ## @WM_REG_IR_BLOCK2
	.comm	_WIIMOTE_STATE_EXP,4,2          ## @WIIMOTE_STATE_EXP
	.comm	_WM_IR_TYPE_BASIC,4,2           ## @WM_IR_TYPE_BASIC
	.comm	_WM_IR_TYPE_EXTENDED,4,2        ## @WM_IR_TYPE_EXTENDED
	.comm	_WM_REG_IR_MODENUM,4,2          ## @WM_REG_IR_MODENUM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_set_ir                  ; -- Begin function wiiuse_set_ir
	.p2align	2
_wiiuse_set_ir:                         ; @wiiuse_set_ir
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	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
	stp	xzr, xzr, [sp, #8]
	cbz	x0, LBB0_16
; %bb.1:
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_WIIMOTE_IS_SET
	cbz	x0, LBB0_6
; %bb.2:
	add	x1, sp, #16
	add	x2, sp, #8
	mov	x0, x19
	bl	_get_ir_sens
	cbz	w0, LBB0_8
; %bb.3:
Lloh3:
	adrp	x8, _WIIMOTE_STATE_IR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WIIMOTE_STATE_IR@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_IS_SET
	cbz	w20, LBB0_9
; %bb.4:
	cbnz	x0, LBB0_15
; %bb.5:
	mov	w8, #4
	b	LBB0_11
LBB0_6:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_WIIUSE_DEBUG
Lloh8:
	adrp	x8, _WIIMOTE_STATE_IR_INIT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _WIIMOTE_STATE_IR_INIT@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	cbz	w20, LBB0_13
; %bb.7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_WIIMOTE_ENABLE_STATE
LBB0_8:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_WIIUSE_ERROR
	b	LBB0_16
LBB0_9:
	cbz	x0, LBB0_15
; %bb.10:
	mov	w8, #0
LBB0_11:
	stur	w8, [x29, #-20]
Lloh13:
	adrp	x8, _WM_CMD_IR@GOTPAGE
Lloh14:
	ldr	x8, [x8, _WM_CMD_IR@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	sub	x2, x29, #20
	mov	x0, x19
	mov	w3, #1
	mov	x4, #0
	bl	_wiiuse_sendcmd
Lloh16:
	adrp	x8, _WM_CMD_IR_2@GOTPAGE
Lloh17:
	ldr	x8, [x8, _WM_CMD_IR_2@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	sub	x2, x29, #20
	mov	x0, x19
	mov	w3, #1
	mov	x4, #0
	bl	_wiiuse_sendcmd
	cbz	w20, LBB0_14
; %bb.12:
	mov	w8, #8
	stur	w8, [x29, #-20]
Lloh19:
	adrp	x8, _WM_REG_IR@GOTPAGE
Lloh20:
	ldr	x8, [x8, _WM_REG_IR@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	sub	x2, x29, #20
	mov	x0, x19
	mov	w3, #1
	mov	x4, #0
	bl	_wiiuse_write_data
Lloh22:
	adrp	x8, _WM_REG_IR_BLOCK1@GOTPAGE
Lloh23:
	ldr	x8, [x8, _WM_REG_IR_BLOCK1@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	ldr	x2, [sp, #16]
	mov	x0, x19
	mov	w3, #9
	mov	x4, #0
	bl	_wiiuse_write_data
Lloh25:
	adrp	x8, _WM_REG_IR_BLOCK2@GOTPAGE
Lloh26:
	ldr	x8, [x8, _WM_REG_IR_BLOCK2@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	ldr	x2, [sp, #8]
	mov	x0, x19
	mov	w3, #2
	mov	x4, #0
	bl	_wiiuse_write_data
Lloh28:
	adrp	x8, _WIIMOTE_STATE_EXP@GOTPAGE
Lloh29:
	ldr	x8, [x8, _WIIMOTE_STATE_EXP@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_IS_SET
Lloh31:
	adrp	x8, _WM_IR_TYPE_EXTENDED@GOTPAGE
Lloh32:
	ldr	x8, [x8, _WM_IR_TYPE_EXTENDED@GOTPAGEOFF]
Lloh33:
	adrp	x9, _WM_IR_TYPE_BASIC@GOTPAGE
Lloh34:
	ldr	x9, [x9, _WM_IR_TYPE_BASIC@GOTPAGEOFF]
	cmp	x0, #0
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	stur	w8, [x29, #-20]
Lloh35:
	adrp	x8, _WM_REG_IR_MODENUM@GOTPAGE
Lloh36:
	ldr	x8, [x8, _WM_REG_IR_MODENUM@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	sub	x2, x29, #20
	mov	x0, x19
	mov	w3, #1
	mov	x4, #0
	bl	_wiiuse_write_data
	b	LBB0_15
LBB0_13:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	b	_WIIMOTE_DISABLE_STATE
LBB0_14:
	ldr	w8, [x19]
	str	x8, [sp]
Lloh38:
	adrp	x0, l_.str.2@PAGE
Lloh39:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_WIIUSE_DEBUG
LBB0_15:
	mov	x0, x19
	mov	x1, #0
	bl	_wiiuse_status
LBB0_16:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh38, Lloh39
	.cfi_endproc
                                        ; -- End function
	.comm	_WIIMOTE_STATE_HANDSHAKE_COMPLETE,4,2 ; @WIIMOTE_STATE_HANDSHAKE_COMPLETE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Tried to enable IR, will wait until handshake finishes.\n"

	.comm	_WIIMOTE_STATE_IR_INIT,4,2      ; @WIIMOTE_STATE_IR_INIT
l_.str.1:                               ; @.str.1
	.asciz	"No IR sensitivity setting selected."

	.comm	_WIIMOTE_STATE_IR,4,2           ; @WIIMOTE_STATE_IR
	.comm	_WM_CMD_IR,4,2                  ; @WM_CMD_IR
	.comm	_WM_CMD_IR_2,4,2                ; @WM_CMD_IR_2
l_.str.2:                               ; @.str.2
	.asciz	"Disabled IR cameras for wiimote id %i."

	.comm	_WM_REG_IR,4,2                  ; @WM_REG_IR
	.comm	_WM_REG_IR_BLOCK1,4,2           ; @WM_REG_IR_BLOCK1
	.comm	_WM_REG_IR_BLOCK2,4,2           ; @WM_REG_IR_BLOCK2
	.comm	_WIIMOTE_STATE_EXP,4,2          ; @WIIMOTE_STATE_EXP
	.comm	_WM_IR_TYPE_BASIC,4,2           ; @WM_IR_TYPE_BASIC
	.comm	_WM_IR_TYPE_EXTENDED,4,2        ; @WM_IR_TYPE_EXTENDED
	.comm	_WM_REG_IR_MODENUM,4,2          ; @WM_REG_IR_MODENUM
.subsections_via_symbols
