	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_vgasr_priv@GOTPCREL(%rip), %r15
	leaq	8(%r15), %rdi
	callq	_find_active_client
	movq	%rax, %rbx
	xorl	%eax, %eax
	testq	%rbx, %rbx
	je	LBB0_9
## %bb.1:
	movl	$0, (%rbx)
	movl	16(%rbx), %edi
	movq	_VGA_SWITCHEROO_OFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_set_audio_state
	movq	32(%r14), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movq	%rax, -32(%rbp)
	movq	_FB_EVENT_REMAP_ALL_CONSOLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-32(%rbp), %rsi
	callq	_fb_notifier_call_chain
LBB0_3:
	movq	(%r15), %rax
	movl	16(%r14), %edi
	callq	*(%rax)
	testl	%eax, %eax
	jne	LBB0_9
## %bb.4:
	movq	24(%r14), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movl	20(%r14), %edi
	callq	*%rax
LBB0_6:
	movq	_VGA_SWITCHEROO_ON@GOTPCREL(%rip), %r15
	movq	(%r15), %rsi
	cmpq	%rsi, 8(%rbx)
	jne	LBB0_8
## %bb.7:
	movq	%rbx, %rdi
	callq	_vga_switchoff
	movq	(%r15), %rsi
LBB0_8:
	movl	16(%r14), %edi
	callq	_set_audio_state
	movl	$1, (%r14)
	xorl	%eax, %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_vgasr_priv,16,3                ## @vgasr_priv
	.comm	_VGA_SWITCHEROO_OFF,8,3         ## @VGA_SWITCHEROO_OFF
	.comm	_FB_EVENT_REMAP_ALL_CONSOLE,4,2 ## @FB_EVENT_REMAP_ALL_CONSOLE
	.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:
	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
	mov	x19, x0
Lloh0:
	adrp	x21, _vgasr_priv@GOTPAGE
Lloh1:
	ldr	x21, [x21, _vgasr_priv@GOTPAGEOFF]
	add	x0, x21, #8
	bl	_find_active_client
	cbz	x0, LBB0_9
; %bb.1:
	mov	x20, x0
	str	wzr, [x0]
	ldr	w0, [x0, #16]
Lloh2:
	adrp	x8, _VGA_SWITCHEROO_OFF@GOTPAGE
Lloh3:
	ldr	x8, [x8, _VGA_SWITCHEROO_OFF@GOTPAGEOFF]
Lloh4:
	ldr	x1, [x8]
	bl	_set_audio_state
	ldr	x8, [x19, #32]
	cbz	x8, LBB0_3
; %bb.2:
	str	x8, [sp, #8]
Lloh5:
	adrp	x8, _FB_EVENT_REMAP_ALL_CONSOLE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _FB_EVENT_REMAP_ALL_CONSOLE@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_fb_notifier_call_chain
LBB0_3:
	ldr	x8, [x21]
	ldr	x8, [x8]
	ldr	w0, [x19, #16]
	blr	x8
	cbnz	w0, LBB0_9
; %bb.4:
	ldr	x8, [x19, #24]
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.5:
	ldr	w0, [x19, #20]
	blr	x8
LBB0_6:
	ldr	x8, [x20, #8]
Lloh8:
	adrp	x21, _VGA_SWITCHEROO_ON@GOTPAGE
Lloh9:
	ldr	x21, [x21, _VGA_SWITCHEROO_ON@GOTPAGEOFF]
	ldr	x1, [x21]
	cmp	x8, x1
	b.ne	LBB0_8
; %bb.7:
	mov	x0, x20
	bl	_vga_switchoff
	ldr	x1, [x21]
LBB0_8:
	ldr	w0, [x19, #16]
	bl	_set_audio_state
	mov	w0, #0
	mov	w8, #1
	str	w8, [x19]
LBB0_9:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_vgasr_priv,16,3                ; @vgasr_priv
	.comm	_VGA_SWITCHEROO_OFF,8,3         ; @VGA_SWITCHEROO_OFF
	.comm	_FB_EVENT_REMAP_ALL_CONSOLE,4,2 ; @FB_EVENT_REMAP_ALL_CONSOLE
	.comm	_VGA_SWITCHEROO_ON,8,3          ; @VGA_SWITCHEROO_ON
	.no_dead_strip	_vga_switchto_stage2
.subsections_via_symbols
