	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mantis_alloc_buffers
_mantis_alloc_buffers:                  ## @mantis_alloc_buffers
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	cmpq	$0, 24(%rdi)
	jne	LBB0_4
## %bb.1:
	movl	16(%rbx), %edi
	movq	_MANTIS_BUF_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	32(%rbx), %r14
	movq	%r14, %rdx
	callq	_pci_alloc_consistent
	movq	%rax, 24(%rbx)
	movq	_MANTIS_ERROR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	testq	%rax, %rax
	je	LBB0_2
## %bb.3:
	movq	(%r14), %rcx
	movl	(%r15), %r9d
	leaq	L_.str.1(%rip), %rdx
	movl	$1, %esi
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	_dprintk
LBB0_4:
	xorl	%r14d, %r14d
	cmpq	$0, (%rbx)
	jne	LBB0_8
## %bb.5:
	movl	16(%rbx), %edi
	movq	_MANTIS_RISC_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	8(%rbx), %r14
	movq	%r14, %rdx
	callq	_pci_alloc_consistent
	movq	%rax, (%rbx)
	movq	_MANTIS_ERROR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	testq	%rax, %rax
	je	LBB0_6
## %bb.9:
	movq	(%r14), %rcx
	movl	(%r15), %r9d
	leaq	L_.str.3(%rip), %rdx
	xorl	%r14d, %r14d
	movl	$1, %esi
	movq	%rax, %r8
	xorl	%eax, %eax
	callq	_dprintk
	jmp	LBB0_8
LBB0_2:
	leaq	L_.str(%rip), %rdx
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_dprintk
	jmp	LBB0_7
LBB0_6:
	leaq	L_.str.2(%rip), %rdx
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_dprintk
	movq	%rbx, %rdi
	callq	_mantis_dma_exit
LBB0_7:
	movq	_MANTIS_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rdx
	xorl	%r14d, %r14d
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_dprintk
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_8:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MANTIS_BUF_SIZE,4,2            ## @MANTIS_BUF_SIZE
	.comm	_MANTIS_ERROR,4,2               ## @MANTIS_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"DMA buffer allocation failed"

L_.str.1:                               ## @.str.1
	.asciz	"DMA=0x%lx cpu=0x%p size=%d"

	.comm	_MANTIS_RISC_SIZE,4,2           ## @MANTIS_RISC_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"RISC program allocation failed"

L_.str.3:                               ## @.str.3
	.asciz	"RISC=0x%lx cpu=0x%p size=%lx"

L_.str.4:                               ## @.str.4
	.asciz	"Out of memory (?) ....."

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mantis_alloc_buffers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mantis_alloc_buffers
_mantis_alloc_buffers:                  ; @mantis_alloc_buffers
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x0
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_3
; %bb.1:
	ldr	x8, [x19]
	cbz	x8, LBB0_5
LBB0_2:
	mov	w0, #0
	b	LBB0_10
LBB0_3:
	ldr	w0, [x19, #16]
Lloh0:
	adrp	x21, _MANTIS_BUF_SIZE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MANTIS_BUF_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x20, x19, #32
	mov	x2, x20
	bl	_pci_alloc_consistent
	mov	x8, x0
	str	x0, [x19, #24]
Lloh2:
	adrp	x9, _MANTIS_ERROR@GOTPAGE
Lloh3:
	ldr	x9, [x9, _MANTIS_ERROR@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x9]
	cbz	x8, LBB0_7
; %bb.4:
	ldr	x9, [x20]
	ldr	w10, [x21]
	stp	x8, x10, [sp, #8]
	str	x9, [sp]
Lloh5:
	adrp	x2, l_.str.1@PAGE
Lloh6:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	w1, #1
	bl	_dprintk
	ldr	x8, [x19]
	cbnz	x8, LBB0_2
LBB0_5:
	ldr	w0, [x19, #16]
Lloh7:
	adrp	x21, _MANTIS_RISC_SIZE@GOTPAGE
Lloh8:
	ldr	x21, [x21, _MANTIS_RISC_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x20, x19, #8
	mov	x2, x20
	bl	_pci_alloc_consistent
	mov	x8, x0
	str	x0, [x19]
Lloh9:
	adrp	x9, _MANTIS_ERROR@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MANTIS_ERROR@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x9]
	cbz	x8, LBB0_8
; %bb.6:
	ldr	x9, [x20]
	ldr	w10, [x21]
	stp	x8, x10, [sp, #8]
	str	x9, [sp]
Lloh12:
	adrp	x2, l_.str.3@PAGE
Lloh13:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	w1, #1
	bl	_dprintk
	mov	w0, #0
	b	LBB0_10
LBB0_7:
Lloh14:
	adrp	x2, l_.str@PAGE
Lloh15:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #1
	bl	_dprintk
	b	LBB0_9
LBB0_8:
Lloh16:
	adrp	x2, l_.str.2@PAGE
Lloh17:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	w1, #1
	bl	_dprintk
	mov	x0, x19
	bl	_mantis_dma_exit
LBB0_9:
Lloh18:
	adrp	x8, _MANTIS_ERROR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MANTIS_ERROR@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
Lloh21:
	adrp	x2, l_.str.4@PAGE
Lloh22:
	add	x2, x2, l_.str.4@PAGEOFF
	mov	w1, #1
	bl	_dprintk
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_MANTIS_BUF_SIZE,4,2            ; @MANTIS_BUF_SIZE
	.comm	_MANTIS_ERROR,4,2               ; @MANTIS_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"DMA buffer allocation failed"

l_.str.1:                               ; @.str.1
	.asciz	"DMA=0x%lx cpu=0x%p size=%d"

	.comm	_MANTIS_RISC_SIZE,4,2           ; @MANTIS_RISC_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"RISC program allocation failed"

l_.str.3:                               ; @.str.3
	.asciz	"RISC=0x%lx cpu=0x%p size=%lx"

l_.str.4:                               ; @.str.4
	.asciz	"Out of memory (?) ....."

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mantis_alloc_buffers
.subsections_via_symbols
