	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stv_close
_stv_close:                             ## @stv_close
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	(%rdi), %rdi
	callq	_video_get_drvdata
	movq	%rax, %r15
	movq	_STV680_NUMFRAMES@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_3
## %bb.1:
	movq	40(%r15), %rax
	xorl	%ecx, %ecx
	movq	_FRAME_UNUSED@GOTPCREL(%rip), %rdx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rdx), %esi
	movl	%esi, (%rax,%rcx,4)
	incq	%rcx
	movslq	(%rbx), %rsi
	cmpq	%rsi, %rcx
	jl	LBB0_2
LBB0_3:
	cmpq	$0, 32(%r15)
	je	LBB0_5
## %bb.4:
	movq	%r15, %rdi
	callq	_stv680_stop_stream
LBB0_5:
	movq	%r15, %rdi
	callq	_stv_stop_video
	testl	%eax, %eax
	jns	LBB0_7
## %bb.6:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_PDEBUG
LBB0_7:
	movl	24(%r15), %edi
	movl	(%rbx), %esi
	imull	(%r15), %esi
	callq	_rvfree
	movq	$0, 16(%r15)
	cmpq	$0, 8(%r15)
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	callq	_kfree
	leaq	L_.str.1(%rip), %rsi
	xorl	%edi, %edi
	callq	_PDEBUG
LBB0_9:
	movq	$0, (%r14)
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STV680_NUMFRAMES,4,2           ## @STV680_NUMFRAMES
	.comm	_FRAME_UNUSED,4,2               ## @FRAME_UNUSED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"STV(e): stop_video failed in stv_close"

L_.str.1:                               ## @.str.1
	.asciz	"STV(i): device unregistered"

	.no_dead_strip	_stv_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stv_close
_stv_close:                             ; @stv_close
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	ldr	x0, [x0]
	bl	_video_get_drvdata
	mov	x20, x0
Lloh0:
	adrp	x21, _STV680_NUMFRAMES@GOTPAGE
Lloh1:
	ldr	x21, [x21, _STV680_NUMFRAMES@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	x8, #0
	ldr	x9, [x20, #40]
Lloh2:
	adrp	x10, _FRAME_UNUSED@GOTPAGE
Lloh3:
	ldr	x10, [x10, _FRAME_UNUSED@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x10]
	str	w11, [x9, x8, lsl #2]
	add	x8, x8, #1
	ldrsw	x11, [x21]
	cmp	x8, x11
	b.lt	LBB0_2
LBB0_3:
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_5
; %bb.4:
	mov	x0, x20
	bl	_stv680_stop_stream
LBB0_5:
	mov	x0, x20
	bl	_stv_stop_video
	tbz	w0, #31, LBB0_7
; %bb.6:
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_PDEBUG
LBB0_7:
	ldr	w0, [x20, #24]
	ldr	w8, [x20]
	ldr	w9, [x21]
	mul	w1, w9, w8
	bl	_rvfree
	str	xzr, [x20, #16]
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_9
; %bb.8:
	mov	x0, x20
	bl	_kfree
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #0
	bl	_PDEBUG
LBB0_9:
	str	xzr, [x19]
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_STV680_NUMFRAMES,4,2           ; @STV680_NUMFRAMES
	.comm	_FRAME_UNUSED,4,2               ; @FRAME_UNUSED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"STV(e): stop_video failed in stv_close"

l_.str.1:                               ; @.str.1
	.asciz	"STV(i): device unregistered"

	.no_dead_strip	_stv_close
.subsections_via_symbols
