	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rvu_mbox_handler_npc_mcam_alloc_counter ## -- Begin function rvu_mbox_handler_npc_mcam_alloc_counter
	.p2align	4, 0x90
_rvu_mbox_handler_npc_mcam_alloc_counter: ## @rvu_mbox_handler_npc_mcam_alloc_counter
	.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	%rdx, %r14
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	(%rdi), %r13
	movl	16(%rsi), %r15d
	movq	_BLKTYPE_NPC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_rvu_get_blkaddr
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	%rbx, %rdi
	movl	%r15d, %esi
	callq	_is_nixlf_attached
	testl	%eax, %eax
	je	LBB0_1
## %bb.3:
	cmpq	$0, 8(%r12)
	jne	LBB0_5
## %bb.4:
	movl	(%r12), %eax
	movq	_NPC_MAX_NONCONTIG_COUNTERS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_5
LBB0_1:
	movq	_NPC_MCAM_INVALID_REQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_16
LBB0_5:
	leaq	8(%r13), %rbx
	movq	%rbx, %rdi
	callq	_mutex_lock
	leaq	12(%r13), %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_rvu_rsrc_free_count
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:
	movl	$0, (%r14)
	cmpq	$0, 8(%r12)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_8
## %bb.12:
	movl	12(%r13), %edi
	movl	16(%r13), %esi
	movl	(%r12), %ecx
	leaq	-44(%rbp), %r8
	xorl	%edx, %edx
	callq	_npc_mcam_find_zero_area
	movl	-44(%rbp), %ecx
	movl	%ecx, (%r14)
	movl	%eax, 4(%r14)
	testl	%ecx, %ecx
	jle	LBB0_15
## %bb.13:
	movslq	%eax, %r14
	movq	%r14, %rbx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	12(%r13), %esi
	movl	%ebx, %edi
	callq	___set_bit
	movq	(%r13), %rax
	movl	%r15d, (%rax,%rbx,4)
	incq	%rbx
	movslq	-44(%rbp), %rax
	addq	%r14, %rax
	cmpq	%rax, %rbx
	jl	LBB0_14
	jmp	LBB0_15
LBB0_6:
	movq	%rbx, %rdi
	callq	_mutex_unlock
	movq	_NPC_MCAM_ALLOC_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_16
LBB0_8:
	cmpl	$0, (%r12)
	jle	LBB0_15
## %bb.9:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_rvu_alloc_rsrc
	testl	%eax, %eax
	js	LBB0_15
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	8(%r14), %rcx
	movl	%eax, (%rcx,%rbx,4)
	incl	(%r14)
	movq	(%r13), %rcx
	movl	%eax, %eax
	movl	%r15d, (%rcx,%rax,4)
	incq	%rbx
	movslq	(%r12), %rax
	cmpq	%rax, %rbx
	jl	LBB0_10
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	xorl	%eax, %eax
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BLKTYPE_NPC,4,2                ## @BLKTYPE_NPC
	.comm	_NPC_MCAM_INVALID_REQ,4,2       ## @NPC_MCAM_INVALID_REQ
	.comm	_NPC_MAX_NONCONTIG_COUNTERS,4,2 ## @NPC_MAX_NONCONTIG_COUNTERS
	.comm	_NPC_MCAM_ALLOC_FAILED,4,2      ## @NPC_MCAM_ALLOC_FAILED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rvu_mbox_handler_npc_mcam_alloc_counter ; -- Begin function rvu_mbox_handler_npc_mcam_alloc_counter
	.p2align	2
_rvu_mbox_handler_npc_mcam_alloc_counter: ; @rvu_mbox_handler_npc_mcam_alloc_counter
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x2
	mov	x22, x1
	mov	x21, x0
	ldr	x24, [x0]
	ldr	w19, [x1, #16]
Lloh0:
	adrp	x8, _BLKTYPE_NPC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BLKTYPE_NPC@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_rvu_get_blkaddr
	tbnz	w0, #31, LBB0_4
; %bb.1:
	mov	x0, x21
	mov	x1, x19
	bl	_is_nixlf_attached
	cbz	w0, LBB0_4
; %bb.2:
	ldr	x8, [x22, #8]
	cbnz	x8, LBB0_5
; %bb.3:
	ldr	w8, [x22]
Lloh3:
	adrp	x9, _NPC_MAX_NONCONTIG_COUNTERS@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NPC_MAX_NONCONTIG_COUNTERS@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_5
LBB0_4:
Lloh6:
	adrp	x8, _NPC_MCAM_INVALID_REQ@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NPC_MCAM_INVALID_REQ@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	b	LBB0_16
LBB0_5:
	add	x21, x24, #8
	mov	x0, x21
	bl	_mutex_lock
	add	x23, x24, #12
	mov	x0, x23
	bl	_rvu_rsrc_free_count
	cbz	w0, LBB0_10
; %bb.6:
	str	wzr, [x20]
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_11
; %bb.7:
	ldp	w0, w1, [x24, #12]
	ldr	w3, [x22]
	add	x4, sp, #12
	mov	w2, #0
	bl	_npc_mcam_find_zero_area
	ldr	w8, [sp, #12]
	stp	w8, w0, [x20]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.8:
	mov	x22, x0
	sxtw	x20, w22
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x24, #12]
	mov	x0, x20
	bl	___set_bit
	ldr	x8, [x24]
	str	w19, [x8, x20, lsl #2]
	add	x20, x20, #1
	ldrsw	x8, [sp, #12]
	add	x8, x8, w22, sxtw
	cmp	x20, x8
	b.lt	LBB0_9
	b	LBB0_15
LBB0_10:
	mov	x0, x21
	bl	_mutex_unlock
Lloh9:
	adrp	x8, _NPC_MCAM_ALLOC_FAILED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _NPC_MCAM_ALLOC_FAILED@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	b	LBB0_16
LBB0_11:
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.12:
	mov	x25, #0
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	bl	_rvu_alloc_rsrc
	tbnz	w0, #31, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x8, [x20, #8]
	str	w0, [x8, x25, lsl #2]
	ldr	w8, [x20]
	add	w8, w8, #1
	str	w8, [x20]
	ldr	x8, [x24]
	str	w19, [x8, w0, uxtw #2]
	add	x25, x25, #1
	ldrsw	x8, [x22]
	cmp	x25, x8
	b.lt	LBB0_13
LBB0_15:
	mov	x0, x21
	bl	_mutex_unlock
	mov	w0, #0
LBB0_16:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_BLKTYPE_NPC,4,2                ; @BLKTYPE_NPC
	.comm	_NPC_MCAM_INVALID_REQ,4,2       ; @NPC_MCAM_INVALID_REQ
	.comm	_NPC_MAX_NONCONTIG_COUNTERS,4,2 ; @NPC_MAX_NONCONTIG_COUNTERS
	.comm	_NPC_MCAM_ALLOC_FAILED,4,2      ; @NPC_MCAM_ALLOC_FAILED
.subsections_via_symbols
