	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pvr2_encoder_cmd
_pvr2_encoder_cmd:                      ## @pvr2_encoder_cmd
	.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
	subq	$248, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r12
	movl	%ecx, %r13d
	movl	%edx, %ebx
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-112(%rbp), %rdi
	callq	_ARRAY_SIZE
	addl	$-4, %eax
	cmpl	%ebx, %eax
	jge	LBB0_3
## %bb.1:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	leaq	-112(%rbp), %rdi
	callq	_ARRAY_SIZE
	movslq	%eax, %rcx
	addq	$-4, %rcx
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	movl	%r15d, %edi
	movl	%ebx, %edx
	jmp	LBB0_2
LBB0_3:
	leaq	-176(%rbp), %rdi
	callq	_ARRAY_SIZE
	addl	$-4, %eax
	cmpl	%r13d, %eax
	jge	LBB0_5
## %bb.4:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	leaq	-176(%rbp), %rdi
	callq	_ARRAY_SIZE
	movslq	%eax, %rcx
	addq	$-4, %rcx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	movl	%r15d, %edi
	movl	%r13d, %edx
LBB0_2:
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_72
LBB0_5:
	movl	%r14d, -188(%rbp)               ## 4-byte Spill
	movl	$4294967292, %r14d              ## imm = 0xFFFFFFFC
	movl	(%r15), %edi
	callq	_LOCK_TAKE
	movq	%r13, -280(%rbp)                ## 8-byte Spill
	leal	4(%r13), %eax
	movl	%eax, -196(%rbp)                ## 4-byte Spill
	movl	%ebx, -192(%rbp)                ## 4-byte Spill
	movl	%ebx, %eax
	movq	%r15, %rbx
	movq	%rax, %r15
	decq	%rax
	movl	%r15d, %ecx
	andl	$-8, %ecx
	movq	%rcx, -272(%rbp)                ## 8-byte Spill
	addq	$-8, %rcx
	movq	%rcx, -264(%rbp)                ## 8-byte Spill
	movq	%rcx, %rdx
	shrq	$3, %rdx
	incq	%rdx
	movl	%eax, %ecx
	andl	$-4, %ecx
	cmpl	%r14d, %ecx
	sete	%cl
	shrq	$32, %rax
	setne	%r8b
	orb	%cl, %r8b
	movq	%rdx, %rax
	movq	%rdx, -256(%rbp)                ## 8-byte Spill
	andq	$-2, %rdx
	movq	%rdx, -232(%rbp)                ## 8-byte Spill
	movl	%r15d, %r9d
	andl	$3, %r9d
	movq	%r15, %rdi
	negq	%rdi
	movabsq	$1688849860263936, %rcx         ## imm = 0x6000000000000
	xorl	%eax, %eax
	movq	%rbx, -216(%rbp)                ## 8-byte Spill
	movq	%r15, -208(%rbp)                ## 8-byte Spill
	movb	%r8b, -177(%rbp)                ## 1-byte Spill
	movq	%r9, -248(%rbp)                 ## 8-byte Spill
	movq	%rdi, -240(%rbp)                ## 8-byte Spill
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_14 Depth 2
                                        ##     Child Loop BB0_21 Depth 2
                                        ##     Child Loop BB0_24 Depth 2
                                        ##     Child Loop BB0_26 Depth 2
                                        ##     Child Loop BB0_31 Depth 2
                                        ##     Child Loop BB0_41 Depth 2
	cmpq	$0, 16(%rbx)
	je	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, -184(%rbp)                ## 4-byte Spill
	movl	$0, -112(%rbp)
	movl	-188(%rbp), %eax                ## 4-byte Reload
	movl	%eax, -108(%rbp)
	movq	%rcx, -104(%rbp)
	movl	-192(%rbp), %r14d               ## 4-byte Reload
	testl	%r14d, %r14d
	leaq	-112(%rbp), %r13
	je	LBB0_25
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	cmpl	$8, %r14d
	setb	%al
	orb	%r8b, %al
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	xorl	%eax, %eax
	jmp	LBB0_19
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpq	$0, -264(%rbp)                  ## 8-byte Folded Reload
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	$8, %eax
	movq	-232(%rbp), %rcx                ## 8-byte Reload
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leal	-8(%rax), %edx
	movups	-32(%r12,%rax,4), %xmm0
	movups	-16(%r12,%rax,4), %xmm1
	andl	$-16, %edx
	movaps	%xmm0, -96(%rbp,%rdx,4)
	movaps	%xmm1, -80(%rbp,%rdx,4)
	movups	(%r12,%rax,4), %xmm0
	movups	16(%r12,%rax,4), %xmm1
	movl	%eax, %edx
	andl	$-8, %edx
	movaps	%xmm0, -96(%rbp,%rdx,4)
	movaps	%xmm1, -80(%rbp,%rdx,4)
	addq	$16, %rax
	addq	$-2, %rcx
	jne	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_6 Depth=1
	addq	$-8, %rax
	testb	$1, -256(%rbp)                  ## 1-byte Folded Reload
	je	LBB0_18
