	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_manage_apbvt               ## -- Begin function nes_manage_apbvt
	.p2align	4, 0x90
_nes_manage_apbvt:                      ## @nes_manage_apbvt
	.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	%rcx, %r14
	movq	%rdx, %r13
	movq	%rsi, %r15
	movq	(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_nes_get_cqp_request
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movl	$1, (%rax)
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	leaq	36(%rax), %r14
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_NES_MANAGE_APBVT_ADD@GOTPCREL(%rip), %rcx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, (%rcx)
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.3(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rcx
	movq	%r15, %r8
	movq	%r13, %r9
	xorl	%eax, %eax
	callq	_nes_debug
	movq	%r14, %rdi
	movq	%rbx, %r14
	movq	%rbx, %rsi
	callq	_nes_fill_init_cqp_wqe
	movl	36(%r12), %edi
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NES_CQP_MANAGE_APBVT@GOTPCREL(%rip), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	_NES_MANAGE_APBVT_ADD@GOTPCREL(%rip), %rdx
	cmpq	%rcx, (%rdx)
	jne	LBB0_3
## %bb.4:
	movq	_NES_CQP_APBVT_ADD@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdx
	jmp	LBB0_5
LBB0_1:
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_nes_debug
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_3:
	xorl	%edx, %edx
LBB0_5:
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rbx
	orq	(%rax), %rdx
	callq	_set_wqe_32bit_value
	movl	36(%r12), %edi
	movq	_NES_CQP_WQE_ID_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NES_CQP_APBVT_NIC_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shlq	%cl, %r13
	orq	%r15, %r13
	movq	%r13, %rdx
	callq	_set_wqe_32bit_value
	movl	(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	xorl	%eax, %eax
	callq	_nes_debug
	movq	%r12, %rdi
	addq	$32, %rdi
	movl	$2, %esi
	callq	_atomic_set
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_nes_post_cqp_request
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	_NES_MANAGE_APBVT_ADD@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	movl	$0, %r13d
	jne	LBB0_7
## %bb.6:
	xorl	%esi, %esi
	cmpq	$0, 8(%r12)
	movl	28(%r12), %edi
	setne	%sil
	movq	_NES_EVENT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_timeout
	movl	%eax, %r13d
LBB0_7:
	movl	(%rbx), %edi
	movq	16(%r12), %rcx
	movl	24(%r12), %r8d
	leaq	L_.str.5(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_nes_debug
	movq	16(%r12), %r15
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_nes_put_cqp_request
	testl	%r13d, %r13d
	je	LBB0_8
## %bb.9:
	testq	%r15, %r15
	je	LBB0_13
## %bb.10:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_8:
	movq	_ETIME@GOTPCREL(%rip), %rax
LBB0_11:
	xorl	%ebx, %ebx
LBB0_12:
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NES_DBG_QP,4,2                 ## @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get a cqp_request.\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"%s APBV for local port=%u(0x%04x), nic_index=%u\n"

	.comm	_NES_MANAGE_APBVT_ADD,8,3       ## @NES_MANAGE_APBVT_ADD
L_.str.2:                               ## @.str.2
	.asciz	"ADD"

L_.str.3:                               ## @.str.3
	.asciz	"DEL"

	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ## @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_MANAGE_APBVT,8,3       ## @NES_CQP_MANAGE_APBVT
	.comm	_NES_CQP_APBVT_ADD,8,3          ## @NES_CQP_APBVT_ADD
	.comm	_NES_CQP_WQE_ID_IDX,4,2         ## @NES_CQP_WQE_ID_IDX
	.comm	_NES_CQP_APBVT_NIC_SHIFT,8,3    ## @NES_CQP_APBVT_NIC_SHIFT
L_.str.4:                               ## @.str.4
	.asciz	"Waiting for CQP completion for APBVT.\n"

	.comm	_NES_EVENT_TIMEOUT,4,2          ## @NES_EVENT_TIMEOUT
L_.str.5:                               ## @.str.5
	.asciz	"Completed, ret=%u,  CQP Major:Minor codes = 0x%04X:0x%04X\n"

	.comm	_ETIME,4,2                      ## @ETIME
	.comm	_EIO,4,2                        ## @EIO
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_manage_apbvt               ; -- Begin function nes_manage_apbvt
	.p2align	2
_nes_manage_apbvt:                      ; @nes_manage_apbvt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x21, x3
	mov	x23, x2
	mov	x22, x1
	ldr	x19, [x0]
	mov	x0, x19
	bl	_nes_get_cqp_request
	cbz	x0, LBB0_3
; %bb.1:
	mov	x20, x0
	mov	w8, #1
	str	w8, [x0]
	add	x24, x0, #36
Lloh0:
	adrp	x25, _NES_DBG_QP@GOTPAGE
Lloh1:
	ldr	x25, [x25, _NES_DBG_QP@GOTPAGEOFF]
	ldr	w0, [x25]
Lloh2:
	adrp	x26, _NES_MANAGE_APBVT_ADD@GOTPAGE
Lloh3:
	ldr	x26, [x26, _NES_MANAGE_APBVT_ADD@GOTPAGEOFF]
	ldr	x8, [x26]
Lloh4:
	adrp	x9, l_.str.3@PAGE
Lloh5:
	add	x9, x9, l_.str.3@PAGEOFF
Lloh6:
	adrp	x10, l_.str.2@PAGE
Lloh7:
	add	x10, x10, l_.str.2@PAGEOFF
	cmp	x8, x21
	csel	x8, x10, x9, eq
	stp	x22, x23, [sp, #16]
	stp	x8, x22, [sp]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_nes_debug
	mov	x0, x24
	mov	x1, x19
	bl	_nes_fill_init_cqp_wqe
Lloh10:
	adrp	x8, _NES_CQP_WQE_OPCODE_IDX@GOTPAGE
Lloh11:
	ldr	x8, [x8, _NES_CQP_WQE_OPCODE_IDX@GOTPAGEOFF]
	ldr	w0, [x20, #36]
Lloh12:
	ldr	w1, [x8]
Lloh13:
	adrp	x8, _NES_CQP_MANAGE_APBVT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _NES_CQP_MANAGE_APBVT@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	ldr	x9, [x26]
Lloh16:
	adrp	x10, _NES_CQP_APBVT_ADD@GOTPAGE
Lloh17:
	ldr	x10, [x10, _NES_CQP_APBVT_ADD@GOTPAGEOFF]
Lloh18:
	ldr	x10, [x10]
	cmp	x9, x21
	csel	x9, x10, xzr, eq
	orr	x2, x9, x8
	bl	_set_wqe_32bit_value
	ldr	w0, [x20, #36]
Lloh19:
	adrp	x8, _NES_CQP_WQE_ID_IDX@GOTPAGE
Lloh20:
	ldr	x8, [x8, _NES_CQP_WQE_ID_IDX@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
Lloh22:
	adrp	x8, _NES_CQP_APBVT_NIC_SHIFT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _NES_CQP_APBVT_NIC_SHIFT@GOTPAGEOFF]
Lloh24:
	ldr	x8, [x8]
	lsl	x8, x23, x8
	orr	x2, x8, x22
	bl	_set_wqe_32bit_value
	ldr	w0, [x25]
Lloh25:
	adrp	x1, l_.str.4@PAGE
Lloh26:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_nes_debug
	add	x0, x20, #32
	mov	w1, #2
	bl	_atomic_set
	mov	x0, x19
	mov	x1, x20
	bl	_nes_post_cqp_request
	ldr	x8, [x26]
	cmp	x8, x21
	b.ne	LBB0_4
; %bb.2:
	ldr	w0, [x20, #28]
	ldr	x8, [x20, #8]
	cmp	x8, #0
	cset	w1, ne
Lloh27:
	adrp	x8, _NES_EVENT_TIMEOUT@GOTPAGE
Lloh28:
	ldr	x8, [x8, _NES_EVENT_TIMEOUT@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	bl	_wait_event_timeout
	mov	x21, x0
	b	LBB0_5
LBB0_3:
Lloh30:
	adrp	x8, _NES_DBG_QP@GOTPAGE
Lloh31:
	ldr	x8, [x8, _NES_DBG_QP@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
Lloh33:
	adrp	x1, l_.str@PAGE
Lloh34:
	add	x1, x1, l_.str@PAGEOFF
	bl	_nes_debug
Lloh35:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh36:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_9
LBB0_4:
	mov	w21, #0
LBB0_5:
	ldr	w0, [x25]
	ldr	x8, [x20, #16]
	ldr	w9, [x20, #24]
	stp	x8, x9, [sp, #8]
	str	x21, [sp]
Lloh37:
	adrp	x1, l_.str.5@PAGE
Lloh38:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_nes_debug
	ldr	x22, [x20, #16]
	mov	x0, x19
	mov	x1, x20
	bl	_nes_put_cqp_request
	cbz	w21, LBB0_8
; %bb.6:
	cbz	x22, LBB0_11
; %bb.7:
Lloh39:
	adrp	x8, _EIO@GOTPAGE
Lloh40:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh41:
	adrp	x8, _ETIME@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ETIME@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	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
	add	sp, sp, #112
	ret
LBB0_11:
	mov	w0, #0
	b	LBB0_10
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGot	Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.comm	_NES_DBG_QP,4,2                 ; @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get a cqp_request.\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"%s APBV for local port=%u(0x%04x), nic_index=%u\n"

	.comm	_NES_MANAGE_APBVT_ADD,8,3       ; @NES_MANAGE_APBVT_ADD
l_.str.2:                               ; @.str.2
	.asciz	"ADD"

l_.str.3:                               ; @.str.3
	.asciz	"DEL"

	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ; @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_MANAGE_APBVT,8,3       ; @NES_CQP_MANAGE_APBVT
	.comm	_NES_CQP_APBVT_ADD,8,3          ; @NES_CQP_APBVT_ADD
	.comm	_NES_CQP_WQE_ID_IDX,4,2         ; @NES_CQP_WQE_ID_IDX
	.comm	_NES_CQP_APBVT_NIC_SHIFT,8,3    ; @NES_CQP_APBVT_NIC_SHIFT
l_.str.4:                               ; @.str.4
	.asciz	"Waiting for CQP completion for APBVT.\n"

	.comm	_NES_EVENT_TIMEOUT,4,2          ; @NES_EVENT_TIMEOUT
l_.str.5:                               ; @.str.5
	.asciz	"Completed, ret=%u,  CQP Major:Minor codes = 0x%04X:0x%04X\n"

	.comm	_ETIME,4,2                      ; @ETIME
	.comm	_EIO,4,2                        ; @EIO
.subsections_via_symbols
