	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fcu_fan_set_pwm
_fcu_fan_set_pwm:                       ## @fcu_fan_set_pwm
	.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
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movl	12(%rdi), %edi
	callq	_device_get_softc
	movq	%rax, %r14
	movl	24(%rbx), %edi
	movl	%r15d, %esi
	callq	_max
	movl	20(%rbx), %edi
	movl	%eax, %esi
	callq	_min
	movl	%eax, %r15d
	movq	(%rbx), %rdx
	movq	_FCU_FAN_PWM@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_2
## %bb.1:
	movl	16(%rbx), %edi
	callq	_FCU_PWM_SGET
	cmpl	$100, %r15d
	movl	$100, %ecx
	cmovll	%r15d, %ecx
	cmpl	$31, %ecx
	movl	$30, %edx
	cmovgel	%ecx, %edx
	movl	%edx, 8(%rbx)
	imull	$2550, %edx, %ecx               ## imm = 0x9F6
	imulq	$274877907, %rcx, %rcx          ## imm = 0x10624DD3
	shrq	$38, %rcx
	movl	%ecx, -40(%rbp)
	movl	(%r14), %esi
	movl	4(%r14), %edi
	leaq	-40(%rbp), %rcx
	movl	%eax, %edx
	movl	$1, %r8d
	callq	_fcu_write
	movq	_EIO@GOTPCREL(%rip), %rcx
	sarq	$63, %rax
	andl	(%rcx), %eax
	jmp	LBB0_3
LBB0_2:
	movl	12(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_device_printf
	movq	_EIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_3:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_5
## %bb.4:
                                        ## kill: def $eax killed $eax killed $rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FCU_FAN_PWM,8,3                ## @FCU_FAN_PWM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unknown fan type: %d\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_fcu_fan_set_pwm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fcu_fan_set_pwm
_fcu_fan_set_pwm:                       ; @fcu_fan_set_pwm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	ldr	w0, [x0, #12]
	bl	_device_get_softc
	mov	x20, x0
	ldr	w0, [x19, #24]
	mov	x1, x21
	bl	_max
	mov	x1, x0
	ldr	w0, [x19, #20]
	bl	_min
	ldr	x2, [x19]
Lloh3:
	adrp	x8, _FCU_FAN_PWM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FCU_FAN_PWM@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	cmp	x2, x8
	b.ne	LBB0_2
; %bb.1:
	mov	x21, x0
	ldr	w0, [x19, #16]
	bl	_FCU_PWM_SGET
	mov	x2, x0
	mov	w8, #100
	cmp	w21, #100
	csel	w8, w21, w8, lt
	mov	w9, #30
	cmp	w8, #30
	csel	w8, w8, w9, gt
	str	w8, [x19, #8]
	mov	w9, #2550
	mul	w8, w8, w9
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	umull	x8, w8, w9
	lsr	x8, x8, #38
	str	w8, [sp]
	ldp	w1, w0, [x20]
	mov	x3, sp
	mov	w4, #1
	bl	_fcu_write
Lloh6:
	adrp	x8, _EIO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	asr	x9, x0, #63
	and	w0, w9, w8
	b	LBB0_3
LBB0_2:
	ldr	w0, [x19, #12]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
LBB0_3:
	ldr	x8, [sp, #8]
Lloh14:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh15:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_5
; %bb.4:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_5:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_FCU_FAN_PWM,8,3                ; @FCU_FAN_PWM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unknown fan type: %d\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_fcu_fan_set_pwm
.subsections_via_symbols