LBB0_17:                                ##   in Loop: Header=BB0_6 Depth=1
	movups	(%r12,%rax,4), %xmm0
	movups	16(%r12,%rax,4), %xmm1
	andl	$-8, %eax
	movaps	%xmm0, -96(%rbp,%rax,4)
	movaps	%xmm1, -80(%rbp,%rax,4)
LBB0_18:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	-272(%rbp), %rcx                ## 8-byte Reload
	movq	%rcx, %rax
	cmpq	%r15, %rcx
	je	LBB0_25
LBB0_19:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %rcx
	notq	%rcx
	addq	%r15, %rcx
	testq	%r9, %r9
	je	LBB0_22
## %bb.20:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r9, %rdx
	.p2align	4, 0x90
LBB0_21:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12,%rax,4), %esi
	movl	%esi, -96(%rbp,%rax,4)
	incq	%rax
	decq	%rdx
	jne	LBB0_21
LBB0_22:                                ##   in Loop: Header=BB0_6 Depth=1
	cmpq	$3, %rcx
	jb	LBB0_25
## %bb.23:                              ##   in Loop: Header=BB0_6 Depth=1
	addq	$7, %rax
	.p2align	4, 0x90
LBB0_24:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	-28(%r12,%rax,4), %ecx
	leal	-3(%rax), %edx
	movl	%ecx, -112(%rbp,%rdx,4)
	movl	-24(%r12,%rax,4), %ecx
	leal	-2(%rax), %edx
	movl	%ecx, -112(%rbp,%rdx,4)
	movl	-20(%r12,%rax,4), %ecx
	leal	-1(%rax), %edx
	movl	%ecx, -112(%rbp,%rdx,4)
	movl	-16(%r12,%rax,4), %ecx
	movl	%eax, %edx
	movl	%ecx, -112(%rbp,%rdx,4)
	leaq	(%rdi,%rax), %rcx
	addq	$4, %rcx
	addq	$4, %rax
	cmpq	$7, %rcx
	jne	LBB0_24
LBB0_25:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rdi
	callq	_ARRAY_SIZE
	addl	$-4, %eax
	movq	%r15, %rbx
	movl	%r14d, %ecx
	cmpl	%r14d, %eax
	jbe	LBB0_28
	.p2align	4, 0x90
LBB0_26:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	leal	4(%rbx), %eax
	movl	$0, -112(%rbp,%rax,4)
	incq	%rbx
	movq	%r13, %rdi
	callq	_ARRAY_SIZE
                                        ## kill: def $eax killed $eax def $rax
	addl	$-4, %eax
	cmpq	%rax, %rbx
	jb	LBB0_26
## %bb.27:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	%ebx, %ecx
LBB0_28:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_MBOX_BASE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	-216(%rbp), %rbx                ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r13, %rdx
	callq	_pvr2_encoder_write_words
	testl	%eax, %eax
	jne	LBB0_70
## %bb.29:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_IVTV_MBOX_DRIVER_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_IVTV_MBOX_DRIVER_DONE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -112(%rbp)
	movl	(%r15), %esi
	movq	%rbx, %rdi
	movq	%r13, %rdx
	movl	$1, %ecx
	callq	_pvr2_encoder_write_words
	testl	%eax, %eax
	jne	LBB0_70
