	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tbnet_alloc_rx_buffers
_tbnet_alloc_rx_buffers:                ## @tbnet_alloc_rx_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	%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
	testl	%esi, %esi
	je	LBB0_9
## %bb.1:
	movl	%esi, %r13d
	movq	%rdi, %rbx
	leaq	8(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movl	12(%rbx), %edi
	callq	_tb_ring_dma_device
	movq	%rax, %r13
	movq	_TBNET_RING_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	decl	%r15d
	andl	8(%rbx), %r15d
	movq	16(%rbx), %r12
	shlq	$4, %r15
	cmpq	$0, 8(%r12,%r15)
	jne	LBB0_9
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%r12,%r15), %r14
	addq	$8, %r14
	movq	_TBNET_RX_PAGE_ORDER@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_dev_alloc_pages
	movq	%rax, (%r14)
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_TBNET_RX_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r8d
	movq	%r13, %rdi
	movq	%rax, %rsi
	xorl	%edx, %edx
	callq	_dma_map_page
	movl	%eax, %r14d
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	jne	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	decl	%r13d
	leaq	(%r12,%r15), %rsi
	movl	%r14d, (%rsi)
	movl	(%rbx), %eax
	movl	%eax, 4(%r12,%r15)
	movl	12(%rbx), %edi
	callq	_tb_ring_rx
	incl	8(%rbx)
	testl	%r13d, %r13d
	jne	LBB0_2
LBB0_9:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_8:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_tbnet_free_buffers
LBB0_10:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_TBNET_RING_SIZE,4,2            ## @TBNET_RING_SIZE
	.comm	_TBNET_RX_PAGE_ORDER,4,2        ## @TBNET_RX_PAGE_ORDER
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_TBNET_RX_PAGE_SIZE,4,2         ## @TBNET_RX_PAGE_SIZE
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.no_dead_strip	_tbnet_alloc_rx_buffers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tbnet_alloc_rx_buffers
_tbnet_alloc_rx_buffers:                ; @tbnet_alloc_rx_buffers
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	cbz	w1, LBB0_8
; %bb.1:
	mov	x21, x0
	add	x8, x0, #8
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
Lloh0:
	adrp	x25, _TBNET_RING_SIZE@GOTPAGE
Lloh1:
	ldr	x25, [x25, _TBNET_RING_SIZE@GOTPAGEOFF]
Lloh2:
	adrp	x26, _TBNET_RX_PAGE_ORDER@GOTPAGE
Lloh3:
	ldr	x26, [x26, _TBNET_RX_PAGE_ORDER@GOTPAGEOFF]
Lloh4:
	adrp	x28, _DMA_FROM_DEVICE@GOTPAGE
Lloh5:
	ldr	x28, [x28, _DMA_FROM_DEVICE@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x21, #12]
	bl	_tb_ring_dma_device
	ldr	w8, [x21, #8]
	ldr	w9, [x25]
	sub	w9, w9, #1
	and	w19, w9, w8
	ldr	x27, [x21, #16]
	add	x22, x27, w19, uxtw #4
	mov	x24, x22
	ldr	x8, [x24, #8]!
	cbnz	x8, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x23, x0
	ldr	w0, [x26]
	bl	_dev_alloc_pages
	str	x0, [x24]
	cbz	x0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x1, x0
Lloh6:
	adrp	x8, _TBNET_RX_PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TBNET_RX_PAGE_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	ldr	w4, [x28]
	mov	x0, x23
	mov	w2, #0
	bl	_dma_map_page
	mov	x24, x0
	mov	x0, x23
	mov	x1, x24
	bl	_dma_mapping_error
	cbnz	x0, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	sub	w20, w20, #1
	str	w24, [x22]
	ldr	w8, [x21]
	add	x9, x27, x19, lsl #4
	str	w8, [x9, #4]
	ldr	w0, [x21, #12]
	mov	x1, x22
	bl	_tb_ring_rx
	ldr	w8, [x21, #8]
	add	w8, w8, #1
	str	w8, [x21, #8]
	cbnz	w20, LBB0_2
	b	LBB0_8
LBB0_6:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w20, w8
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_tbnet_free_buffers
	b	LBB0_8
LBB0_7:
	mov	w20, #0
LBB0_8:
	mov	x0, x20
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_TBNET_RING_SIZE,4,2            ; @TBNET_RING_SIZE
	.comm	_TBNET_RX_PAGE_ORDER,4,2        ; @TBNET_RX_PAGE_ORDER
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_TBNET_RX_PAGE_SIZE,4,2         ; @TBNET_RX_PAGE_SIZE
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.no_dead_strip	_tbnet_alloc_rx_buffers
.subsections_via_symbols
