	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_adv748x_afe_init               ## -- Begin function adv748x_afe_init
	.p2align	4, 0x90
_adv748x_afe_init:                      ## @adv748x_afe_init
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	callq	_adv748x_afe_to_state
	movq	%rax, %r15
	movq	$0, (%r12)
	movq	_V4L2_STD_NTSC_M@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r12)
	leaq	8(%r12), %r14
	movq	_MEDIA_ENT_F_ATV_DECODER@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_adv748x_afe_ops@GOTPCREL(%rip), %rdx
	leaq	L_.str(%rip), %r8
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_adv748x_subdev_init
	movq	_ADV748X_PORT_AIN0@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_ADV748X_PORT_AIN7@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %eax
	ja	LBB0_5
## %bb.1:
	movq	(%r15), %rdx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, %esi
	cmpq	$0, (%rdx,%rsi,8)
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	incl	%eax
	cmpl	%ecx, %eax
	jbe	LBB0_2
	jmp	LBB0_5
LBB0_3:
	movl	%eax, (%r12)
LBB0_5:
	movl	(%r12), %esi
	movq	%r12, %rdi
	callq	_adv748x_afe_s_input
	movl	(%r12), %edx
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	callq	_adv_dbg
	movq	_ADV748X_AFE_SINK_AIN0@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_ADV748X_AFE_SINK_AIN7@GOTPCREL(%rip), %rcx
	movq	16(%r12), %rdx
	cmpl	(%rcx), %eax
	ja	LBB0_8
## %bb.6:
	movq	_MEDIA_PAD_FL_SINK@GOTPCREL(%rip), %rsi
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rsi), %edi
	movl	%eax, %ebx
	movl	%edi, (%rdx,%rbx,4)
	incl	%eax
	cmpl	(%rcx), %eax
	jbe	LBB0_7
LBB0_8:
	movq	_MEDIA_PAD_FL_SOURCE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_ADV748X_AFE_SOURCE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%eax, (%rdx,%rcx,4)
	movq	_ADV748X_AFE_NR_PADS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_media_entity_pads_init
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.9:
	movq	%r12, %rdi
	callq	_adv748x_afe_init_controls
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_media_entity_cleanup
	jmp	LBB0_12
LBB0_10:
	xorl	%ebx, %ebx
LBB0_12:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_STD_NTSC_M,4,2            ## @V4L2_STD_NTSC_M
	.comm	_adv748x_afe_ops,4,2            ## @adv748x_afe_ops
	.comm	_MEDIA_ENT_F_ATV_DECODER,4,2    ## @MEDIA_ENT_F_ATV_DECODER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"afe"

	.comm	_ADV748X_PORT_AIN0,4,2          ## @ADV748X_PORT_AIN0
	.comm	_ADV748X_PORT_AIN7,4,2          ## @ADV748X_PORT_AIN7
L_.str.1:                               ## @.str.1
	.asciz	"AFE Default input set to %d\n"

	.comm	_ADV748X_AFE_SINK_AIN0,4,2      ## @ADV748X_AFE_SINK_AIN0
	.comm	_ADV748X_AFE_SINK_AIN7,4,2      ## @ADV748X_AFE_SINK_AIN7
	.comm	_MEDIA_PAD_FL_SINK,4,2          ## @MEDIA_PAD_FL_SINK
	.comm	_MEDIA_PAD_FL_SOURCE,4,2        ## @MEDIA_PAD_FL_SOURCE
	.comm	_ADV748X_AFE_SOURCE,8,3         ## @ADV748X_AFE_SOURCE
	.comm	_ADV748X_AFE_NR_PADS,4,2        ## @ADV748X_AFE_NR_PADS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_adv748x_afe_init               ; -- Begin function adv748x_afe_init
	.p2align	2
_adv748x_afe_init:                      ; @adv748x_afe_init
	.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	x19, x0
	bl	_adv748x_afe_to_state
	mov	x21, x0
	str	xzr, [x19]
Lloh0:
	adrp	x8, _V4L2_STD_NTSC_M@GOTPAGE
