	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function applesmc_store_fan_speed
_applesmc_store_fan_speed:              ## @applesmc_store_fan_speed
	.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	$40, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %rbx
	movq	%rdx, %rdi
	movq	%rsi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	leaq	-56(%rbp), %rdx
	movl	$10, %esi
	callq	_kstrtoul
	testq	%rax, %rax
	js	LBB0_2
## %bb.1:
	cmpq	$16384, -56(%rbp)               ## imm = 0x4000
	jae	LBB0_2
## %bb.3:
	movq	_fan_speed_fmt@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movq	%r14, %rdi
	callq	_to_option
	movl	(%r15,%rax,4), %r15d
	movq	%r14, %rdi
	callq	_to_index
	leaq	-61(%rbp), %r14
	movq	%r14, %rdi
	movl	$5, %esi
	movl	%r15d, %edx
	movl	%eax, %ecx
	callq	_scnprintf
	movl	-56(%rbp), %eax
	movl	%eax, %ecx
	shrl	$6, %ecx
	movzbl	%cl, %ecx
	movq	%rcx, -48(%rbp)
	shll	$2, %eax
	movzbl	%al, %eax
	movq	%rax, -40(%rbp)
	leaq	-48(%rbp), %rsi
	movq	%r14, %rdi
	movl	$2, %edx
	callq	_applesmc_write_key
	testl	%eax, %eax
	cmovnel	%eax, %ebx
	jmp	LBB0_4
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_4:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-32(%rbp), %rax
	jne	LBB0_6
## %bb.5:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_fan_speed_fmt,8,3              ## @fan_speed_fmt
	.no_dead_strip	_applesmc_store_fan_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function applesmc_store_fan_speed
_applesmc_store_fan_speed:              ; @applesmc_store_fan_speed
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x3
	mov	x0, x2
	mov	x20, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	add	x2, sp, #16
	mov	w1, #10
	bl	_kstrtoul
	tbnz	x0, #63, LBB0_3
; %bb.1:
	ldr	x8, [sp, #16]
	cmp	x8, #4, lsl #12                 ; =16384
	b.hs	LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _fan_speed_fmt@GOTPAGE
Lloh4:
	ldr	x8, [x8, _fan_speed_fmt@GOTPAGEOFF]
Lloh5:
	ldr	x21, [x8]
	mov	x0, x20
	bl	_to_option
	ldr	w21, [x21, x0, lsl #2]
	mov	x0, x20
	bl	_to_index
	mov	x3, x0
	add	x0, sp, #11
	mov	w1, #5
	mov	x2, x21
	bl	_scnprintf
	ldr	x8, [sp, #16]
	ubfx	x9, x8, #6, #8
	lsl	w8, w8, #2
	and	x8, x8, #0xfc
	stp	x9, x8, [sp, #24]
	add	x0, sp, #11
	add	x1, sp, #24
	mov	w2, #2
	bl	_applesmc_write_key
	cmp	w0, #0
	csel	w0, w19, w0, eq
	b	LBB0_4
LBB0_3:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	ldr	x8, [sp, #40]
Lloh9:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_6
; %bb.5:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_6:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_fan_speed_fmt,8,3              ; @fan_speed_fmt
	.no_dead_strip	_applesmc_store_fan_speed
.subsections_via_symbols
