	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function zoran_try_fmt_vid_out
_zoran_try_fmt_vid_out:                 ## @zoran_try_fmt_vid_out
	.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	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdx), %rax
	movq	_V4L2_PIX_FMT_MJPEG@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.1:
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	48(%rsi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movups	(%r12), %xmm0
	movups	16(%r12), %xmm1
	movaps	%xmm0, -80(%rbp)
	movaps	%xmm1, -64(%rbp)
	movq	32(%r12), %rax
	movq	%rax, -48(%rbp)
	movl	8(%r15), %edx
	leal	(%rdx,%rdx), %eax
	movq	_BUZ_MAX_HEIGHT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%esi, %esi
	cmpl	%ecx, %eax
	setg	%sil
	movl	$2, %edi
	movl	$2, %ebx
	subl	%esi, %ebx
	movl	%ebx, -80(%rbp)
	movq	$0, -40(%rbp)
	movl	4(%r12), %ebx
	movl	%ebx, %esi
	shrl	$31, %esi
	addl	%ebx, %esi
	sarl	%esi
	xorl	%ebx, %ebx
	cmpl	%esi, %edx
	setg	%bl
	subl	%ebx, %edi
	movl	%edi, -72(%rbp)
	movl	12(%r15), %edx
	movl	12(%r12), %esi
	leal	3(%rsi), %edi
	testl	%esi, %esi
	cmovnsl	%esi, %edi
	sarl	$2, %edi
	cmpl	%edi, %edx
	jle	LBB0_5
## %bb.2:
	movl	%esi, %edi
	shrl	$31, %edi
	addl	%esi, %edi
	sarl	%edi
	cmpl	%edi, %edx
	jle	LBB0_6
## %bb.3:
	movl	$1, -64(%rbp)
	xorl	%edx, %edx
	jmp	LBB0_8
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_11
LBB0_5:
	movl	$4, -64(%rbp)
	jmp	LBB0_7
LBB0_6:
	movl	$2, -64(%rbp)
LBB0_7:
	movb	$1, %dl
LBB0_8:
	xorl	%esi, %esi
	cmpl	%ecx, %eax
	setg	%sil
	incl	%esi
	movl	%esi, -60(%rbp)
	movq	_BUZ_MAX_WIDTH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	$720, %eax                      ## imm = 0x2D0
	sete	%cl
	andb	%dl, %cl
	movzbl	%cl, %ecx
	leal	(,%rcx,8), %edx
	testb	%cl, %cl
	movl	$704, %ecx                      ## imm = 0x2C0
	cmovel	%eax, %ecx
	movl	%edx, -56(%rbp)
	movl	%ecx, -68(%rbp)
	leaq	-80(%rbp), %rsi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_zoran_check_jpg_settings
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.9:
	movl	-68(%rbp), %eax
	cltd
	idivl	-64(%rbp)
	movl	%eax, 12(%r15)
	movl	-80(%rbp), %ecx
	movl	-76(%rbp), %eax
	addl	%eax, %eax
	movl	-72(%rbp), %esi
	imull	%ecx, %esi
	cltd
	idivl	%esi
	cmpl	$1, %ecx
	movq	_V4L2_FIELD_TOP@GOTPCREL(%rip), %rcx
	cmoveq	_V4L2_FIELD_SEQ_TB@GOTPCREL(%rip), %rcx
	movq	_V4L2_FIELD_BOTTOM@GOTPCREL(%rip), %rdx
	cmoveq	_V4L2_FIELD_SEQ_BT@GOTPCREL(%rip), %rdx
	movl	%eax, 8(%r15)
	cmpq	$0, 32(%r12)
	cmovneq	%rcx, %rdx
	movl	(%rdx), %eax
	movl	%eax, 36(%r15)
	leaq	-80(%rbp), %rdi
	callq	_zoran_v4l2_calc_bufsize
	movl	%eax, 32(%r15)
	movq	$0, 24(%r15)
	movq	_V4L2_COLORSPACE_SMPTE170M@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r15)
