	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_claim_stream              ## -- Begin function cx18_claim_stream
	.p2align	4, 0x90
_cx18_claim_stream:                     ## @cx18_claim_stream
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_CX18_ENC_STREAM_TYPE_IDX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_CX18_WARN
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_14
LBB0_2:
	movl	%esi, %r12d
	movq	%rdi, %rbx
	movq	8(%rdi), %r14
	movq	(%r14), %r13
	movslq	%esi, %r15
	movq	_CX18_F_S_CLAIMED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	4(,%r15,8), %rsi
	addq	%r13, %rsi
	callq	_test_and_set_bit
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movl	(%r13,%r15,8), %ecx
	movl	(%rbx), %eax
	xorl	%r14d, %r14d
	cmpl	%eax, %ecx
	je	LBB0_14
## %bb.4:
	cmpl	$-1, %ecx
	jne	LBB0_7
## %bb.5:
	movq	_CX18_ENC_STREAM_TYPE_VBI@GOTPCREL(%rip), %rcx
	cmpl	%r12d, (%rcx)
	jne	LBB0_7
## %bb.6:
	movl	%eax, (%r13,%r15,8)
	leaq	L_.str.1(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_CX18_DEBUG_INFO
	jmp	LBB0_14
LBB0_8:
	movq	%r14, %rcx
	movl	(%rbx), %eax
	movl	%eax, (%r13,%r15,8)
	movq	_CX18_ENC_STREAM_TYPE_MPG@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	cmpl	%r12d, (%rax)
	jne	LBB0_14
## %bb.9:
	movq	_CX18_ENC_STREAM_TYPE_IDX@GOTPCREL(%rip), %rax
	movslq	(%rax), %rbx
	shlq	$3, %rbx
	addq	(%rcx), %rbx
	cmpq	$0, 8(%rcx)
	je	LBB0_12
## %bb.10:
	movq	%rcx, %r15
	movq	%rcx, %rdi
	callq	_cx18_raw_vbi
	testl	%eax, %eax
	je	LBB0_11
LBB0_12:
	movq	%rbx, %rdi
	callq	_cx18_stream_enabled
	testl	%eax, %eax
	jne	LBB0_13
	jmp	LBB0_14
LBB0_7:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r14d, %r14d
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_CX18_DEBUG_INFO
	movq	_EBUSY@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_14
LBB0_11:
	movq	_CX18_ENC_STREAM_TYPE_VBI@GOTPCREL(%rip), %rax
	movslq	(%rax), %rbx
	shlq	$3, %rbx
	addq	(%r15), %rbx
LBB0_13:
	movq	_CX18_F_S_CLAIMED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addq	$4, %rbx
	movq	%rbx, %rsi
	callq	_set_bit
	movq	_CX18_F_S_INTERNAL_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	callq	_set_bit
LBB0_14:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CX18_ENC_STREAM_TYPE_IDX,4,2   ## @CX18_ENC_STREAM_TYPE_IDX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"MPEG Index stream cannot be claimed directly, but something tried.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CX18_F_S_CLAIMED,4,2           ## @CX18_F_S_CLAIMED
	.comm	_CX18_ENC_STREAM_TYPE_VBI,4,2   ## @CX18_ENC_STREAM_TYPE_VBI
L_.str.1:                               ## @.str.1
	.asciz	"Start Read VBI\n"

L_.str.2:                               ## @.str.2
	.asciz	"Stream %d is busy\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_CX18_ENC_STREAM_TYPE_MPG,4,2   ## @CX18_ENC_STREAM_TYPE_MPG
	.comm	_CX18_F_S_INTERNAL_USE,4,2      ## @CX18_F_S_INTERNAL_USE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_claim_stream              ; -- Begin function cx18_claim_stream
	.p2align	2
_cx18_claim_stream:                     ; @cx18_claim_stream
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
Lloh0:
	adrp	x23, _CX18_ENC_STREAM_TYPE_IDX@GOTPAGE
Lloh1:
	ldr	x23, [x23, _CX18_ENC_STREAM_TYPE_IDX@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, w1
	b.ne	LBB0_3
; %bb.1:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_CX18_WARN
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
LBB0_3:
	mov	x19, x1
	mov	x21, x0
	ldr	x20, [x0, #8]
	ldr	x8, [x20]
	sxtw	x9, w19
	add	x24, x8, w1, sxtw #3
Lloh6:
	adrp	x22, _CX18_F_S_CLAIMED@GOTPAGE
Lloh7:
	ldr	x22, [x22, _CX18_F_S_CLAIMED@GOTPAGEOFF]
	ldr	w0, [x22]
	add	x8, x8, x9, lsl #3
	add	x1, x8, #4
	bl	_test_and_set_bit
	cbz	x0, LBB0_7
; %bb.4:
	ldr	w9, [x24]
	ldr	w8, [x21]
	cmp	w9, w8
	b.eq	LBB0_14
; %bb.5:
Lloh8:
	adrp	x10, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGE
Lloh9:
	ldr	x10, [x10, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	cmn	w9, #1
	ccmp	w10, w19, #0, eq
	b.eq	LBB0_11
; %bb.6:
                                        ; kill: def $w19 killed $w19 killed $x19 def $x19
	str	x19, [sp]
Lloh11:
	adrp	x0, l_.str.2@PAGE
Lloh12:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_CX18_DEBUG_INFO
Lloh13:
	adrp	x8, _EBUSY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_2
LBB0_7:
	ldr	w8, [x21]
	str	w8, [x24]
Lloh15:
	adrp	x8, _CX18_ENC_STREAM_TYPE_MPG@GOTPAGE
Lloh16:
	ldr	x8, [x8, _CX18_ENC_STREAM_TYPE_MPG@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_14
; %bb.8:
	ldrsw	x19, [x23]
	ldp	x21, x8, [x20]
	cbz	x8, LBB0_10
; %bb.9:
	mov	x0, x20
	bl	_cx18_raw_vbi
	cbz	w0, LBB0_12
LBB0_10:
	add	x19, x21, x19, lsl #3
	mov	x0, x19
	bl	_cx18_stream_enabled
	cbnz	w0, LBB0_13
	b	LBB0_15
LBB0_11:
	str	w8, [x24]
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_CX18_DEBUG_INFO
	b	LBB0_14
LBB0_12:
	ldr	x8, [x20]
Lloh20:
	adrp	x9, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGE
Lloh21:
	ldr	x9, [x9, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGEOFF]
Lloh22:
	ldrsw	x9, [x9]
	add	x19, x8, x9, lsl #3
LBB0_13:
	ldr	w0, [x22]
	add	x19, x19, #4
	mov	x1, x19
	bl	_set_bit
Lloh23:
	adrp	x8, _CX18_F_S_INTERNAL_USE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CX18_F_S_INTERNAL_USE@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	mov	x1, x19
	bl	_set_bit
LBB0_14:
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_CX18_ENC_STREAM_TYPE_IDX,4,2   ; @CX18_ENC_STREAM_TYPE_IDX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"MPEG Index stream cannot be claimed directly, but something tried.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CX18_F_S_CLAIMED,4,2           ; @CX18_F_S_CLAIMED
	.comm	_CX18_ENC_STREAM_TYPE_VBI,4,2   ; @CX18_ENC_STREAM_TYPE_VBI
l_.str.1:                               ; @.str.1
	.asciz	"Start Read VBI\n"

l_.str.2:                               ; @.str.2
	.asciz	"Stream %d is busy\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_CX18_ENC_STREAM_TYPE_MPG,4,2   ; @CX18_ENC_STREAM_TYPE_MPG
	.comm	_CX18_F_S_INTERNAL_USE,4,2      ; @CX18_F_S_INTERNAL_USE
.subsections_via_symbols
