	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function em28xx_set_audio_source
_em28xx_set_audio_source:               ## @em28xx_set_audio_source
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	cmpq	$0, 24(%rdi)
	je	LBB0_5
## %bb.1:
	cmpl	$129, (%r14)
	jne	LBB0_2
## %bb.3:
	movq	_EM2800_AUDIO_SRC_TUNER@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	_EM2800_AUDIO_SRC_LINE@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	movq	_EM2800_R08_AUDIOSRC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-20(%rbp), %rdx
	movq	%r14, %rdi
	movl	$1, %ecx
	callq	_em28xx_write_regs
	testl	%eax, %eax
	js	LBB0_15
LBB0_5:
	cmpq	$0, 40(%r14)
	jne	LBB0_6
## %bb.7:
	cmpl	$129, (%r14)
	jne	LBB0_8
LBB0_6:
	movq	_EM28XX_AUDIO_SRC_TUNER@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_8:
	movq	_EM28XX_AUDIO_SRC_LINE@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
	movq	16(%r14), %rsi
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.10:
	cmpq	$0, 32(%r14)
	jne	LBB0_12
LBB0_11:
	movl	8(%r14), %edi
	callq	_INPUT
	movq	(%rax), %rsi
LBB0_12:
	movq	%r14, %rdi
	callq	_em28xx_gpio_set
	movq	_EM28XX_R0E_AUDIOSRC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-20(%rbp), %edx
	movq	%r14, %rdi
	movl	$192, %ecx
	callq	_em28xx_write_reg_bits
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_16
## %bb.13:
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	callq	_usleep_range
	cmpl	$128, 4(%r14)
	je	LBB0_16
## %bb.14:
	movq	%r14, %rdi
	callq	_set_ac97_input
LBB0_15:
	movl	%eax, %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EM2800_AUDIO_SRC_TUNER,4,2     ## @EM2800_AUDIO_SRC_TUNER
	.comm	_EM2800_AUDIO_SRC_LINE,4,2      ## @EM2800_AUDIO_SRC_LINE
	.comm	_EM2800_R08_AUDIOSRC,4,2        ## @EM2800_R08_AUDIOSRC
	.comm	_EM28XX_AUDIO_SRC_TUNER,4,2     ## @EM28XX_AUDIO_SRC_TUNER
	.comm	_EM28XX_AUDIO_SRC_LINE,4,2      ## @EM28XX_AUDIO_SRC_LINE
	.comm	_EM28XX_R0E_AUDIOSRC,4,2        ## @EM28XX_R0E_AUDIOSRC
	.no_dead_strip	_em28xx_set_audio_source
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function em28xx_set_audio_source
_em28xx_set_audio_source:               ; @em28xx_set_audio_source
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _EM2800_AUDIO_SRC_TUNER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EM2800_AUDIO_SRC_TUNER@GOTPAGEOFF]
Lloh2:
	adrp	x10, _EM2800_AUDIO_SRC_LINE@GOTPAGE
Lloh3:
	ldr	x10, [x10, _EM2800_AUDIO_SRC_LINE@GOTPAGEOFF]
	cmp	w8, #129
	csel	x8, x9, x10, eq
	ldr	w8, [x8]
	str	w8, [sp, #12]
Lloh4:
	adrp	x8, _EM2800_R08_AUDIOSRC@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EM2800_R08_AUDIOSRC@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	mov	w3, #1
	bl	_em28xx_write_regs
	tbnz	w0, #31, LBB0_12
LBB0_2:
	ldr	x8, [x19, #40]
	cbnz	x8, LBB0_4
; %bb.3:
	ldr	w8, [x19]
	cmp	w8, #129
	b.ne	LBB0_5
LBB0_4:
Lloh7:
	adrp	x8, _EM28XX_AUDIO_SRC_TUNER@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EM28XX_AUDIO_SRC_TUNER@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh9:
	adrp	x8, _EM28XX_AUDIO_SRC_LINE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EM28XX_AUDIO_SRC_LINE@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	str	w8, [sp, #12]
	ldr	x1, [x19, #16]
	cbz	x1, LBB0_8
; %bb.7:
	ldr	x8, [x19, #32]
	cbnz	x8, LBB0_9
LBB0_8:
	ldr	w0, [x19, #8]
	bl	_INPUT
	ldr	x1, [x0]
LBB0_9:
	mov	x0, x19
	bl	_em28xx_gpio_set
Lloh11:
	adrp	x8, _EM28XX_R0E_AUDIOSRC@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EM28XX_R0E_AUDIOSRC@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	ldr	w2, [sp, #12]
	mov	x0, x19
	mov	w3, #192
	bl	_em28xx_write_reg_bits
	mov	x20, x0
	tbnz	w0, #31, LBB0_13
; %bb.10:
	mov	w0, #10000
	mov	w1, #11000
	bl	_usleep_range
	ldr	w8, [x19, #4]
	cmp	w8, #128
	b.eq	LBB0_13
; %bb.11:
	mov	x0, x19
	bl	_set_ac97_input
LBB0_12:
	mov	x20, x0
LBB0_13:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EM2800_AUDIO_SRC_TUNER,4,2     ; @EM2800_AUDIO_SRC_TUNER
	.comm	_EM2800_AUDIO_SRC_LINE,4,2      ; @EM2800_AUDIO_SRC_LINE
	.comm	_EM2800_R08_AUDIOSRC,4,2        ; @EM2800_R08_AUDIOSRC
	.comm	_EM28XX_AUDIO_SRC_TUNER,4,2     ; @EM28XX_AUDIO_SRC_TUNER
	.comm	_EM28XX_AUDIO_SRC_LINE,4,2      ; @EM28XX_AUDIO_SRC_LINE
	.comm	_EM28XX_R0E_AUDIOSRC,4,2        ; @EM28XX_R0E_AUDIOSRC
	.no_dead_strip	_em28xx_set_audio_source
.subsections_via_symbols
