	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function buffer_prepare
_buffer_prepare:                        ## @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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	(%rax), %rax
	movq	(%rax), %r15
	movq	8(%r15), %rbx
	leaq	L_.str(%rip), %rdi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_DEB_CAP
	movl	8(%rbx), %esi
	movl	12(%rbx), %edx
	cmpl	$48, %esi
	jl	LBB0_4
## %bb.1:
	cmpl	$32, %edx
	jl	LBB0_4
## %bb.2:
	movq	48(%rbx), %rax
	cmpl	(%rax), %esi
	jg	LBB0_4
## %bb.3:
	cmpl	4(%rax), %edx
	jle	LBB0_6
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_DEB_D
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_24:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	16(%rbx), %r13d
	cmpq	$0, 8(%r12)
	je	LBB0_9
## %bb.7:
	cmpl	%r13d, 16(%r12)
	jge	LBB0_9
## %bb.8:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_DEB_D
	jmp	LBB0_5
LBB0_9:
	leaq	8(%rbx), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_v4l2_field_names@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	24(%rbx), %rcx
	movl	(%rax,%rcx,4), %r8d
	leaq	L_.str.3(%rip), %rdi
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_DEB_CAP
	movl	20(%r12), %eax
	cmpl	8(%rbx), %eax
	jne	LBB0_16
## %bb.10:
	movq	24(%r12), %rax
	cmpq	32(%rbx), %rax
	jne	LBB0_16
## %bb.11:
	movl	32(%r12), %eax
	cmpl	12(%rbx), %eax
	jne	LBB0_16
## %bb.12:
	cmpl	%r13d, 36(%r12)
	jne	LBB0_16
## %bb.13:
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, 40(%r12)
	jne	LBB0_16
## %bb.14:
	movslq	-48(%rbp), %rax                 ## 4-byte Folded Reload
	cmpq	%rax, 24(%rbx)
	jne	LBB0_16
## %bb.15:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, 64(%r12)
	je	LBB0_17
LBB0_16:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%r12, %rdx
	callq	_saa7146_dma_free
LBB0_17:
	movq	_VIDEOBUF_NEEDS_INIT@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	48(%r12), %rax
	jne	LBB0_22
## %bb.18:
	leaq	8(%r12), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	32(%rbx), %rax
	movq	%rax, 24(%r12)
	movl	8(%rbx), %eax
	movl	%eax, 20(%r12)
	movl	12(%rbx), %eax
	movl	%eax, 32(%r12)
	movl	%r13d, 36(%r12)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 64(%r12)
	movl	24(%rbx), %eax
	movl	%eax, 40(%r12)
	movl	40(%rbx), %esi
	movq	%r15, %rdi
	callq	_saa7146_format_by_fourcc
	movq	%rax, %r13
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_release_all_pagetables
	movl	(%r13), %edi
	callq	_IS_PLANAR
	movq	%rax, %r13
	movl	(%r15), %edi
	movq	56(%r12), %rsi
	callq	_saa7146_pgtable_alloc
	testq	%r13, %r13
	je	LBB0_20
## %bb.19:
	movl	(%r15), %edi
	movq	56(%r12), %rsi
	addq	$4, %rsi
	callq	_saa7146_pgtable_alloc
	movl	(%r15), %edi
	movq	56(%r12), %rsi
	addq	$8, %rsi
	callq	_saa7146_pgtable_alloc
LBB0_20:
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_videobuf_iolock
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_23
## %bb.21:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_saa7146_pgtable_build
	movl	%eax, %r13d
	testl	%eax, %eax
	je	LBB0_22
LBB0_23:
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_DEB_D
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%r12, %rdx
	callq	_saa7146_dma_free
	jmp	LBB0_24
LBB0_22:
	movq	_VIDEOBUF_PREPARED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 48(%r12)
	movq	_buffer_activate@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12)
	xorl	%r13d, %r13d
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vbuf:%p\n"

L_.str.1:                               ## @.str.1
	.asciz	"w (%d) / h (%d) out of bounds\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"size mismatch\n"

L_.str.3:                               ## @.str.3
	.asciz	"buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n"

	.comm	_v4l2_field_names,8,3           ## @v4l2_field_names
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ## @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ## @VIDEOBUF_PREPARED
	.comm	_buffer_activate,4,2            ## @buffer_activate
L_.str.4:                               ## @.str.4
	.asciz	"error out\n"

	.no_dead_strip	_buffer_prepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function buffer_prepare
