	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stv680_newframe
_stv680_newframe:                       ## @stv680_newframe
	.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
	cmpq	$0, 40(%rdi)
	je	LBB0_11
## %bb.1:
	movq	%rdi, %rbx
	movslq	%esi, %r15
	shlq	$4, %r15
	movq	_BUFFER_READY@GOTPCREL(%rip), %r14
	xorl	%r13d, %r13d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, 8(%rbx)
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %r12d
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	$2, %edi
	callq	_PDEBUG
	movq	%rbx, %rdi
	callq	_stv680_stop_stream
	movq	%rbx, %rdi
	callq	_stv680_start_stream
	movl	%r12d, %r13d
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpq	$0, 40(%rbx)
	je	LBB0_11
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	24(%rbx), %rax
	movq	(%rax,%r15), %rcx
	movq	_FRAME_READY@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_FRAME_GRABBING@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_11
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$1, 8(%rax,%r15)
	adcl	$0, %r13d
	movl	32(%rbx), %edi
	movq	(%rbx), %rax
	movq	16(%rbx), %rcx
	movq	(%rcx,%rax,8), %rax
	xorl	%esi, %esi
	cmpq	(%r14), %rax
	sete	%sil
	callq	_wait_event_interruptible
	movq	8(%rbx), %rax
	movq	_STV680_MAX_NULLPACKETS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jg	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rax
	movq	16(%rbx), %rcx
	movq	(%rcx,%rax,8), %rdx
	cmpq	(%r14), %rdx
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_BUFFER_BUSY@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, (%rcx,%rax,8)
	leaq	(%rcx,%rax,8), %rsi
	movq	%rbx, %rdi
	callq	_bayer_unshuffle
	movq	_BUFFER_UNUSED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rbx), %rcx
	movq	16(%rbx), %rdx
	movq	%rax, (%rdx,%rcx,8)
	incq	%rcx
	movq	%rcx, (%rbx)
	xorl	%r12d, %r12d
	movq	_STV680_NUMSCRATCH@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	cmovaeq	%r12, %rcx
	movq	%rcx, (%rbx)
	leaq	L_.str.2(%rip), %rsi
	movq	_STV680_MAX_ERRORS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jg	LBB0_9
	jmp	LBB0_10
LBB0_11:
	xorl	%eax, %eax
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_FRAME_ERROR@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	24(%rbx), %rcx
	movq	%rax, (%rcx,%r15)
	leaq	L_.str.1(%rip), %rsi
	movl	$2, %edi
	callq	_PDEBUG
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_FRAME_READY,8,3                ## @FRAME_READY
	.comm	_FRAME_GRABBING,8,3             ## @FRAME_GRABBING
	.comm	_BUFFER_READY,8,3               ## @BUFFER_READY
	.comm	_STV680_MAX_NULLPACKETS,8,3     ## @STV680_MAX_NULLPACKETS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"STV(i): too many null length packets, restarting capture"

	.comm	_FRAME_ERROR,8,3                ## @FRAME_ERROR
L_.str.1:                               ## @.str.1
	.asciz	"STV(e): FRAME_ERROR in _newframe"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_BUFFER_BUSY,8,3                ## @BUFFER_BUSY
	.comm	_BUFFER_UNUSED,8,3              ## @BUFFER_UNUSED
	.comm	_STV680_NUMSCRATCH,8,3          ## @STV680_NUMSCRATCH
	.comm	_STV680_MAX_ERRORS,4,2          ## @STV680_MAX_ERRORS
