	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_encoder_configure         ## -- Begin function pvr2_encoder_configure
	.p2align	4, 0x90
_pvr2_encoder_configure:                ## @pvr2_encoder_configure
	.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
	movq	%rdi, %rbx
	movq	_PVR2_TRACE_ENCODER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	callq	_pvr2_trace
	movq	_CX2341X_PORT_STREAMING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%rbx)
	movq	32(%rbx), %rax
	movq	%rax, 20(%rbx)
	movq	_V4L2_STD_525_60@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	andl	(%rbx), %eax
	sete	%cl
	movl	%ecx, 16(%rbx)
	movq	%rbx, %rdi
	callq	_pvr2_encoder_prep_config
	leaq	L_.str.1(%rip), %r14
	testl	%eax, %eax
	jne	LBB0_7
## %bb.1:
	movq	8(%rbx), %rax
	cmpq	$0, (%rax)
	movl	$240, %eax
	movl	$320, %ecx                      ## imm = 0x140
	cmovel	%eax, %ecx
	movq	_CX2341X_ENC_SET_NUM_VSYNC_LINES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$2, %edx
	movl	%ecx, %r8d
	xorl	%eax, %eax
	callq	_pvr2_encoder_vcmd
	testl	%eax, %eax
	jne	LBB0_7
## %bb.2:
	movq	_CX2341X_ENC_SET_EVENT_NOTIFICATION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	subq	$8, %rsp
	movq	%rbx, %rdi
	movl	$4, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movl	$268435456, %r9d                ## imm = 0x10000000
	xorl	%eax, %eax
	pushq	$-1
	callq	_pvr2_encoder_vcmd
	addq	$16, %rsp
	testl	%eax, %eax
	je	LBB0_3
LBB0_7:
	movl	%eax, %r15d
LBB0_8:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_pvr2_trace
LBB0_9:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	_CX2341X_ENC_SET_VBI_LINE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$5, %edx
	movl	$-1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	pushq	$0
	pushq	$0
	callq	_pvr2_encoder_vcmd
	addq	$16, %rsp
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.4:
	movq	%rbx, %rdi
	callq	_pvr2_encoder_adjust
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_9
## %bb.5:
	movq	_CX2341X_ENC_INITIALIZE_INPUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	xorl	%eax, %eax
	callq	_pvr2_encoder_vcmd
	testl	%eax, %eax
	je	LBB0_9
## %bb.6:
	leaq	L_.str.2(%rip), %r14
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_ENCODER,4,2         ## @PVR2_TRACE_ENCODER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pvr2_encoder_configure (cx2341x module)"

	.comm	_CX2341X_PORT_STREAMING,4,2     ## @CX2341X_PORT_STREAMING
	.comm	_V4L2_STD_525_60,4,2            ## @V4L2_STD_525_60
	.comm	_CX2341X_ENC_SET_NUM_VSYNC_LINES,4,2 ## @CX2341X_ENC_SET_NUM_VSYNC_LINES
	.comm	_CX2341X_ENC_SET_EVENT_NOTIFICATION,4,2 ## @CX2341X_ENC_SET_EVENT_NOTIFICATION
	.comm	_CX2341X_ENC_SET_VBI_LINE,4,2   ## @CX2341X_ENC_SET_VBI_LINE
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
L_.str.1:                               ## @.str.1
	.asciz	"Failed to configure cx23416"

	.comm	_CX2341X_ENC_INITIALIZE_INPUT,4,2 ## @CX2341X_ENC_INITIALIZE_INPUT
L_.str.2:                               ## @.str.2
	.asciz	"Failed to initialize cx23416 video input"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_encoder_configure         ; -- Begin function pvr2_encoder_configure
	.p2align	2
