	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gmux_set_discrete_state
_gmux_set_discrete_state:               ## @gmux_set_discrete_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	%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
	movl	%esi, %r15d
	movq	%rdi, %r12
	leaq	16(%rdi), %r14
	movq	%r14, %rdi
	callq	_reinit_completion
	movq	_VGA_SWITCHEROO_ON@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_GMUX_PORT_DISCRETE_POWER@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r12, %rdi
	movl	$1, %edx
	callq	_gmux_write8
	xorl	%eax, %eax
	cmpl	%r15d, %ebx
	sete	%al
	movl	(%r13), %esi
	leal	(%rax,%rax,2), %edx
	leaq	L_.str(%rip), %rax
	leaq	L_.str.1(%rip), %rbx
	cmoveq	%rax, %rbx
	movq	%r12, %rdi
	callq	_gmux_write8
	movq	%rbx, %rdi
	callq	_pr_debug
	movl	%r15d, (%r12)
	cmpq	$0, 8(%r12)
	js	LBB0_3
## %bb.1:
	movl	$200, %edi
	callq	_msecs_to_jiffies
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_wait_for_completion_interruptible_timeout
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_warn
LBB0_3:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VGA_SWITCHEROO_ON,4,2          ## @VGA_SWITCHEROO_ON
	.comm	_GMUX_PORT_DISCRETE_POWER,4,2   ## @GMUX_PORT_DISCRETE_POWER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Discrete card powered up\n"

L_.str.1:                               ## @.str.1
	.asciz	"Discrete card powered down\n"

L_.str.2:                               ## @.str.2
	.asciz	"Timeout waiting for gmux switch to complete\n"

	.no_dead_strip	_gmux_set_discrete_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gmux_set_discrete_state
_gmux_set_discrete_state:               ; @gmux_set_discrete_state
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x21, x0
	add	x19, x0, #16
	mov	x0, x19
	bl	_reinit_completion
Lloh0:
	adrp	x8, _VGA_SWITCHEROO_ON@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VGA_SWITCHEROO_ON@GOTPAGEOFF]
Lloh2:
	ldr	w22, [x8]
Lloh3:
	adrp	x23, _GMUX_PORT_DISCRETE_POWER@GOTPAGE
Lloh4:
	ldr	x23, [x23, _GMUX_PORT_DISCRETE_POWER@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x21
	mov	w2, #1
	bl	_gmux_write8
	ldr	w1, [x23]
	mov	w8, #3
	cmp	w22, w20
	csel	w2, w8, wzr, eq
Lloh5:
	adrp	x8, l_.str.1@PAGE
Lloh6:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh7:
	adrp	x9, l_.str@PAGE
Lloh8:
	add	x9, x9, l_.str@PAGEOFF
	csel	x22, x9, x8, eq
	mov	x0, x21
	bl	_gmux_write8
	mov	x0, x22
	bl	_pr_debug
	str	w20, [x21]
	ldr	x8, [x21, #8]
	tbnz	x8, #63, LBB0_3
; %bb.1:
	mov	w0, #200
	bl	_msecs_to_jiffies
	mov	x1, x0
	mov	x0, x19
	bl	_wait_for_completion_interruptible_timeout
	cbnz	w0, LBB0_3
; %bb.2:
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_warn
LBB0_3:
	mov	w0, #0
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_VGA_SWITCHEROO_ON,4,2          ; @VGA_SWITCHEROO_ON
	.comm	_GMUX_PORT_DISCRETE_POWER,4,2   ; @GMUX_PORT_DISCRETE_POWER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Discrete card powered up\n"

l_.str.1:                               ; @.str.1
	.asciz	"Discrete card powered down\n"

l_.str.2:                               ; @.str.2
	.asciz	"Timeout waiting for gmux switch to complete\n"

	.no_dead_strip	_gmux_set_discrete_state
.subsections_via_symbols
