	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cx18_av_set_fmt
_cx18_av_set_fmt:                       ## @cx18_av_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rdi, %r15
	callq	_to_cx18_av_state
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_v4l2_get_subdevdata
	cmpq	$0, 8(%r14)
	jne	LBB0_2
## %bb.1:
	movq	16(%r14), %rdx
	movq	_MEDIA_BUS_FMT_FIXED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rdx
	jne	LBB0_2
## %bb.4:
	movq	_V4L2_STD_525_60@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	(%rbx), %ecx
	sete	-48(%rbp)                       ## 1-byte Folded Spill
	movq	_V4L2_FIELD_INTERLACED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 36(%r14)
	movq	_V4L2_COLORSPACE_SMPTE170M@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 32(%r14)
	movq	%rax, %r13
	movq	%rax, %rdi
	movl	$1142, %esi                     ## imm = 0x476
	callq	_cx18_av_read
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	movl	$1141, %esi                     ## imm = 0x475
	callq	_cx18_av_read
	movl	%eax, %r12d
	movq	%r13, %rdi
	movl	$1138, %esi                     ## imm = 0x472
	callq	_cx18_av_read
	movl	%eax, %ebx
	andl	$63, %ebx
	shll	$4, %ebx
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movl	$1137, %esi                     ## imm = 0x471
	callq	_cx18_av_read
	xorl	%esi, %esi
	shrl	$4, %eax
	andl	$15, %eax
	orl	%ebx, %eax
	movl	24(%r14), %ecx
	movl	28(%r14), %r8d
	movl	%r8d, %edx
	shll	$4, %edx
	cmpl	%eax, %edx
	jl	LBB0_8
## %bb.5:
	cmpl	%r8d, %eax
	jl	LBB0_8
## %bb.6:
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	andl	$63, %edx
	shll	$4, %edx
	shrl	$4, %r12d
	andl	$15, %r12d
	orl	%edx, %r12d
	movb	-48(%rbp), %dl                  ## 1-byte Reload
	movb	%dl, %sil
	leal	(%rcx,%rsi,2), %edx
	leal	8(,%rdx,8), %edx
	cmpl	%r12d, %edx
	jl	LBB0_8
## %bb.7:
	leal	(%rcx,%rsi,2), %esi
	incl	%esi
	cmpl	%esi, %r12d
	jl	LBB0_8
## %bb.9:
	movq	(%r14), %rdx
	movq	_V4L2_SUBDEV_FORMAT_TRY@GOTPCREL(%rip), %rdi
	xorl	%ebx, %ebx
	cmpq	(%rdi), %rdx
	je	LBB0_14
## %bb.10:
	shll	$20, %eax
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	idivl	%r8d
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, %r9d
	addl	$-1048576, %r9d                 ## imm = 0xFFF00000
	shll	$9, %r12d
	movl	%r12d, %eax
	xorl	%edx, %edx
	idivl	%esi
	movl	$512, %r14d                     ## imm = 0x200
	subl	%eax, %r14d
	movl	%r14d, %r13d
	andl	$8191, %r13d                    ## imm = 0x1FFF
	movl	$8, %eax
	cmpl	$384, %r8d                      ## imm = 0x180
	jg	LBB0_13
## %bb.11:
	movl	$9, %eax
	cmpl	$192, %r8d
	jg	LBB0_13
## %bb.12:
	xorl	%eax, %eax
	cmpl	$97, %r8d
	setge	%al
	xorl	$11, %eax
LBB0_13:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%r8d, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
	movl	%r9d, %r12d
	movl	%r9d, %r8d
	movl	%r13d, %r9d
	callq	_CX18_DEBUG_INFO_DEV
	movzbl	-48(%rbp), %edx                 ## 1-byte Folded Reload
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movl	$1048, %esi                     ## imm = 0x418
	callq	_cx18_av_write
	movl	%r12d, %eax
	movzbl	%ah, %edx
	movq	%r15, %rdi
	movl	$1049, %esi                     ## imm = 0x419
	callq	_cx18_av_write
	sarl	$16, %r12d
	movq	%r15, %rdi
	movl	$1050, %esi                     ## imm = 0x41A
	movl	%r12d, %edx
	callq	_cx18_av_write
	movzbl	%r14b, %edx
	movq	%r15, %rdi
	movl	$1052, %esi                     ## imm = 0x41C
	callq	_cx18_av_write
	shrl	$8, %r13d
	movq	%r15, %rdi
	movl	$1053, %esi                     ## imm = 0x41D
	movl	%r13d, %edx
	callq	_cx18_av_write
	movq	%r15, %rdi
	movl	$1054, %esi                     ## imm = 0x41E
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_cx18_av_write
	jmp	LBB0_14
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%r8d, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_CX18_ERR_DEV
	movq	_ERANGE@GOTPCREL(%rip), %rax
	jmp	LBB0_3
	.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	"%dx%d is not a valid size!\n"

	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_V4L2_SUBDEV_FORMAT_TRY,8,3     ## @V4L2_SUBDEV_FORMAT_TRY
