	.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	$168, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movl	%ecx, %ebx
	movl	%edx, %r12d
	movl	%esi, %r13d
	movq	%rdi, %r14
	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	%r12d, %eax
	jge	LBB0_3
## %bb.1:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	-112(%rbp), %rdi
	callq	_ARRAY_SIZE
	movslq	%eax, %rcx
	addq	$-4, %rcx
	leaq	L_.str(%rip), %rsi
	xorl	%r13d, %r13d
	movl	%ebx, %edi
	movl	%r12d, %edx
	jmp	LBB0_2
LBB0_3:
	leaq	-176(%rbp), %rdi
	callq	_ARRAY_SIZE
	addl	$-4, %eax
	cmpl	%ebx, %eax
	jge	LBB0_5
## %bb.4:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movq	%rbx, %r14
	movl	(%rax), %ebx
	leaq	-176(%rbp), %rdi
	callq	_ARRAY_SIZE
	movslq	%eax, %rcx
	addq	$-4, %rcx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r13d, %r13d
	movl	%ebx, %edi
	movl	%r14d, %edx
LBB0_2:
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	jmp	LBB0_69
LBB0_5:
	movl	(%r14), %edi
	callq	_LOCK_TAKE
	cmpq	$0, 16(%r14)
	je	LBB0_6
## %bb.7:
	movl	$0, -112(%rbp)
	movl	%r13d, -108(%rbp)
	movabsq	$1688849860263936, %rax         ## imm = 0x6000000000000
	movq	%rax, -104(%rbp)
	movl	%r12d, %r8d
	testl	%r12d, %r12d
	je	LBB0_25
## %bb.8:
	cmpl	$8, %r12d
	jae	LBB0_10
## %bb.9:
	xorl	%eax, %eax
LBB0_20:
	movq	%rax, %rcx
	notq	%rcx
	addq	%r8, %rcx
	movq	%r8, %rdx
	andq	$3, %rdx
	je	LBB0_22
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r15,%rax,4), %esi
	movl	%esi, -96(%rbp,%rax,4)
	incq	%rax
	decq	%rdx
	jne	LBB0_21
LBB0_22:
	cmpq	$3, %rcx
	jb	LBB0_25
## %bb.23:
	movq	%r8, %rcx
	negq	%rcx
	addq	$7, %rax
	.p2align	4, 0x90
LBB0_24:                                ## =>This Inner Loop Header: Depth=1
	movl	-28(%r15,%rax,4), %edx
	leal	-3(%rax), %esi
	movl	%edx, -112(%rbp,%rsi,4)
	movl	-24(%r15,%rax,4), %edx
	leal	-2(%rax), %esi
	movl	%edx, -112(%rbp,%rsi,4)
	movl	-20(%r15,%rax,4), %edx
	leal	-1(%rax), %esi
	movl	%edx, -112(%rbp,%rsi,4)
	movl	-16(%r15,%rax,4), %edx
	movl	%eax, %esi
	movl	%edx, -112(%rbp,%rsi,4)
	leaq	(%rcx,%rax), %rdx
	addq	$4, %rdx
	addq	$4, %rax
	cmpq	$7, %rdx
	jne	LBB0_24
	jmp	LBB0_25
LBB0_6:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_68
LBB0_10:
	leaq	-1(%r8), %rcx
	movl	%ecx, %edx
	andl	$-4, %edx
	movl	$4294967292, %esi               ## imm = 0xFFFFFFFC
	xorl	%eax, %eax
	cmpl	%esi, %edx
	je	LBB0_20
## %bb.11:
	shrq	$32, %rcx
	jne	LBB0_20
