	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function video_begin
_video_begin:                           ## @video_begin
	.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), %r14
	movq	(%r14), %r13
	leaq	L_.str(%rip), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	callq	_DEB_EE
	movl	(%r13), %eax
	movq	_STATUS_CAPTURE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.1:
	cmpq	%r15, 8(%r13)
	je	LBB0_2
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DEB_S
LBB0_10:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_12
LBB0_4:
	movq	_STATUS_OVERLAY@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.5:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_DEB_S
	movq	8(%r13), %rdi
	movq	%rdi, 16(%r13)
	callq	_saa7146_stop_preview
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %ebx
	leaq	L_.str.4(%rip), %rdi
	callq	_DEB_D
	jmp	LBB0_12
LBB0_2:
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DEB_S
	jmp	LBB0_12
LBB0_7:
	movl	24(%r13), %esi
	movq	%r14, %rdi
	callq	_saa7146_format_by_fourcc
	movq	%rax, %rbx
	xorl	%edi, %edi
	testq	%rax, %rax
	sete	%dil
	callq	_BUG_ON
	movq	_FORMAT_IS_PLANAR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rbx), %eax
	movq	_RESOURCE_DMA1_HPS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_RESOURCE_DMA2_CLP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r12d
	orl	%ecx, %r12d
	movq	_RESOURCE_DMA3_BRS@GOTPCREL(%rip), %rdx
	orl	(%rdx), %r12d
	testl	%eax, %eax
	cmovel	%ecx, %r12d
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_saa7146_res_get
	testl	%eax, %eax
	je	LBB0_8
