	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nes_dealloc_mw
_nes_dealloc_mw:                        ## @nes_dealloc_mw
	.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	%rdi, %r12
	callq	_to_nesmw
	movq	%rax, %r14
	movl	4(%r12), %edi
	callq	_to_nesvnic
	movq	(%rax), %r13
	movq	(%r13), %r15
	movq	%r13, %rdi
	callq	_nes_get_cqp_request
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	$1, (%rax)
	leaq	36(%rax), %rdi
	movq	%r13, %rsi
	callq	_nes_fill_init_cqp_wqe
	movl	36(%rbx), %edi
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NES_CQP_DEALLOCATE_STAG@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_set_wqe_32bit_value
	movl	36(%rbx), %edi
	movq	_NES_CQP_STAG_WQE_STAG_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r12), %edx
	callq	_set_wqe_32bit_value
	movq	%rbx, %rdi
	addq	$32, %rdi
	movl	$2, %esi
	callq	_atomic_set
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_nes_post_cqp_request
	movq	_NES_DBG_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r12), %edx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_nes_debug
	xorl	%esi, %esi
	cmpq	$0, 8(%rbx)
	movl	28(%rbx), %edi
	setne	%sil
	movq	_NES_EVENT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_timeout
	movl	%eax, %r15d
	movq	_NES_DBG_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	16(%rbx), %rcx
	movl	24(%rbx), %r8d
	leaq	L_.str.2(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_nes_debug
	testl	%r15d, %r15d
	je	LBB0_3
## %bb.4:
	cmpq	$0, 16(%rbx)
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_6
## %bb.5:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_6
LBB0_1:
	movq	_NES_DBG_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_nes_debug
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_7
LBB0_3:
	movq	_ETIME@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	-48(%rbp), %r15                 ## 8-byte Reload
LBB0_6:
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_nes_put_cqp_request
	movl	(%r15), %esi
	movl	(%r12), %edx
	shrl	$8, %edx
	andl	$1048575, %edx                  ## imm = 0xFFFFF
	movq	%r15, %rdi
	callq	_nes_free_resource
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
LBB0_7:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NES_DBG_MR,4,2                 ## @NES_DBG_MR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get a cqp_request.\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ## @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_DEALLOCATE_STAG,4,2    ## @NES_CQP_DEALLOCATE_STAG
	.comm	_NES_CQP_STAG_WQE_STAG_IDX,4,2  ## @NES_CQP_STAG_WQE_STAG_IDX
L_.str.1:                               ## @.str.1
	.asciz	"Waiting for deallocate STag 0x%08X to complete.\n"

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

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nes_dealloc_mw
_nes_dealloc_mw:                        ; @nes_dealloc_mw
	.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	x20, x0
	bl	_to_nesmw
	mov	x19, x0
	ldr	w0, [x20, #4]
	bl	_to_nesvnic
	ldr	x22, [x0]
	ldr	x21, [x22]
	mov	x0, x22
	bl	_nes_get_cqp_request
	cbz	x0, LBB0_4
; %bb.1:
	mov	x23, x0
	mov	w8, #1
	str	w8, [x0], #36
	mov	x1, x22
	bl	_nes_fill_init_cqp_wqe
	ldr	w0, [x23, #36]
Lloh0:
	adrp	x8, _NES_CQP_WQE_OPCODE_IDX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NES_CQP_WQE_OPCODE_IDX@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _NES_CQP_DEALLOCATE_STAG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NES_CQP_DEALLOCATE_STAG@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_set_wqe_32bit_value
	ldr	w0, [x23, #36]
Lloh6:
	adrp	x8, _NES_CQP_STAG_WQE_STAG_IDX@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NES_CQP_STAG_WQE_STAG_IDX@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	w2, [x20]
	bl	_set_wqe_32bit_value
	add	x0, x23, #32
	mov	w1, #2
	bl	_atomic_set
	mov	x0, x22
	mov	x1, x23
	bl	_nes_post_cqp_request
Lloh9:
	adrp	x25, _NES_DBG_MR@GOTPAGE
Lloh10:
	ldr	x25, [x25, _NES_DBG_MR@GOTPAGEOFF]
	ldr	w0, [x25]
	ldr	w8, [x20]
	str	x8, [sp]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_nes_debug
	ldr	w0, [x23, #28]
	ldr	x8, [x23, #8]
	cmp	x8, #0
	cset	w1, ne
Lloh13:
	adrp	x8, _NES_EVENT_TIMEOUT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _NES_EVENT_TIMEOUT@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	bl	_wait_event_timeout
	mov	x24, x0
	ldr	w0, [x25]
	ldr	x8, [x23, #16]
	ldr	w9, [x23, #24]
	stp	x8, x9, [sp, #8]
	str	x24, [sp]
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_nes_debug
	cbz	w24, LBB0_5
; %bb.2:
	ldr	x8, [x23, #16]
	cbz	x8, LBB0_7
; %bb.3:
Lloh18:
	adrp	x8, _EIO@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
Lloh20:
	adrp	x8, _NES_DBG_MR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _NES_DBG_MR@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
Lloh23:
	adrp	x1, l_.str@PAGE
Lloh24:
	add	x1, x1, l_.str@PAGEOFF
	bl	_nes_debug
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_9
LBB0_5:
Lloh28:
	adrp	x8, _ETIME@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ETIME@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_8
LBB0_7:
	mov	w24, #0
LBB0_8:
	mov	x0, x22
	mov	x1, x23
	bl	_nes_put_cqp_request
	ldr	w1, [x21]
	ldr	w8, [x20]
	ubfx	w2, w8, #8, #20
	mov	x0, x21
	bl	_nes_free_resource
	mov	x0, x19
	bl	_kfree
LBB0_9:
	mov	x0, x24
	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
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_NES_DBG_MR,4,2                 ; @NES_DBG_MR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get a cqp_request.\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ; @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_DEALLOCATE_STAG,4,2    ; @NES_CQP_DEALLOCATE_STAG
	.comm	_NES_CQP_STAG_WQE_STAG_IDX,4,2  ; @NES_CQP_STAG_WQE_STAG_IDX
l_.str.1:                               ; @.str.1
	.asciz	"Waiting for deallocate STag 0x%08X to complete.\n"

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

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