	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i915_switcheroo_set_state
_i915_switcheroo_set_state:             ## @i915_switcheroo_set_state
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	callq	_pdev_to_i915
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	movq	%rax, %rbx
	movq	_VGA_SWITCHEROO_ON@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_3
## %bb.2:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_info
	movq	_DRM_SWITCH_POWER_CHANGING@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	_PCI_D0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_pci_set_power_state
	movq	%rbx, %rdi
	callq	_i915_resume_switcheroo
	movq	_DRM_SWITCH_POWER_ON@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_5:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_3:
	movq	_PM_EVENT_SUSPEND@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_info
	movq	_DRM_SWITCH_POWER_CHANGING@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_i915_suspend_switcheroo
	movq	_DRM_SWITCH_POWER_OFF@GOTPCREL(%rip), %rax
LBB0_4:
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PM_EVENT_SUSPEND,4,2           ## @PM_EVENT_SUSPEND
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DRM not initialized, aborting switch.\n"

	.comm	_VGA_SWITCHEROO_ON,4,2          ## @VGA_SWITCHEROO_ON
L_.str.1:                               ## @.str.1
	.asciz	"switched on\n"

	.comm	_DRM_SWITCH_POWER_CHANGING,8,3  ## @DRM_SWITCH_POWER_CHANGING
	.comm	_PCI_D0,4,2                     ## @PCI_D0
	.comm	_DRM_SWITCH_POWER_ON,8,3        ## @DRM_SWITCH_POWER_ON
L_.str.2:                               ## @.str.2
	.asciz	"switched off\n"

	.comm	_DRM_SWITCH_POWER_OFF,8,3       ## @DRM_SWITCH_POWER_OFF
	.no_dead_strip	_i915_switcheroo_set_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i915_switcheroo_set_state
_i915_switcheroo_set_state:             ; @i915_switcheroo_set_state
	.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	x21, x1
	mov	x20, x0
	bl	_pdev_to_i915
	cbz	x0, LBB0_3
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _VGA_SWITCHEROO_ON@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VGA_SWITCHEROO_ON@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w21
	b.ne	LBB0_4
; %bb.2:
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_info
Lloh5:
	adrp	x8, _DRM_SWITCH_POWER_CHANGING@GOTPAGE
Lloh6:
	ldr	x8, [x8, _DRM_SWITCH_POWER_CHANGING@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	str	x8, [x19]
Lloh8:
	adrp	x8, _PCI_D0@GOTPAGE
Lloh9:
	ldr	x8, [x8, _PCI_D0@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_pci_set_power_state
	mov	x0, x19
	bl	_i915_resume_switcheroo
Lloh11:
	adrp	x8, _DRM_SWITCH_POWER_ON@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DRM_SWITCH_POWER_ON@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	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
	b	_dev_err
LBB0_4:
Lloh15:
	adrp	x8, _PM_EVENT_SUSPEND@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PM_EVENT_SUSPEND@GOTPAGEOFF]
Lloh17:
	ldr	w20, [x8]
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_info
Lloh20:
	adrp	x8, _DRM_SWITCH_POWER_CHANGING@GOTPAGE
Lloh21:
	ldr	x8, [x8, _DRM_SWITCH_POWER_CHANGING@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	str	x8, [x19]
	mov	x0, x19
	mov	x1, x20
	bl	_i915_suspend_switcheroo
Lloh23:
	adrp	x8, _DRM_SWITCH_POWER_OFF@GOTPAGE
Lloh24:
	ldr	x8, [x8, _DRM_SWITCH_POWER_OFF@GOTPAGEOFF]
LBB0_5:
	ldr	x8, [x8]
	str	x8, [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	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_PM_EVENT_SUSPEND,4,2           ; @PM_EVENT_SUSPEND
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DRM not initialized, aborting switch.\n"

	.comm	_VGA_SWITCHEROO_ON,4,2          ; @VGA_SWITCHEROO_ON
l_.str.1:                               ; @.str.1
	.asciz	"switched on\n"

	.comm	_DRM_SWITCH_POWER_CHANGING,8,3  ; @DRM_SWITCH_POWER_CHANGING
	.comm	_PCI_D0,4,2                     ; @PCI_D0
	.comm	_DRM_SWITCH_POWER_ON,8,3        ; @DRM_SWITCH_POWER_ON
l_.str.2:                               ; @.str.2
	.asciz	"switched off\n"

	.comm	_DRM_SWITCH_POWER_OFF,8,3       ; @DRM_SWITCH_POWER_OFF
	.no_dead_strip	_i915_switcheroo_set_state
.subsections_via_symbols
