	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cx18_prepare_buffer
_cx18_prepare_buffer:                   ## @cx18_prepare_buffer
	.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	%rsi, %r14
	movq	16(%rsi), %rsi
	movq	$0, 48(%rdx)
	cmpl	$48, %r8d
	jb	LBB0_2
## %bb.1:
	movl	%r9d, %r12d
	cmpl	$31, %r9d
	jbe	LBB0_2
## %bb.3:
	movl	%r8d, %r15d
	movq	%rdx, %r13
	movl	%r8d, %edx
	imull	%r12d, %edx
	addl	%edx, %edx
	movl	%edx, 8(%r13)
	movq	16(%r13), %rax
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	cmpl	%edx, 24(%r13)
	jb	LBB0_2
LBB0_5:
	movl	16(%rbp), %r8d
	cmpl	%r15d, 28(%r13)
	jne	LBB0_10
## %bb.6:
	cmpl	%r12d, 32(%r13)
	jne	LBB0_10
## %bb.7:
	cmpl	%r8d, 36(%r13)
	jne	LBB0_10
## %bb.8:
	cmpq	%rcx, (%r14)
	jne	LBB0_10
## %bb.9:
	movq	(%r13), %rdx
	cmpq	(%rsi), %rdx
	je	LBB0_11
LBB0_10:
	movl	%r15d, 28(%r13)
	movl	%r12d, 32(%r13)
	movl	%r8d, 36(%r13)
	movq	(%rsi), %rax
	movq	%rax, (%r13)
	movq	%rcx, (%r14)
	movq	_V4L2_PIX_FMT_HM12@GOTPCREL(%rip), %rax
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	imull	$2160, %r12d, %esi              ## imm = 0x870
	shrl	%esi
	imull	$1440, %r12d, %edx              ## imm = 0x5A0
	cmpq	%rcx, (%rax)
	cmovel	%esi, %edx
	movl	%edx, 8(%r14)
	movq	%rdi, %rbx
	movq	%r14, %rsi
	movq	%r13, %rdx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%rcx, %r14
	callq	_cx18_dma_free
	movl	16(%rbp), %r8d
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rcx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	16(%r13), %rax
LBB0_11:
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movl	24(%r13), %eax
	cmpl	8(%r13), %eax
	jae	LBB0_13
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_19:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	cmpl	$0, 36(%r13)
	jne	LBB0_15
## %bb.14:
	movq	_V4L2_FIELD_INTERLACED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 36(%r13)
LBB0_15:
	movq	_VIDEOBUF_NEEDS_INIT@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	40(%r13), %rax
	jne	LBB0_17
## %bb.16:
	movl	%r15d, 28(%r13)
	movl	%r12d, 32(%r13)
	movl	%r8d, 36(%r13)
	movq	(%rsi), %rax
	movq	%rax, (%r13)
	movq	%rcx, (%r14)
	movq	_V4L2_PIX_FMT_HM12@GOTPCREL(%rip), %rax
	imull	$2160, %r12d, %ebx              ## imm = 0x870
	shrl	%ebx
	imull	$1440, %r12d, %edx              ## imm = 0x5A0
	cmpq	%rcx, (%rax)
	leaq	8(%r13), %rsi
	cmovel	%ebx, %edx
	movl	%edx, 8(%r14)
	movq	%rdi, %rbx
	xorl	%edx, %edx
	callq	_videobuf_iolock
	testl	%eax, %eax
	je	LBB0_17
## %bb.18:
	movq	%rbx, %rdi
	movl	%eax, %ebx
	movq	%r14, %rsi
	movq	%r13, %rdx
	callq	_cx18_dma_free
	jmp	LBB0_19
LBB0_17:
	movq	_VIDEOBUF_PREPARED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%r13)
	xorl	%ebx, %ebx
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_V4L2_PIX_FMT_HM12,8,3          ## @V4L2_PIX_FMT_HM12
	.comm	_V4L2_FIELD_INTERLACED,8,3      ## @V4L2_FIELD_INTERLACED
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ## @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ## @VIDEOBUF_PREPARED
	.no_dead_strip	_cx18_prepare_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cx18_prepare_buffer
