	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vpif_buffer_prepare
_vpif_buffer_prepare:                   ## @vpif_buffer_prepare
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	8(%rdi), %rax
	movq	(%rax), %r12
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movl	$2, %edi
	callq	_vpif_dbg
	movq	(%r12), %r13
	movq	_VPIF_VIDEO_INDEX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_VIDEOBUF_NEEDS_INIT@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	leaq	(%rax,%rax,2), %r12
	cmpq	(%rbx), %rcx
	jne	LBB0_2
## %bb.1:
	movq	%r12, %rax
	shlq	$4, %rax
	movl	(%r13,%rax), %ecx
	movl	%ecx, 8(%rbx)
	movl	4(%r13,%rax), %eax
	movl	%eax, 12(%rbx)
	imull	%ecx, %eax
	movl	%eax, 16(%rbx)
	movl	%r14d, 20(%rbx)
LBB0_2:
	movq	_VIDEOBUF_PREPARED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%rbx)
	movq	_V4L2_MEMORY_USERPTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	shlq	$4, %r12
	cmpq	8(%r13,%r12), %rax
	jne	LBB0_7
## %bb.3:
	movq	24(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.5:
	callq	_vpif_uservirt_to_phys
	movq	%rax, 32(%rbx)
	movq	%rax, %rdi
	movl	$8, %esi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	je	LBB0_6
LBB0_7:
	xorl	%r14d, %r14d
	cmpq	$0, (%r15)
	je	LBB0_13
## %bb.8:
	movq	32(%rbx), %rbx
	movq	16(%r13,%r12), %rdi
	addq	%rbx, %rdi
	movl	$8, %esi
	callq	_IS_ALIGNED
	leaq	L_.str.2(%rip), %r15
	testl	%eax, %eax
	je	LBB0_12
## %bb.9:
	movq	24(%r13,%r12), %rdi
	addq	%rbx, %rdi
	movl	$8, %esi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	je	LBB0_12
## %bb.10:
	movq	32(%r13,%r12), %rdi
	addq	%rbx, %rdi
	movl	$8, %esi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	je	LBB0_12
## %bb.11:
	addq	40(%r13,%r12), %rbx
	movq	%rbx, %rdi
	movl	$8, %esi
	callq	_IS_ALIGNED
	testl	%eax, %eax
	jne	LBB0_13
	jmp	LBB0_12
LBB0_4:
	leaq	L_.str.1(%rip), %r15
	jmp	LBB0_12
LBB0_6:
	leaq	L_.str.2(%rip), %r15
LBB0_12:
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$1, %edi
	movq	%r15, %rdx
	callq	_vpif_dbg
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_13:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_debug,4,2                      ## @debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vpif_buffer_prepare\n"

	.comm	_VPIF_VIDEO_INDEX,8,3           ## @VPIF_VIDEO_INDEX
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ## @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ## @VIDEOBUF_PREPARED
	.comm	_V4L2_MEMORY_USERPTR,8,3        ## @V4L2_MEMORY_USERPTR
L_.str.1:                               ## @.str.1
	.asciz	"buffer address is 0\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"buffer_prepare:offset is not aligned to 8 bytes\n"

	.no_dead_strip	_vpif_buffer_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vpif_buffer_prepare
_vpif_buffer_prepare:                   ; @vpif_buffer_prepare
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0, #8]
	ldr	x23, [x8]
Lloh0:
	adrp	x22, _debug@GOTPAGE
Lloh1:
	ldr	x22, [x22, _debug@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh2:
	adrp	x2, l_.str@PAGE
Lloh3:
	add	x2, x2, l_.str@PAGEOFF
	mov	w0, #2
	bl	_vpif_dbg
	ldr	x23, [x23]
Lloh4:
	adrp	x8, _VPIF_VIDEO_INDEX@GOTPAGE
Lloh5:
	ldr	x8, [x8, _VPIF_VIDEO_INDEX@GOTPAGEOFF]
Lloh6:
	ldr	x24, [x8]
Lloh7:
	adrp	x8, _VIDEOBUF_NEEDS_INIT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _VIDEOBUF_NEEDS_INIT@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	ldr	x9, [x19]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	mov	w8, #48
	madd	x8, x24, x8, x23
	ldp	w9, w8, [x8]
	stp	w9, w8, [x19, #8]
	mul	w8, w8, w9
	stp	w8, w21, [x19, #16]
LBB0_2:
Lloh10:
	adrp	x8, _VIDEOBUF_PREPARED@GOTPAGE
Lloh11:
	ldr	x8, [x8, _VIDEOBUF_PREPARED@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
Lloh13:
	adrp	x9, _V4L2_MEMORY_USERPTR@GOTPAGE
Lloh14:
	ldr	x9, [x9, _V4L2_MEMORY_USERPTR@GOTPAGEOFF]
	str	x8, [x19]
Lloh15:
	ldr	x8, [x9]
	mov	w9, #48
	madd	x9, x24, x9, x23
	ldr	x9, [x9, #8]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	ldr	x0, [x19, #24]
	cbz	x0, LBB0_12
; %bb.4:
	bl	_vpif_uservirt_to_phys
	str	x0, [x19, #32]
	mov	w1, #8
	bl	_IS_ALIGNED
	cbz	w0, LBB0_11
LBB0_5:
	ldr	x8, [x20]
	cbz	x8, LBB0_10
; %bb.6:
	ldr	x19, [x19, #32]
	mov	w8, #48
	madd	x8, x24, x8, x23
	ldr	x8, [x8, #16]
	add	x0, x8, x19
	mov	w1, #8
	bl	_IS_ALIGNED
	cbz	w0, LBB0_11
; %bb.7:
	mov	w8, #48
	madd	x8, x24, x8, x23
	ldr	x8, [x8, #24]
	add	x0, x8, x19
	mov	w1, #8
	bl	_IS_ALIGNED
	cbz	w0, LBB0_11
; %bb.8:
	mov	w8, #48
	madd	x8, x24, x8, x23
	ldr	x8, [x8, #32]
	add	x0, x8, x19
	mov	w1, #8
	bl	_IS_ALIGNED
	cbz	w0, LBB0_11
; %bb.9:
	mov	w8, #48
	madd	x8, x24, x8, x23
	ldr	x8, [x8, #40]
	add	x0, x8, x19
	mov	w1, #8
	bl	_IS_ALIGNED
	cbz	w0, LBB0_11
LBB0_10:
	mov	w0, #0
	b	LBB0_14
LBB0_11:
Lloh16:
	adrp	x2, l_.str.2@PAGE
Lloh17:
	add	x2, x2, l_.str.2@PAGEOFF
	b	LBB0_13
LBB0_12:
Lloh18:
	adrp	x2, l_.str.1@PAGE
Lloh19:
	add	x2, x2, l_.str.1@PAGEOFF
LBB0_13:
	ldr	w1, [x22]
	mov	w0, #1
	bl	_vpif_dbg
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_14:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_debug,4,2                      ; @debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vpif_buffer_prepare\n"

	.comm	_VPIF_VIDEO_INDEX,8,3           ; @VPIF_VIDEO_INDEX
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ; @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ; @VIDEOBUF_PREPARED
	.comm	_V4L2_MEMORY_USERPTR,8,3        ; @V4L2_MEMORY_USERPTR
l_.str.1:                               ; @.str.1
	.asciz	"buffer address is 0\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"buffer_prepare:offset is not aligned to 8 bytes\n"

	.no_dead_strip	_vpif_buffer_prepare
.subsections_via_symbols
