	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cx25840_set_fmt
_cx25840_set_fmt:                       ## @cx25840_set_fmt
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rdi, %rbx
	callq	_to_state
	movq	%rax, %r12
	movq	%rbx, %rdi
	callq	_v4l2_get_subdevdata
	cmpq	$0, 8(%r15)
	jne	LBB0_2
## %bb.1:
	movq	%rax, %r13
	movq	16(%r15), %rax
	movq	_MEDIA_BUS_FMT_FIXED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.3:
	movq	_V4L2_STD_525_60@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%r12), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	_V4L2_FIELD_INTERLACED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%r15)
	movq	_V4L2_COLORSPACE_SMPTE170M@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r15)
	movq	%r12, %rdi
	callq	_is_cx23888
	testq	%rax, %rax
	movl	$1142, %eax                     ## imm = 0x476
	movl	$1066, %esi                     ## imm = 0x42A
	cmovel	%eax, %esi
	movl	$1141, %eax                     ## imm = 0x475
	movl	$1065, %ebx                     ## imm = 0x429
	cmovel	%eax, %ebx
	movq	%r13, %rdi
	callq	_cx25840_read
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	andl	$63, %eax
	shll	$4, %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_cx25840_read
	movl	%eax, %r14d
	shrl	$4, %r14d
	andl	$15, %r14d
	movq	%r12, %rdi
	callq	_is_cx23888
	testq	%rax, %rax
	movl	$1138, %eax                     ## imm = 0x472
	movl	$1062, %esi                     ## imm = 0x426
	cmovel	%eax, %esi
	movl	$1137, %eax                     ## imm = 0x471
	movl	$1061, %ebx                     ## imm = 0x425
	cmovel	%eax, %ebx
	movq	%r13, %rdi
	callq	_cx25840_read
	movl	%eax, %r12d
	andl	$63, %r12d
	shll	$4, %r12d
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_cx25840_read
	movl	%eax, %r13d
	shrl	$4, %r13d
	andl	$15, %r13d
	orl	%r12d, %r13d
	xorl	%r12d, %r12d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpl	$0, 4(%rax)
	jne	LBB0_5
## %bb.4:
	xorl	%ebx, %ebx
	cmpl	$0, -60(%rbp)                   ## 4-byte Folded Reload
	setne	%bl
	leal	(%rbx,%rbx,2), %r12d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_is_cx23888
	testq	%rax, %rax
	setne	%al
	andb	%al, %bl
	movzbl	%bl, %eax
	subl	%eax, %r12d
	addl	$4, %r12d
LBB0_5:
	addl	-48(%rbp), %r14d                ## 4-byte Folded Reload
	testl	%r13d, %r13d
	movl	%r14d, %ebx
	je	LBB0_7
## %bb.6:
	movl	%ebx, %r14d
	subl	%r12d, %r14d
	jle	LBB0_7
## %bb.8:
	movl	24(%r15), %edi
	leal	15(%r13), %esi
	shrl	$4, %esi
	movl	%r13d, %edx
	callq	_clamp
	movl	%eax, 24(%r15)
	leal	(,%r12,8), %ecx
	movl	%ebx, %eax
	movl	28(%r15), %edi
	movl	$1, %esi
	subl	%ecx, %eax
	jle	LBB0_10
## %bb.9:
	leal	7(%rax), %ecx
	addl	$14, %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$3, %eax
	movl	%eax, %esi
LBB0_10:
	movl	%r14d, %edx
	callq	_clamp
	movq	%rax, %r9
	movl	%r9d, 28(%r15)
	movq	(%r15), %rcx
	movq	_V4L2_SUBDEV_FORMAT_TRY@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	cmpq	(%rdx), %rcx
	je	LBB0_18
## %bb.11:
	shll	$20, %r13d
	movl	24(%r15), %r8d
	xorl	%ecx, %ecx
	movl	%r13d, %eax
	xorl	%edx, %edx
	idivl	%r8d
	movl	%eax, %r13d
	leal	-1048576(%r13), %r10d
	shll	$9, %ebx
	addl	%r9d, %r12d
	movl	%ebx, %eax
	xorl	%edx, %edx
	idivl	%r12d
	movl	$512, %r15d                     ## imm = 0x200
	subl	%eax, %r15d
	movl	%r15d, %r12d
	andl	$8191, %r12d                    ## imm = 0x1FFF
	cmpl	$384, %r8d                      ## imm = 0x180
	jg	LBB0_14
## %bb.12:
	movl	$1, %ecx
	cmpl	$192, %r8d
	jg	LBB0_14
## %bb.13:
	xorl	%ecx, %ecx
	cmpl	$97, %r8d
	setge	%cl
	xorl	$3, %ecx