_pvr2_encoder_configure:                ; @pvr2_encoder_configure
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x8, _PVR2_TRACE_ENCODER@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PVR2_TRACE_ENCODER@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pvr2_trace
Lloh5:
	adrp	x8, _CX2341X_PORT_STREAMING@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CX2341X_PORT_STREAMING@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x19, #28]
	ldr	d0, [x19, #32]
	stur	d0, [x19, #20]
	ldr	w8, [x19]
Lloh8:
	adrp	x9, _V4L2_STD_525_60@GOTPAGE
Lloh9:
	ldr	x9, [x9, _V4L2_STD_525_60@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w8, eq
	str	w8, [x19, #16]
	mov	x0, x19
	bl	_pvr2_encoder_prep_config
	cbnz	w0, LBB0_4
; %bb.1:
	ldr	x8, [x19, #8]
Lloh11:
	adrp	x9, _CX2341X_ENC_SET_NUM_VSYNC_LINES@GOTPAGE
Lloh12:
	ldr	x9, [x9, _CX2341X_ENC_SET_NUM_VSYNC_LINES@GOTPAGEOFF]
	ldr	x8, [x8]
Lloh13:
	ldr	w1, [x9]
	mov	w9, #320
	mov	w10, #240
	cmp	x8, #0
	csel	x8, x10, x9, eq
	stp	x8, x8, [sp]
	mov	x0, x19
	mov	w2, #2
	bl	_pvr2_encoder_vcmd
	cbnz	w0, LBB0_4
; %bb.2:
Lloh14:
	adrp	x8, _CX2341X_ENC_SET_EVENT_NOTIFICATION@GOTPAGE
Lloh15:
	ldr	x8, [x8, _CX2341X_ENC_SET_EVENT_NOTIFICATION@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	stp	xzr, xzr, [sp]
	mov	w8, #-1
	mov	w9, #268435456
	stp	x9, x8, [sp, #16]
	mov	x0, x19
	mov	w2, #4
	bl	_pvr2_encoder_vcmd
	cbnz	w0, LBB0_4
; %bb.3:
Lloh17:
	adrp	x8, _CX2341X_ENC_SET_VBI_LINE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _CX2341X_ENC_SET_VBI_LINE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	movi.2d	v0, #0000000000000000
	stur	q0, [sp, #24]
	stur	q0, [sp, #8]
	mov	w8, #-1
	str	x8, [sp]
	mov	x0, x19
	mov	w2, #5
	bl	_pvr2_encoder_vcmd
	cbz	w0, LBB0_7
LBB0_4:
	mov	x20, x0
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_5:
Lloh22:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
	bl	_pvr2_trace
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_7:
	mov	x0, x19
	bl	_pvr2_encoder_adjust
	mov	x20, x0
	cbnz	w0, LBB0_6
; %bb.8:
Lloh25:
	adrp	x8, _CX2341X_ENC_INITIALIZE_INPUT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CX2341X_ENC_INITIALIZE_INPUT@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_pvr2_encoder_vcmd
	mov	x20, x0
	cbz	w0, LBB0_6
; %bb.9:
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_ENCODER,4,2         ; @PVR2_TRACE_ENCODER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pvr2_encoder_configure (cx2341x module)"

	.comm	_CX2341X_PORT_STREAMING,4,2     ; @CX2341X_PORT_STREAMING
	.comm	_V4L2_STD_525_60,4,2            ; @V4L2_STD_525_60
	.comm	_CX2341X_ENC_SET_NUM_VSYNC_LINES,4,2 ; @CX2341X_ENC_SET_NUM_VSYNC_LINES
	.comm	_CX2341X_ENC_SET_EVENT_NOTIFICATION,4,2 ; @CX2341X_ENC_SET_EVENT_NOTIFICATION
	.comm	_CX2341X_ENC_SET_VBI_LINE,4,2   ; @CX2341X_ENC_SET_VBI_LINE
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
l_.str.1:                               ; @.str.1
	.asciz	"Failed to configure cx23416"

	.comm	_CX2341X_ENC_INITIALIZE_INPUT,4,2 ; @CX2341X_ENC_INITIALIZE_INPUT
l_.str.2:                               ; @.str.2
	.asciz	"Failed to initialize cx23416 video input"

.subsections_via_symbols
