	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bttv_release
_bttv_release:                          ## @bttv_release
	.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	%rdi, %r15
	movq	(%rdi), %rbx
	movq	24(%rbx), %r14
	movq	_RESOURCE_OVERLAY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_check_btres
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	callq	_bttv_switch_overlay
LBB0_2:
	movq	_RESOURCE_VIDEO_STREAM@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_check_btres
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	16(%rbx), %rdi
	callq	_videobuf_streamoff
	movl	(%r12), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_free_btres_lock
LBB0_4:
	leaq	16(%rbx), %r12
	movq	16(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_6
## %bb.5:
	movq	%r12, %rdi
	callq	_buffer_release
	movq	(%r12), %rdi
	callq	_kfree
LBB0_6:
	movq	_RESOURCE_VIDEO_READ@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_check_btres
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movl	(%r13), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_free_btres_lock
LBB0_8:
	movq	_RESOURCE_VBI@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_check_btres
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	leaq	8(%rbx), %rdi
	callq	_videobuf_stop
	movl	(%r13), %edx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_free_btres_lock
LBB0_10:
	movq	%r12, %rdi
	callq	_videobuf_mmap_free
	leaq	8(%rbx), %rdi
	callq	_videobuf_mmap_free
	movq	$0, (%r15)
	decl	4(%r14)
	movq	%r14, %rdi
	callq	_bttv_field_count
	cmpl	$0, 4(%r14)
	jne	LBB0_12
## %bb.11:
	movl	(%r14), %esi
	movq	%r14, %rdi
	callq	_audio_mute
LBB0_12:
	movq	%rbx, %rdi
	callq	_v4l2_fh_del
	movq	%rbx, %rdi
	callq	_v4l2_fh_exit
	movq	%rbx, %rdi
	callq	_kfree
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RESOURCE_OVERLAY,4,2           ## @RESOURCE_OVERLAY
	.comm	_RESOURCE_VIDEO_STREAM,4,2      ## @RESOURCE_VIDEO_STREAM
	.comm	_RESOURCE_VIDEO_READ,4,2        ## @RESOURCE_VIDEO_READ
	.comm	_RESOURCE_VBI,4,2               ## @RESOURCE_VBI
	.no_dead_strip	_bttv_release
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bttv_release
_bttv_release:                          ; @bttv_release
	.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
	mov	x21, x0
	ldr	x19, [x0]
	ldr	x20, [x19, #24]
Lloh0:
	adrp	x8, _RESOURCE_OVERLAY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RESOURCE_OVERLAY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_check_btres
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	mov	x1, x19
	mov	x2, #0
	bl	_bttv_switch_overlay
LBB0_2:
Lloh3:
	adrp	x22, _RESOURCE_VIDEO_STREAM@GOTPAGE
Lloh4:
	ldr	x22, [x22, _RESOURCE_VIDEO_STREAM@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_check_btres
	cbz	x0, LBB0_4
; %bb.3:
	add	x0, x19, #16
	bl	_videobuf_streamoff
	ldr	w2, [x22]
	mov	x0, x20
	mov	x1, x19
	bl	_free_btres_lock
LBB0_4:
	mov	x22, x19
	ldr	x1, [x22, #16]!
	cbz	x1, LBB0_6
; %bb.5:
	mov	x0, x22
	bl	_buffer_release
	ldr	x0, [x22]
	bl	_kfree
LBB0_6:
Lloh5:
	adrp	x23, _RESOURCE_VIDEO_READ@GOTPAGE
Lloh6:
	ldr	x23, [x23, _RESOURCE_VIDEO_READ@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_check_btres
	cbz	x0, LBB0_8
; %bb.7:
	ldr	w2, [x23]
	mov	x0, x20
	mov	x1, x19
	bl	_free_btres_lock
LBB0_8:
Lloh7:
	adrp	x23, _RESOURCE_VBI@GOTPAGE
Lloh8:
	ldr	x23, [x23, _RESOURCE_VBI@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_check_btres
	cbz	x0, LBB0_10
; %bb.9:
	add	x0, x19, #8
	bl	_videobuf_stop
	ldr	w2, [x23]
	mov	x0, x20
	mov	x1, x19
	bl	_free_btres_lock
LBB0_10:
	mov	x0, x22
	bl	_videobuf_mmap_free
	add	x0, x19, #8
	bl	_videobuf_mmap_free
	str	xzr, [x21]
	ldr	w8, [x20, #4]
	sub	w8, w8, #1
	str	w8, [x20, #4]
	mov	x0, x20
	bl	_bttv_field_count
	ldr	w8, [x20, #4]
	cbnz	w8, LBB0_12
; %bb.11:
	ldr	w1, [x20]
	mov	x0, x20
	bl	_audio_mute
LBB0_12:
	mov	x0, x19
	bl	_v4l2_fh_del
	mov	x0, x19
	bl	_v4l2_fh_exit
	mov	x0, x19
	bl	_kfree
	mov	w0, #0
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_RESOURCE_OVERLAY,4,2           ; @RESOURCE_OVERLAY
	.comm	_RESOURCE_VIDEO_STREAM,4,2      ; @RESOURCE_VIDEO_STREAM
	.comm	_RESOURCE_VIDEO_READ,4,2        ; @RESOURCE_VIDEO_READ
	.comm	_RESOURCE_VBI,4,2               ; @RESOURCE_VBI
	.no_dead_strip	_bttv_release
.subsections_via_symbols