LBB0_14:
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	_cx25840_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rcx
	movl	$1, %edi
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
                                        ## kill: def $r9d killed $r9d killed $r9
	pushq	%r12
	movq	%r10, %rbx
	pushq	%r10
	callq	_v4l_dbg
	addq	$16, %rsp
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_is_cx23888
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	orl	$16777216, %ebx                 ## imm = 0x1000000
	movq	%r14, %rdi
	movl	$1076, %esi                     ## imm = 0x434
	movl	%ebx, %edx
	callq	_cx25840_write4
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	shll	$16, %r13d
	leal	(%r12,%r13), %edx
	addl	$524288, %edx                   ## imm = 0x80000
	movq	%r14, %rdi
	movl	$1080, %esi                     ## imm = 0x438
	callq	_cx25840_write4
	jmp	LBB0_17
LBB0_7:
	leaq	L_.str(%rip), %rsi
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r13d, %edx
	movl	%ebx, %ecx
	callq	_v4l_err
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_18:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movzbl	%r13b, %edx
	movq	%r14, %rdi
	movl	$1048, %esi                     ## imm = 0x418
	callq	_cx25840_write
	movzbl	%bh, %edx
	movq	%r14, %rdi
	movl	$1049, %esi                     ## imm = 0x419
	callq	_cx25840_write
	sarl	$16, %ebx
	movq	%r14, %rdi
	movl	$1050, %esi                     ## imm = 0x41A
	movl	%ebx, %edx
	callq	_cx25840_write
	movzbl	%r15b, %edx
	movq	%r14, %rdi
	movl	$1052, %esi                     ## imm = 0x41C
	callq	_cx25840_write
	shrl	$8, %r12d
	movq	%r14, %rdi
	movl	$1053, %esi                     ## imm = 0x41D
	movl	%r12d, %edx
	callq	_cx25840_write
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	orl	$8, %edx
	movq	%r14, %rdi
	movl	$1054, %esi                     ## imm = 0x41E
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_cx25840_write
LBB0_17:
	xorl	%eax, %eax
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_STD_525_60,4,2            ## @V4L2_STD_525_60
	.comm	_MEDIA_BUS_FMT_FIXED,8,3        ## @MEDIA_BUS_FMT_FIXED
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_V4L2_FIELD_INTERLACED,4,2      ## @V4L2_FIELD_INTERLACED
	.comm	_V4L2_COLORSPACE_SMPTE170M,4,2  ## @V4L2_COLORSPACE_SMPTE170M
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"chip reported picture size (%u x %u) is far too small\n"

	.comm	_V4L2_SUBDEV_FORMAT_TRY,8,3     ## @V4L2_SUBDEV_FORMAT_TRY
	.comm	_cx25840_debug,4,2              ## @cx25840_debug
L_.str.1:                               ## @.str.1
	.asciz	"decoder set size %u x %u with scale %x x %x\n"

	.no_dead_strip	_cx25840_set_fmt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cx25840_set_fmt
