	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_saa7146_stop_preview           ## -- Begin function saa7146_stop_preview
	.p2align	4, 0x90
_saa7146_stop_preview:                  ## @saa7146_stop_preview
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	(%rdi), %rsi
	movq	(%rsi), %r14
	leaq	L_.str(%rip), %rdi
	movq	%rbx, %rdx
	callq	_DEB_EE
	movq	%rbx, %rdi
	callq	_IS_CAPTURE_ACTIVE
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	leaq	L_.str.1(%rip), %rdi
LBB0_2:
	callq	_DEB_D
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_3:
	movq	_STATUS_OVERLAY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_4
## %bb.5:
	cmpq	%rbx, 8(%r14)
	je	LBB0_7
## %bb.6:
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.2(%rip), %rdi
	callq	_DEB_D
	jmp	LBB0_8
LBB0_7:
	movl	$0, (%r14)
	movq	$0, 8(%r14)
	movq	%rbx, %rdi
	callq	_saa7146_disable_overlay
	movq	_RESOURCE_DMA1_HPS@GOTPCREL(%rip), %rax
	movq	_RESOURCE_DMA2_CLP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_saa7146_res_free
LBB0_8:
	xorl	%eax, %eax
LBB0_9:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dev:%p, fh:%p\n"

L_.str.1:                               ## @.str.1
	.asciz	"streaming capture is active\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_STATUS_OVERLAY,4,2             ## @STATUS_OVERLAY
L_.str.2:                               ## @.str.2
	.asciz	"no active overlay\n"

L_.str.3:                               ## @.str.3
	.asciz	"overlay is active, but in another open\n"

	.comm	_RESOURCE_DMA1_HPS,4,2          ## @RESOURCE_DMA1_HPS
	.comm	_RESOURCE_DMA2_CLP,4,2          ## @RESOURCE_DMA2_CLP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_saa7146_stop_preview           ; -- Begin function saa7146_stop_preview
	.p2align	2
_saa7146_stop_preview:                  ; @saa7146_stop_preview
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x1, [x0]
	ldr	x20, [x1]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x19
	bl	_DEB_EE
	mov	x0, x19
	bl	_IS_CAPTURE_ACTIVE
	cbz	x0, LBB0_3
; %bb.1:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_2:
	bl	_DEB_D
Lloh4:
	adrp	x8, _EBUSY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_3:
	ldr	w8, [x20]
Lloh7:
	adrp	x9, _STATUS_OVERLAY@GOTPAGE
Lloh8:
	ldr	x9, [x9, _STATUS_OVERLAY@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.4:
	ldr	x8, [x20, #8]
	cmp	x8, x19
	b.eq	LBB0_7
; %bb.5:
Lloh10:
	adrp	x0, l_.str.3@PAGE
Lloh11:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_2
LBB0_6:
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DEB_D
	b	LBB0_8
LBB0_7:
	str	wzr, [x20]
	str	xzr, [x20, #8]
	mov	x0, x19
	bl	_saa7146_disable_overlay
Lloh14:
	adrp	x8, _RESOURCE_DMA1_HPS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _RESOURCE_DMA1_HPS@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _RESOURCE_DMA2_CLP@GOTPAGE
Lloh18:
	ldr	x9, [x9, _RESOURCE_DMA2_CLP@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x19
	bl	_saa7146_res_free
LBB0_8:
	mov	w0, #0
LBB0_9:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dev:%p, fh:%p\n"

l_.str.1:                               ; @.str.1
	.asciz	"streaming capture is active\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_STATUS_OVERLAY,4,2             ; @STATUS_OVERLAY
l_.str.2:                               ; @.str.2
	.asciz	"no active overlay\n"

l_.str.3:                               ; @.str.3
	.asciz	"overlay is active, but in another open\n"

	.comm	_RESOURCE_DMA1_HPS,4,2          ; @RESOURCE_DMA1_HPS
	.comm	_RESOURCE_DMA2_CLP,4,2          ; @RESOURCE_DMA2_CLP
.subsections_via_symbols
