	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calculate_video_dma_grab_packed
_calculate_video_dma_grab_packed:       ## @calculate_video_dma_grab_packed
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%rsi), %rax
	movl	16(%rax), %esi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_saa7146_format_by_fourcc
	movq	8(%r12), %rcx
	movl	(%rcx), %r14d
	movl	4(%rcx), %r13d
	movl	8(%rcx), %r15d
	movl	12(%rcx), %ecx
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movl	(%rax), %ebx
	movq	_v4l2_field_names@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rcx, -112(%rbp)                ## 8-byte Spill
	movl	(%rax,%rcx,4), %ecx
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	callq	_DEB_CAP
	testl	%r15d, %r15d
	je	LBB0_2
## %bb.1:
	addl	%r15d, %r15d
	jmp	LBB0_3
LBB0_2:
	imull	%r14d, %ebx
	leal	3(%rbx), %r15d
	testl	%ebx, %ebx
	cmovnsl	%ebx, %r15d
	sarl	$2, %r15d
LBB0_3:
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	movl	%r15d, -96(%rbp)
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	16(%rdx), %rax
	movl	(%rax), %ecx
	shll	$16, %ecx
	movslq	%ecx, %rcx
	addq	8(%rax), %rcx
	movq	%rcx, -64(%rbp)
	movq	(%r12), %rax
	movq	_ME1@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	orl	4(%rsi), %ecx
	movl	%ecx, -92(%rbp)
	movl	%r15d, %ebx
	shrl	$31, %ebx
	addl	%r15d, %ebx
	sarl	%ebx
	cmpq	$0, (%rdx)
	movq	8(%rax), %r14
	je	LBB0_5
## %bb.4:
	imull	%ebx, %r13d
	movslq	%r13d, %r12
	addq	%r14, %r12
	movslq	%ebx, %rcx
	movq	%r12, %rax
	subq	%rcx, %rax
	jmp	LBB0_6
LBB0_5:
	movslq	%ebx, %rax
	addq	%r14, %rax
	imull	%ebx, %r13d
	movslq	%r13d, %rcx
	addq	%r14, %rcx
	movq	%r14, %r12
	movq	%rcx, %r14
LBB0_6:
	movq	-112(%rbp), %r13                ## 8-byte Reload
	movq	%r12, -80(%rbp)
	movq	%rax, -72(%rbp)
	movq	%r14, -88(%rbp)
	movl	%r13d, %edi
	callq	_V4L2_FIELD_HAS_BOTH
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_8:
	movq	_V4L2_FIELD_ALTERNATE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_12
## %bb.9:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %eax
	movq	_V4L2_FIELD_TOP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_10
## %bb.11:
	movq	_V4L2_FIELD_BOTTOM@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	je	LBB0_15
	jmp	LBB0_16
LBB0_12:
	movq	_V4L2_FIELD_TOP@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_13
LBB0_10:
	movq	%r14, -72(%rbp)
	movl	%ebx, -96(%rbp)
	movl	%ebx, %r15d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_13:
	movq	_V4L2_FIELD_BOTTOM@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jne	LBB0_16
LBB0_15:
	movq	%r12, -72(%rbp)
	movq	%r14, -80(%rbp)
	movl	%ebx, -96(%rbp)
	movl	%ebx, %r15d
LBB0_16:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	$0, (%rax)
	je	LBB0_18
## %bb.17:
	negl	%r15d
	movl	%r15d, -96(%rbp)
LBB0_18:
	leaq	-96(%rbp), %rdx
	movl	$1, %esi
	callq	_saa7146_write_out_dma
	xorl	%eax, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"[size=%dx%d,fields=%s]\n"

	.comm	_v4l2_field_names,8,3           ## @v4l2_field_names
	.comm	_ME1,4,2                        ## @ME1
	.comm	_V4L2_FIELD_ALTERNATE,4,2       ## @V4L2_FIELD_ALTERNATE
	.comm	_V4L2_FIELD_TOP,4,2             ## @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_BOTTOM,4,2          ## @V4L2_FIELD_BOTTOM
	.no_dead_strip	_calculate_video_dma_grab_packed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_video_dma_grab_packed