_cx25840_set_fmt:                       ; @cx25840_set_fmt
	.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
	mov	x21, x2
	mov	x19, x0
	bl	_to_state
	mov	x20, x0
	mov	x0, x19
	bl	_v4l2_get_subdevdata
	ldr	x8, [x21, #8]
	cbnz	x8, LBB0_10
; %bb.1:
	ldr	x8, [x21, #16]
Lloh0:
	adrp	x9, _MEDIA_BUS_FMT_FIXED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MEDIA_BUS_FMT_FIXED@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.2:
	mov	x19, x0
	ldr	w26, [x20]
Lloh3:
	adrp	x8, _V4L2_STD_525_60@GOTPAGE
Lloh4:
	ldr	x8, [x8, _V4L2_STD_525_60@GOTPAGEOFF]
Lloh5:
	ldr	w27, [x8]
Lloh6:
	adrp	x8, _V4L2_FIELD_INTERLACED@GOTPAGE
Lloh7:
	ldr	x8, [x8, _V4L2_FIELD_INTERLACED@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
Lloh9:
	adrp	x9, _V4L2_COLORSPACE_SMPTE170M@GOTPAGE
Lloh10:
	ldr	x9, [x9, _V4L2_COLORSPACE_SMPTE170M@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	stp	w9, w8, [x21, #32]
	mov	x0, x20
	bl	_is_cx23888
	cmp	x0, #0
	mov	w8, #1066
	mov	w9, #1142
	csel	w1, w9, w8, eq
	mov	w8, #1065
	mov	w9, #1141
	csel	w23, w9, w8, eq
	mov	x0, x19
	bl	_cx25840_read
	ubfiz	w22, w0, #4, #6
	mov	x0, x19
	mov	x1, x23
	bl	_cx25840_read
	mov	x24, x0
	mov	x0, x20
	bl	_is_cx23888
	cmp	x0, #0
	mov	w8, #1062
	mov	w9, #1138
	csel	w1, w9, w8, eq
	mov	w8, #1061
	mov	w9, #1137
	csel	w25, w9, w8, eq
	mov	x0, x19
	bl	_cx25840_read
	ubfiz	w23, w0, #4, #6
	mov	x0, x19
	mov	x1, x25
	bl	_cx25840_read
	bfxil	w23, w0, #4, #4
	ldr	w8, [x20, #4]
	cbz	w8, LBB0_4
; %bb.3:
	mov	w25, #0
	bfxil	w22, w24, #4, #4
	cbnz	w23, LBB0_5
	b	LBB0_9
LBB0_4:
	and	w8, w27, w26
	mov	w9, #7
	mov	w10, #4
	cmp	w8, #0
	csel	w25, w10, w9, eq
	cset	w26, ne
	mov	x0, x20
	bl	_is_cx23888
	cmp	x0, #0
	cset	w8, ne
	and	w8, w8, w26
	sub	w25, w25, w8
	bfxil	w22, w24, #4, #4
	cbz	w23, LBB0_9
LBB0_5:
	subs	w24, w22, w25
	b.le	LBB0_9
; %bb.6:
	ldr	w0, [x21, #24]
	add	w8, w23, #15
	lsr	w1, w8, #4
	mov	x2, x23
	bl	_clamp
	str	w0, [x21, #24]
	lsl	w8, w25, #3
	ldr	w0, [x21, #28]
	mov	w9, #1
	sub	w10, w22, w8
	add	w11, w10, #7
	add	w10, w10, #14
	cmp	w11, #0
	csel	w10, w10, w11, lt
	asr	w10, w10, #3
	cmp	w22, w8
	csel	w1, w9, w10, le
	mov	x2, x24
	bl	_clamp
	mov	x5, x0
	str	w5, [x21, #28]
	ldr	x8, [x21]
Lloh12:
	adrp	x9, _V4L2_SUBDEV_FORMAT_TRY@GOTPAGE
Lloh13:
	ldr	x9, [x9, _V4L2_SUBDEV_FORMAT_TRY@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_18
; %bb.7:
	lsl	w8, w23, #20
	ldr	w4, [x21, #24]
	sdiv	w26, w8, w4
	sub	w23, w26, #256, lsl #12         ; =1048576
	lsl	w8, w22, #9
	add	w9, w25, w5
	mov	w10, #512
	sdiv	w8, w8, w9
	sub	w24, w10, w8
	and	w21, w24, #0x1fff
	cmp	w4, #384
	b.le	LBB0_12
; %bb.8:
	mov	w22, #0
	b	LBB0_15
LBB0_9:
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x23
	mov	x3, x22
	bl	_v4l_err
LBB0_10:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
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:
	cmp	w4, #192
	b.le	LBB0_14
; %bb.13:
	mov	w22, #1
	b	LBB0_15
LBB0_14:
	cmp	w4, #96
	mov	w8, #2
	cinc	w22, w8, le
LBB0_15:
Lloh20:
	adrp	x8, _cx25840_debug@GOTPAGE
Lloh21:
	ldr	x8, [x8, _cx25840_debug@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
Lloh23:
	adrp	x3, l_.str.1@PAGE
Lloh24:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	w0, #1
	mov	x2, x19
                                        ; kill: def $w5 killed $w5 killed $x5
	mov	x6, x23
	mov	x7, x21
	bl	_v4l_dbg
	mov	x0, x20
	bl	_is_cx23888
	cbz	x0, LBB0_17
; %bb.16:
	orr	w2, w23, #0x1000000
	mov	x0, x19
	mov	w1, #1076
	bl	_cx25840_write4
	bfi	w21, w22, #16, #16
	orr	w2, w21, #0x80000
	mov	x0, x19
	mov	w1, #1080
	bl	_cx25840_write4
	b	LBB0_18
LBB0_17:
	and	w2, w26, #0xff
	mov	x0, x19
	mov	w1, #1048
	bl	_cx25840_write
	ubfx	w2, w23, #8, #8
	mov	x0, x19
	mov	w1, #1049
	bl	_cx25840_write
	asr	w2, w23, #16
	mov	x0, x19
	mov	w1, #1050
	bl	_cx25840_write
	and	w2, w24, #0xff
	mov	x0, x19
	mov	w1, #1052
	bl	_cx25840_write
	lsr	w2, w21, #8
	mov	x0, x19
	mov	w1, #1053
	bl	_cx25840_write
	orr	w2, w22, #0x8
	mov	x0, x19
	mov	w1, #1054
	bl	_cx25840_write
LBB0_18:
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_STD_525_60,4,2            ; @V4L2_STD_525_60
	.comm	_MEDIA_BUS_FMT_FIXED,8,3        ; @MEDIA_BUS_FMT_FIXED
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_V4L2_FIELD_INTERLACED,4,2      ; @V4L2_FIELD_INTERLACED
	.comm	_V4L2_COLORSPACE_SMPTE170M,4,2  ; @V4L2_COLORSPACE_SMPTE170M
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"chip reported picture size (%u x %u) is far too small\n"

	.comm	_V4L2_SUBDEV_FORMAT_TRY,8,3     ; @V4L2_SUBDEV_FORMAT_TRY
	.comm	_cx25840_debug,4,2              ; @cx25840_debug
l_.str.1:                               ; @.str.1
	.asciz	"decoder set size %u x %u with scale %x x %x\n"

	.no_dead_strip	_cx25840_set_fmt
.subsections_via_symbols
