	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_rpm_fan
_set_rpm_fan:                           ## @set_rpm_fan
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	subq	$16, %rsp
	movq	_fcu_fans@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%edi, %rcx
	shlq	$4, %rcx
	movq	(%rax,%rcx), %rdx
	movq	_FCU_FAN_RPM@GOTPCREL(%rip), %rdi
	cmpq	(%rdi), %rdx
	jne	LBB0_1
## %bb.2:
	movl	8(%rax,%rcx), %r8d
	movq	_FCU_FAN_ABSENT_ID@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r8d
	jne	LBB0_3
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_5:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_6:
	addq	$16, %rsp
	popq	%rbp
	retq
LBB0_3:
	movq	_fcu_rpm_shift@GOTPCREL(%rip), %rax
	movb	(%rax), %al
	movl	$2400, %edi                     ## imm = 0x960
	movl	%eax, %ecx
	shrl	%cl, %edi
	movl	$56000, %edx                    ## imm = 0xDAC0
	shrl	%cl, %edx
	cmpl	%esi, %edx
	cmovgel	%esi, %edx
	cmpl	%esi, %edi
	cmovgl	%edi, %edx
	movb	$8, %cl
	subb	%al, %cl
	movl	%edx, %esi
	sarl	%cl, %esi
	movl	%eax, %ecx
	shll	%cl, %edx
	movb	%sil, -2(%rbp)
	movb	%dl, -1(%rbp)
	leal	(%r8,%r8), %edi
	addl	$16, %edi
	leaq	-2(%rbp), %rsi
	movl	$2, %edx
	callq	_fan_write_reg
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jns	LBB0_6
## %bb.4:
	movq	_EIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_fcu_fans,8,3                   ## @fcu_fans
	.comm	_FCU_FAN_RPM,8,3                ## @FCU_FAN_RPM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_FCU_FAN_ABSENT_ID,4,2          ## @FCU_FAN_ABSENT_ID
	.comm	_fcu_rpm_shift,4,2              ## @fcu_rpm_shift
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_set_rpm_fan
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_rpm_fan
_set_rpm_fan:                           ; @set_rpm_fan
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #32
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
                                        ; kill: def $w0 killed $w0 def $x0
Lloh0:
	adrp	x8, _fcu_fans@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fcu_fans@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	sbfiz	x9, x0, #4, #32
	ldr	x9, [x8, x9]
Lloh3:
	adrp	x10, _FCU_FAN_RPM@GOTPAGE
Lloh4:
	ldr	x10, [x10, _FCU_FAN_RPM@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_2
; %bb.1:
	sxtw	x9, w0
	add	x8, x8, x9, lsl #4
	ldr	w8, [x8, #8]
Lloh6:
	adrp	x9, _FCU_FAN_ABSENT_ID@GOTPAGE
Lloh7:
	ldr	x9, [x9, _FCU_FAN_ABSENT_ID@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_5
LBB0_2:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #32
	ret
LBB0_5:
Lloh11:
	adrp	x9, _fcu_rpm_shift@GOTPAGE
Lloh12:
	ldr	x9, [x9, _fcu_rpm_shift@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	mov	w10, #2400
	lsr	w10, w10, w9
	mov	w11, #56000
	lsr	w11, w11, w9
	cmp	w11, w1
	csel	w11, w11, w1, lt
	cmp	w10, w1
	csel	w10, w10, w11, gt
	mov	w11, #8
	sub	w11, w11, w9
	asr	w11, w10, w11
	sturb	w11, [x29, #-2]
	lsl	w9, w10, w9
	sturb	w9, [x29, #-1]
	lsl	w8, w8, #1
	add	w0, w8, #16
	sub	x1, x29, #2
	mov	w2, #2
	bl	_fan_write_reg
	tbnz	w0, #31, LBB0_7
; %bb.6:
	mov	w0, #0
	b	LBB0_4
LBB0_7:
Lloh14:
	adrp	x8, _EIO@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_fcu_fans,8,3                   ; @fcu_fans
	.comm	_FCU_FAN_RPM,8,3                ; @FCU_FAN_RPM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_FCU_FAN_ABSENT_ID,4,2          ; @FCU_FAN_ABSENT_ID
	.comm	_fcu_rpm_shift,4,2              ; @fcu_rpm_shift
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_set_rpm_fan
.subsections_via_symbols
