	.file	"extr_cx18-av-core.c_cx18_av_set_fmt.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%dx%d is not a valid size!\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"decoder set size %dx%d -> scale  %ux%u\n"
	.text
	.p2align 4
	.type	cx18_av_set_fmt, @function
cx18_av_set_fmt:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	call	to_cx18_av_state@PLT
	mov	rdi, r13
	mov	rbp, rax
	call	v4l2_get_subdevdata@PLT
	cmp	QWORD PTR 8[rbx], 0
	jne	.L2
	mov	r15, rax
	mov	rax, QWORD PTR MEDIA_BUS_FMT_FIXED[rip]
	cmp	QWORD PTR 16[rbx], rax
	je	.L3
.L2:
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
.L1:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	eax, DWORD PTR V4L2_FIELD_INTERLACED[rip]
	mov	r14d, DWORD PTR 0[rbp]
	mov	esi, 1142
	mov	rdi, r15
	mov	ebp, DWORD PTR V4L2_STD_525_60[rip]
	mov	DWORD PTR 36[rbx], eax
	mov	eax, DWORD PTR V4L2_COLORSPACE_SMPTE170M[rip]
	and	r14d, ebp
	mov	DWORD PTR 32[rbx], eax
	call	cx18_av_read@PLT
	mov	esi, 1141
	mov	rdi, r15
	mov	DWORD PTR 8[rsp], eax
	call	cx18_av_read@PLT
	mov	esi, 1138
	mov	rdi, r15
	mov	DWORD PTR 12[rsp], eax
	call	cx18_av_read@PLT
	mov	esi, 1137
	mov	rdi, r15
	mov	r12d, eax
	call	cx18_av_read@PLT
	sal	r12d, 4
	mov	ecx, DWORD PTR 24[rbx]
	sar	eax, 4
	and	r12d, 1008
	and	eax, 15
	or	r12d, eax
	cmp	r14d, 1
	mov	r14d, DWORD PTR 28[rbx]
	sbb	esi, esi
	mov	edx, r14d
	and	esi, 2
	sal	edx, 4
	add	esi, 1
	cmp	edx, r12d
	jl	.L6
	cmp	r14d, r12d
	jg	.L6
	mov	edx, DWORD PTR 8[rsp]
	mov	ebp, DWORD PTR 12[rsp]
	add	esi, ecx
	sal	edx, 4
	sar	ebp, 4
	mov	eax, edx
	and	ebp, 15
	and	eax, 1008
	or	ebp, eax
	lea	eax, 0[0+rsi*8]
	cmp	eax, ebp
	jl	.L6
	cmp	ebp, esi
	jl	.L6
	mov	rdx, QWORD PTR V4L2_SUBDEV_FORMAT_TRY[rip]
	xor	eax, eax
	cmp	QWORD PTR [rbx], rdx
	je	.L1
	sal	r12d, 20
	sal	ebp, 9
	mov	r10d, 8
	mov	eax, r12d
	mov	r12d, 66048
	cdq
	idiv	r14d
	lea	ebx, -1048576[rax]
	mov	eax, ebp
	cdq
	idiv	esi
	sub	r12d, eax
	mov	ebp, eax
	and	r12d, 8191
	cmp	r14d, 384
	jg	.L9
	mov	r10d, 9
	cmp	r14d, 192
	jg	.L9
	xor	r10d, r10d
	cmp	r14d, 97
	setl	r10b
	add	r10d, 10
.L9:
	mov	r8d, ebx
	mov	r9d, r12d
	mov	edx, r14d
	mov	rdi, r13
	lea	rsi, .LC1[rip]
	mov	DWORD PTR 8[rsp], r10d
	neg	ebp
	call	CX18_DEBUG_INFO_DEV@PLT
	movzx	edx, bl
	mov	esi, 1048
	mov	rdi, r15
	call	cx18_av_write@PLT
	movzx	edx, bh
	mov	esi, 1049
	mov	rdi, r15
	call	cx18_av_write@PLT
	sar	ebx, 16
	mov	esi, 1050
	mov	rdi, r15
	mov	edx, ebx
	call	cx18_av_write@PLT
	movzx	edx, bpl
	mov	esi, 1052
	mov	rdi, r15
	call	cx18_av_write@PLT
	mov	edx, r12d
	mov	esi, 1053
	mov	rdi, r15
	sar	edx, 8
	call	cx18_av_write@PLT
	mov	r10d, DWORD PTR 8[rsp]
	mov	esi, 1054
	mov	rdi, r15
	mov	edx, r10d
	call	cx18_av_write@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	mov	edx, r14d
	mov	rdi, r13
	lea	rsi, .LC0[rip]
	call	CX18_ERR_DEV@PLT
	mov	eax, DWORD PTR ERANGE[rip]
	add	rsp, 24
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	neg	eax
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	cx18_av_set_fmt, .-cx18_av_set_fmt
	.comm	V4L2_SUBDEV_FORMAT_TRY,8,8
	.comm	V4L2_STD_525_60,4,4
	.comm	V4L2_FIELD_INTERLACED,4,4
	.comm	V4L2_COLORSPACE_SMPTE170M,4,4
	.comm	MEDIA_BUS_FMT_FIXED,8,8
	.comm	ERANGE,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cx18-av-core.c_cx18_av_set_fmt.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"%dx%d is not a valid size!\012\000"
	.global	__aeabi_idiv
	.align	2
