	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bnx2x_alloc_mem                ## -- Begin function bnx2x_alloc_mem
	.p2align	4, 0x90
_bnx2x_alloc_mem:                       ## @bnx2x_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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_CONFIGURE_NIC_MODE
	testl	%eax, %eax
	jne	LBB0_3
## %bb.1:
	cmpq	$0, 80(%r14)
	jne	LBB0_3
## %bb.2:
	leaq	88(%r14), %rdi
	movq	_SRC_T2_SZ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_BNX2X_PCI_ALLOC
	movq	%rax, 80(%r14)
	testq	%rax, %rax
	je	LBB0_14
LBB0_3:
	leaq	72(%r14), %rdi
	movl	$4, %esi
	callq	_BNX2X_PCI_ALLOC
	movq	%rax, 64(%r14)
	testq	%rax, %rax
	je	LBB0_14
## %bb.4:
	leaq	56(%r14), %rdi
	movl	$4, %esi
	callq	_BNX2X_PCI_ALLOC
	movq	%rax, 48(%r14)
	testq	%rax, %rax
	je	LBB0_14
## %bb.5:
	movq	%r14, %rdi
	callq	_BNX2X_L2_CID_COUNT
	movl	%eax, %r15d
	shll	$2, %r15d
	testl	%r15d, %r15d
	jle	LBB0_9
## %bb.6:
	xorl	%r12d, %r12d
	movl	$16, %ebx
	movq	_CDU_ILT_PAGE_SZ@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	movl	%r15d, %esi
	subl	%r12d, %esi
	callq	_min
	movq	40(%r14), %rdi
	movl	%eax, -16(%rdi,%rbx)
	addq	%rbx, %rdi
	movl	%eax, %esi
	callq	_BNX2X_PCI_ALLOC
	movq	40(%r14), %rcx
	movq	%rax, -8(%rcx,%rbx)
	testq	%rax, %rax
	je	LBB0_14
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	addl	-16(%rcx,%rbx), %r12d
	addq	$24, %rbx
	cmpl	%r12d, %r15d
	jg	LBB0_7
LBB0_9:
	movq	_ILT_MAX_LINES@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kcalloc
	movq	32(%r14), %rcx
	movl	%eax, (%rcx)
	testl	%eax, %eax
	je	LBB0_14
## %bb.10:
	movq	_ILT_MEMOP_ALLOC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_bnx2x_ilt_mem_op
	testq	%rax, %rax
	jne	LBB0_14
## %bb.11:
	movq	%r14, %rdi
	callq	_bnx2x_iov_alloc_mem
	testq	%rax, %rax
	je	LBB0_12
LBB0_14:
	movq	%r14, %rdi
	callq	_bnx2x_free_mem
	leaq	L_.str(%rip), %rdi
	callq	_BNX2X_ERR
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	leaq	24(%r14), %rdi
	movq	_BCM_PAGE_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_BNX2X_PCI_ALLOC
	movq	%rax, 16(%r14)
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	leaq	8(%r14), %rdi
	movq	_NUM_EQ_PAGES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	imull	(%rbx), %esi
	callq	_BNX2X_PCI_ALLOC
	movq	%rax, %rcx
	movq	%rax, (%r14)
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jne	LBB0_15
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_SRC_T2_SZ,4,2                  ## @SRC_T2_SZ
	.comm	_CDU_ILT_PAGE_SZ,4,2            ## @CDU_ILT_PAGE_SZ
	.comm	_ILT_MAX_LINES,4,2              ## @ILT_MAX_LINES
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ILT_MEMOP_ALLOC,4,2            ## @ILT_MEMOP_ALLOC
	.comm	_BCM_PAGE_SIZE,4,2              ## @BCM_PAGE_SIZE
	.comm	_NUM_EQ_PAGES,4,2               ## @NUM_EQ_PAGES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't allocate memory\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bnx2x_alloc_mem                ; -- Begin function bnx2x_alloc_mem
	.p2align	2
