	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_set_ir_sensitivity      ## -- Begin function wiiuse_set_ir_sensitivity
	.p2align	4, 0x90
_wiiuse_set_ir_sensitivity:             ## @wiiuse_set_ir_sensitivity
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	$0, -32(%rbp)
	movq	$0, -24(%rbp)
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.1:
	movq	%rdi, %rbx
	cmpl	$5, %esi
	movl	$5, %eax
	cmovll	%esi, %eax
	cmpl	$2, %eax
	movl	$1, %r14d
	cmovgel	%eax, %r14d
	movq	_WIIMOTE_STATE_IR_SENS_LVL1@GOTPCREL(%rip), %rax
	movq	_WIIMOTE_STATE_IR_SENS_LVL2@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	_WIIMOTE_STATE_IR_SENS_LVL3@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_WIIMOTE_STATE_IR_SENS_LVL4@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	_WIIMOTE_STATE_IR_SENS_LVL5@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	callq	_WIIMOTE_DISABLE_STATE
	leal	-1(%r14), %eax
	cmpl	$4, %eax
	ja	LBB0_4
## %bb.2:
	cltq
	leaq	l_switch.table.wiiuse_set_ir_sensitivity(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_ENABLE_STATE
	movq	_WIIMOTE_STATE_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_IS_SET
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	leaq	-32(%rbp), %rsi
	leaq	-24(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_get_ir_sens
	movq	_WM_REG_IR_BLOCK1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-32(%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	-24(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$2, %ecx
	xorl	%r8d, %r8d
	callq	_wiiuse_write_data
	movl	(%rbx), %edx
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	callq	_WIIUSE_DEBUG
LBB0_4:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_WIIMOTE_STATE_IR_SENS_LVL1,4,2 ## @WIIMOTE_STATE_IR_SENS_LVL1
	.comm	_WIIMOTE_STATE_IR_SENS_LVL2,4,2 ## @WIIMOTE_STATE_IR_SENS_LVL2
	.comm	_WIIMOTE_STATE_IR_SENS_LVL3,4,2 ## @WIIMOTE_STATE_IR_SENS_LVL3
	.comm	_WIIMOTE_STATE_IR_SENS_LVL4,4,2 ## @WIIMOTE_STATE_IR_SENS_LVL4
	.comm	_WIIMOTE_STATE_IR_SENS_LVL5,4,2 ## @WIIMOTE_STATE_IR_SENS_LVL5
	.comm	_WIIMOTE_STATE_IR,4,2           ## @WIIMOTE_STATE_IR
	.comm	_WM_REG_IR_BLOCK1,4,2           ## @WM_REG_IR_BLOCK1
	.comm	_WM_REG_IR_BLOCK2,4,2           ## @WM_REG_IR_BLOCK2
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Set IR sensitivity to level %i (unid %i)"

	.section	__DATA,__const
	.p2align	3                               ## @switch.table.wiiuse_set_ir_sensitivity
l_switch.table.wiiuse_set_ir_sensitivity:
	.quad	_WIIMOTE_STATE_IR_SENS_LVL1
	.quad	_WIIMOTE_STATE_IR_SENS_LVL2
	.quad	_WIIMOTE_STATE_IR_SENS_LVL3
	.quad	_WIIMOTE_STATE_IR_SENS_LVL4
	.quad	_WIIMOTE_STATE_IR_SENS_LVL5

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wiiuse_set_ir_sensitivity      ; -- Begin function wiiuse_set_ir_sensitivity
	.p2align	2
_wiiuse_set_ir_sensitivity:             ; @wiiuse_set_ir_sensitivity
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	stp	xzr, xzr, [sp]
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	mov	w8, #5
	cmp	w1, #5
	csel	w8, w1, w8, lt
	cmp	w8, #1
Lloh0:
	adrp	x9, _WIIMOTE_STATE_IR_SENS_LVL1@GOTPAGE
Lloh1:
	ldr	x9, [x9, _WIIMOTE_STATE_IR_SENS_LVL1@GOTPAGEOFF]
	csinc	w20, w8, wzr, gt
Lloh2:
	ldr	w8, [x9]
Lloh3:
	adrp	x9, _WIIMOTE_STATE_IR_SENS_LVL2@GOTPAGE
Lloh4:
	ldr	x9, [x9, _WIIMOTE_STATE_IR_SENS_LVL2@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _WIIMOTE_STATE_IR_SENS_LVL3@GOTPAGE
Lloh7:
	ldr	x9, [x9, _WIIMOTE_STATE_IR_SENS_LVL3@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh9:
	adrp	x9, _WIIMOTE_STATE_IR_SENS_LVL4@GOTPAGE
Lloh10:
	ldr	x9, [x9, _WIIMOTE_STATE_IR_SENS_LVL4@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh12:
	adrp	x9, _WIIMOTE_STATE_IR_SENS_LVL5@GOTPAGE
Lloh13:
	ldr	x9, [x9, _WIIMOTE_STATE_IR_SENS_LVL5@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	orr	w1, w8, w9
	bl	_WIIMOTE_DISABLE_STATE
	sub	x8, x20, #1
	cmp	w8, #4
	b.hi	LBB0_4
; %bb.2:
Lloh15:
	adrp	x9, l_switch.table.wiiuse_set_ir_sensitivity@PAGE
Lloh16:
	add	x9, x9, l_switch.table.wiiuse_set_ir_sensitivity@PAGEOFF
	ldr	x8, [x9, x8, lsl #3]
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_ENABLE_STATE
Lloh17:
	adrp	x8, _WIIMOTE_STATE_IR@GOTPAGE
Lloh18:
	ldr	x8, [x8, _WIIMOTE_STATE_IR@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_WIIMOTE_IS_SET
	cbz	w0, LBB0_4
; %bb.3:
	add	x1, sp, #8
	mov	x2, sp
	mov	x0, x19
	bl	_get_ir_sens
Lloh20:
	adrp	x8, _WM_REG_IR_BLOCK1@GOTPAGE
Lloh21:
	ldr	x8, [x8, _WM_REG_IR_BLOCK1@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	ldr	x2, [sp, #8]
	mov	x0, x19
	mov	w3, #9
	mov	x4, #0
	bl	_wiiuse_write_data
Lloh23:
	adrp	x8, _WM_REG_IR_BLOCK2@GOTPAGE
Lloh24:
	ldr	x8, [x8, _WM_REG_IR_BLOCK2@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	ldr	x2, [sp]
	mov	x0, x19
	mov	w3, #2
	mov	x4, #0
	bl	_wiiuse_write_data
	ldr	w2, [x19]
Lloh26:
	adrp	x0, l_.str@PAGE
Lloh27:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_WIIUSE_DEBUG
LBB0_4:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_WIIMOTE_STATE_IR_SENS_LVL1,4,2 ; @WIIMOTE_STATE_IR_SENS_LVL1
	.comm	_WIIMOTE_STATE_IR_SENS_LVL2,4,2 ; @WIIMOTE_STATE_IR_SENS_LVL2
	.comm	_WIIMOTE_STATE_IR_SENS_LVL3,4,2 ; @WIIMOTE_STATE_IR_SENS_LVL3
	.comm	_WIIMOTE_STATE_IR_SENS_LVL4,4,2 ; @WIIMOTE_STATE_IR_SENS_LVL4
	.comm	_WIIMOTE_STATE_IR_SENS_LVL5,4,2 ; @WIIMOTE_STATE_IR_SENS_LVL5
	.comm	_WIIMOTE_STATE_IR,4,2           ; @WIIMOTE_STATE_IR
	.comm	_WM_REG_IR_BLOCK1,4,2           ; @WM_REG_IR_BLOCK1
	.comm	_WM_REG_IR_BLOCK2,4,2           ; @WM_REG_IR_BLOCK2
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Set IR sensitivity to level %i (unid %i)"

	.section	__DATA,__const
	.p2align	3                               ; @switch.table.wiiuse_set_ir_sensitivity
l_switch.table.wiiuse_set_ir_sensitivity:
	.quad	_WIIMOTE_STATE_IR_SENS_LVL1
	.quad	_WIIMOTE_STATE_IR_SENS_LVL2
	.quad	_WIIMOTE_STATE_IR_SENS_LVL3
	.quad	_WIIMOTE_STATE_IR_SENS_LVL4
	.quad	_WIIMOTE_STATE_IR_SENS_LVL5

.subsections_via_symbols