## %bb.12:
	movl	%r8d, %eax
	andl	$-8, %eax
	leaq	-8(%rax), %rcx
	movq	%rcx, %rdx
	shrq	$3, %rdx
	incq	%rdx
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.14:
	movq	%rdx, %rsi
	andq	$-2, %rsi
	movl	$8, %ecx
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	leal	-8(%rcx), %edi
	movups	-32(%r15,%rcx,4), %xmm0
	movups	-16(%r15,%rcx,4), %xmm1
	andl	$-16, %edi
	movaps	%xmm0, -96(%rbp,%rdi,4)
	movaps	%xmm1, -80(%rbp,%rdi,4)
	movups	(%r15,%rcx,4), %xmm0
	movups	16(%r15,%rcx,4), %xmm1
	movl	%ecx, %edi
	andl	$-8, %edi
	movaps	%xmm0, -96(%rbp,%rdi,4)
	movaps	%xmm1, -80(%rbp,%rdi,4)
	addq	$16, %rcx
	addq	$-2, %rsi
	jne	LBB0_15
## %bb.16:
	addq	$-8, %rcx
	jmp	LBB0_17
LBB0_13:
	xorl	%ecx, %ecx
LBB0_17:
	testb	$1, %dl
	je	LBB0_19
## %bb.18:
	movups	(%r15,%rcx,4), %xmm0
	movups	16(%r15,%rcx,4), %xmm1
	andl	$-8, %ecx
	movaps	%xmm0, -96(%rbp,%rcx,4)
	movaps	%xmm1, -80(%rbp,%rcx,4)
LBB0_19:
	cmpq	%r8, %rax
	jne	LBB0_20
LBB0_25:
	movq	%r8, -208(%rbp)                 ## 8-byte Spill
	movl	%r13d, -188(%rbp)               ## 4-byte Spill
	movq	%rbx, -200(%rbp)                ## 8-byte Spill
	leaq	-112(%rbp), %rdi
	callq	_ARRAY_SIZE
	addl	$-4, %eax
	movl	%r12d, %ebx
	cmpl	%r12d, %eax
	jbe	LBB0_29
## %bb.26:
	movq	%r14, %r13
	leaq	-112(%rbp), %r14
	movq	-208(%rbp), %rbx                ## 8-byte Reload
	.p2align	4, 0x90
LBB0_27:                                ## =>This Inner Loop Header: Depth=1
	leal	4(%rbx), %eax
	movl	$0, -112(%rbp,%rax,4)
	incq	%rbx
	movq	%r14, %rdi
	callq	_ARRAY_SIZE
                                        ## kill: def $eax killed $eax def $rax
	addl	$-4, %eax
	cmpq	%rax, %rbx
	jb	LBB0_27
## %bb.28:
	movq	%r13, %r14
LBB0_29:
	movq	_MBOX_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-112(%rbp), %rdx
	movq	%r14, %rdi
	movl	%ebx, %ecx
	callq	_pvr2_encoder_write_words
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_68
## %bb.30:
	movq	_IVTV_MBOX_DRIVER_DONE@GOTPCREL(%rip), %rax
	movq	_IVTV_MBOX_DRIVER_BUSY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%ecx, -112(%rbp)
	movq	_MBOX_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-112(%rbp), %rdx
	movq	%r14, %rdi
	movl	$1, %ecx
	callq	_pvr2_encoder_write_words
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_68
## %bb.31:
	movq	%r14, -184(%rbp)                ## 8-byte Spill
	movq	-200(%rbp), %rax                ## 8-byte Reload
	addl	$4, %eax
	movl	%eax, -192(%rbp)                ## 4-byte Spill
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_32:                                ## =>This Inner Loop Header: Depth=1
	movq	_MBOX_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-184(%rbp), %rdi                ## 8-byte Reload
	leaq	-176(%rbp), %rdx
	movl	-192(%rbp), %ecx                ## 4-byte Reload
	callq	_pvr2_encoder_read_words
	testl	%eax, %eax
	jne	LBB0_33
## %bb.34:                              ##   in Loop: Header=BB0_32 Depth=1
	movl	-176(%rbp), %r14d
	movq	_IVTV_MBOX_FIRMWARE_DONE@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	jne	LBB0_49
## %bb.35:                              ##   in Loop: Header=BB0_32 Depth=1
	testl	%r14d, %r14d
	je	LBB0_37
