	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ipw_wx_set_powermode
_ipw_wx_set_powermode:                  ## @ipw_wx_set_powermode
	.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, %rbx
	callq	_libipw_priv
	movq	%rax, %r12
	movl	(%rbx), %r15d
	leaq	4(%rax), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_IPW_POWER_LIMIT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	movq	_IPW_POWER_AC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%r15d, %ebx
	cmovgl	%eax, %ebx
	testl	%r15d, %r15d
	cmovlel	%eax, %ebx
	movl	(%r12), %edi
	callq	_IPW_POWER_LEVEL
	xorl	%r15d, %r15d
	cmpl	%ebx, %eax
	je	LBB0_4
## %bb.1:
	movq	%r12, %rdi
	movl	%ebx, %esi
	callq	_ipw_send_power_mode
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %r13d
	leaq	L_.str(%rip), %rdi
	callq	_IPW_DEBUG_WX
	movl	%r13d, %r15d
	jmp	LBB0_4
LBB0_3:
	movq	_IPW_POWER_ENABLED@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movl	%ebx, (%r12)
LBB0_4:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IPW_POWER_LIMIT,4,2            ## @IPW_POWER_LIMIT
	.comm	_IPW_POWER_AC,4,2               ## @IPW_POWER_AC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed setting power mode.\n"

	.comm	_IPW_POWER_ENABLED,4,2          ## @IPW_POWER_ENABLED
	.no_dead_strip	_ipw_wx_set_powermode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ipw_wx_set_powermode
_ipw_wx_set_powermode:                  ; @ipw_wx_set_powermode
	.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, x3
	bl	_libipw_priv
	mov	x20, x0
	ldr	w21, [x19]
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
Lloh0:
	adrp	x8, _IPW_POWER_LIMIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IPW_POWER_LIMIT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w21, w8
	ccmp	w21, #1, #8, le
Lloh3:
	adrp	x8, _IPW_POWER_AC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IPW_POWER_AC@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	csel	w22, w8, w21, lt
	ldr	w0, [x20]
	bl	_IPW_POWER_LEVEL
	cmp	w0, w22
	b.ne	LBB0_2
; %bb.1:
	mov	w21, #0
	b	LBB0_5
LBB0_2:
	mov	x0, x20
	mov	x1, x22
	bl	_ipw_send_power_mode
	mov	x21, x0
	cbz	w0, LBB0_4
; %bb.3:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_IPW_DEBUG_WX
	b	LBB0_5
LBB0_4:
Lloh8:
	adrp	x8, _IPW_POWER_ENABLED@GOTPAGE
Lloh9:
	ldr	x8, [x8, _IPW_POWER_ENABLED@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w8, w8, w22
	str	w8, [x20]
LBB0_5:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	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	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_IPW_POWER_LIMIT,4,2            ; @IPW_POWER_LIMIT
	.comm	_IPW_POWER_AC,4,2               ; @IPW_POWER_AC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed setting power mode.\n"

	.comm	_IPW_POWER_ENABLED,4,2          ; @IPW_POWER_ENABLED
	.no_dead_strip	_ipw_wx_set_powermode
.subsections_via_symbols
