	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mlxreg_fan_set_cur_state
_mlxreg_fan_set_cur_state:              ## @mlxreg_fan_set_cur_state
	.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
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r15
	movq	_MLXREG_FAN_SPEED_MIN@GOTPCREL(%rip), %rax
	cmpq	%rsi, (%rax)
	ja	LBB0_21
## %bb.1:
	movq	_MLXREG_FAN_SPEED_MAX@GOTPCREL(%rip), %rax
	cmpq	%rsi, (%rax)
	jb	LBB0_21
## %bb.2:
	movq	_MLXREG_FAN_MAX_STATE@GOTPCREL(%rip), %r8
	movq	%rsi, %rbx
	subq	(%r8), %rbx
	je	LBB0_15
## %bb.3:
	movq	(%r15), %rcx
	cmpq	$4, %rbx
	jae	LBB0_6
## %bb.4:
	xorl	%edx, %edx
	jmp	LBB0_5
LBB0_6:
	movq	%rbx, %rdx
	andq	$-4, %rdx
	movq	%rbx, %xmm0
	pshufd	$68, %xmm0, %xmm0               ## xmm0 = xmm0[0,1,0,1]
	leaq	-4(%rdx), %rax
	movq	%rax, %rdi
	shrq	$2, %rdi
	incq	%rdi
	movl	%edi, %esi
	andl	$7, %esi
	cmpq	$28, %rax
	jae	LBB0_8
## %bb.7:
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_8:
	andq	$-8, %rdi
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movdqu	%xmm0, (%rcx,%rax,8)
	movdqu	%xmm0, 16(%rcx,%rax,8)
	movdqu	%xmm0, 32(%rcx,%rax,8)
	movdqu	%xmm0, 48(%rcx,%rax,8)
	movdqu	%xmm0, 64(%rcx,%rax,8)
	movdqu	%xmm0, 80(%rcx,%rax,8)
	movdqu	%xmm0, 96(%rcx,%rax,8)
	movdqu	%xmm0, 112(%rcx,%rax,8)
	movdqu	%xmm0, 128(%rcx,%rax,8)
	movdqu	%xmm0, 144(%rcx,%rax,8)
	movdqu	%xmm0, 160(%rcx,%rax,8)
	movdqu	%xmm0, 176(%rcx,%rax,8)
	movdqu	%xmm0, 192(%rcx,%rax,8)
	movdqu	%xmm0, 208(%rcx,%rax,8)
	movdqu	%xmm0, 224(%rcx,%rax,8)
	movdqu	%xmm0, 240(%rcx,%rax,8)
	addq	$32, %rax
	addq	$-8, %rdi
	jne	LBB0_9
LBB0_10:
	testq	%rsi, %rsi
	je	LBB0_13
## %bb.11:
	leaq	(%rcx,%rax,8), %rax
	addq	$16, %rax
	shlq	$5, %rsi
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movdqu	%xmm0, -16(%rax,%rdi)
	movdqu	%xmm0, (%rax,%rdi)
	addq	$32, %rdi
	cmpq	%rdi, %rsi
	jne	LBB0_12
	jmp	LBB0_13
LBB0_5:
	movq	%rbx, (%rcx,%rdx,8)
	incq	%rdx
LBB0_13:
	cmpq	%rdx, %rbx
	jne	LBB0_5
## %bb.14:
	movq	(%r8), %rsi
LBB0_15:
	movslq	%ebx, %rax
	cmpq	%rax, %rsi
	jb	LBB0_18
## %bb.16:
	movq	(%r15), %rcx
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	%rax, (%rcx,%rax,8)
	incq	%rax
	cmpq	%rax, (%r8)
	jae	LBB0_17
LBB0_18:
	movl	12(%r15), %esi
	movl	16(%r15), %edi
	leaq	-28(%rbp), %rdx
	callq	_regmap_read
	testl	%eax, %eax
	je	LBB0_20
## %bb.19:
	movl	%eax, %r14d
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_26
LBB0_20:
	movl	-28(%rbp), %edi
	callq	_MLXREG_FAN_PWM_DUTY2STATE
	movq	%rax, %rsi
	xorl	%r14d, %r14d
	cmpq	%rax, %rbx
	jb	LBB0_27
LBB0_21:
	movq	_MLXREG_FAN_MAX_STATE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jbe	LBB0_23
## %bb.22:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_27
LBB0_23:
	movq	(%r15), %rax
	movq	(%rax,%rsi,8), %rdi
	movl	16(%r15), %ebx
	movl	12(%r15), %r14d
	callq	_MLXREG_FAN_PWM_STATE2DUTY
	movl	%ebx, %edi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_regmap_write
	testl	%eax, %eax
	je	LBB0_24