_buffer_prepare:                        ; @buffer_prepare
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x24, x2
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0]
	ldr	x8, [x8]
	ldr	x21, [x8]
	ldr	x22, [x21, #8]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DEB_CAP
	mov	x25, x22
	ldr	w1, [x25, #8]!
	ldr	w8, [x22, #12]
	cmp	w1, #48
	b.lt	LBB0_4
; %bb.1:
	cmp	w8, #32
	b.lt	LBB0_4
; %bb.2:
	ldr	x9, [x22, #48]
	ldr	w10, [x9]
	cmp	w1, w10
	b.gt	LBB0_4
; %bb.3:
	ldr	w9, [x9, #4]
	cmp	w8, w9
	b.le	LBB0_7
LBB0_4:
	stp	x1, x8, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_5:
	bl	_DEB_D
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_6:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_7:
	ldr	w26, [x22, #16]
	mov	x23, x19
	ldr	x9, [x23, #8]!
	cbz	x9, LBB0_10
; %bb.8:
	ldr	w9, [x19, #16]
	cmp	w9, w26
	b.ge	LBB0_10
; %bb.9:
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_5
LBB0_10:
Lloh9:
	adrp	x9, _v4l2_field_names@GOTPAGE
Lloh10:
	ldr	x9, [x9, _v4l2_field_names@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	ldr	x10, [x22, #24]
	ldr	w9, [x9, x10, lsl #2]
	stp	x26, x9, [sp, #8]
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	str	x8, [sp]
Lloh12:
	adrp	x0, l_.str.3@PAGE
Lloh13:
	add	x0, x0, l_.str.3@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_DEB_CAP
	ldr	w8, [x19, #20]
	ldr	w9, [x22, #8]
	cmp	w8, w9
	b.ne	LBB0_17
; %bb.11:
	ldr	x8, [x19, #24]
	ldr	x9, [x22, #32]
	cmp	x8, x9
	b.ne	LBB0_17
; %bb.12:
	ldr	w8, [x19, #32]
	ldr	w9, [x22, #12]
	cmp	w8, w9
	b.ne	LBB0_17
; %bb.13:
	ldr	w8, [x19, #36]
	cmp	w8, w26
	b.ne	LBB0_17
; %bb.14:
	ldr	w8, [x19, #40]
	cmp	w8, w24
	b.ne	LBB0_17
; %bb.15:
	ldr	x8, [x22, #24]
	cmp	x8, w24, sxtw
	b.ne	LBB0_17
; %bb.16:
	ldr	x8, [x19, #64]
	cmp	x8, x25
	b.eq	LBB0_18
LBB0_17:
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_saa7146_dma_free
LBB0_18:
Lloh14:
	adrp	x8, _VIDEOBUF_NEEDS_INIT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _VIDEOBUF_NEEDS_INIT@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	ldr	x9, [x19, #48]
	cmp	x8, x9
	b.ne	LBB0_24
; %bb.19:
	ldp	x9, x8, [x22, #24]
	str	x8, [x19, #24]
	ldp	w8, w10, [x22, #8]
	str	w8, [x19, #20]
	stp	w10, w26, [x19, #32]
	str	x25, [x19, #64]
	str	w9, [x19, #40]
	ldr	w1, [x22, #40]
	mov	x0, x21
	bl	_saa7146_format_by_fourcc
	mov	x24, x0
	mov	x0, x21
	mov	x1, x19
	bl	_release_all_pagetables
	ldr	w0, [x24]
	bl	_IS_PLANAR
	mov	x24, x0
	ldr	w0, [x21]
	ldr	x1, [x19, #56]
	bl	_saa7146_pgtable_alloc
	cbz	x24, LBB0_21
; %bb.20:
	ldr	w0, [x21]
	ldr	x8, [x19, #56]
	add	x1, x8, #4
	bl	_saa7146_pgtable_alloc
	ldr	w0, [x21]
	ldr	x8, [x19, #56]
	add	x1, x8, #8
	bl	_saa7146_pgtable_alloc
LBB0_21:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x22
	bl	_videobuf_iolock
	mov	x22, x0
	cbnz	w0, LBB0_23
; %bb.22:
	mov	x0, x21
	mov	x1, x19
	bl	_saa7146_pgtable_build
	mov	x22, x0
	cbz	w0, LBB0_24
LBB0_23:
Lloh17:
	adrp	x0, l_.str.4@PAGE
Lloh18:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DEB_D
	mov	x0, x21
	mov	x1, x20
	mov	x2, x19
	bl	_saa7146_dma_free
	b	LBB0_6
LBB0_24:
	mov	w22, #0
Lloh19:
	adrp	x8, _VIDEOBUF_PREPARED@GOTPAGE
Lloh20:
	ldr	x8, [x8, _VIDEOBUF_PREPARED@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	str	x8, [x19, #48]
Lloh22:
	adrp	x8, _buffer_activate@GOTPAGE
Lloh23:
	ldr	x8, [x8, _buffer_activate@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	str	w8, [x19]
	b	LBB0_6
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vbuf:%p\n"

l_.str.1:                               ; @.str.1
	.asciz	"w (%d) / h (%d) out of bounds\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"size mismatch\n"

l_.str.3:                               ; @.str.3
	.asciz	"buffer_prepare [size=%dx%d,bytes=%d,fields=%s]\n"

	.comm	_v4l2_field_names,8,3           ; @v4l2_field_names
	.comm	_VIDEOBUF_NEEDS_INIT,8,3        ; @VIDEOBUF_NEEDS_INIT
	.comm	_VIDEOBUF_PREPARED,8,3          ; @VIDEOBUF_PREPARED
	.comm	_buffer_activate,4,2            ; @buffer_activate
l_.str.4:                               ; @.str.4
	.asciz	"error out\n"

	.no_dead_strip	_buffer_prepare
.subsections_via_symbols