L_.str.2:                               ## @.str.2
	.asciz	"STV(i): too many errors, restarting capture"

	.no_dead_strip	_stv680_newframe
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stv680_newframe
_stv680_newframe:                       ; @stv680_newframe
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
                                        ; kill: def $w1 killed $w1 def $x1
	ldr	x8, [x0, #40]
	cbz	x8, LBB0_10
; %bb.1:
	mov	x19, x0
	mov	w21, #0
	sxtw	x22, w1
	lsl	x20, x22, #4
Lloh0:
	adrp	x23, _FRAME_READY@GOTPAGE
Lloh1:
	ldr	x23, [x23, _FRAME_READY@GOTPAGEOFF]
Lloh2:
	adrp	x24, _FRAME_GRABBING@GOTPAGE
Lloh3:
	ldr	x24, [x24, _FRAME_GRABBING@GOTPAGEOFF]
Lloh4:
	adrp	x25, _BUFFER_READY@GOTPAGE
Lloh5:
	ldr	x25, [x25, _BUFFER_READY@GOTPAGEOFF]
Lloh6:
	adrp	x26, _STV680_MAX_NULLPACKETS@GOTPAGE
Lloh7:
	ldr	x26, [x26, _STV680_MAX_NULLPACKETS@GOTPAGEOFF]
Lloh8:
	adrp	x27, l_.str@PAGE
Lloh9:
	add	x27, x27, l_.str@PAGEOFF
Lloh10:
	adrp	x28, _STV680_MAX_ERRORS@GOTPAGE
Lloh11:
	ldr	x28, [x28, _STV680_MAX_ERRORS@GOTPAGEOFF]
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
	str	xzr, [x19, #8]
	mov	x1, x27
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	w0, #2
	bl	_PDEBUG
	mov	x0, x19
	bl	_stv680_stop_stream
	mov	x0, x19
	bl	_stv680_start_stream
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_10
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #24]
	ldr	x9, [x8, x20]
	ldr	x10, [x23]
	ldr	x11, [x24]
	cmp	x9, x10
	ccmp	x9, x11, #4, ne
	b.ne	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x8, x8, x22, lsl #4
	ldr	w8, [x8, #8]
	cmp	w8, #0
	cinc	w21, w21, eq
	ldr	w0, [x19, #32]
	ldr	x8, [x19, #16]
	ldr	x9, [x19]
	ldr	x8, [x8, x9, lsl #3]
	ldr	x9, [x25]
	cmp	x8, x9
	cset	w1, eq
	bl	_wait_event_interruptible
	ldr	x8, [x19, #8]
	ldr	x9, [x26]
	cmp	x8, x9
	b.gt	LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #16]
	ldr	x9, [x19]
	ldr	x10, [x8, x9, lsl #3]
	ldr	x11, [x25]
	cmp	x10, x11
	b.ne	LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh12:
	adrp	x10, _BUFFER_BUSY@GOTPAGE
Lloh13:
	ldr	x10, [x10, _BUFFER_BUSY@GOTPAGEOFF]
Lloh14:
	ldr	x10, [x10]
	add	x1, x8, x9, lsl #3
	str	x10, [x1]
	mov	x0, x19
	bl	_bayer_unshuffle
Lloh15:
	adrp	x8, _BUFFER_UNUSED@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BUFFER_UNUSED@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	ldr	x9, [x19, #16]
	ldr	x10, [x19]
	str	x8, [x9, x10, lsl #3]
	add	x8, x10, #1
	str	x8, [x19]
Lloh18:
	adrp	x9, _STV680_NUMSCRATCH@GOTPAGE
Lloh19:
	ldr	x9, [x9, _STV680_NUMSCRATCH@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x8, x9
	csinc	x8, xzr, x10, hs
	str	x8, [x19]
	ldr	w8, [x28]
	cmp	w21, w8
	b.le	LBB0_4
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	w21, #0
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_3
LBB0_10:
	mov	w0, #0
LBB0_11:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
Lloh23:
	adrp	x8, _FRAME_ERROR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _FRAME_ERROR@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	ldr	x9, [x19, #24]
	str	x8, [x9, x20]
Lloh26:
	adrp	x1, l_.str.1@PAGE
Lloh27:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #2
	bl	_PDEBUG
Lloh28:
	adrp	x8, _EIO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_FRAME_READY,8,3                ; @FRAME_READY
	.comm	_FRAME_GRABBING,8,3             ; @FRAME_GRABBING
	.comm	_BUFFER_READY,8,3               ; @BUFFER_READY
	.comm	_STV680_MAX_NULLPACKETS,8,3     ; @STV680_MAX_NULLPACKETS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"STV(i): too many null length packets, restarting capture"

	.comm	_FRAME_ERROR,8,3                ; @FRAME_ERROR
l_.str.1:                               ; @.str.1
	.asciz	"STV(e): FRAME_ERROR in _newframe"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_BUFFER_BUSY,8,3                ; @BUFFER_BUSY
	.comm	_BUFFER_UNUSED,8,3              ; @BUFFER_UNUSED
	.comm	_STV680_NUMSCRATCH,8,3          ; @STV680_NUMSCRATCH
	.comm	_STV680_MAX_ERRORS,4,2          ; @STV680_MAX_ERRORS
l_.str.2:                               ; @.str.2
	.asciz	"STV(i): too many errors, restarting capture"

	.no_dead_strip	_stv680_newframe
.subsections_via_symbols
