	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bnad_mem_alloc
_bnad_mem_alloc:                        ## @bnad_mem_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	%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
	movq	%rsi, %r14
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %edi
	testl	%edi, %edi
	je	LBB0_9
## %bb.1:
	cmpq	$0, 8(%r14)
	je	LBB0_9
## %bb.2:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, 24(%r14)
	testq	%rax, %rax
	je	LBB0_16
## %bb.3:
	movq	16(%r14), %rdx
	movq	_BNA_MEM_T_DMA@GOTPCREL(%rip), %rsi
	movl	(%r14), %ecx
	cmpq	(%rsi), %rdx
	jne	LBB0_10
## %bb.4:
	xorl	%r15d, %r15d
	testl	%ecx, %ecx
	jle	LBB0_17
## %bb.5:
	movl	$16, %r12d
	movl	$1, %r13d
	leaq	-44(%rbp), %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r14), %rsi
	movq	%rsi, -16(%rax,%r12)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdx
	callq	_dma_alloc_coherent
	movq	24(%r14), %rsi
	movq	%rax, -8(%rsi,%r12)
	testq	%rax, %rax
	je	LBB0_15
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	-44(%rbp), %edi
	addq	%r12, %rsi
	callq	_BNA_SET_DMA_ADDR
	movslq	(%r14), %rax
	cmpq	%rax, %r13
	jge	LBB0_17
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	24(%r14), %rax
	addq	$24, %r12
	incq	%r13
	jmp	LBB0_6
LBB0_9:
	movq	$0, 24(%r14)
	xorl	%r15d, %r15d
	jmp	LBB0_17
LBB0_10:
	testl	%ecx, %ecx
	jle	LBB0_18
## %bb.11:
	xorl	%ebx, %ebx
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r14), %rdi
	movq	%rdi, (%rax,%rbx)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	movq	%rax, %rcx
	movq	24(%r14), %rax
	movq	%rcx, 8(%rax,%rbx)
	testq	%rcx, %rcx
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	incq	%r15
	movslq	(%r14), %rcx
	addq	$24, %rbx
	cmpq	%rcx, %r15
	jl	LBB0_12
LBB0_18:
	xorl	%r15d, %r15d
	jmp	LBB0_17
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_bnad_mem_free
LBB0_16:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_BNA_MEM_T_DMA,8,3              ## @BNA_MEM_T_DMA
	.no_dead_strip	_bnad_mem_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bnad_mem_alloc
_bnad_mem_alloc:                        ; @bnad_mem_alloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x1
	mov	x20, x0
	ldr	w0, [x1]
	cbz	w0, LBB0_11
; %bb.1:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_11
; %bb.2:
Lloh0:
	adrp	x21, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x21, [x21, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19, #24]
	cbz	x0, LBB0_10
; %bb.3:
	ldr	x9, [x19, #16]
Lloh2:
	adrp	x8, _BNA_MEM_T_DMA@GOTPAGE
Lloh3:
	ldr	x8, [x8, _BNA_MEM_T_DMA@GOTPAGEOFF]
Lloh4:
	ldr	x10, [x8]
	ldr	w8, [x19]
	cmp	x9, x10
	b.ne	LBB0_13
; %bb.4:
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.5:
	ldr	x1, [x19, #8]
	str	x1, [x0]
	ldr	x0, [x20]
	ldr	w3, [x21]
	add	x2, sp, #12
	bl	_dma_alloc_coherent
	ldr	x8, [x19, #24]
	str	x0, [x8, #8]
	cbz	x0, LBB0_9
; %bb.6:
	mov	x22, #0
	mov	x23, #0
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [sp, #12]
	add	x8, x8, x22
	add	x1, x8, #16
	bl	_BNA_SET_DMA_ADDR
	add	x23, x23, #1
	ldrsw	x8, [x19]
	cmp	x23, x8
	b.ge	LBB0_17
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x24, x22, #24
	ldr	x8, [x19, #24]
	ldr	x1, [x19, #8]
	add	x8, x8, x22
	str	x1, [x8, #24]
	ldr	x0, [x20]
	ldr	w3, [x21]
	add	x2, sp, #12
	bl	_dma_alloc_coherent
	ldr	x8, [x19, #24]
	add	x9, x8, x22
	str	x0, [x9, #32]
	mov	x22, x24
	cbnz	x0, LBB0_7
LBB0_9:
	mov	x0, x20
	mov	x1, x19
	bl	_bnad_mem_free
LBB0_10:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_12
LBB0_11:
	mov	w0, #0
	str	xzr, [x19, #24]
LBB0_12:
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_13:
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.14:
	mov	x22, #0
	mov	x23, #0
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	str	x8, [x0, x22]
	ldr	w1, [x21]
	mov	x0, x8
	bl	_kzalloc
	mov	x8, x0
	ldr	x0, [x19, #24]
	add	x9, x0, x22
	str	x8, [x9, #8]
	cbz	x8, LBB0_9
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	add	x23, x23, #1
	ldrsw	x8, [x19]
	add	x22, x22, #24
	cmp	x23, x8
	b.lt	LBB0_15
LBB0_17:
	mov	w0, #0
	b	LBB0_12
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_BNA_MEM_T_DMA,8,3              ; @BNA_MEM_T_DMA
	.no_dead_strip	_bnad_mem_alloc
.subsections_via_symbols