## %bb.11:
	movq	_MC2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MASK_27@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movq	%r14, %rdi
	callq	_saa7146_write
	movl	(%rbx), %esi
	movq	%r14, %rdi
	callq	_SAA7146_IER_ENABLE
	movq	%r15, 8(%r13)
	movq	_STATUS_CAPTURE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r13)
	xorl	%ebx, %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	leaq	L_.str.5(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_DEB_S
	movq	16(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.9:
	callq	_saa7146_start_preview
	movq	$0, 16(%r13)
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dev:%p, fh:%p\n"

	.comm	_STATUS_CAPTURE,4,2             ## @STATUS_CAPTURE
L_.str.1:                               ## @.str.1
	.asciz	"already capturing\n"

L_.str.2:                               ## @.str.2
	.asciz	"already capturing in another open\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_STATUS_OVERLAY,4,2             ## @STATUS_OVERLAY
L_.str.3:                               ## @.str.3
	.asciz	"warning: suspending overlay video for streaming capture\n"

L_.str.4:                               ## @.str.4
	.asciz	"suspending video failed. aborting\n"

	.comm	_FORMAT_IS_PLANAR,4,2           ## @FORMAT_IS_PLANAR
	.comm	_RESOURCE_DMA1_HPS,4,2          ## @RESOURCE_DMA1_HPS
	.comm	_RESOURCE_DMA2_CLP,4,2          ## @RESOURCE_DMA2_CLP
	.comm	_RESOURCE_DMA3_BRS,4,2          ## @RESOURCE_DMA3_BRS
L_.str.5:                               ## @.str.5
	.asciz	"cannot get capture resource %d\n"

	.comm	_MC2,4,2                        ## @MC2
	.comm	_MASK_27,4,2                    ## @MASK_27
	.no_dead_strip	_video_begin
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function video_begin
_video_begin:                           ; @video_begin
	.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
	mov	x19, x0
	ldr	x20, [x0]
	ldr	x22, [x20]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	mov	x2, x19
	bl	_DEB_EE
	ldr	w8, [x22]
Lloh2:
	adrp	x23, _STATUS_CAPTURE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _STATUS_CAPTURE@GOTPAGEOFF]
	ldr	w9, [x23]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.1:
	ldr	x8, [x22, #8]
	cmp	x8, x19
	b.eq	LBB0_7
; %bb.2:
Lloh4:
	adrp	x0, l_.str.2@PAGE
Lloh5:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DEB_S
LBB0_3:
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_10
LBB0_4:
Lloh9:
	adrp	x9, _STATUS_OVERLAY@GOTPAGE
Lloh10:
	ldr	x9, [x9, _STATUS_OVERLAY@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.5:
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DEB_S
	ldr	x0, [x22, #8]
	str	x0, [x22, #16]
	bl	_saa7146_stop_preview
	cbz	w0, LBB0_8
; %bb.6:
	mov	x21, x0
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DEB_D
	b	LBB0_10
LBB0_7:
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DEB_S
	mov	w21, #0
	b	LBB0_10
LBB0_8:
	ldr	w1, [x22, #24]
	mov	x0, x20
	bl	_saa7146_format_by_fourcc
	mov	x21, x0
	cmp	x0, #0
	cset	w0, eq
	bl	_BUG_ON
	ldr	w8, [x21]
Lloh18:
	adrp	x9, _FORMAT_IS_PLANAR@GOTPAGE
Lloh19:
	ldr	x9, [x9, _FORMAT_IS_PLANAR@GOTPAGEOFF]
Lloh20:
	adrp	x10, _RESOURCE_DMA1_HPS@GOTPAGE
Lloh21:
	ldr	x10, [x10, _RESOURCE_DMA1_HPS@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
Lloh23:
	ldr	w10, [x10]
Lloh24:
	adrp	x11, _RESOURCE_DMA2_CLP@GOTPAGE
Lloh25:
	ldr	x11, [x11, _RESOURCE_DMA2_CLP@GOTPAGEOFF]
Lloh26:
	ldr	w11, [x11]
	orr	w11, w11, w10
Lloh27:
	adrp	x12, _RESOURCE_DMA3_BRS@GOTPAGE
Lloh28:
	ldr	x12, [x12, _RESOURCE_DMA3_BRS@GOTPAGEOFF]
Lloh29:
	ldr	w12, [x12]
	orr	w11, w11, w12
	tst	w9, w8
	csel	w21, w10, w11, eq
	mov	x0, x19
	mov	x1, x21
	bl	_saa7146_res_get
	cbz	w0, LBB0_11
; %bb.9:
Lloh30:
	adrp	x8, _MC2@GOTPAGE
Lloh31:
	ldr	x8, [x8, _MC2@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
Lloh33:
	adrp	x21, _MASK_27@GOTPAGE
Lloh34:
	ldr	x21, [x21, _MASK_27@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x20
	bl	_saa7146_write
	ldr	w1, [x21]
	mov	x0, x20
	bl	_SAA7146_IER_ENABLE
	mov	w21, #0
	str	x19, [x22, #8]
	ldr	w8, [x23]
	str	w8, [x22]
LBB0_10:
	mov	x0, x21
	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
LBB0_11:
	str	x21, [sp]
Lloh35:
	adrp	x0, l_.str.5@PAGE
Lloh36:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_DEB_S
	ldr	x0, [x22, #16]
	cbz	x0, LBB0_3
; %bb.12:
	bl	_saa7146_start_preview
	str	xzr, [x22, #16]
	b	LBB0_3
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh22
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dev:%p, fh:%p\n"

	.comm	_STATUS_CAPTURE,4,2             ; @STATUS_CAPTURE
l_.str.1:                               ; @.str.1
	.asciz	"already capturing\n"

l_.str.2:                               ; @.str.2
	.asciz	"already capturing in another open\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_STATUS_OVERLAY,4,2             ; @STATUS_OVERLAY
l_.str.3:                               ; @.str.3
	.asciz	"warning: suspending overlay video for streaming capture\n"

l_.str.4:                               ; @.str.4
	.asciz	"suspending video failed. aborting\n"

	.comm	_FORMAT_IS_PLANAR,4,2           ; @FORMAT_IS_PLANAR
	.comm	_RESOURCE_DMA1_HPS,4,2          ; @RESOURCE_DMA1_HPS
	.comm	_RESOURCE_DMA2_CLP,4,2          ; @RESOURCE_DMA2_CLP
	.comm	_RESOURCE_DMA3_BRS,4,2          ; @RESOURCE_DMA3_BRS
l_.str.5:                               ; @.str.5
	.asciz	"cannot get capture resource %d\n"

	.comm	_MC2,4,2                        ; @MC2
	.comm	_MASK_27,4,2                    ; @MASK_27
	.no_dead_strip	_video_begin
.subsections_via_symbols