_calculate_video_dma_grab_packed:       ; @calculate_video_dma_grab_packed
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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, x1
	mov	x19, x0
	ldr	x25, [x0]
	ldr	x8, [x1, #8]
	ldr	w1, [x8, #16]
	bl	_saa7146_format_by_fourcc
	mov	x23, x0
	ldr	x8, [x21, #8]
	ldp	w24, w22, [x8]
	ldp	w26, w20, [x8, #8]
	ldr	w27, [x0]
Lloh0:
	adrp	x8, _v4l2_field_names@GOTPAGE
Lloh1:
	ldr	x8, [x8, _v4l2_field_names@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	w3, [x8, x20, lsl #2]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x24
	mov	x2, x22
	bl	_DEB_CAP
	cbz	w26, LBB0_2
; %bb.1:
	lsl	w24, w26, #1
	b	LBB0_3
LBB0_2:
	mul	w8, w27, w24
	add	w9, w8, #3
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w24, w8, #2
LBB0_3:
	str	w24, [sp, #8]
	ldr	x8, [x25, #16]
	ldr	w9, [x8]
	lsl	w9, w9, #16
	ldr	x8, [x8, #8]
	add	x8, x8, w9, sxtw
	str	x8, [sp, #40]
	ldr	x8, [x21]
	ldr	w9, [x8]
Lloh5:
	adrp	x10, _ME1@GOTPAGE
Lloh6:
	ldr	x10, [x10, _ME1@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	orr	w9, w10, w9
	ldr	w10, [x23, #4]
	orr	w9, w9, w10
	str	w9, [sp, #12]
	ldr	x9, [x25]
	ldr	x8, [x8, #8]
	cmp	w24, #0
	cinc	w10, w24, lt
	asr	w21, w10, #1
	add	x10, x8, w21, sxtw
	mul	w11, w21, w22
	add	x11, x8, w11, sxtw
	sub	x12, x11, w21, sxtw
	cmp	x9, #0
	csel	x23, x8, x11, eq
	csel	x9, x10, x12, eq
	csel	x22, x11, x8, eq
	stp	x23, x9, [sp, #24]
	str	x22, [sp, #16]
	mov	x0, x20
	bl	_V4L2_FIELD_HAS_BOTH
	cbnz	x0, LBB0_11
; %bb.4:
Lloh8:
	adrp	x8, _V4L2_FIELD_ALTERNATE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _V4L2_FIELD_ALTERNATE@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_7
; %bb.5:
	ldr	w8, [x25, #8]
Lloh11:
	adrp	x9, _V4L2_FIELD_TOP@GOTPAGE
Lloh12:
	ldr	x9, [x9, _V4L2_FIELD_TOP@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	cmp	w8, w9
	b.eq	LBB0_8
; %bb.6:
Lloh14:
	adrp	x9, _V4L2_FIELD_BOTTOM@GOTPAGE
Lloh15:
	ldr	x9, [x9, _V4L2_FIELD_BOTTOM@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	cmp	w8, w9
	b.eq	LBB0_10
	b	LBB0_11
LBB0_7:
Lloh17:
	adrp	x8, _V4L2_FIELD_TOP@GOTPAGE
Lloh18:
	ldr	x8, [x8, _V4L2_FIELD_TOP@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_9
LBB0_8:
	str	x22, [sp, #32]
	str	w21, [sp, #8]
	mov	x24, x21
	b	LBB0_11
LBB0_9:
Lloh20:
	adrp	x8, _V4L2_FIELD_BOTTOM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _V4L2_FIELD_BOTTOM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	cmp	w20, w8
	b.ne	LBB0_11
LBB0_10:
	stp	x22, x23, [sp, #24]
	mov	x24, x21
	str	w21, [sp, #8]
LBB0_11:
	ldr	x8, [x25]
	cbz	x8, LBB0_13
; %bb.12:
	neg	w8, w24
	str	w8, [sp, #8]
LBB0_13:
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #1
	bl	_saa7146_write_out_dma
	mov	w0, #0
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"[size=%dx%d,fields=%s]\n"

	.comm	_v4l2_field_names,8,3           ; @v4l2_field_names
	.comm	_ME1,4,2                        ; @ME1
	.comm	_V4L2_FIELD_ALTERNATE,4,2       ; @V4L2_FIELD_ALTERNATE
	.comm	_V4L2_FIELD_TOP,4,2             ; @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_BOTTOM,4,2          ; @V4L2_FIELD_BOTTOM
	.no_dead_strip	_calculate_video_dma_grab_packed
.subsections_via_symbols
