	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cafe_alloc_dma_bufs
_cafe_alloc_dma_bufs:                   ## @cafe_alloc_dma_bufs
	.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	%esi, %r14d
	movq	%rdi, %r12
	movl	$1, %esi
	callq	_cafe_set_config_needed
	testl	%r14d, %r14d
	je	LBB0_1
## %bb.2:
	movq	_dma_buf_size@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	leaq	40(%r12), %rax
LBB0_3:
	movl	(%rax), %esi
	movl	%esi, 24(%r12)
	movq	_n_dma_bufs@GOTPCREL(%rip), %r15
	cmpl	$4, (%r15)
	jl	LBB0_5
## %bb.4:
	movl	$3, (%r15)
LBB0_5:
	movl	$0, (%r12)
	cmpl	$0, (%r15)
	jle	LBB0_15
## %bb.6:
	movq	8(%r12), %rdx
	movq	32(%r12), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	callq	_dma_alloc_coherent
	movq	16(%r12), %rcx
	movq	%rax, (%rcx)
	movq	16(%r12), %rax
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.7:
	movl	$4, %ebx
	movl	$1, %r13d
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	24(%r12), %edx
	movl	$204, %esi
	callq	_memset
	movl	(%r12), %eax
	incl	%eax
	movl	%eax, (%r12)
	movslq	(%r15), %rcx
	cmpq	%rcx, %r13
	jge	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	24(%r12), %esi
	movq	32(%r12), %rdi
	movq	8(%r12), %rdx
	addq	%rbx, %rdx
	movl	(%r14), %ecx
	callq	_dma_alloc_coherent
	movq	16(%r12), %rcx
	movq	%rax, (%rcx,%rbx,2)
	movq	16(%r12), %rax
	movq	(%rax,%rbx,2), %rdi
	addq	$4, %rbx
	incq	%r13
	testq	%rdi, %rdi
	jne	LBB0_8
LBB0_10:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	callq	_cam_warn
	movl	(%r12), %eax
LBB0_11:
	testl	%eax, %eax
	je	LBB0_15
## %bb.12:
	xorl	%r14d, %r14d
	cmpl	$2, %eax
	je	LBB0_16
## %bb.13:
	cmpl	$1, %eax
	jne	LBB0_18
## %bb.14:
	movq	32(%r12), %rdi
	movl	24(%r12), %esi
	movq	8(%r12), %rax
	movq	16(%r12), %rcx
	movq	(%rcx), %rdx
	movl	(%rax), %ecx
	callq	_dma_free_coherent
	movl	$0, (%r12)
LBB0_15:
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	callq	_cam_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_18:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	cmpl	$3, (%r15)
	jl	LBB0_18
## %bb.17:
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	callq	_cam_warn
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_dma_buf_size,4,2               ## @dma_buf_size
	.comm	_n_dma_bufs,4,2                 ## @n_dma_bufs
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate DMA buffer\n"

L_.str.1:                               ## @.str.1
	.asciz	"Insufficient DMA buffers, cannot operate\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.2:                               ## @.str.2
	.asciz	"Will limp along with only 2 buffers\n"

	.no_dead_strip	_cafe_alloc_dma_bufs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cafe_alloc_dma_bufs
_cafe_alloc_dma_bufs:                   ; @cafe_alloc_dma_bufs
	.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	x20, x1
	mov	x19, x0
	mov	w1, #1
	bl	_cafe_set_config_needed
	add	x8, x19, #40
Lloh0:
	adrp	x9, _dma_buf_size@GOTPAGE
Lloh1:
	ldr	x9, [x9, _dma_buf_size@GOTPAGEOFF]
	cmp	w20, #0
	csel	x8, x8, x9, eq
	ldr	w1, [x8]
	str	w1, [x19, #24]
Lloh2:
	adrp	x20, _n_dma_bufs@GOTPAGE
Lloh3:
	ldr	x20, [x20, _n_dma_bufs@GOTPAGEOFF]
	ldr	w8, [x20]
	cmp	w8, #4
	b.lt	LBB0_2
; %bb.1:
	mov	w8, #3
	str	w8, [x20]
LBB0_2:
	str	wzr, [x19]
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.3:
	ldr	x0, [x19, #32]
	ldr	x2, [x19, #8]
Lloh4:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w3, [x21]
	bl	_dma_alloc_coherent
	ldr	x8, [x19, #16]
	str	x0, [x8]
	ldr	x8, [x19, #16]
	ldr	x0, [x8]
	cbz	x0, LBB0_7
; %bb.4:
	mov	w22, #4
	mov	w23, #1
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x19, #24]
	mov	w1, #204
	bl	_memset
	ldr	w8, [x19]
	add	w8, w8, #1
	str	w8, [x19]
	ldrsw	x9, [x20]
	cmp	x23, x9
	b.ge	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w1, [x19, #24]
	ldr	x0, [x19, #32]
	ldr	x8, [x19, #8]
	add	x2, x8, x22
	ldr	w3, [x21]
	bl	_dma_alloc_coherent
	ldr	x8, [x19, #16]
	lsl	x9, x23, #3
	str	x0, [x8, x9]
	ldr	x8, [x19, #16]
	ldr	x0, [x8, x9]
	add	x22, x22, #4
	add	x23, x23, #1
	cbnz	x0, LBB0_5
LBB0_7:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_cam_warn
	ldr	w8, [x19]
LBB0_8:
	cbz	w8, LBB0_12
; %bb.9:
	cmp	w8, #2
	b.eq	LBB0_13
; %bb.10:
	cmp	w8, #1
	b.ne	LBB0_15
; %bb.11:
	ldr	x0, [x19, #32]
	ldr	w1, [x19, #24]
	ldp	x9, x8, [x19, #8]
	ldr	x2, [x8]
	ldr	w3, [x9]
	bl	_dma_free_coherent
	str	wzr, [x19]
LBB0_12:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_cam_err
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_16
LBB0_13:
	ldr	w8, [x20]
	cmp	w8, #3
	b.lt	LBB0_15
; %bb.14:
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_cam_warn
LBB0_15:
	mov	w0, #0
LBB0_16:
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_dma_buf_size,4,2               ; @dma_buf_size
	.comm	_n_dma_bufs,4,2                 ; @n_dma_bufs
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate DMA buffer\n"

l_.str.1:                               ; @.str.1
	.asciz	"Insufficient DMA buffers, cannot operate\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.2:                               ; @.str.2
	.asciz	"Will limp along with only 2 buffers\n"

	.no_dead_strip	_cafe_alloc_dma_bufs
.subsections_via_symbols