LBB0_10:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_11:
	movl	%ebx, %eax
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_PIX_FMT_MJPEG,8,3         ## @V4L2_PIX_FMT_MJPEG
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BUZ_MAX_HEIGHT,4,2             ## @BUZ_MAX_HEIGHT
	.comm	_BUZ_MAX_WIDTH,4,2              ## @BUZ_MAX_WIDTH
	.comm	_V4L2_FIELD_SEQ_TB,4,2          ## @V4L2_FIELD_SEQ_TB
	.comm	_V4L2_FIELD_SEQ_BT,4,2          ## @V4L2_FIELD_SEQ_BT
	.comm	_V4L2_FIELD_TOP,4,2             ## @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_BOTTOM,4,2          ## @V4L2_FIELD_BOTTOM
	.comm	_V4L2_COLORSPACE_SMPTE170M,4,2  ## @V4L2_COLORSPACE_SMPTE170M
	.no_dead_strip	_zoran_try_fmt_vid_out
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function zoran_try_fmt_vid_out
_zoran_try_fmt_vid_out:                 ; @zoran_try_fmt_vid_out
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	ldr	x8, [x2]
Lloh0:
	adrp	x9, _V4L2_PIX_FMT_MJPEG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _V4L2_PIX_FMT_MJPEG@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	ldr	x20, [x1, #48]
	mov	x0, x20
	bl	_mutex_lock
Lloh3:
	adrp	x9, _BUZ_MAX_HEIGHT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _BUZ_MAX_HEIGHT@GOTPAGEOFF]
	ldp	w11, w10, [x19, #8]
	lsl	w8, w11, #1
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	mov	w12, #1
	cinc	w13, w12, le
	ldr	w14, [x21, #4]
	cmp	w14, #0
	cinc	w14, w14, lt
	cmp	w11, w14, asr #1
	ldp	q0, q1, [x21]
	stp	q0, q1, [sp]
	ldr	x11, [x21, #32]
	stp	x11, xzr, [sp, #32]
	cinc	w11, w12, le
	str	w13, [sp]
	str	w11, [sp, #8]
	ldr	w11, [x21, #12]
	add	w12, w11, #3
	cmp	w11, #0
	csel	w12, w12, w11, lt
	cmp	w10, w12, asr #2
	b.le	LBB0_5
; %bb.2:
	cmp	w11, #0
	cinc	w11, w11, lt
	cmp	w10, w11, asr #1
	b.le	LBB0_6
; %bb.3:
	mov	w10, #0
	mov	w11, #1
	str	w11, [sp, #16]
	b	LBB0_8
LBB0_4:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_11
LBB0_5:
	mov	w10, #4
	b	LBB0_7
LBB0_6:
	mov	w10, #2
LBB0_7:
	str	w10, [sp, #16]
	mov	w10, #1
LBB0_8:
	cmp	w8, w9
	mov	w8, #1
Lloh9:
	adrp	x9, _BUZ_MAX_WIDTH@GOTPAGE
Lloh10:
	ldr	x9, [x9, _BUZ_MAX_WIDTH@GOTPAGEOFF]
	cinc	w8, w8, gt
Lloh11:
	ldr	w9, [x9]
	cmp	w9, #720
	cset	w11, eq
	tst	w10, w11
	mov	w10, #8
	csel	w10, w10, wzr, ne
	stp	w8, w10, [sp, #20]
	mov	w10, #704
	csel	w9, w10, w9, ne
	str	w9, [sp, #12]
	mov	x1, sp
	mov	x0, x20
	mov	w2, #1
	bl	_zoran_check_jpg_settings
	mov	x22, x0
	cbnz	w0, LBB0_10
; %bb.9:
	ldp	w9, w8, [sp, #12]
	sdiv	w8, w9, w8
	ldp	w9, w10, [sp, #4]
	ldr	w11, [sp]
	lsl	w9, w9, #1
	mul	w10, w10, w11
	sdiv	w9, w9, w10
	stp	w9, w8, [x19, #8]
Lloh12:
	adrp	x8, _V4L2_FIELD_SEQ_TB@GOTPAGE
Lloh13:
	ldr	x8, [x8, _V4L2_FIELD_SEQ_TB@GOTPAGEOFF]
Lloh14:
	adrp	x9, _V4L2_FIELD_TOP@GOTPAGE
Lloh15:
	ldr	x9, [x9, _V4L2_FIELD_TOP@GOTPAGEOFF]
	cmp	w11, #1
	csel	x8, x8, x9, eq
Lloh16:
	adrp	x9, _V4L2_FIELD_SEQ_BT@GOTPAGE
Lloh17:
	ldr	x9, [x9, _V4L2_FIELD_SEQ_BT@GOTPAGEOFF]
Lloh18:
	adrp	x10, _V4L2_FIELD_BOTTOM@GOTPAGE
Lloh19:
	ldr	x10, [x10, _V4L2_FIELD_BOTTOM@GOTPAGEOFF]
	ldr	x11, [x21, #32]
	csel	x9, x9, x10, eq
	cmp	x11, #0
	csel	x8, x9, x8, eq
	ldr	w8, [x8]
	str	w8, [x19, #36]
	mov	x0, sp
	bl	_zoran_v4l2_calc_bufsize
	str	w0, [x19, #32]
	str	xzr, [x19, #24]
Lloh20:
	adrp	x8, _V4L2_COLORSPACE_SMPTE170M@GOTPAGE
Lloh21:
	ldr	x8, [x8, _V4L2_COLORSPACE_SMPTE170M@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	str	w8, [x19, #16]
LBB0_10:
	mov	x0, x20
	bl	_mutex_unlock
LBB0_11:
	mov	x0, x22
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_PIX_FMT_MJPEG,8,3         ; @V4L2_PIX_FMT_MJPEG
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BUZ_MAX_HEIGHT,4,2             ; @BUZ_MAX_HEIGHT
	.comm	_BUZ_MAX_WIDTH,4,2              ; @BUZ_MAX_WIDTH
	.comm	_V4L2_FIELD_SEQ_TB,4,2          ; @V4L2_FIELD_SEQ_TB
	.comm	_V4L2_FIELD_SEQ_BT,4,2          ; @V4L2_FIELD_SEQ_BT
	.comm	_V4L2_FIELD_TOP,4,2             ; @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_BOTTOM,4,2          ; @V4L2_FIELD_BOTTOM
	.comm	_V4L2_COLORSPACE_SMPTE170M,4,2  ; @V4L2_COLORSPACE_SMPTE170M
	.no_dead_strip	_zoran_try_fmt_vid_out
.subsections_via_symbols
