	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vga_switchto_stage2
_vga_switchto_stage2:                   ## @vga_switchto_stage2
	.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
	movq	%rdi, %r14
	movq	_vgasr_priv@GOTPCREL(%rip), %r15
	leaq	16(%r15), %rdi
	callq	_find_active_client
	xorl	%ebx, %ebx
	testq	%rax, %rax
	je	LBB0_13
## %bb.1:
	movq	%rax, %r12
	movl	$0, (%rax)
	cmpl	$0, 8(%rax)
	jne	LBB0_3
## %bb.2:
	movl	4(%r12), %edi
	movq	_VGA_SWITCHEROO_OFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_set_audio_state
LBB0_3:
	movq	24(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_5
## %bb.4:
	callq	_fbcon_remap_all
LBB0_5:
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	8(%r15), %rax
	movl	4(%r14), %edi
	callq	*(%rax)
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_mutex_unlock
	testl	%ebx, %ebx
	jne	LBB0_13
## %bb.6:
	movq	16(%r14), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movl	12(%r14), %edi
	callq	*%rax
LBB0_8:
	movq	%r12, %rdi
	callq	_vga_switcheroo_pwr_state
	movq	_VGA_SWITCHEROO_ON@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	jne	LBB0_10
## %bb.9:
	movq	%r12, %rdi
	callq	_vga_switchoff
LBB0_10:
	cmpl	$0, 8(%r14)
	jne	LBB0_12
## %bb.11:
	movl	4(%r14), %edi
	movq	(%rbx), %rsi
	callq	_set_audio_state
LBB0_12:
	movl	$1, (%r14)
	xorl	%ebx, %ebx
LBB0_13:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_vgasr_priv,24,3                ## @vgasr_priv
	.comm	_VGA_SWITCHEROO_OFF,8,3         ## @VGA_SWITCHEROO_OFF
	.comm	_VGA_SWITCHEROO_ON,8,3          ## @VGA_SWITCHEROO_ON
	.no_dead_strip	_vga_switchto_stage2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vga_switchto_stage2
_vga_switchto_stage2:                   ; @vga_switchto_stage2
	.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	x21, _vgasr_priv@GOTPAGE
Lloh1:
	ldr	x21, [x21, _vgasr_priv@GOTPAGEOFF]
	add	x0, x21, #16
	bl	_find_active_client
	cbz	x0, LBB0_13
; %bb.1:
	mov	x20, x0
	str	wzr, [x0]
	ldr	w8, [x0, #8]
	cbnz	w8, LBB0_3
; %bb.2:
	ldr	w0, [x20, #4]
Lloh2:
	adrp	x8, _VGA_SWITCHEROO_OFF@GOTPAGE
Lloh3:
	ldr	x8, [x8, _VGA_SWITCHEROO_OFF@GOTPAGEOFF]
Lloh4:
	ldr	x1, [x8]
	bl	_set_audio_state
LBB0_3:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_5
; %bb.4:
	bl	_fbcon_remap_all
LBB0_5:
	mov	x0, x21
	bl	_mutex_lock
	ldr	x8, [x21, #8]
	ldr	x8, [x8]
	ldr	w0, [x19, #4]
	blr	x8
	mov	x22, x0
	mov	x0, x21
	bl	_mutex_unlock
	cbnz	w22, LBB0_14
; %bb.6:
	ldr	x8, [x19, #16]
	ldr	x8, [x8]
	cbz	x8, LBB0_8
; %bb.7:
	ldr	w0, [x19, #12]
	blr	x8
LBB0_8:
	mov	x0, x20
	bl	_vga_switcheroo_pwr_state
Lloh5:
	adrp	x21, _VGA_SWITCHEROO_ON@GOTPAGE
Lloh6:
	ldr	x21, [x21, _VGA_SWITCHEROO_ON@GOTPAGEOFF]
	ldr	x8, [x21]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.9:
	mov	x0, x20
	bl	_vga_switchoff
LBB0_10:
	ldr	w8, [x19, #8]
	cbnz	w8, LBB0_12
; %bb.11:
	ldr	w0, [x19, #4]
	ldr	x1, [x21]
	bl	_set_audio_state
LBB0_12:
	mov	w22, #0
	mov	w8, #1
	str	w8, [x19]
	b	LBB0_14
LBB0_13:
	mov	w22, #0
LBB0_14:
	mov	x0, x22
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_vgasr_priv,24,3                ; @vgasr_priv
	.comm	_VGA_SWITCHEROO_OFF,8,3         ; @VGA_SWITCHEROO_OFF
	.comm	_VGA_SWITCHEROO_ON,8,3          ; @VGA_SWITCHEROO_ON
	.no_dead_strip	_vga_switchto_stage2
.subsections_via_symbols