## %bb.30:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	-184(%rbp), %r13d               ## 4-byte Reload
	incl	%r13d
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_31:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_MBOX_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	leaq	-176(%rbp), %rdx
	movl	-196(%rbp), %ecx                ## 4-byte Reload
	callq	_pvr2_encoder_read_words
	testl	%eax, %eax
	jne	LBB0_32
## %bb.33:                              ##   in Loop: Header=BB0_31 Depth=2
	movl	-176(%rbp), %r14d
	movq	_IVTV_MBOX_FIRMWARE_DONE@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	jne	LBB0_50
## %bb.34:                              ##   in Loop: Header=BB0_31 Depth=2
	testl	%r14d, %r14d
	je	LBB0_36
## %bb.35:                              ##   in Loop: Header=BB0_31 Depth=2
	leal	1(%r15), %eax
	cmpl	$999, %r15d                     ## imm = 0x3E7
	movl	%eax, %r15d
	jb	LBB0_31
LBB0_36:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	testl	%r14d, %r14d
	movl	%r13d, -184(%rbp)               ## 4-byte Spill
	movq	%r12, -224(%rbp)                ## 8-byte Spill
	je	LBB0_37
## %bb.38:                              ##   in Loop: Header=BB0_6 Depth=1
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_pvr2_trace
	jmp	LBB0_39
LBB0_12:                                ##   in Loop: Header=BB0_6 Depth=1
	xorl	%eax, %eax
	testb	$1, -256(%rbp)                  ## 1-byte Folded Reload
	jne	LBB0_17
	jmp	LBB0_18
LBB0_37:                                ##   in Loop: Header=BB0_6 Depth=1
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
LBB0_39:                                ##   in Loop: Header=BB0_6 Depth=1
	movl	(%r15), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	-188(%rbp), %edx                ## 4-byte Reload
	xorl	%eax, %eax
	callq	_pvr2_trace
	cmpl	$5, -192(%rbp)                  ## 4-byte Folded Reload
	movq	-208(%rbp), %rcx                ## 8-byte Reload
	leaq	L_.str.5(%rip), %r12
	jb	LBB0_42
## %bb.40:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	$4, %ebx
	.p2align	4, 0x90
LBB0_41:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r15), %edi
	movq	%rcx, %r13
	movl	-112(%rbp,%rbx,4), %ecx
	leal	-3(%rbx), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	%r13, %rcx
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_41
LBB0_42:                                ##   in Loop: Header=BB0_6 Depth=1
	testl	%r14d, %r14d
	movq	-216(%rbp), %rbx                ## 8-byte Reload
	movq	-224(%rbp), %r12                ## 8-byte Reload
	jne	LBB0_45
## %bb.43:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	-184(%rbp), %eax                ## 4-byte Reload
	cmpl	$20, %eax
	movq	-208(%rbp), %r15                ## 8-byte Reload
	movb	-177(%rbp), %r8b                ## 1-byte Reload
	movq	-248(%rbp), %r9                 ## 8-byte Reload
	movq	-240(%rbp), %rdi                ## 8-byte Reload
	movabsq	$1688849860263936, %rcx         ## imm = 0x6000000000000
	jne	LBB0_6
## %bb.44:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.6(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
LBB0_45:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	testl	%r14d, %r14d
	je	LBB0_50
## %bb.46:
	negl	%r14d
	jmp	LBB0_47
LBB0_32:
	movl	%eax, %r14d
LBB0_47:
	leaq	24(%rbx), %rdi
	callq	_del_timer_sync
	movq	$0, 16(%rbx)
	movq	_PVR2_TRACE_STBITS@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	L_.str.7(%rip), %rsi
	leaq	L_.str.8(%rip), %rdx
	leaq	L_.str.10(%rip), %rcx
	xorl	%eax, %eax
	callq	_pvr2_trace
	cmpq	$0, 8(%rbx)
	je	LBB0_49
## %bb.48:
	movq	$0, 8(%rbx)
	movl	(%r15), %edi
	leaq	L_.str.7(%rip), %rsi
	leaq	L_.str.11(%rip), %rdx
	leaq	L_.str.10(%rip), %rcx
	xorl	%eax, %eax
	callq	_pvr2_trace