L_.str.1:                               ## @.str.1
	.asciz	"decoder set size %dx%d -> scale  %ux%u\n"

	.no_dead_strip	_cx18_av_set_fmt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cx18_av_set_fmt
_cx18_av_set_fmt:                       ; @cx18_av_set_fmt
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x21, x2
	mov	x20, x0
	bl	_to_cx18_av_state
	mov	x22, x0
	mov	x0, x20
	bl	_v4l2_get_subdevdata
	ldr	x8, [x21, #8]
	cbnz	x8, LBB0_8
; %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_8
; %bb.2:
	mov	x19, x0
	ldr	w8, [x22]
Lloh3:
	adrp	x9, _V4L2_STD_525_60@GOTPAGE
Lloh4:
	ldr	x9, [x9, _V4L2_STD_525_60@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	and	w25, w9, w8
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	w1, #1142
	bl	_cx18_av_read
	mov	x22, x0
	mov	x0, x19
	mov	w1, #1141
	bl	_cx18_av_read
	mov	x23, x0
	mov	x0, x19
	mov	w1, #1138
	bl	_cx18_av_read
	ubfiz	w24, w0, #4, #6
	mov	x0, x19
	mov	w1, #1137
	bl	_cx18_av_read
	bfxil	w24, w0, #4, #4
	cmp	w25, #0
	ldp	w3, w2, [x21, #24]
	add	w8, w3, #3
	csinc	w8, w8, w3, eq
	cmp	w24, w2, lsl #4
	b.gt	LBB0_11
; %bb.3:
	cmp	w24, w2
	b.lt	LBB0_11
; %bb.4:
	ubfiz	w9, w22, #4, #6
	bfxil	w9, w23, #4, #4
	lsl	w10, w8, #3
	cmp	w10, w9
	ccmp	w9, w8, #8, ge
	b.lt	LBB0_11
; %bb.5:
	ldr	x10, [x21]
Lloh12:
	adrp	x11, _V4L2_SUBDEV_FORMAT_TRY@GOTPAGE
Lloh13:
	ldr	x11, [x11, _V4L2_SUBDEV_FORMAT_TRY@GOTPAGEOFF]
Lloh14:
	ldr	x11, [x11]
	cmp	x10, x11
	b.eq	LBB0_16
; %bb.6:
	lsl	w10, w24, #20
	sdiv	w25, w10, w2
	sub	w23, w25, #256, lsl #12         ; =1048576
	lsl	w9, w9, #9
	mov	w10, #512
	sdiv	w8, w9, w8
	sub	w24, w10, w8
	and	w21, w24, #0x1fff
	cmp	w2, #384
	b.le	LBB0_12
; %bb.7:
	mov	w22, #8
	b	LBB0_15
LBB0_8:
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_11:
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_CX18_ERR_DEV
Lloh19:
	adrp	x8, _ERANGE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
	b	LBB0_9
LBB0_12:
	cmp	w2, #192
	b.le	LBB0_14
; %bb.13:
	mov	w22, #9
	b	LBB0_15
LBB0_14:
	cmp	w2, #96
	mov	w8, #10
	cinc	w22, w8, le
LBB0_15:
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x4, x23
	mov	x5, x21
	bl	_CX18_DEBUG_INFO_DEV
	and	w2, w25, #0xff
	mov	x0, x19
	mov	w1, #1048
	bl	_cx18_av_write
	ubfx	w2, w23, #8, #8
	mov	x0, x19
	mov	w1, #1049
	bl	_cx18_av_write
	asr	w2, w23, #16
	mov	x0, x19
	mov	w1, #1050
	bl	_cx18_av_write
	and	w2, w24, #0xff
	mov	x0, x19
	mov	w1, #1052
	bl	_cx18_av_write
	lsr	w2, w21, #8
	mov	x0, x19
	mov	w1, #1053
	bl	_cx18_av_write
	mov	x0, x19
	mov	w1, #1054
	mov	x2, x22
	bl	_cx18_av_write
LBB0_16:
	mov	w0, #0
	b	LBB0_10
	.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 AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	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	"%dx%d is not a valid size!\n"

	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_V4L2_SUBDEV_FORMAT_TRY,8,3     ; @V4L2_SUBDEV_FORMAT_TRY
l_.str.1:                               ; @.str.1
	.asciz	"decoder set size %dx%d -> scale  %ux%u\n"

	.no_dead_strip	_cx18_av_set_fmt
.subsections_via_symbols
