	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hm_get_fanpolicy_with_devices_idx ## -- Begin function hm_get_fanpolicy_with_devices_idx
	.p2align	4, 0x90
_hm_get_fanpolicy_with_devices_idx:     ## @hm_get_fanpolicy_with_devices_idx
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	8(%rdi), %r12
	cmpl	$0, (%r12)
	je	LBB0_15
## %bb.1:
	movq	8(%r12), %rcx
	movslq	%esi, %rax
	movq	%rax, %r15
	shlq	$4, %r15
	cmpl	$0, (%rcx,%r15)
	je	LBB0_15
## %bb.2:
	movq	%rdi, %rbx
	movq	(%rdi), %rdx
	movq	(%rdx), %rdx
	leaq	(%rax,%rax,2), %rsi
	movl	$1, %eax
	cmpl	$1, (%rdx,%rsi,8)
	je	LBB0_16
## %bb.3:
	cmpl	$1, 4(%rdx,%rsi,8)
	jne	LBB0_14
## %bb.4:
	movq	_CL_DEVICE_TYPE_GPU@GOTPCREL(%rip), %rdi
	movl	(%rdi), %edi
	testl	%edi, 8(%rdx,%rsi,8)
	je	LBB0_15
## %bb.5:
	movq	16(%rdx,%rsi,8), %rdx
	movq	_VENDOR_ID_AMD@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	jne	LBB0_13
## %bb.6:
	cmpq	$0, 24(%r12)
	je	LBB0_12
## %bb.7:
	movl	4(%rcx,%r15), %esi
	cmpl	$6, %esi
	je	LBB0_16
## %bb.8:
	cmpl	$5, %esi
	jne	LBB0_12
