	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vga_switcheroo_register_handler ## -- Begin function vga_switcheroo_register_handler
	.p2align	4, 0x90
_vga_switcheroo_register_handler:       ## @vga_switcheroo_register_handler
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	_vgasr_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_vgasr_priv@GOTPCREL(%rip), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_2
## %bb.1:
	movq	_vgasr_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	movq	%rbx, 8(%rax)
	movl	%r14d, (%rax)
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_vga_switcheroo_ready
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	callq	_pr_info
	xorl	%eax, %eax
	callq	_vga_switcheroo_enable
LBB0_4:
	movq	_vgasr_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_5:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_vgasr_mutex,4,2                ## @vgasr_mutex
	.comm	_vgasr_priv,16,3                ## @vgasr_priv
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"enabled\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vga_switcheroo_register_handler ; -- Begin function vga_switcheroo_register_handler
	.p2align	2
_vga_switcheroo_register_handler:       ; @vga_switcheroo_register_handler
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x0, _vgasr_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _vgasr_mutex@GOTPAGEOFF]
	bl	_mutex_lock
Lloh2:
	adrp	x8, _vgasr_priv@GOTPAGE
Lloh3:
	ldr	x8, [x8, _vgasr_priv@GOTPAGEOFF]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_2
; %bb.1:
Lloh4:
	adrp	x0, _vgasr_mutex@GOTPAGE
Lloh5:
	ldr	x0, [x0, _vgasr_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_5
LBB0_2:
	str	x20, [x8, #8]
	str	w19, [x8]
	bl	_vga_switcheroo_ready
	cbz	x0, LBB0_4
; %bb.3:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_info
	bl	_vga_switcheroo_enable
LBB0_4:
Lloh11:
	adrp	x0, _vgasr_mutex@GOTPAGE
Lloh12:
	ldr	x0, [x0, _vgasr_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	w0, #0
LBB0_5:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_vgasr_mutex,4,2                ; @vgasr_mutex
	.comm	_vgasr_priv,16,3                ; @vgasr_priv
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"enabled\n"

.subsections_via_symbols