## %bb.36:                              ##   in Loop: Header=BB0_32 Depth=1
	leal	1(%rbx), %eax
	cmpl	$999, %ebx                      ## imm = 0x3E7
	movl	%eax, %ebx
	jb	LBB0_32
LBB0_37:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	testl	%r14d, %r14d
	je	LBB0_38
## %bb.39:
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_pvr2_trace
	jmp	LBB0_40
LBB0_33:
	movl	%eax, %r13d
	jmp	LBB0_46
LBB0_38:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
LBB0_40:
	movl	(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	-188(%rbp), %edx                ## 4-byte Reload
	xorl	%eax, %eax
	callq	_pvr2_trace
	cmpl	$5, %r12d
	movq	-208(%rbp), %r13                ## 8-byte Reload
	jb	LBB0_43
## %bb.41:
	movq	%rbx, %r12
	movl	$4, %ebx
LBB0_42:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %edi
	movl	-112(%rbp,%rbx,4), %ecx
	leal	-3(%rbx), %edx
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_42
LBB0_43:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %r13d
	negl	%r13d
	testl	%r14d, %r14d
	je	LBB0_44
## %bb.45:
	testl	%eax, %eax
	je	LBB0_49
LBB0_46:
	movq	-184(%rbp), %r14                ## 8-byte Reload
	leaq	24(%r14), %rdi
	callq	_del_timer_sync
	movq	$0, 16(%r14)
	movq	_PVR2_TRACE_STBITS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %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(%r14)
	je	LBB0_48
## %bb.47:
	movq	$0, 8(%r14)
	movl	(%rbx), %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_48:
	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_68
LBB0_49:
	movq	-200(%rbp), %rcx                ## 8-byte Reload
	testl	%ecx, %ecx
	movq	-184(%rbp), %r14                ## 8-byte Reload
	je	LBB0_67
## %bb.50:
	movl	%ecx, %eax
	cmpl	$8, %ecx
	jae	LBB0_52
## %bb.51:
	xorl	%ecx, %ecx
LBB0_62:
	movq	%rcx, %rdx
	notq	%rdx
	addq	%rax, %rdx
	movq	%rax, %rsi
	andq	$3, %rsi
	je	LBB0_64
LBB0_63:                                ## =>This Inner Loop Header: Depth=1
	movl	-160(%rbp,%rcx,4), %edi
	movl	%edi, (%r15,%rcx,4)
	incq	%rcx
	decq	%rsi
	jne	LBB0_63
LBB0_64:
	cmpq	$3, %rdx
	jb	LBB0_67
## %bb.65:
	negq	%rax
	addq	$7, %rcx
LBB0_66:                                ## =>This Inner Loop Header: Depth=1
	leal	-3(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -28(%r15,%rcx,4)
	leal	-2(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -24(%r15,%rcx,4)
	leal	-1(%rcx), %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -20(%r15,%rcx,4)
	movl	%ecx, %edx
	movl	-176(%rbp,%rdx,4), %edx
	movl	%edx, -16(%r15,%rcx,4)
	leaq	(%rax,%rcx), %rdx
	addq	$4, %rdx
	addq	$4, %rcx
	cmpq	$7, %rdx
	jne	LBB0_66
	jmp	LBB0_67
LBB0_52:
	leaq	-1(%rax), %rdx
	movl	%edx, %esi
	andl	$-4, %esi
	movl	$4294967292, %edi               ## imm = 0xFFFFFFFC
	xorl	%ecx, %ecx
	cmpl	%edi, %esi
	je	LBB0_62
## %bb.53:
	shrq	$32, %rdx
	jne	LBB0_62
## %bb.54:
	movl	%eax, %ecx
	andl	$-8, %ecx
	leaq	-8(%rcx), %rdx
	movq	%rdx, %r8
	shrq	$3, %r8
	incq	%r8
	testq	%rdx, %rdx
	je	LBB0_55
## %bb.56:
	movq	%r8, %rdi
	andq	$-2, %rdi
	movl	$8, %esi
LBB0_57:                                ## =>This Inner Loop Header: Depth=1
	leal	-8(%rsi), %ebx
	andl	$-16, %ebx
	movaps	-160(%rbp,%rbx,4), %xmm0
	movaps	-144(%rbp,%rbx,4), %xmm1
	movups	%xmm0, -32(%r15,%rsi,4)
	movups	%xmm1, -16(%r15,%rsi,4)
	movl	%esi, %edx
	andl	$-8, %edx
	movaps	-160(%rbp,%rdx,4), %xmm0
	movaps	-144(%rbp,%rdx,4), %xmm1
	movups	%xmm0, (%r15,%rsi,4)
	movups	%xmm1, 16(%r15,%rsi,4)
	addq	$16, %rsi
	addq	$-2, %rdi
	jne	LBB0_57
## %bb.58:
	addq	$-8, %rsi
	jmp	LBB0_59
LBB0_44:
	movq	-184(%rbp), %r14                ## 8-byte Reload
	jmp	LBB0_68
LBB0_55:
	xorl	%esi, %esi
LBB0_59:
	testb	$1, %r8b
	je	LBB0_61
## %bb.60:
	movl	%esi, %edx
	andl	$-8, %edx
	movaps	-160(%rbp,%rdx,4), %xmm0
	movaps	-144(%rbp,%rdx,4), %xmm1
	movups	%xmm0, (%r15,%rsi,4)
	movups	%xmm1, 16(%r15,%rsi,4)
LBB0_61:
	cmpq	%rax, %rcx
	jne	LBB0_62
LBB0_67:
	movl	$0, -112(%rbp)
	movq	_MBOX_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-112(%rbp), %rdx
	movq	%r14, %rdi
	movl	$1, %ecx
	callq	_pvr2_encoder_write_words
	movl	%eax, %r13d
LBB0_68:
	movl	(%r14), %edi
	callq	_LOCK_GIVE
LBB0_69:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_71
## %bb.70:
	movl	%r13d, %eax
	addq	$168, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_71:
	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
	.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, #256
	.cfi_def_cfa_offset 256
	stp	x28, x27, [sp, #160]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #176]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #192]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #208]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #224]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #240]            ; 16-byte Folded Spill
	add	x29, sp, #240
	.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
	mov	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x23, 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, #-96]
	add	x0, sp, #80
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	cmp	w8, w22
	b.ge	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh5:
	ldr	w19, [x8]
	add	x0, sp, #80
	bl	_ARRAY_SIZE
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	sub	x8, x8, #4
	stp	x22, x8, [sp]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	add	x0, sp, #16
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	cmp	w8, w21
	b.ge	LBB0_5
; %bb.3:
Lloh8:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh10:
	ldr	w19, [x8]
	add	x0, sp, #16
	bl	_ARRAY_SIZE
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x8, w0
	sub	x8, x8, #4
	stp	x21, x8, [sp]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_4:
	mov	x0, x19
	bl	_pvr2_trace
Lloh13:
	adrp	x8, _EINVAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_25
LBB0_5:
	ldr	w0, [x19]
	bl	_LOCK_TAKE
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_23
; %bb.6:
	stp	wzr, w23, [sp, #80]
Lloh16:
	adrp	x8, lCPI0_0@PAGE
Lloh17:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [sp, #88]
	cbz	w22, LBB0_11
; %bb.7:
	mov	w8, w22
	cmp	w22, #16
	b.hs	LBB0_27
; %bb.8:
	mov	x9, #0
LBB0_9:
	add	x10, sp, #80
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x20, x9, lsl #2]
	add	w12, w9, #4
	str	w11, [x10, w12, uxtw #2]
	add	x9, x9, #1
	cmp	x8, x9
	b.ne	LBB0_10
LBB0_11:
	add	x25, sp, #80
	add	x0, sp, #80
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	mov	x24, x22
	cmp	w8, w22
	b.ls	LBB0_14
; %bb.12:
	mov	w24, w22
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w24, #4
	str	wzr, [x25, w8, uxtw #2]
	add	x24, x24, #1
	add	x0, sp, #80
	bl	_ARRAY_SIZE
	sub	w8, w0, #4
	cmp	x24, x8
	b.lo	LBB0_13
LBB0_14:
Lloh18:
	adrp	x25, _MBOX_BASE@GOTPAGE
Lloh19:
	ldr	x25, [x25, _MBOX_BASE@GOTPAGEOFF]
	ldr	w1, [x25]
	add	x2, sp, #80
	mov	x0, x19
	mov	x3, x24
	bl	_pvr2_encoder_write_words
	mov	x24, x0
	cbnz	w0, LBB0_24
; %bb.15:
Lloh20:
	adrp	x8, _IVTV_MBOX_DRIVER_DONE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _IVTV_MBOX_DRIVER_DONE@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
Lloh23:
	adrp	x9, _IVTV_MBOX_DRIVER_BUSY@GOTPAGE
Lloh24:
	ldr	x9, [x9, _IVTV_MBOX_DRIVER_BUSY@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #80]
	ldr	w1, [x25]
	add	x2, sp, #80
	mov	x0, x19
	mov	w3, #1
	bl	_pvr2_encoder_write_words
	mov	x24, x0
	cbnz	w0, LBB0_24
; %bb.16:
	mov	w28, #0
	add	w25, w21, #4
Lloh26:
	adrp	x26, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGE
Lloh27:
	ldr	x26, [x26, _IVTV_MBOX_FIRMWARE_DONE@GOTPAGEOFF]
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
Lloh28:
	adrp	x8, _MBOX_BASE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _MBOX_BASE@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	x0, x19
	mov	x3, x25
	bl	_pvr2_encoder_read_words
	cbnz	w0, LBB0_32
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	w27, [sp, #16]
	ldr	w8, [x26]
	tst	w8, w27
	b.ne	LBB0_42
; %bb.19:                               ;   in Loop: Header=BB0_17 Depth=1
	cbz	w27, LBB0_21
; %bb.20:                               ;   in Loop: Header=BB0_17 Depth=1
	add	w8, w28, #1
	cmp	w28, #999
	mov	x28, x8
	b.lo	LBB0_17
LBB0_21:
Lloh31:
	adrp	x24, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh32:
	ldr	x24, [x24, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
	ldr	w0, [x24]
	cbz	w27, LBB0_33
; %bb.22:
	str	x27, [sp]
Lloh33:
	adrp	x1, l_.str.3@PAGE
Lloh34:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_34
LBB0_23:
Lloh35:
	adrp	x8, _EIO@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_24:
	ldr	w0, [x19]
	bl	_LOCK_GIVE
LBB0_25:
	ldur	x8, [x29, #-96]
Lloh38:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh39:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh40:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_53
; %bb.26:
	mov	x0, x24
	ldp	x29, x30, [sp, #240]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #224]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #208]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #192]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #176]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #160]            ; 16-byte Folded Reload
	add	sp, sp, #256
	ret
LBB0_27:
	mov	x9, #0
	sub	x10, x8, #1
	mvn	w11, w10
	tst	x11, #0xfffffffc
	b.eq	LBB0_9
; %bb.28:
	lsr	x10, x10, #32
	cbnz	x10, LBB0_9
; %bb.29:
	and	x9, x8, #0xfffffff0
	add	x10, x20, #32
	add	x11, sp, #80
	add	x11, x11, #32
	mov	x12, x9
LBB0_30:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x10, #-32]
	ldp	q2, q3, [x10], #64
	stp	q0, q1, [x11, #-16]
	stp	q2, q3, [x11, #16]
	add	x11, x11, #64
	subs	x12, x12, #16
	b.ne	LBB0_30
; %bb.31:
	cmp	x9, x8
	b.ne	LBB0_9
	b	LBB0_11
LBB0_32:
	mov	x24, x0
	b	LBB0_39
LBB0_33:
Lloh41:
	adrp	x1, l_.str.2@PAGE
Lloh42:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_34:
	bl	_pvr2_trace
	ldr	w0, [x24]
	str	x23, [sp]
Lloh43:
	adrp	x1, l_.str.4@PAGE
Lloh44:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_pvr2_trace
	cmp	w22, #5
	b.lo	LBB0_37
; %bb.35:
	mov	w23, w22
	mov	w25, #4
	add	x26, sp, #80
Lloh45:
	adrp	x22, l_.str.5@PAGE
Lloh46:
	add	x22, x22, l_.str.5@PAGEOFF
LBB0_36:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x24]
	sub	x8, x25, #3
	ldr	w9, [x26, x25, lsl #2]
	stp	x8, x9, [sp]
	mov	x1, x22
	bl	_pvr2_trace
	add	x25, x25, #1
	cmp	x23, x25
	b.ne	LBB0_36
LBB0_37:
Lloh47:
	adrp	x8, _EBUSY@GOTPAGE
Lloh48:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh49:
	ldr	w8, [x8]
	neg	w24, w8
	cbz	w27, LBB0_24
; %bb.38:
	cbz	w8, LBB0_42
LBB0_39:
	add	x0, x19, #24
	bl	_del_timer_sync
	str	xzr, [x19, #16]
Lloh50:
	adrp	x20, _PVR2_TRACE_STBITS@GOTPAGE
Lloh51:
	ldr	x20, [x20, _PVR2_TRACE_STBITS@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh52:
	adrp	x21, l_.str.10@PAGE
Lloh53:
	add	x21, x21, l_.str.10@PAGEOFF
Lloh54:
	adrp	x8, l_.str.8@PAGE
Lloh55:
	add	x8, x8, l_.str.8@PAGEOFF
	stp	x8, x21, [sp]
Lloh56:
	adrp	x1, l_.str.7@PAGE
Lloh57:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_pvr2_trace
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_41
; %bb.40:
	str	xzr, [x19, #8]
	ldr	w0, [x20]
Lloh58:
	adrp	x8, l_.str.11@PAGE
Lloh59:
	add	x8, x8, l_.str.11@PAGEOFF
	stp	x8, x21, [sp]
Lloh60:
	adrp	x1, l_.str.7@PAGE
Lloh61:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_pvr2_trace
LBB0_41:
Lloh62:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh63:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh64:
	ldr	w0, [x8]
Lloh65:
	adrp	x1, l_.str.12@PAGE
Lloh66:
	add	x1, x1, l_.str.12@PAGEOFF
	bl	_pvr2_trace
	b	LBB0_24
LBB0_42:
Lloh67:
	adrp	x13, _MBOX_BASE@GOTPAGE
Lloh68:
	ldr	x13, [x13, _MBOX_BASE@GOTPAGEOFF]
	cbz	w21, LBB0_47
; %bb.43:
	mov	w8, w21
	cmp	w21, #16
	b.hs	LBB0_48
; %bb.44:
	mov	x9, #0
LBB0_45:
	add	x10, sp, #16
LBB0_46:                                ; =>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_46
LBB0_47:
	str	wzr, [sp, #80]
	ldr	w1, [x13]
	add	x2, sp, #80
	mov	x0, x19
	mov	w3, #1
	bl	_pvr2_encoder_write_words
	mov	x24, x0
	b	LBB0_24
LBB0_48:
	mov	x9, #0
	sub	x10, x8, #1
	mvn	w11, w10
	tst	x11, #0xfffffffc
	b.eq	LBB0_45
; %bb.49:
	lsr	x10, x10, #32
	cbnz	x10, LBB0_45
; %bb.50:
	and	x9, x8, #0xfffffff0
	add	x10, x20, #32
	add	x11, sp, #16
	add	x11, x11, #32
	mov	x12, x9
LBB0_51:                                ; =>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_51
; %bb.52:
	cmp	x9, x8
	b.ne	LBB0_45
	b	LBB0_47
LBB0_53:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdr	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpAdd	Lloh56, Lloh57
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpAdd	Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpAdd	Lloh60, Lloh61
	.loh AdrpAdd	Lloh58, Lloh59
	.loh AdrpAdd	Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh62, Lloh63, Lloh64
	.loh AdrpLdrGot	Lloh67, Lloh68
	.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
	.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