## %bb.25:
	movl	%eax, %r14d
	movl	8(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
LBB0_26:
	callq	_dev_err
LBB0_27:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	xorl	%r14d, %r14d
	jmp	LBB0_27
	.cfi_endproc
                                        ## -- End function
	.comm	_MLXREG_FAN_SPEED_MIN,8,3       ## @MLXREG_FAN_SPEED_MIN
	.comm	_MLXREG_FAN_SPEED_MAX,8,3       ## @MLXREG_FAN_SPEED_MAX
	.comm	_MLXREG_FAN_MAX_STATE,8,3       ## @MLXREG_FAN_MAX_STATE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to query PWM duty\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Failed to write PWM duty\n"

	.no_dead_strip	_mlxreg_fan_set_cur_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlxreg_fan_set_cur_state
_mlxreg_fan_set_cur_state:              ; @mlxreg_fan_set_cur_state
	.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
	ldr	x21, [x0]
Lloh0:
	adrp	x8, _MLXREG_FAN_SPEED_MIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MLXREG_FAN_SPEED_MIN@GOTPAGEOFF]
Lloh2:
	adrp	x9, _MLXREG_FAN_SPEED_MAX@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MLXREG_FAN_SPEED_MAX@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x1
	ccmp	x9, x1, #0, ls
Lloh6:
	adrp	x20, _MLXREG_FAN_MAX_STATE@GOTPAGE
Lloh7:
	ldr	x20, [x20, _MLXREG_FAN_MAX_STATE@GOTPAGEOFF]
	b.hs	LBB0_3
LBB0_1:
	ldr	x8, [x20]
	cmp	x1, x8
	b.ls	LBB0_6
; %bb.2:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w19, w8
	b	LBB0_20
LBB0_3:
	ldr	x8, [x20]
	subs	x22, x1, x8
	b.eq	LBB0_14
; %bb.4:
	ldr	x9, [x21]
	cmp	x22, #8
	b.hs	LBB0_8
; %bb.5:
	mov	x10, #0
	b	LBB0_11
LBB0_6:
	ldr	x8, [x21]
	ldr	x0, [x8, x1, lsl #3]
	ldp	w20, w19, [x21, #12]
	bl	_MLXREG_FAN_PWM_STATE2DUTY
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_regmap_write
	mov	x19, x0
	cbz	w0, LBB0_20
; %bb.7:
	ldr	w0, [x21, #8]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_19
LBB0_8:
	and	x10, x22, #0xfffffffffffffff8
	dup.2d	v0, x22
	add	x11, x9, #32
	mov	x12, x10
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	stp	q0, q0, [x11, #-32]
	stp	q0, q0, [x11], #64
	subs	x12, x12, #8
	b.ne	LBB0_9
; %bb.10:
	cmp	x22, x10
	b.eq	LBB0_13
LBB0_11:
	add	x9, x9, x10, lsl #3
	add	x8, x10, x8
	sub	x8, x8, x1
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	str	x22, [x9], #8
	adds	x8, x8, #1
	b.lo	LBB0_12
LBB0_13:
	ldr	x1, [x20]
LBB0_14:
	sxtw	x8, w22
	cmp	x1, x8
	b.lo	LBB0_17
; %bb.15:
	ldr	x9, [x21]
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	str	x8, [x9, x8, lsl #3]
	add	x8, x8, #1
	ldr	x10, [x20]
	cmp	x10, x8
	b.hs	LBB0_16
LBB0_17:
	ldp	w1, w0, [x21, #12]
	add	x2, sp, #12
	bl	_regmap_read
	cbz	w0, LBB0_21
; %bb.18:
	mov	x19, x0
	ldr	w0, [x21, #8]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
LBB0_19:
	bl	_dev_err
LBB0_20:
	mov	x0, x19
	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_21:
	ldr	w0, [sp, #12]
	bl	_MLXREG_FAN_PWM_DUTY2STATE
	mov	x1, x0
	cmp	x22, x0
	b.hs	LBB0_1
; %bb.22:
	mov	w19, #0
	b	LBB0_20
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_MLXREG_FAN_SPEED_MIN,8,3       ; @MLXREG_FAN_SPEED_MIN
	.comm	_MLXREG_FAN_SPEED_MAX,8,3       ; @MLXREG_FAN_SPEED_MAX
	.comm	_MLXREG_FAN_MAX_STATE,8,3       ; @MLXREG_FAN_MAX_STATE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to query PWM duty\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Failed to write PWM duty\n"

	.no_dead_strip	_mlxreg_fan_set_cur_state
.subsections_via_symbols