_cx18_prepare_buffer:                   ; @cx18_prepare_buffer
	.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
	ldr	x27, [x1, #16]
	str	xzr, [x2, #48]
	cmp	w4, #48
	b.lo	LBB0_12
; %bb.1:
	mov	x22, x5
	cmp	w5, #31
	b.ls	LBB0_12
; %bb.2:
	mov	x24, x6
	mov	x25, x4
	mov	x23, x3
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	mul	w8, w4, w22
	lsl	w9, w8, #1
	mov	x26, x2
	str	w9, [x26, #8]!
	ldr	x8, [x26, #8]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	w10, [x19, #24]
	cmp	w10, w9
	b.lo	LBB0_12
LBB0_4:
	ldr	w9, [x19, #28]
Lloh0:
	adrp	x28, _V4L2_PIX_FMT_HM12@GOTPAGE
Lloh1:
	ldr	x28, [x28, _V4L2_PIX_FMT_HM12@GOTPAGEOFF]
	cmp	w9, w25
	b.ne	LBB0_9
; %bb.5:
	ldr	w9, [x19, #32]
	cmp	w9, w22
	b.ne	LBB0_9
; %bb.6:
	ldr	w9, [x19, #36]
	cmp	w9, w24
	b.ne	LBB0_9
; %bb.7:
	ldr	x9, [x20]
	cmp	x9, x23
	b.ne	LBB0_9
; %bb.8:
	ldr	x9, [x19]
	ldr	x10, [x27]
	cmp	x9, x10
	b.eq	LBB0_10
LBB0_9:
	stp	w25, w22, [x19, #28]
	str	w24, [x19, #36]
	ldr	x8, [x27]
	str	x8, [x19]
	str	x23, [x20]
	ldr	x8, [x28]
	mov	w9, #2160
	mul	w9, w22, w9
	lsr	w9, w9, #1
	mov	w10, #1440
	mul	w10, w22, w10
	cmp	x8, x23
	csel	w8, w9, w10, eq
	str	w8, [x20, #8]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_cx18_dma_free
	ldr	x8, [x19, #16]
LBB0_10:
	cbz	x8, LBB0_14
; %bb.11:
	ldr	w8, [x19, #24]
	ldr	w9, [x19, #8]
	cmp	w8, w9
	b.hs	LBB0_14
LBB0_12:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_13:
	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
	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_14:
	ldr	w8, [x19, #36]
	cbnz	w8, LBB0_16
; %bb.15:
Lloh5:
	adrp	x8, _V4L2_FIELD_INTERLACED@GOTPAGE
Lloh6:
	ldr	x8, [x8, _V4L2_FIELD_INTERLACED@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	str	w8, [x19, #36]
LBB0_16:
Lloh8:
	adrp	x8, _VIDEOBUF_NEEDS_INIT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VIDEOBUF_NEEDS_INIT@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	ldr	x9, [x19, #40]
	cmp	x8, x9
	b.ne	LBB0_19
; %bb.17:
	stp	w25, w22, [x19, #28]
	str	w24, [x19, #36]
	ldr	x8, [x27]
	str	x8, [x19]
	str	x23, [x20]
	ldr	x8, [x28]
	mov	w9, #2160
	mul	w9, w22, w9
	lsr	w9, w9, #1
	mov	w10, #1440
	mul	w10, w22, w10
	cmp	x8, x23
	csel	w8, w9, w10, eq
	str	w8, [x20, #8]
	mov	x0, x21
	mov	x1, x26
	mov	x2, #0
	bl	_videobuf_iolock
	cbz	w0, LBB0_19
; %bb.18:
	mov	x22, x0
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_cx18_dma_free
	b	LBB0_13
LBB0_19:
	mov	w22, #0
Lloh11:
	adrp	x8, _VIDEOBUF_PREPARED@GOTPAGE
Lloh12:
	ldr	x8, [x8, _VIDEOBUF_PREPARED@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	str	x8, [x19, #40]
	b	LBB0_13
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_V4L2_PIX_FMT_HM12,8,3          ; @V4L2_PIX_FMT_HM12
	.comm	_V4L2_FIELD_INTERLACED,8,3      ; @V4L2_FIELD_INTERLACED
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ; @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ; @VIDEOBUF_PREPARED
	.no_dead_strip	_cx18_prepare_buffer
.subsections_via_symbols