LBB0_49:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.12(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
	jmp	LBB0_71
LBB0_50:
	movq	-280(%rbp), %rcx                ## 8-byte Reload
	testl	%ecx, %ecx
	movq	_MBOX_BASE@GOTPCREL(%rip), %r8
	movabsq	$4611686018427387902, %rsi      ## imm = 0x3FFFFFFFFFFFFFFE
	je	LBB0_69
## %bb.51:
	movl	%ecx, %eax
	cmpl	$8, %ecx
	jae	LBB0_53
## %bb.52:
	xorl	%ecx, %ecx
	jmp	LBB0_64
LBB0_53:
	movq	%rbx, %r9
	leaq	-1(%rax), %rdx
	movl	%edx, %edi
	andl	$-4, %edi
	xorl	%ecx, %ecx
	movl	$4294967292, %ebx               ## imm = 0xFFFFFFFC
	cmpq	%rbx, %rdi
	je	LBB0_54
## %bb.55:
	shrq	$32, %rdx
	movq	%r9, %rbx
	jne	LBB0_64
## %bb.56:
	movl	%eax, %ecx
	andl	$-8, %ecx
	leaq	-8(%rcx), %rdx
	movq	%rdx, %r9
	shrq	$3, %r9
	incq	%r9
	testq	%rdx, %rdx
	je	LBB0_57
## %bb.58:
	andq	%r9, %rsi
	movl	$8, %edx
	.p2align	4, 0x90
LBB0_59:                                ## =>This Inner Loop Header: Depth=1
	leal	-8(%rdx), %edi
	andl	$-16, %edi
	movaps	-160(%rbp,%rdi,4), %xmm0
	movaps	-144(%rbp,%rdi,4), %xmm1
	movups	%xmm0, -32(%r12,%rdx,4)
	movups	%xmm1, -16(%r12,%rdx,4)
	movl	%edx, %edi
	andl	$-8, %edi
	movaps	-160(%rbp,%rdi,4), %xmm0
	movaps	-144(%rbp,%rdi,4), %xmm1
	movups	%xmm0, (%r12,%rdx,4)
	movups	%xmm1, 16(%r12,%rdx,4)
	addq	$16, %rdx
	addq	$-2, %rsi
	jne	LBB0_59
## %bb.60:
	addq	$-8, %rdx
	jmp	LBB0_61
LBB0_7:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_71
LBB0_54:
	movq	%r9, %rbx
	jmp	LBB0_64
LBB0_57:
	xorl	%edx, %edx
LBB0_61:
	testb	$1, %r9b
	je	LBB0_63
## %bb.62:
	movl	%edx, %esi
	andl	$-8, %esi
	movaps	-160(%rbp,%rsi,4), %xmm0
	movaps	-144(%rbp,%rsi,4), %xmm1
	movups	%xmm0, (%r12,%rdx,4)
	movups	%xmm1, 16(%r12,%rdx,4)
LBB0_63:
	cmpq	%rax, %rcx
	je	LBB0_69
LBB0_64:
	movq	%rcx, %rdx
	notq	%rdx
	addq	%rax, %rdx
	movq	%rax, %rsi
	andq	$3, %rsi
	je	LBB0_66
	.p2align	4, 0x90
LBB0_65:                                ## =>This Inner Loop Header: Depth=1
	movl	-160(%rbp,%rcx,4), %edi
	movl	%edi, (%r12,%rcx,4)
	incq	%rcx
	decq	%rsi
	jne	LBB0_65
LBB0_66:
	cmpq	$3, %rdx
	jb	LBB0_69
## %bb.67:
	negq	%rax
	addq	$7, %rcx
	.p2align	4, 0x90
LBB0_68:                                ## =>This Inner Loop Header: Depth=1
	leal	-3(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -28(%r12,%rcx,4)
	leal	-2(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -24(%r12,%rcx,4)
	leal	-1(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -20(%r12,%rcx,4)
	movl	%ecx, %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -16(%r12,%rcx,4)
	leaq	(%rax,%rcx), %rdx
	addq	$4, %rdx
	addq	$4, %rcx
	cmpq	$7, %rdx
	jne	LBB0_68
LBB0_69:
	movl	$0, -112(%rbp)
	movl	(%r8), %esi
	leaq	-112(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$1, %ecx
	callq	_pvr2_encoder_write_words
LBB0_70:
	movl	%eax, %r14d
LBB0_71:
	movl	(%rbx), %edi
	callq	_LOCK_GIVE
LBB0_72:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_74
## %bb.73:
	movl	%r14d, %eax
	addq	$248, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_74:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to write cx23416 command - too many input arguments (was given %u limit %lu)"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Failed to write cx23416 command - too many return arguments (was given %u limit %lu)"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_MBOX_BASE,4,2                  ## @MBOX_BASE
	.comm	_IVTV_MBOX_DRIVER_DONE,4,2      ## @IVTV_MBOX_DRIVER_DONE
	.comm	_IVTV_MBOX_DRIVER_BUSY,4,2      ## @IVTV_MBOX_DRIVER_BUSY
	.comm	_IVTV_MBOX_FIRMWARE_DONE,4,2    ## @IVTV_MBOX_FIRMWARE_DONE
L_.str.2:                               ## @.str.2
	.asciz	"Encoder timed out waiting for us; arranging to retry"

L_.str.3:                               ## @.str.3
	.asciz	"***WARNING*** device's encoder appears to be stuck (status=0x%08x)"

L_.str.4:                               ## @.str.4
	.asciz	"Encoder command: 0x%02x"

L_.str.5:                               ## @.str.5
	.asciz	"Encoder arg%d: 0x%08x"

	.comm	_EBUSY,4,2                      ## @EBUSY
L_.str.6:                               ## @.str.6
	.asciz	"Too many retries..."

	.comm	_PVR2_TRACE_STBITS,4,2          ## @PVR2_TRACE_STBITS
L_.str.7:                               ## @.str.7
	.asciz	"State bit %s <-- %s"

L_.str.8:                               ## @.str.8
	.asciz	"state_encoder_ok"

L_.str.10:                              ## @.str.10
	.asciz	"false"

L_.str.11:                              ## @.str.11
	.asciz	"state_encoder_runok"

L_.str.12:                              ## @.str.12
	.asciz	"Giving up on command.  This is normally recovered via a firmware reload and re-initialization; concern is only warranted if this happens repeatedly and rapidly."

	.no_dead_strip	_pvr2_encoder_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function pvr2_encoder_cmd
lCPI0_0:
	.long	0                               ; 0x0
	.long	393216                          ; 0x60000
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_pvr2_encoder_cmd:                      ; @pvr2_encoder_cmd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #336
	.cfi_def_cfa_offset 336
	stp	d9, d8, [sp, #224]              ; 16-byte Folded Spill
	stp	x28, x27, [sp, #240]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #256]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #272]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #288]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #304]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #320]            ; 16-byte Folded Spill
	add	x29, sp, #320
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	.cfi_offset b8, -104
	.cfi_offset b9, -112
	mov	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x26, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-112]
	add	x0, sp, #144
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
Lloh3:
	adrp	x23, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh4:
	ldr	x23, [x23, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	cmp	w8, w22
	b.ge	LBB0_2
; %bb.1:
	ldr	w19, [x23]
	add	x0, sp, #144
	bl	_ARRAY_SIZE
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	sub	x8, x8, #4
	stp	x22, x8, [sp]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	add	x0, sp, #80
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	cmp	w8, w21
	b.ge	LBB0_5
; %bb.3:
	ldr	w19, [x23]
	add	x0, sp, #80
	bl	_ARRAY_SIZE
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	sub	x8, x8, #4
	stp	x21, x8, [sp]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_4:
	mov	x0, x19
	bl	_pvr2_trace
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w28, w8
	b	LBB0_52
LBB0_5:
	ldr	w0, [x19]
	bl	_LOCK_TAKE
	str	wzr, [sp, #76]                  ; 4-byte Folded Spill
	add	w24, w21, #4
	mov	w27, w22
	sub	x8, x27, #1
	mvn	w9, w8
	tst	x9, #0xfffffffc
	cset	w9, eq
	tst	x8, #0xffffffff00000000
	cset	w8, ne
	orr	w11, w9, w8
	and	x12, x27, #0xfffffff0
	add	x8, x20, #32
	stp	x8, x21, [sp, #48]              ; 16-byte Folded Spill
	add	x23, sp, #144
	add	x8, x23, #32
	str	x8, [sp, #40]                   ; 8-byte Folded Spill
Lloh12:
	adrp	x8, lCPI0_0@PAGE
Lloh13:
	ldr	d8, [x8, lCPI0_0@PAGEOFF]
Lloh14:
	adrp	x21, _MBOX_BASE@GOTPAGE
Lloh15:
	ldr	x21, [x21, _MBOX_BASE@GOTPAGEOFF]
Lloh16:
	adrp	x25, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGE
Lloh17:
	ldr	x25, [x25, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGEOFF]
	str	x26, [sp, #64]                  ; 8-byte Folded Spill
	str	w11, [sp, #36]                  ; 4-byte Folded Spill
	str	x12, [sp, #24]                  ; 8-byte Folded Spill
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_11 Depth 2
                                        ;     Child Loop BB0_13 Depth 2
                                        ;     Child Loop BB0_15 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
                                        ;     Child Loop BB0_29 Depth 2
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_54
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	stp	wzr, w26, [sp, #144]
	str	d8, [sp, #152]
	cbz	w22, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w22, #16
	cset	w8, lo
	orr	w8, w8, w11
	tbz	w8, #0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x8, #0
	b	LBB0_13
LBB0_10:                                ;   in Loop: Header=BB0_6 Depth=1
	ldp	x8, x9, [sp, #40]               ; 16-byte Folded Reload
	mov	x10, x12
LBB0_11:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q0, q1, [x9, #-32]
	ldp	q2, q3, [x9], #64
	stp	q0, q1, [x8, #-16]
	stp	q2, q3, [x8, #16]
	add	x8, x8, #64
	subs	x10, x10, #16
	b.ne	LBB0_11
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x8, x12
	cmp	x12, x27
	b.eq	LBB0_14
LBB0_13:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w9, [x20, x8, lsl #2]
	add	w10, w8, #4
	str	w9, [x23, w10, uxtw #2]
	add	x8, x8, #1
	cmp	x27, x8
	b.ne	LBB0_13
LBB0_14:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x0, sp, #144
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	mov	x26, x27
	mov	x3, x22
	cmp	w8, w22
	b.ls	LBB0_17
LBB0_15:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	w8, w26, #4
	str	wzr, [x23, w8, uxtw #2]
	add	x26, x26, #1
	add	x0, sp, #144
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	cmp	x26, x8
	b.lo	LBB0_15
; %bb.16:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x3, x26
LBB0_17:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w1, [x21]
	add	x2, sp, #144
	mov	x0, x19
	bl	_pvr2_encoder_write_words
	cbnz	w0, LBB0_50
; %bb.18:                               ;   in Loop: Header=BB0_6 Depth=1
Lloh18:
	adrp	x8, _IVTV_MBOX_DRIVER_DONE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _IVTV_MBOX_DRIVER_DONE@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _IVTV_MBOX_DRIVER_BUSY@GOTPAGE
Lloh22:
	ldr	x9, [x9, _IVTV_MBOX_DRIVER_BUSY@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #144]
	ldr	w1, [x21]
	add	x2, sp, #144
	mov	x0, x19
	mov	w3, #1
	bl	_pvr2_encoder_write_words
	cbnz	w0, LBB0_50
; %bb.19:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	w26, #0
	ldr	w8, [sp, #76]                   ; 4-byte Folded Reload
	add	w8, w8, #1
	str	w8, [sp, #76]                   ; 4-byte Folded Spill
LBB0_20:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x21]
	add	x2, sp, #80
	mov	x0, x19
	mov	x3, x24
	bl	_pvr2_encoder_read_words
	cbnz	w0, LBB0_35
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	ldr	w28, [sp, #80]
	ldr	w8, [x25]
	tst	w8, w28
	b.ne	LBB0_39
; %bb.22:                               ;   in Loop: Header=BB0_20 Depth=2
	cbz	w28, LBB0_24
; %bb.23:                               ;   in Loop: Header=BB0_20 Depth=2
	add	w8, w26, #1
	cmp	w26, #999
	mov	x26, x8
	b.lo	LBB0_20
LBB0_24:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh24:
	adrp	x21, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh25:
	ldr	x21, [x21, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	ldr	w0, [x21]
	cbz	w28, LBB0_26
; %bb.25:                               ;   in Loop: Header=BB0_6 Depth=1
	str	x28, [sp]
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_27
LBB0_26:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh28:
	adrp	x1, l_.str.2@PAGE
Lloh29:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_27:                                ;   in Loop: Header=BB0_6 Depth=1
	bl	_pvr2_trace
	ldr	w0, [x21]
	ldr	x8, [sp, #64]                   ; 8-byte Folded Reload
	str	x8, [sp]
Lloh30:
	adrp	x1, l_.str.4@PAGE
Lloh31:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_pvr2_trace
	cmp	w22, #5
Lloh32:
	adrp	x25, l_.str.5@PAGE
Lloh33:
	add	x25, x25, l_.str.5@PAGEOFF
	b.lo	LBB0_30
; %bb.28:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	w26, #4
LBB0_29:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x21]
	sub	x8, x26, #3
	ldr	w9, [x23, x26, lsl #2]
	stp	x8, x9, [sp]
	mov	x1, x25
	bl	_pvr2_trace
	add	x26, x26, #1
	cmp	x27, x26
	b.ne	LBB0_29
LBB0_30:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh34:
	adrp	x21, _MBOX_BASE@GOTPAGE
Lloh35:
	ldr	x21, [x21, _MBOX_BASE@GOTPAGEOFF]
	cbnz	w28, LBB0_33
; %bb.31:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [sp, #76]                   ; 4-byte Folded Reload
	cmp	w8, #20
Lloh36:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh37:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	ldr	x26, [sp, #64]                  ; 8-byte Folded Reload
	ldr	w11, [sp, #36]                  ; 4-byte Folded Reload
	ldr	x12, [sp, #24]                  ; 8-byte Folded Reload
Lloh38:
	adrp	x25, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGE
Lloh39:
	ldr	x25, [x25, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGEOFF]
	b.ne	LBB0_6
; %bb.32:
	ldr	w0, [x8]
Lloh40:
	adrp	x1, l_.str.6@PAGE
Lloh41:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_pvr2_trace
LBB0_33:
Lloh42:
	adrp	x8, _EBUSY@GOTPAGE
Lloh43:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh44:
	ldr	w8, [x8]
	cbz	w8, LBB0_39
; %bb.34:
	neg	w28, w8
	b	LBB0_36
LBB0_35:
	mov	x28, x0
LBB0_36:
	add	x0, x19, #24
	bl	_del_timer_sync
	str	xzr, [x19, #16]
Lloh45:
	adrp	x20, _PVR2_TRACE_STBITS@GOTPAGE
Lloh46:
	ldr	x20, [x20, _PVR2_TRACE_STBITS@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh47:
	adrp	x21, l_.str.10@PAGE
Lloh48:
	add	x21, x21, l_.str.10@PAGEOFF
Lloh49:
	adrp	x8, l_.str.8@PAGE
Lloh50:
	add	x8, x8, l_.str.8@PAGEOFF
	stp	x8, x21, [sp]
Lloh51:
	adrp	x1, l_.str.7@PAGE
Lloh52:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_pvr2_trace
	ldr	x8, [x19, #8]
Lloh53:
	adrp	x22, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh54:
	ldr	x22, [x22, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	cbz	x8, LBB0_38
; %bb.37:
	str	xzr, [x19, #8]
	ldr	w0, [x20]
Lloh55:
	adrp	x8, l_.str.11@PAGE
Lloh56:
	add	x8, x8, l_.str.11@PAGEOFF
	stp	x8, x21, [sp]
Lloh57:
	adrp	x1, l_.str.7@PAGE
Lloh58:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_pvr2_trace
LBB0_38:
	ldr	w0, [x22]
Lloh59:
	adrp	x1, l_.str.12@PAGE
Lloh60:
	add	x1, x1, l_.str.12@PAGEOFF
	bl	_pvr2_trace
	b	LBB0_51
LBB0_39:
	ldr	x9, [sp, #56]                   ; 8-byte Folded Reload
	cbz	w9, LBB0_49
; %bb.40:
	mov	w8, w9
	cmp	w9, #16
	b.hs	LBB0_42
; %bb.41:
	mov	x9, #0
	b	LBB0_47
LBB0_42:
	mov	x9, #0
	sub	x10, x8, #1
	mvn	w11, w10
	tst	x11, #0xfffffffc
	b.eq	LBB0_47
; %bb.43:
	lsr	x10, x10, #32
	cbnz	x10, LBB0_47
; %bb.44:
	and	x9, x8, #0xfffffff0
	add	x10, x20, #32
	add	x11, sp, #80
	add	x11, x11, #32
	mov	x12, x9
LBB0_45:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x11, #-16]
	ldp	q2, q3, [x11, #16]
	stp	q0, q1, [x10, #-32]
	stp	q2, q3, [x10], #64
	add	x11, x11, #64
	subs	x12, x12, #16
	b.ne	LBB0_45
; %bb.46:
	cmp	x9, x8
	b.eq	LBB0_49
LBB0_47:
	add	x10, sp, #80
LBB0_48:                                ; =>This Inner Loop Header: Depth=1
	add	w11, w9, #4
	ldr	w11, [x10, w11, uxtw #2]
	str	w11, [x20, x9, lsl #2]
	add	x9, x9, #1
	cmp	x8, x9
	b.ne	LBB0_48
LBB0_49:
	str	wzr, [sp, #144]
	ldr	w1, [x21]
	add	x2, sp, #144
	mov	x0, x19
	mov	w3, #1
	bl	_pvr2_encoder_write_words
LBB0_50:
	mov	x28, x0
LBB0_51:
	ldr	w0, [x19]
	bl	_LOCK_GIVE
LBB0_52:
	ldur	x8, [x29, #-112]
Lloh61:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh62:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh63:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_55
; %bb.53:
	mov	x0, x28
	ldp	x29, x30, [sp, #320]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #304]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #288]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #272]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #256]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #240]            ; 16-byte Folded Reload
	ldp	d9, d8, [sp, #224]              ; 16-byte Folded Reload
	add	sp, sp, #336
	ret
LBB0_54:
Lloh64:
	adrp	x8, _EIO@GOTPAGE
Lloh65:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh66:
	ldr	w8, [x8]
	neg	w28, w8
	b	LBB0_51
LBB0_55:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdr	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGot	Lloh53, Lloh54
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpAdd	Lloh57, Lloh58
	.loh AdrpAdd	Lloh55, Lloh56
	.loh AdrpAdd	Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpLdrGotLdr	Lloh64, Lloh65, Lloh66
	.cfi_endproc
                                        ; -- End function
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to write cx23416 command - too many input arguments (was given %u limit %lu)"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Failed to write cx23416 command - too many return arguments (was given %u limit %lu)"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_MBOX_BASE,4,2                  ; @MBOX_BASE
	.comm	_IVTV_MBOX_DRIVER_DONE,4,2      ; @IVTV_MBOX_DRIVER_DONE
	.comm	_IVTV_MBOX_DRIVER_BUSY,4,2      ; @IVTV_MBOX_DRIVER_BUSY
	.comm	_IVTV_MBOX_FIRMWARE_DONE,4,2    ; @IVTV_MBOX_FIRMWARE_DONE
l_.str.2:                               ; @.str.2
	.asciz	"Encoder timed out waiting for us; arranging to retry"

l_.str.3:                               ; @.str.3
	.asciz	"***WARNING*** device's encoder appears to be stuck (status=0x%08x)"

l_.str.4:                               ; @.str.4
	.asciz	"Encoder command: 0x%02x"

l_.str.5:                               ; @.str.5
	.asciz	"Encoder arg%d: 0x%08x"

	.comm	_EBUSY,4,2                      ; @EBUSY
l_.str.6:                               ; @.str.6
	.asciz	"Too many retries..."

	.comm	_PVR2_TRACE_STBITS,4,2          ; @PVR2_TRACE_STBITS
l_.str.7:                               ; @.str.7
	.asciz	"State bit %s <-- %s"

l_.str.8:                               ; @.str.8
	.asciz	"state_encoder_ok"

l_.str.10:                              ; @.str.10
	.asciz	"false"

l_.str.11:                              ; @.str.11
	.asciz	"state_encoder_runok"

l_.str.12:                              ; @.str.12
	.asciz	"Giving up on command.  This is normally recovered via a firmware reload and re-initialization; concern is only warranted if this happens repeatedly and rapidly."

	.no_dead_strip	_pvr2_encoder_cmd
.subsections_via_symbols
