	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ksz_alloc_mem
_ksz_alloc_mem:                         ## @ksz_alloc_mem
	.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
	movq	_NUM_OF_RX_DESC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rdi)
	movq	_NUM_OF_TX_DESC@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, 8(%rdi)
	movl	$0, (%rdi)
	movl	(%rax), %ecx
	movl	$8, %eax
	cmpl	$35, %ecx
	jg	LBB0_2
## %bb.1:
	leal	3(%rcx), %eax
	testl	%ecx, %ecx
	cmovnsl	%ecx, %eax
	sarl	$2, %eax
LBB0_2:
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	$-1, %ecx
	movl	%eax, %edx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	sarl	%edx
	incl	%ecx
	cmpl	$1, %eax
	movl	%edx, %eax
	ja	LBB0_5
## %bb.6:
	movl	$-1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	notl	%eax
	movl	%eax, 4(%rbx)
	movq	%rbx, %rax
	jmp	LBB0_7
LBB0_3:
	leaq	4(%rbx), %rax
LBB0_7:
	movl	$0, (%rax)
	movq	_DESC_ALIGNMENT@GOTPCREL(%rip), %rax
	movslq	(%rax), %rsi
	leaq	3(%rsi), %rcx
	movq	%rcx, %rax
	orq	%rsi, %rax
	shrq	$32, %rax
	je	LBB0_8
## %bb.9:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%rsi
	jmp	LBB0_10
LBB0_8:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_10:
	leaq	16(%rbx), %r15
	leaq	8(%rbx), %r14
	subl	%edx, %ecx
	movl	%ecx, 20(%rbx)
	movl	%ecx, 12(%rbx)
	cmpl	$4, %ecx
	je	LBB0_12
## %bb.11:
	leaq	L_.str(%rip), %rdi
	callq	_pr_alert
LBB0_12:
	movq	%r15, %rdi
	callq	_ksz_check_desc_num
	movq	%r14, %rdi
	callq	_ksz_check_desc_num
	movq	%rbx, %rdi
	callq	_ksz_alloc_desc
	xorl	%ecx, %ecx
	testq	%rax, %rax
	setne	%cl
	movl	%ecx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NUM_OF_RX_DESC,4,2             ## @NUM_OF_RX_DESC
	.comm	_NUM_OF_TX_DESC,4,2             ## @NUM_OF_TX_DESC
	.comm	_DESC_ALIGNMENT,4,2             ## @DESC_ALIGNMENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Hardware descriptor size not right!\n"

	.no_dead_strip	_ksz_alloc_mem
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ksz_alloc_mem
_ksz_alloc_mem:                         ; @ksz_alloc_mem
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
Lloh0:
	adrp	x8, _NUM_OF_RX_DESC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NUM_OF_RX_DESC@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	mov	x20, x0
	str	w8, [x20, #16]!
Lloh3:
	adrp	x8, _NUM_OF_TX_DESC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NUM_OF_TX_DESC@GOTPAGEOFF]
	ldr	w9, [x8]
	mov	x21, x0
	str	w9, [x21, #8]!
	str	wzr, [x0]
	ldr	w8, [x8]
	add	w9, w8, #3
	cmp	w8, #0
	csel	w9, w9, w8, lt
	asr	w9, w9, #2
	mov	w10, #8
	cmp	w8, #35
	csel	w9, w10, w9, gt
	cbz	w9, LBB0_4
; %bb.1:
	mov	w8, #-1
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	asr	w10, w9, #1
	add	w8, w8, #1
	cmp	w9, #1
	mov	x9, x10
	b.hi	LBB0_2
; %bb.3:
	mov	w9, #-1
	lsl	w8, w9, w8
	mvn	w8, w8
	str	w8, [x19, #4]
	mov	x8, x19
	b	LBB0_5
LBB0_4:
	add	x8, x19, #4
LBB0_5:
	str	wzr, [x8]
Lloh5:
	adrp	x8, _DESC_ALIGNMENT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _DESC_ALIGNMENT@GOTPAGEOFF]
Lloh7:
	ldrsw	x8, [x8]
	add	x9, x8, #3
	udiv	x9, x9, x8
	mul	w8, w9, w8
	str	w8, [x19, #20]
	str	w8, [x19, #12]
	cmp	w8, #4
	b.eq	LBB0_7
; %bb.6:
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_alert
LBB0_7:
	mov	x0, x20
	bl	_ksz_check_desc_num
	mov	x0, x21
	bl	_ksz_check_desc_num
	mov	x0, x19
	bl	_ksz_alloc_desc
	cmp	x0, #0
	cset	w0, ne
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_NUM_OF_RX_DESC,4,2             ; @NUM_OF_RX_DESC
	.comm	_NUM_OF_TX_DESC,4,2             ; @NUM_OF_TX_DESC
	.comm	_DESC_ALIGNMENT,4,2             ; @DESC_ALIGNMENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Hardware descriptor size not right!\n"

	.no_dead_strip	_ksz_alloc_mem
.subsections_via_symbols