Lloh1:
	ldr	x8, [x8, _V4L2_STD_NTSC_M@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	add	x20, x19, #8
Lloh3:
	adrp	x8, _MEDIA_ENT_F_ATV_DECODER@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MEDIA_ENT_F_ATV_DECODER@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
Lloh6:
	adrp	x2, _adv748x_afe_ops@GOTPAGE
Lloh7:
	ldr	x2, [x2, _adv748x_afe_ops@GOTPAGEOFF]
Lloh8:
	adrp	x4, l_.str@PAGE
Lloh9:
	add	x4, x4, l_.str@PAGEOFF
	mov	x0, x20
	mov	x1, x21
	bl	_adv748x_subdev_init
Lloh10:
	adrp	x8, _ADV748X_PORT_AIN0@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ADV748X_PORT_AIN0@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _ADV748X_PORT_AIN7@GOTPAGE
Lloh14:
	ldr	x9, [x9, _ADV748X_PORT_AIN7@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	cmp	w8, w9
	b.hi	LBB0_5
; %bb.1:
	ldr	x10, [x21]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x10, w8, uxtw #3]
	cbnz	x11, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w8, w8, #1
	cmp	w8, w9
	b.ls	LBB0_2
	b	LBB0_5
LBB0_4:
	str	w8, [x19]
LBB0_5:
	ldr	w1, [x19]
	mov	x0, x19
	bl	_adv748x_afe_s_input
	ldr	w2, [x19]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_adv_dbg
Lloh18:
	adrp	x8, _ADV748X_AFE_SINK_AIN0@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ADV748X_AFE_SINK_AIN0@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _ADV748X_AFE_SINK_AIN7@GOTPAGE
Lloh22:
	ldr	x9, [x9, _ADV748X_AFE_SINK_AIN7@GOTPAGEOFF]
	ldr	w10, [x9]
	ldr	x2, [x19, #16]
	cmp	w8, w10
	b.hi	LBB0_8
; %bb.6:
Lloh23:
	adrp	x10, _MEDIA_PAD_FL_SINK@GOTPAGE
Lloh24:
	ldr	x10, [x10, _MEDIA_PAD_FL_SINK@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10]
	str	w11, [x2, w8, uxtw #2]
	add	w8, w8, #1
	ldr	w11, [x9]
	cmp	w8, w11
	b.ls	LBB0_7
LBB0_8:
Lloh25:
	adrp	x8, _MEDIA_PAD_FL_SOURCE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MEDIA_PAD_FL_SOURCE@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
Lloh28:
	adrp	x9, _ADV748X_AFE_SOURCE@GOTPAGE
Lloh29:
	ldr	x9, [x9, _ADV748X_AFE_SOURCE@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	str	w8, [x2, x9, lsl #2]
Lloh31:
	adrp	x8, _ADV748X_AFE_NR_PADS@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ADV748X_AFE_NR_PADS@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_media_entity_pads_init
	mov	x21, x0
	cbnz	w0, LBB0_11
; %bb.9:
	mov	x0, x19
	bl	_adv748x_afe_init_controls
	mov	x21, x0
	cbz	w0, LBB0_11
; %bb.10:
	mov	x0, x20
	bl	_media_entity_cleanup
LBB0_11:
	mov	x0, x21
	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	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_STD_NTSC_M,4,2            ; @V4L2_STD_NTSC_M
	.comm	_adv748x_afe_ops,4,2            ; @adv748x_afe_ops
	.comm	_MEDIA_ENT_F_ATV_DECODER,4,2    ; @MEDIA_ENT_F_ATV_DECODER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"afe"

	.comm	_ADV748X_PORT_AIN0,4,2          ; @ADV748X_PORT_AIN0
	.comm	_ADV748X_PORT_AIN7,4,2          ; @ADV748X_PORT_AIN7
l_.str.1:                               ; @.str.1
	.asciz	"AFE Default input set to %d\n"

	.comm	_ADV748X_AFE_SINK_AIN0,4,2      ; @ADV748X_AFE_SINK_AIN0
	.comm	_ADV748X_AFE_SINK_AIN7,4,2      ; @ADV748X_AFE_SINK_AIN7
	.comm	_MEDIA_PAD_FL_SINK,4,2          ; @MEDIA_PAD_FL_SINK
	.comm	_MEDIA_PAD_FL_SOURCE,4,2        ; @MEDIA_PAD_FL_SOURCE
	.comm	_ADV748X_AFE_SOURCE,8,3         ; @ADV748X_AFE_SOURCE
	.comm	_ADV748X_AFE_NR_PADS,4,2        ; @ADV748X_AFE_NR_PADS
.subsections_via_symbols