_bnx2x_alloc_mem:                       ; @bnx2x_alloc_mem
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x0
	bl	_CONFIGURE_NIC_MODE
	cbnz	w0, LBB0_3
; %bb.1:
	ldr	x8, [x19, #80]
	cbnz	x8, LBB0_3
; %bb.2:
	add	x0, x19, #88
Lloh0:
	adrp	x8, _SRC_T2_SZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SRC_T2_SZ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_BNX2X_PCI_ALLOC
	str	x0, [x19, #80]
	cbz	x0, LBB0_12
LBB0_3:
	add	x0, x19, #72
	mov	w1, #4
	bl	_BNX2X_PCI_ALLOC
	str	x0, [x19, #64]
	cbz	x0, LBB0_12
; %bb.4:
	add	x0, x19, #56
	mov	w1, #4
	bl	_BNX2X_PCI_ALLOC
	str	x0, [x19, #48]
	cbz	x0, LBB0_12
; %bb.5:
	mov	x0, x19
	bl	_BNX2X_L2_CID_COUNT
	lsl	w20, w0, #2
	cmp	w20, #1
	b.lt	LBB0_9
; %bb.6:
	mov	x21, #0
	mov	w22, #0
Lloh3:
	adrp	x23, _CDU_ILT_PAGE_SZ@GOTPAGE
Lloh4:
	ldr	x23, [x23, _CDU_ILT_PAGE_SZ@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x23]
	sub	w1, w20, w22
	bl	_min
	mov	x1, x0
	ldr	x8, [x19, #40]
	add	x0, x8, x21
	str	w1, [x0], #16
	bl	_BNX2X_PCI_ALLOC
	ldr	x8, [x19, #40]
	add	x9, x8, x21
	str	x0, [x9, #8]
	cbz	x0, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [x8, x21]
	add	x21, x21, #24
	add	w22, w8, w22
	cmp	w20, w22
	b.gt	LBB0_7
LBB0_9:
Lloh5:
	adrp	x8, _ILT_MAX_LINES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ILT_MAX_LINES@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	w1, #4
	bl	_kcalloc
	ldr	x8, [x19, #32]
	str	w0, [x8]
	cbz	w0, LBB0_12
; %bb.10:
Lloh11:
	adrp	x8, _ILT_MEMOP_ALLOC@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ILT_MEMOP_ALLOC@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_bnx2x_ilt_mem_op
	cbnz	x0, LBB0_12
; %bb.11:
	mov	x0, x19
	bl	_bnx2x_iov_alloc_mem
	cbz	x0, LBB0_14
LBB0_12:
	mov	x0, x19
	bl	_bnx2x_free_mem
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BNX2X_ERR
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_13:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_14:
	add	x0, x19, #24
Lloh19:
	adrp	x20, _BCM_PAGE_SIZE@GOTPAGE
Lloh20:
	ldr	x20, [x20, _BCM_PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x20]
	bl	_BNX2X_PCI_ALLOC
	str	x0, [x19, #16]
	cbz	x0, LBB0_12
; %bb.15:
	add	x0, x19, #8
	ldr	w8, [x20]
Lloh21:
	adrp	x9, _NUM_EQ_PAGES@GOTPAGE
Lloh22:
	ldr	x9, [x9, _NUM_EQ_PAGES@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	mul	w1, w9, w8
	bl	_BNX2X_PCI_ALLOC
	str	x0, [x19]
	cbz	x0, LBB0_12
; %bb.16:
	mov	w0, #0
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_SRC_T2_SZ,4,2                  ; @SRC_T2_SZ
	.comm	_CDU_ILT_PAGE_SZ,4,2            ; @CDU_ILT_PAGE_SZ
	.comm	_ILT_MAX_LINES,4,2              ; @ILT_MAX_LINES
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ILT_MEMOP_ALLOC,4,2            ; @ILT_MEMOP_ALLOC
	.comm	_BCM_PAGE_SIZE,4,2              ; @BCM_PAGE_SIZE
	.comm	_NUM_EQ_PAGES,4,2               ; @NUM_EQ_PAGES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't allocate memory\n"

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