.LC1:
	.ascii	"decoder set size %dx%d -> scale  %ux%u\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cx18_av_set_fmt, %function
cx18_av_set_fmt:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	mov	r5, r2
	mov	r7, r0
	bl	to_cx18_av_state
	mov	r6, r0
	mov	r0, r7
	bl	v4l2_get_subdevdata
	ldr	r4, [r5, #4]
	cmp	r4, #0
	bne	.L2
	ldr	r3, .L15
	ldr	r2, [r5, #8]
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L3
.L2:
	ldr	r3, .L15+4
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L1:
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L3:
	ldr	r2, .L15+8
	ldr	r3, .L15+12
	ldr	lr, [r2]
	ldr	ip, [r3]
	ldr	r2, .L15+16
	ldr	r3, [r6]
	ldr	r1, .L15+20
	str	lr, [r5, #24]
	str	ip, [r5, #20]
	ldr	fp, [r2]
	str	r3, [sp, #8]
	mov	r8, r0
	bl	cx18_av_read
	ldr	r1, .L15+24
	mov	r6, r0
	mov	r0, r8
	bl	cx18_av_read
	ldr	r1, .L15+28
	mov	r9, r0
	mov	r0, r8
	bl	cx18_av_read
	ldr	r1, .L15+32
	lsl	r10, r0, #4
	mov	r0, r8
	bl	cx18_av_read
	ldr	r3, [sp, #8]
	and	r10, r10, #1008
	ldr	r2, [r5, #16]
	lsl	r0, r0, #24
	tst	r3, fp
	orr	r0, r10, r0, lsr #28
	moveq	r10, #3
	movne	r10, #1
	cmp	r0, r2, lsl #4
	movgt	r3, #1
	movle	r3, #0
	cmp	r2, r0
	orrgt	r3, r3, #1
	cmp	r3, #0
	ldr	r3, [r5, #12]
	bne	.L6
	lsl	r6, r6, #4
	add	r10, r3, r10
	and	r6, r6, #1008
	lsl	r9, r9, #24
	orr	r6, r6, r9, lsr #28
	lsl	r1, r10, #3
	cmp	r1, r6
	cmpge	r6, r10
	bge	.L7
.L6:
	mov	r0, r7
	ldr	r1, .L15+36
	bl	CX18_ERR_DEV
	ldr	r3, .L15+40
	ldr	r4, [r3]
	rsb	r4, r4, #0
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L7:
	ldr	r1, .L15+44
	ldr	ip, [r5]
	ldr	r1, [r1]
	str	r3, [sp, #8]
	cmp	ip, r1
	beq	.L1
	mov	r1, r2
	lsl	r0, r0, #20
	str	r2, [sp, #12]
	bl	__aeabi_idiv
	mov	r1, r10
	mov	r9, r0
	lsl	r0, r6, #9
	bl	__aeabi_idiv
	ldr	r2, [sp, #12]
	rsb	r5, r0, #65536
	add	r5, r5, #512
	cmp	r2, #384
	lsl	r5, r5, #19
	mov	r6, r0
	movgt	r10, #8
	ldr	r3, [sp, #8]
	sub	r9, r9, #1048576
	lsr	r5, r5, #19
	bgt	.L8
	cmp	r2, #192
	movgt	r10, #9
	bgt	.L8
	cmp	r2, #96
	movgt	r10, #10
	movle	r10, #11
.L8:
	mov	r0, r7
	ldr	r1, .L15+48
	str	r5, [sp, #4]
	str	r9, [sp]
	bl	CX18_DEBUG_INFO_DEV
	and	r2, r9, #255
	mov	r0, r8
	ldr	r1, .L15+52
	bl	cx18_av_write
	asr	r2, r9, #8
	mov	r0, r8
	ldr	r1, .L15+56
	and	r2, r2, #255
	bl	cx18_av_write
	asr	r2, r9, #16
	mov	r0, r8
	ldr	r1, .L15+60
	bl	cx18_av_write
	rsb	r2, r6, #0
	mov	r0, r8
	ldr	r1, .L15+64
	and	r2, r2, #255
	bl	cx18_av_write
	lsr	r2, r5, #8
	mov	r0, r8
	ldr	r1, .L15+68
	bl	cx18_av_write
	mov	r2, r10
	mov	r0, r8
	ldr	r1, .L15+72
	bl	cx18_av_write
	b	.L1
.L16:
	.align	2
.L15:
	.word	MEDIA_BUS_FMT_FIXED
	.word	EINVAL
	.word	V4L2_FIELD_INTERLACED
	.word	V4L2_COLORSPACE_SMPTE170M
	.word	V4L2_STD_525_60
	.word	1142
	.word	1141
	.word	1138
	.word	1137
	.word	.LC0
	.word	ERANGE
	.word	V4L2_SUBDEV_FORMAT_TRY
	.word	.LC1
	.word	1048
	.word	1049
	.word	1050
	.word	1052
	.word	1053
	.word	1054
	.size	cx18_av_set_fmt, .-cx18_av_set_fmt
	.comm	V4L2_SUBDEV_FORMAT_TRY,4,4
	.comm	V4L2_STD_525_60,4,4
	.comm	V4L2_FIELD_INTERLACED,4,4
	.comm	V4L2_COLORSPACE_SMPTE170M,4,4
	.comm	MEDIA_BUS_FMT_FIXED,4,4
	.comm	ERANGE,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
