	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btcx_riscmem_alloc             ## -- Begin function btcx_riscmem_alloc
	.p2align	4, 0x90
_btcx_riscmem_alloc:                    ## @btcx_riscmem_alloc
	.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
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	$0, -32(%rbp)
	movq	8(%rsi), %rdi
	testq	%rdi, %rdi
	je	LBB0_3
## %bb.1:
	cmpl	%r14d, (%rbx)
	jae	LBB0_6
## %bb.2:
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_btcx_riscmem_free
	movq	8(%rbx), %rdi
	testq	%rdi, %rdi
	jne	LBB0_6
LBB0_3:
	leaq	-32(%rbp), %rdx
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_pci_alloc_consistent
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, 8(%rbx)
	movq	-32(%rbp), %rdx
	movq	%rdx, 16(%rbx)
	movl	%r14d, (%rbx)
	movq	_memcnt@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	incl	%esi
	movl	%esi, (%rcx)
	leaq	L_.str(%rip), %rdi
	movq	%rax, %rcx
	movl	%r14d, %r8d
	callq	_dprintk
	movq	8(%rbx), %rdi
LBB0_6:
	movl	(%rbx), %edx
	xorl	%ebx, %ebx
	xorl	%esi, %esi
	callq	_memset
LBB0_7:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_memcnt,4,2                     ## @memcnt
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"btcx: riscmem alloc [%d] dma=%lx cpu=%p size=%d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btcx_riscmem_alloc             ; -- Begin function btcx_riscmem_alloc
	.p2align	2
_btcx_riscmem_alloc:                    ; @btcx_riscmem_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x2
	mov	x19, x1
	mov	x21, x0
	str	xzr, [sp, #8]
	ldr	x0, [x1, #8]
	cbz	x0, LBB0_3
; %bb.1:
	ldr	w8, [x19]
	cmp	w8, w20
	b.hs	LBB0_5
; %bb.2:
	mov	x0, x21
	mov	x1, x19
	bl	_btcx_riscmem_free
	ldr	x0, [x19, #8]
	cbnz	x0, LBB0_5
LBB0_3:
	add	x2, sp, #8
	mov	x0, x21
	mov	x1, x20
	bl	_pci_alloc_consistent
	cbz	x0, LBB0_7
; %bb.4:
	mov	x3, x0
	ldr	x2, [sp, #8]
	stp	x0, x2, [x19, #8]
	str	w20, [x19]
Lloh0:
	adrp	x8, _memcnt@GOTPAGE
Lloh1:
	ldr	x8, [x8, _memcnt@GOTPAGEOFF]
	ldr	w9, [x8]
	add	w1, w9, #1
	str	w1, [x8]
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	mov	x4, x20
	bl	_dprintk
	ldr	x0, [x19, #8]
LBB0_5:
	ldr	w2, [x19]
	mov	w1, #0
	bl	_memset
	mov	w0, #0
LBB0_6:
	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
	add	sp, sp, #64
	ret
LBB0_7:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_memcnt,4,2                     ; @memcnt
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"btcx: riscmem alloc [%d] dma=%lx cpu=%p size=%d\n"

.subsections_via_symbols