## %bb.9:
	leaq	-48(%rbp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$12, %edx
	callq	_memset
	movl	$12, -48(%rbp)
	movq	_ADL_DL_FANCTRL_SPEED_TYPE_PERCENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -40(%rbp)
	movq	8(%r12), %rax
	movl	12(%rax,%r15), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	movq	%r14, %rcx
	callq	_hm_ADL_Overdrive5_FanSpeed_Get
	cmpl	$-1, %eax
	je	LBB0_10
## %bb.11:
	movq	_ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	xorl	%eax, %eax
	testl	%ecx, -44(%rbp)
	sete	%al
	jmp	LBB0_16
LBB0_12:
	cmpq	$0, 16(%r12)
	jne	LBB0_16
LBB0_13:
	movq	_VENDOR_ID_NV@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	je	LBB0_16
LBB0_14:
	leaq	(%rcx,%r15), %rax
	movl	$0, (%rax)
	movl	$0, 8(%rcx,%r15)
LBB0_15:
	movl	$-1, %eax
LBB0_16:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	8(%r12), %rax
	movl	$0, (%rax,%r15)
	movl	$0, 8(%rax,%r15)
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_CL_DEVICE_TYPE_GPU,4,2         ## @CL_DEVICE_TYPE_GPU
	.comm	_VENDOR_ID_AMD,8,3              ## @VENDOR_ID_AMD
	.comm	_ADL_DL_FANCTRL_SPEED_TYPE_PERCENT,4,2 ## @ADL_DL_FANCTRL_SPEED_TYPE_PERCENT
	.comm	_ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED,4,2 ## @ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED
	.comm	_VENDOR_ID_NV,8,3               ## @VENDOR_ID_NV
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_hm_get_fanpolicy_with_devices_idx ; -- Begin function hm_get_fanpolicy_with_devices_idx
	.p2align	2
_hm_get_fanpolicy_with_devices_idx:     ; @hm_get_fanpolicy_with_devices_idx
	.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
                                        ; kill: def $w1 killed $w1 def $x1
	ldr	x21, [x0, #8]
	ldr	w8, [x21]
	cbz	w8, LBB0_16
; %bb.1:
	ldr	x8, [x21, #8]
	add	x9, x8, w1, sxtw #4
	ldr	w10, [x9]
	cbz	w10, LBB0_16
; %bb.2:
	mov	x19, x0
	ldr	x10, [x0]
	sxtw	x20, w1
	ldr	x10, [x10]
	mov	w11, #24
	mul	x11, x20, x11
	ldr	w11, [x10, x11]
	cmp	w11, #1
	b.ne	LBB0_4
LBB0_3:
	mov	w0, #1
	b	LBB0_17
LBB0_4:
	mov	w11, #24
	madd	x11, x20, x11, x10
	ldr	w11, [x11, #4]
	cmp	w11, #1
	b.ne	LBB0_15
; %bb.5:
	mov	w11, #24
	madd	x11, x20, x11, x10
	ldr	w11, [x11, #8]
Lloh0:
	adrp	x12, _CL_DEVICE_TYPE_GPU@GOTPAGE
Lloh1:
	ldr	x12, [x12, _CL_DEVICE_TYPE_GPU@GOTPAGEOFF]
Lloh2:
	ldr	w12, [x12]
	tst	w12, w11
	b.eq	LBB0_16
; %bb.6:
	mov	w11, #24
	madd	x10, x20, x11, x10
	ldr	x10, [x10, #16]
Lloh3:
	adrp	x11, _VENDOR_ID_AMD@GOTPAGE
Lloh4:
	ldr	x11, [x11, _VENDOR_ID_AMD@GOTPAGEOFF]
Lloh5:
	ldr	x11, [x11]
	cmp	x10, x11
	b.ne	LBB0_12
; %bb.7:
	ldr	x11, [x21, #24]
	cbz	x11, LBB0_13
; %bb.8:
	add	x11, x8, x20, lsl #4
	ldr	w11, [x11, #4]
	cmp	w11, #6
	b.eq	LBB0_3
; %bb.9:
	cmp	w11, #5
	b.ne	LBB0_13
; %bb.10:
	mov	w22, #12
	mov	x0, sp
	mov	w1, #0
	mov	w2, #12
	bl	_memset
Lloh6:
	adrp	x8, _ADL_DL_FANCTRL_SPEED_TYPE_PERCENT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ADL_DL_FANCTRL_SPEED_TYPE_PERCENT@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	str	w22, [sp]
	str	w8, [sp, #8]
	ldr	x8, [x21, #8]
	add	x8, x8, x20, lsl #4
	ldr	w1, [x8, #12]
	mov	x3, sp
	mov	x0, x19
	mov	w2, #0
	bl	_hm_ADL_Overdrive5_FanSpeed_Get
	cmn	w0, #1
	b.eq	LBB0_18
; %bb.11:
	ldr	w8, [sp, #4]
Lloh9:
	adrp	x9, _ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w0, eq
	b	LBB0_17
LBB0_12:
Lloh12:
	adrp	x11, _VENDOR_ID_NV@GOTPAGE
Lloh13:
	ldr	x11, [x11, _VENDOR_ID_NV@GOTPAGEOFF]
Lloh14:
	ldr	x11, [x11]
	cmp	x10, x11
	b.eq	LBB0_3
	b	LBB0_15
LBB0_13:
	ldr	x11, [x21, #16]
	mov	w0, #1
	cbnz	x11, LBB0_17
; %bb.14:
Lloh15:
	adrp	x11, _VENDOR_ID_NV@GOTPAGE
Lloh16:
	ldr	x11, [x11, _VENDOR_ID_NV@GOTPAGEOFF]
Lloh17:
	ldr	x11, [x11]
	cmp	x10, x11
	b.eq	LBB0_17
LBB0_15:
	str	wzr, [x9]
	add	x8, x8, x20, lsl #4
	str	wzr, [x8, #8]
LBB0_16:
	mov	w0, #-1
LBB0_17:
	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_18:
	ldr	x8, [x21, #8]
	add	x8, x8, x20, lsl #4
	str	wzr, [x8]
	str	wzr, [x8, #8]
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_CL_DEVICE_TYPE_GPU,4,2         ; @CL_DEVICE_TYPE_GPU
	.comm	_VENDOR_ID_AMD,8,3              ; @VENDOR_ID_AMD
	.comm	_ADL_DL_FANCTRL_SPEED_TYPE_PERCENT,4,2 ; @ADL_DL_FANCTRL_SPEED_TYPE_PERCENT
	.comm	_ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED,4,2 ; @ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED
	.comm	_VENDOR_ID_NV,8,3               ; @VENDOR_ID_NV
.subsections_via_symbols
