	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rvu_mbox_handler_npc_mcam_alloc_and_write_entry ## -- Begin function rvu_mbox_handler_npc_mcam_alloc_and_write_entry
	.p2align	4, 0x90
_rvu_mbox_handler_npc_mcam_alloc_and_write_entry: ## @rvu_mbox_handler_npc_mcam_alloc_and_write_entry
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	(%rdi), %r15
	movq	_NPC_MCAM_ENTRY_INVALID@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	_BLKTYPE_NPC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_rvu_get_blkaddr
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movl	%eax, %r14d
	movl	16(%r12), %eax
	movq	_NIX_INTF_RX@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_4
## %bb.3:
	movq	_NIX_INTF_TX@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_4
LBB0_1:
	movq	_NPC_MCAM_INVALID_REQ@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_14
LBB0_4:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	20(%r12), %eax
	movl	%eax, -64(%rbp)
	movl	$1, -80(%rbp)
	movl	28(%r12), %eax
	movl	%eax, -68(%rbp)
	movl	24(%r12), %eax
	movl	%eax, -72(%rbp)
	movl	$1, -76(%rbp)
	leaq	-80(%rbp), %rsi
	leaq	-128(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rvu_mbox_handler_npc_mcam_alloc_entry
	movl	%eax, %r15d
	testl	%eax, %eax
	je	LBB0_5
LBB0_14:
	movl	%r15d, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	cmpl	$0, -120(%rbp)
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_6
## %bb.7:
	movq	-128(%rbp), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	cmpq	$0, (%r12)
	je	LBB0_11
## %bb.8:
	movl	20(%r12), %eax
	movl	%eax, -104(%rbp)
	movabsq	$4294967297, %rax               ## imm = 0x100000001
	movq	%rax, -112(%rbp)
	leaq	-112(%rbp), %rsi
	leaq	-96(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rvu_mbox_handler_npc_mcam_alloc_counter
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %r15d
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_mutex_lock
	movq	8(%rbx), %rax
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	$0, (%rax,%rsi,8)
	movq	%rbx, %rdi
	callq	_npc_mcam_clear_bit
	movq	%rbx, %rdi
	callq	_mutex_unlock
	jmp	LBB0_14
LBB0_6:
	movq	_NPC_MCAM_ALLOC_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_14
LBB0_10:
	movq	-96(%rbp), %r13
	movq	-56(%rbp), %r15                 ## 8-byte Reload
LBB0_11:
	movq	%r15, %rdi
	callq	_mutex_lock
	movl	8(%r12), %eax
	movl	16(%r12), %r8d
	leaq	12(%r12), %r9
	movl	%eax, (%rsp)
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	callq	_npc_config_mcam_entry
	cmpq	$0, (%r12)
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_13
## %bb.12:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	movl	%r14d, %edx
	movq	%r12, %rcx
	movq	%r13, %r8
	callq	_npc_map_mcam_entry_and_cntr
LBB0_13:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	%r12, (%rax)
	movq	%r13, 8(%rax)
	xorl	%r15d, %r15d
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_NPC_MCAM_ENTRY_INVALID,8,3     ## @NPC_MCAM_ENTRY_INVALID
	.comm	_BLKTYPE_NPC,4,2                ## @BLKTYPE_NPC
	.comm	_NPC_MCAM_INVALID_REQ,4,2       ## @NPC_MCAM_INVALID_REQ
	.comm	_NIX_INTF_RX,4,2                ## @NIX_INTF_RX
	.comm	_NIX_INTF_TX,4,2                ## @NIX_INTF_TX
	.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_and_write_entry ; -- Begin function rvu_mbox_handler_npc_mcam_alloc_and_write_entry
	.p2align	2
_rvu_mbox_handler_npc_mcam_alloc_and_write_entry: ; @rvu_mbox_handler_npc_mcam_alloc_and_write_entry
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x19, [x0]
Lloh0:
	adrp	x8, _NPC_MCAM_ENTRY_INVALID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NPC_MCAM_ENTRY_INVALID@GOTPAGEOFF]
Lloh2:
	ldr	x23, [x8]
Lloh3:
	adrp	x8, _BLKTYPE_NPC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BLKTYPE_NPC@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_rvu_get_blkaddr
	tbnz	w0, #31, LBB0_7
; %bb.1:
	ldr	w8, [x22, #16]
Lloh6:
	adrp	x9, _NIX_INTF_RX@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NIX_INTF_RX@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _NIX_INTF_TX@GOTPAGE
Lloh10:
	ldr	x10, [x10, _NIX_INTF_TX@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	cmp	w8, w9
	ccmp	w8, w10, #4, ne
	b.ne	LBB0_7
; %bb.2:
	mov	x24, x0
	ldr	w8, [x22, #20]
	str	w8, [sp, #32]
	ldr	d0, [x22, #24]
	movi.2s	v1, #1
	stp	d1, d0, [sp, #16]
	add	x1, sp, #16
	mov	x2, sp
	mov	x0, x21
	bl	_rvu_mbox_handler_npc_mcam_alloc_entry
	mov	x26, x0
	cbnz	w0, LBB0_9
; %bb.3:
	ldr	w8, [sp, #8]
	cbz	w8, LBB0_10
; %bb.4:
	ldr	x25, [sp]
	ldr	x8, [x22]
	cbz	x8, LBB0_12
; %bb.5:
	ldr	w8, [x22, #20]
	str	w8, [sp, #56]
	movi.2s	v0, #1
	str	d0, [sp, #48]
	add	x1, sp, #48
	add	x2, sp, #40
	mov	x0, x21
	bl	_rvu_mbox_handler_npc_mcam_alloc_counter
	cbz	w0, LBB0_11
; %bb.6:
	mov	x26, x0
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x19, #8]
	str	xzr, [x8, x25, lsl #3]
	mov	x0, x19
	mov	x1, x25
	bl	_npc_mcam_clear_bit
	mov	x0, x19
	bl	_mutex_unlock
	b	LBB0_9
LBB0_7:
Lloh12:
	adrp	x8, _NPC_MCAM_INVALID_REQ@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NPC_MCAM_INVALID_REQ@GOTPAGEOFF]
LBB0_8:
	ldr	w26, [x8]
LBB0_9:
	mov	x0, x26
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_10:
Lloh14:
	adrp	x8, _NPC_MCAM_ALLOC_FAILED@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NPC_MCAM_ALLOC_FAILED@GOTPAGEOFF]
	b	LBB0_8
LBB0_11:
	ldr	x23, [sp, #40]
LBB0_12:
	mov	x0, x19
	bl	_mutex_lock
	ldr	w4, [x22, #16]
	add	x5, x22, #12
	ldr	w6, [x22, #8]
	mov	x0, x21
	mov	x1, x19
	mov	x2, x24
	mov	x3, x25
	bl	_npc_config_mcam_entry
	ldr	x8, [x22]
	cbz	x8, LBB0_14
; %bb.13:
	mov	x0, x21
	mov	x1, x19
	mov	x2, x24
	mov	x3, x25
	mov	x4, x23
	bl	_npc_map_mcam_entry_and_cntr
LBB0_14:
	mov	x0, x19
	bl	_mutex_unlock
	mov	w26, #0
	stp	x25, x23, [x20]
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_NPC_MCAM_ENTRY_INVALID,8,3     ; @NPC_MCAM_ENTRY_INVALID
	.comm	_BLKTYPE_NPC,4,2                ; @BLKTYPE_NPC
	.comm	_NPC_MCAM_INVALID_REQ,4,2       ; @NPC_MCAM_INVALID_REQ
	.comm	_NIX_INTF_RX,4,2                ; @NIX_INTF_RX
	.comm	_NIX_INTF_TX,4,2                ; @NIX_INTF_TX
	.comm	_NPC_MCAM_ALLOC_FAILED,4,2      ; @NPC_MCAM_ALLOC_FAILED
.subsections_via_symbols
