	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_menelaus_set_vcore_sw          ## -- Begin function menelaus_set_vcore_sw
	.p2align	4, 0x90
_menelaus_set_vcore_sw:                 ## @menelaus_set_vcore_sw
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	movq	_the_menelaus@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	16(%rax), %r15
	movq	_vcore_values@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%ebx, %edi
	callq	_ARRAY_SIZE
	movl	%r14d, %edi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_menelaus_get_vtg_value
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	movl	%eax, %ecx
	callq	_dev_dbg
	movq	(%r12), %rdi
	callq	_mutex_lock
	movq	_MENELAUS_VCORE_CTRL1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	callq	_menelaus_write_reg
	movl	%eax, %ebx
	movq	(%r12), %rdi
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	$0, 8(%rdi)
LBB0_4:
	callq	_mutex_unlock
	movl	$1, %edi
	callq	_msleep
	jmp	LBB0_5
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_5:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_the_menelaus,8,3               ## @the_menelaus
	.comm	_vcore_values,4,2               ## @vcore_values
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Setting VCORE to %d mV (val 0x%02x)\n"

	.comm	_MENELAUS_VCORE_CTRL1,4,2       ## @MENELAUS_VCORE_CTRL1
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_menelaus_set_vcore_sw          ; -- Begin function menelaus_set_vcore_sw
	.p2align	2
_menelaus_set_vcore_sw:                 ; @menelaus_set_vcore_sw
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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, x0
Lloh0:
	adrp	x22, _the_menelaus@GOTPAGE
Lloh1:
	ldr	x22, [x22, _the_menelaus@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	x21, [x8, #16]
Lloh2:
	adrp	x8, _vcore_values@GOTPAGE
Lloh3:
	ldr	x8, [x8, _vcore_values@GOTPAGEOFF]
Lloh4:
	ldr	w20, [x8]
	mov	x0, x20
	bl	_ARRAY_SIZE
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_menelaus_get_vtg_value
	tbnz	w0, #31, LBB0_4
; %bb.1:
	mov	x20, x0
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x19
	mov	x3, x20
	bl	_dev_dbg
	ldr	x0, [x22]
	bl	_mutex_lock
Lloh7:
	adrp	x8, _MENELAUS_VCORE_CTRL1@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MENELAUS_VCORE_CTRL1@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	mov	x1, x20
	bl	_menelaus_write_reg
	mov	x19, x0
	ldr	x0, [x22]
	cbnz	w19, LBB0_3
; %bb.2:
	str	xzr, [x0, #8]
LBB0_3:
	bl	_mutex_unlock
	mov	w0, #1
	bl	_msleep
	b	LBB0_5
LBB0_4:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_5:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_the_menelaus,8,3               ; @the_menelaus
	.comm	_vcore_values,4,2               ; @vcore_values
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Setting VCORE to %d mV (val 0x%02x)\n"

	.comm	_MENELAUS_VCORE_CTRL1,4,2       ; @MENELAUS_VCORE_CTRL1
.subsections_via_symbols
