	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function max31790_write_fan
_max31790_write_fan:                    ## @max31790_write_fan
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r13
	movl	%edx, %r12d
	movl	%esi, %ebx
	callq	_dev_get_drvdata
	movq	%rax, %r15
	movq	24(%rax), %r14
	leaq	16(%rax), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	cmpl	$128, %ebx
	jne	LBB0_3
## %bb.1:
	movq	_FAN_RPM_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_FAN_RPM_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r13d, %edi
	callq	_clamp_val
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_bits_for_tach_period
	movq	(%r15), %rdx
	movslq	%r12d, %r12
	movq	_MAX31790_FAN_DYN_SR_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	notl	%esi
	movq	_MAX31790_FAN_DYN_SR_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	andl	(%rdx,%r12,4), %esi
	orl	%esi, %eax
	movl	%eax, (%rdx,%r12,4)
	movl	%r12d, %edi
	callq	_MAX31790_REG_FAN_DYNAMICS
	movq	(%r15), %rcx
	movl	(%rcx,%r12,4), %edx
	movq	%r14, %rbx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_i2c_smbus_write_byte_data
	testl	%eax, %eax
	js	LBB0_4
## %bb.2:
	movq	(%r15), %rax
	movl	(%rax,%r12,4), %edi
	callq	_get_tach_period
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_RPM_TO_REG
	movl	%eax, %edi
	movl	$1, %esi
	movl	$2047, %edx                     ## imm = 0x7FF
	callq	_clamp_val
	shll	$5, %eax
	movq	8(%r15), %rcx
	movl	%eax, (%rcx,%r12,4)
	movl	%r12d, %edi
	callq	_MAX31790_REG_TARGET_COUNT
	movq	8(%r15), %rcx
	movl	(%rcx,%r12,4), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_i2c_smbus_write_word_swapped
LBB0_4:
	movl	%eax, %r14d
	jmp	LBB0_5
LBB0_3:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_5:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FAN_RPM_MIN,4,2                ## @FAN_RPM_MIN
	.comm	_FAN_RPM_MAX,4,2                ## @FAN_RPM_MAX
	.comm	_MAX31790_FAN_DYN_SR_MASK,4,2   ## @MAX31790_FAN_DYN_SR_MASK
	.comm	_MAX31790_FAN_DYN_SR_SHIFT,4,2  ## @MAX31790_FAN_DYN_SR_SHIFT
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.no_dead_strip	_max31790_write_fan
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function max31790_write_fan
_max31790_write_fan:                    ; @max31790_write_fan
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x23, x3
	mov	x20, x2
	mov	x24, x1
	bl	_dev_get_drvdata
	mov	x22, x0
	ldr	x21, [x0, #24]
	add	x19, x0, #16
	mov	x0, x19
	bl	_mutex_lock
	cmp	w24, #128
	b.ne	LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _FAN_RPM_MIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FAN_RPM_MIN@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _FAN_RPM_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FAN_RPM_MAX@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x23
	bl	_clamp_val
	mov	x23, x0
	bl	_bits_for_tach_period
	ldr	x8, [x22]
	sbfiz	x24, x20, #2, #32
	ldr	w9, [x8, x24]
Lloh6:
	adrp	x10, _MAX31790_FAN_DYN_SR_MASK@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MAX31790_FAN_DYN_SR_MASK@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
Lloh9:
	adrp	x11, _MAX31790_FAN_DYN_SR_SHIFT@GOTPAGE
Lloh10:
	ldr	x11, [x11, _MAX31790_FAN_DYN_SR_SHIFT@GOTPAGEOFF]
	bic	w9, w9, w10
Lloh11:
	ldr	w10, [x11]
	lsl	w10, w0, w10
	orr	w9, w10, w9
	str	w9, [x8, x24]
	mov	x0, x20
	bl	_MAX31790_REG_FAN_DYNAMICS
	mov	x1, x0
	ldr	x8, [x22]
	ldr	w2, [x8, x24]
	mov	x0, x21
	bl	_i2c_smbus_write_byte_data
	tbnz	w0, #31, LBB0_3
; %bb.2:
	sxtw	x8, w20
	ldr	x9, [x22]
	lsl	x24, x8, #2
	ldr	w0, [x9, x24]
	bl	_get_tach_period
	mov	x1, x0
	mov	x0, x23
	bl	_RPM_TO_REG
	mov	w1, #1
	mov	w2, #2047
	bl	_clamp_val
	lsl	w8, w0, #5
	ldr	x9, [x22, #8]
	str	w8, [x9, x24]
	mov	x0, x20
	bl	_MAX31790_REG_TARGET_COUNT
	mov	x1, x0
	ldr	x8, [x22, #8]
	ldr	w2, [x8, x24]
	mov	x0, x21
	bl	_i2c_smbus_write_word_swapped
LBB0_3:
	mov	x24, x0
	b	LBB0_5
LBB0_4:
Lloh12:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x24
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_FAN_RPM_MIN,4,2                ; @FAN_RPM_MIN
	.comm	_FAN_RPM_MAX,4,2                ; @FAN_RPM_MAX
	.comm	_MAX31790_FAN_DYN_SR_MASK,4,2   ; @MAX31790_FAN_DYN_SR_MASK
	.comm	_MAX31790_FAN_DYN_SR_SHIFT,4,2  ; @MAX31790_FAN_DYN_SR_SHIFT
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.no_dead_strip	_max31790_write_fan
.subsections_via_symbols
