	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_release_stream            ## -- Begin function cx18_release_stream
	.p2align	4, 0x90
_cx18_release_stream:                   ## @cx18_release_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	8(%rdi), %rax
	movq	24(%rdi), %r15
	movl	$-1, (%rdi)
	movq	_CX18_ENC_STREAM_TYPE_IDX@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	je	LBB0_9
## %bb.1:
	movq	%rdi, %rbx
	movq	_CX18_ENC_STREAM_TYPE_VBI@GOTPCREL(%rip), %r13
	cmpq	(%r13), %rax
	jne	LBB0_3
## %bb.2:
	movq	_CX18_F_S_INTERNAL_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	16(%rbx), %rsi
	callq	_test_bit
	testq	%rax, %rax
	jne	LBB0_9
LBB0_3:
	movq	_CX18_F_S_CLAIMED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	16(%rbx), %rsi
	callq	_test_and_clear_bit
	testq	%rax, %rax
	je	LBB0_10
## %bb.4:
	movq	%rbx, %rdi
	callq	_cx18_flush_queues
	movq	8(%rbx), %rax
	movq	_CX18_ENC_STREAM_TYPE_MPG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.5:
	movq	(%r15), %rbx
	movq	(%r14), %r12
	movq	_CX18_F_S_INTERNAL_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shlq	$5, %r12
	leaq	(%rbx,%r12), %r14
	addq	$16, %r14
	movq	%r14, %rsi
	callq	_test_and_clear_bit
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	addq	%r12, %rbx
	movq	_CX18_F_S_CLAIMED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_clear_bit
	movq	%rbx, %rdi
	callq	_cx18_flush_queues
LBB0_7:
	movq	(%r15), %r15
	movq	(%r13), %rbx
	shlq	$5, %rbx
	movq	_CX18_F_S_INTERNAL_USE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	(%r15,%rbx), %r14
	addq	$16, %r14
	movq	%r14, %rsi
	callq	_test_and_clear_bit
	testq	%rax, %rax
	movq	_CX18_F_S_CLAIMED@GOTPCREL(%rip), %rax
	je	LBB0_9
## %bb.8:
	addq	%rbx, %r15
	cmpl	$-1, (%r15)
	je	LBB0_11
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	20(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_CX18_DEBUG_WARN                ## TAILCALL
LBB0_11:
	movl	(%rax), %edi
	movq	%r14, %rsi
	callq	_clear_bit
	movq	%r15, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_cx18_flush_queues              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_CX18_ENC_STREAM_TYPE_IDX,8,3   ## @CX18_ENC_STREAM_TYPE_IDX
	.comm	_CX18_ENC_STREAM_TYPE_VBI,8,3   ## @CX18_ENC_STREAM_TYPE_VBI
	.comm	_CX18_F_S_INTERNAL_USE,4,2      ## @CX18_F_S_INTERNAL_USE
	.comm	_CX18_F_S_CLAIMED,4,2           ## @CX18_F_S_CLAIMED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Release stream %s not in use!\n"

	.comm	_CX18_ENC_STREAM_TYPE_MPG,8,3   ## @CX18_ENC_STREAM_TYPE_MPG
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx18_release_stream            ; -- Begin function cx18_release_stream
	.p2align	2
_cx18_release_stream:                   ; @cx18_release_stream
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x21, [x0, #24]
	mov	w8, #-1
	str	w8, [x0]
	ldr	x8, [x0, #8]
Lloh0:
	adrp	x20, _CX18_ENC_STREAM_TYPE_IDX@GOTPAGE
Lloh1:
	ldr	x20, [x20, _CX18_ENC_STREAM_TYPE_IDX@GOTPAGEOFF]
	ldr	x9, [x20]
	cmp	x8, x9
	b.eq	LBB0_9
; %bb.1:
	mov	x19, x0
Lloh2:
	adrp	x23, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CX18_ENC_STREAM_TYPE_VBI@GOTPAGEOFF]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh4:
	adrp	x8, _CX18_F_S_INTERNAL_USE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CX18_F_S_INTERNAL_USE@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	add	x1, x19, #16
	bl	_test_bit
	cbnz	x0, LBB0_9
LBB0_3:
Lloh7:
	adrp	x22, _CX18_F_S_CLAIMED@GOTPAGE
Lloh8:
	ldr	x22, [x22, _CX18_F_S_CLAIMED@GOTPAGEOFF]
	ldr	w0, [x22]
	add	x1, x19, #16
	bl	_test_and_clear_bit
	cbz	x0, LBB0_10
; %bb.4:
	mov	x0, x19
	bl	_cx18_flush_queues
	ldr	x8, [x19, #8]
Lloh9:
	adrp	x9, _CX18_ENC_STREAM_TYPE_MPG@GOTPAGE
Lloh10:
	ldr	x9, [x9, _CX18_ENC_STREAM_TYPE_MPG@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.5:
	ldr	x8, [x21]
	ldr	x9, [x20]
Lloh12:
	adrp	x24, _CX18_F_S_INTERNAL_USE@GOTPAGE
Lloh13:
	ldr	x24, [x24, _CX18_F_S_INTERNAL_USE@GOTPAGEOFF]
	ldr	w0, [x24]
	add	x19, x8, x9, lsl #5
	add	x20, x19, #16
	mov	x1, x20
	bl	_test_and_clear_bit
	cbz	x0, LBB0_7
; %bb.6:
	ldr	w0, [x22]
	mov	x1, x20
	bl	_clear_bit
	mov	x0, x19
	bl	_cx18_flush_queues
LBB0_7:
	ldr	x8, [x21]
	ldr	x9, [x23]
	add	x19, x8, x9, lsl #5
	ldr	w0, [x24]
	add	x20, x19, #16
	mov	x1, x20
	bl	_test_and_clear_bit
	cbz	x0, LBB0_9
; %bb.8:
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_11
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w1, [x19, #20]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_CX18_DEBUG_WARN
LBB0_11:
	ldr	w0, [x22]
	mov	x1, x20
	bl	_clear_bit
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_cx18_flush_queues
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_CX18_ENC_STREAM_TYPE_IDX,8,3   ; @CX18_ENC_STREAM_TYPE_IDX
	.comm	_CX18_ENC_STREAM_TYPE_VBI,8,3   ; @CX18_ENC_STREAM_TYPE_VBI
	.comm	_CX18_F_S_INTERNAL_USE,4,2      ; @CX18_F_S_INTERNAL_USE
	.comm	_CX18_F_S_CLAIMED,4,2           ; @CX18_F_S_CLAIMED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Release stream %s not in use!\n"

	.comm	_CX18_ENC_STREAM_TYPE_MPG,8,3   ; @CX18_ENC_STREAM_TYPE_MPG
.subsections_via_symbols
