	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_destroy_mgt                ## -- Begin function nes_destroy_mgt
	.p2align	4, 0x90
_nes_destroy_mgt:                       ## @nes_destroy_mgt
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	40(%rdi), %r15
	movl	32(%rdi), %edi
	callq	_kthread_stop
	movq	24(%r14), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_NES_MGT_QP_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_10
## %bb.1:
	leaq	44(%r15), %rcx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	_PCI_DMA_FROMDEVICE@GOTPCREL(%rip), %rbx
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	xorl	%edx, %edx
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	testq	%r12, %r12
	je	LBB0_8
	.p2align	4, 0x90
LBB0_3:
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %rax
	cmpq	%rax, (%r12)
	je	LBB0_5
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%r12), %rcx
	movq	(%rcx,%rax,8), %rsi
	movl	(%rbx), %edx
	movq	%r15, %rdi
	callq	_nes_mgt_free_skb
	movq	(%r12), %rcx
	movq	8(%r12), %rdx
	incq	%rdx
	movslq	16(%r12), %rax
	decq	%rax
	andq	%rdx, %rax
	movq	%rax, 8(%r12)
	cmpq	%rax, %rcx
	jne	LBB0_4
LBB0_5:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	movq	8(%r15), %r13
	movq	48(%r15), %r14
	leaq	(%r14,%r13,4), %rdi
	movq	%r15, %rsi
	callq	_nes_fill_init_cqp_wqe
	movl	(%r14,%r13,4), %edi
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NES_CQP_QP_TYPE_NIC@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_NES_CQP_DESTROY_QP@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	callq	_set_wqe_32bit_value
	movl	(%r14,%r13,4), %edi
	movq	_NES_CQP_WQE_ID_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	24(%r12), %rdx
	callq	_set_wqe_32bit_value
	incq	%r13
	cmpq	16(%r15), %r13
	movl	$0, %eax
	cmovaeq	%rax, %r13
	movq	48(%r15), %r14
	leaq	(%r14,%r13,4), %rdi
	movq	%r15, %rsi
	callq	_nes_fill_init_cqp_wqe
	movl	(%r14,%r13,4), %edi
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	48(%r12), %rdx
	shlq	$16, %rdx
	movq	_NES_CQP_DESTROY_CQ@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	callq	_set_wqe_32bit_value
	movl	(%r14,%r13,4), %edi
	movq	_NES_CQP_WQE_ID_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	64(%r15), %rdx
	shlq	$16, %rdx
	orq	40(%r12), %rdx
	callq	_set_wqe_32bit_value
	incq	%r13
	cmpq	16(%r15), %r13
	movl	$0, %eax
	cmovaeq	%rax, %r13
	movq	%r13, 8(%r15)
	xorl	%eax, %eax
	callq	_barrier
	movq	_NES_WQE_ALLOC@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%r15), %rdi
	movl	24(%r15), %esi
	movl	$41943040, %eax                 ## imm = 0x2800000
	orl	%eax, %esi
	callq	_nes_write32
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	_NES_DBG_SHUTDOWN@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movq	32(%r15), %r8
	movq	8(%r15), %rcx
	movq	16(%r15), %r9
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdx
	xorl	%eax, %eax
	callq	_nes_debug
	movl	40(%r15), %edi
	xorl	%esi, %esi
	cmpq	%r13, 32(%r15)
	sete	%sil
	movq	_NES_EVENT_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_wait_event_timeout
	movl	(%r14), %edi
	movslq	%eax, %r14
	movq	8(%r15), %r8
	movq	32(%r15), %r9
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdx
	movq	%r13, %rcx
	xorl	%eax, %eax
	callq	_nes_debug
	testl	%r14d, %r14d
	jne	LBB0_7
## %bb.6:
	movq	_NES_DBG_SHUTDOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	24(%r12), %rdx
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_nes_debug
LBB0_7:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	24(%r14), %rax
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movq	$0, (%rax,%rdx,8)
	movq	_NES_MGT_QP_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_PCI_DMA_FROMDEVICE@GOTPCREL(%rip), %rbx
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	incq	%rdx
	movslq	%eax, %rcx
	cmpq	%rcx, %rdx
	jge	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	24(%r14), %rcx
	movq	(%rcx,%rdx,8), %r12
	testq	%r12, %r12
	jne	LBB0_3
	jmp	LBB0_8
LBB0_10:
	movq	8(%r14), %rdx
	testq	%rdx, %rdx
	je	LBB0_12
## %bb.11:
	movl	(%r15), %edi
	movl	(%r14), %ecx
	movl	16(%r14), %esi
	callq	_pci_free_consistent
	movq	$0, 8(%r14)
	movl	$0, (%r14)
LBB0_12:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_kfree                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NES_MGT_QP_COUNT,4,2           ## @NES_MGT_QP_COUNT
	.comm	_PCI_DMA_FROMDEVICE,4,2         ## @PCI_DMA_FROMDEVICE
	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ## @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_DESTROY_QP,8,3         ## @NES_CQP_DESTROY_QP
	.comm	_NES_CQP_QP_TYPE_NIC,8,3        ## @NES_CQP_QP_TYPE_NIC
	.comm	_NES_CQP_WQE_ID_IDX,4,2         ## @NES_CQP_WQE_ID_IDX
	.comm	_NES_CQP_DESTROY_CQ,8,3         ## @NES_CQP_DESTROY_CQ
	.comm	_NES_WQE_ALLOC,8,3              ## @NES_WQE_ALLOC
	.comm	_NES_DBG_SHUTDOWN,4,2           ## @NES_DBG_SHUTDOWN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Waiting for CQP, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u, cqp.sq_size=%u\n"

	.comm	_NES_EVENT_TIMEOUT,4,2          ## @NES_EVENT_TIMEOUT
L_.str.1:                               ## @.str.1
	.asciz	"Destroy MGT QP returned, wait_event_timeout ret = %u, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u\n"

L_.str.2:                               ## @.str.2
	.asciz	"MGT QP%u destroy timeout expired\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_destroy_mgt                ; -- Begin function nes_destroy_mgt
	.p2align	2
_nes_destroy_mgt:                       ; @nes_destroy_mgt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
	ldr	x21, [x0, #40]
	ldr	w0, [x0, #32]
	bl	_kthread_stop
	ldr	x8, [x19, #24]
	ldr	x8, [x8]
	str	x8, [sp, #24]                   ; 8-byte Folded Spill
Lloh0:
	adrp	x8, _NES_MGT_QP_COUNT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NES_MGT_QP_COUNT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.1:
	mov	x20, #0
	add	x22, x21, #44
	ldr	x25, [sp, #24]                  ; 8-byte Folded Reload
Lloh3:
	adrp	x24, _PCI_DMA_FROMDEVICE@GOTPAGE
Lloh4:
	ldr	x24, [x24, _PCI_DMA_FROMDEVICE@GOTPAGEOFF]
Lloh5:
	adrp	x28, _NES_CQP_WQE_ID_IDX@GOTPAGE
Lloh6:
	ldr	x28, [x28, _NES_CQP_WQE_ID_IDX@GOTPAGEOFF]
	cbz	x25, LBB0_7
LBB0_2:
	ldp	x9, x8, [x25]
	cmp	x9, x8
	b.eq	LBB0_4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x25, #32]
	ldr	x1, [x9, x8, lsl #3]
	ldr	w2, [x24]
	mov	x0, x21
	bl	_nes_mgt_free_skb
	ldp	x9, x8, [x25]
	add	x8, x8, #1
	ldrsw	x10, [x25, #16]
	sub	x10, x10, #1
	and	x8, x8, x10
	str	x8, [x25, #8]
	cmp	x9, x8
	b.ne	LBB0_3
LBB0_4:
	mov	x0, x22
	bl	_spin_lock_irqsave
	ldr	x27, [x21, #8]
	ldr	x8, [x21, #48]
	add	x26, x8, x27, lsl #2
	mov	x0, x26
	mov	x1, x21
	bl	_nes_fill_init_cqp_wqe
	ldr	w0, [x26]
Lloh7:
	adrp	x23, _NES_CQP_WQE_OPCODE_IDX@GOTPAGE
Lloh8:
	ldr	x23, [x23, _NES_CQP_WQE_OPCODE_IDX@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh9:
	adrp	x8, _NES_CQP_DESTROY_QP@GOTPAGE
Lloh10:
	ldr	x8, [x8, _NES_CQP_DESTROY_QP@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
Lloh12:
	adrp	x9, _NES_CQP_QP_TYPE_NIC@GOTPAGE
Lloh13:
	ldr	x9, [x9, _NES_CQP_QP_TYPE_NIC@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	orr	x2, x9, x8
	bl	_set_wqe_32bit_value
	ldr	w0, [x26]
	ldr	w1, [x28]
	ldr	x2, [x25, #24]
	bl	_set_wqe_32bit_value
	add	x8, x27, #1
	ldr	x9, [x21, #16]
	cmp	x8, x9
	csinc	x27, xzr, x27, hs
	ldr	x8, [x21, #48]
	add	x26, x8, x27, lsl #2
	mov	x0, x26
	mov	x1, x21
	bl	_nes_fill_init_cqp_wqe
	ldr	w0, [x26]
	ldr	w1, [x23]
Lloh15:
	adrp	x8, _NES_CQP_DESTROY_CQ@GOTPAGE
Lloh16:
	ldr	x8, [x8, _NES_CQP_DESTROY_CQ@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	ldr	x9, [x25, #48]
	orr	x2, x8, x9, lsl #16
	bl	_set_wqe_32bit_value
	ldr	w0, [x26]
	ldr	w1, [x28]
	ldr	x8, [x25, #40]
	ldr	x9, [x21, #64]
	orr	x2, x8, x9, lsl #16
	bl	_set_wqe_32bit_value
	add	x8, x27, #1
	ldr	x9, [x21, #16]
	cmp	x8, x9
	csinc	x26, xzr, x27, hs
	str	x26, [x21, #8]
	bl	_barrier
	ldr	x8, [x21, #56]
Lloh18:
	adrp	x9, _NES_WQE_ALLOC@GOTPAGE
Lloh19:
	ldr	x9, [x9, _NES_WQE_ALLOC@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x0, x9, x8
	ldr	w8, [x21, #24]
	mov	w9, #41943040
	orr	w1, w8, w9
	bl	_nes_write32
	mov	x0, x22
	bl	_spin_unlock_irqrestore
Lloh21:
	adrp	x23, _NES_DBG_SHUTDOWN@GOTPAGE
Lloh22:
	ldr	x23, [x23, _NES_DBG_SHUTDOWN@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	x8, [x21, #32]
	ldp	x9, x10, [x21, #8]
	stp	x8, x10, [sp, #8]
	str	x9, [sp]
Lloh23:
	adrp	x1, l_.str@PAGE
Lloh24:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x26
	bl	_nes_debug
	ldr	w0, [x21, #40]
	ldr	x8, [x21, #32]
	cmp	x8, x26
	cset	w1, eq
Lloh25:
	adrp	x8, _NES_EVENT_TIMEOUT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _NES_EVENT_TIMEOUT@GOTPAGEOFF]
Lloh27:
	ldr	w2, [x8]
	bl	_wait_event_timeout
	mov	x27, x0
	ldr	w0, [x23]
	sxtw	x2, w27
	ldr	x8, [x21, #8]
	ldr	x9, [x21, #32]
	stp	x8, x9, [sp, #8]
	str	x26, [sp]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_nes_debug
	cbnz	w27, LBB0_6
; %bb.5:
Lloh30:
	adrp	x8, _NES_DBG_SHUTDOWN@GOTPAGE
Lloh31:
	ldr	x8, [x8, _NES_DBG_SHUTDOWN@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
	ldr	x2, [x25, #24]
Lloh33:
	adrp	x1, l_.str.2@PAGE
Lloh34:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_nes_debug
LBB0_6:
	ldr	x8, [x19, #24]
	str	xzr, [x8, x20, lsl #3]
Lloh35:
	adrp	x8, _NES_MGT_QP_COUNT@GOTPAGE
Lloh36:
	ldr	x8, [x8, _NES_MGT_QP_COUNT@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x20, x20, #1
	cmp	x20, w8, sxtw
	b.ge	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x9, [x19, #24]
	ldr	x25, [x9, x20, lsl #3]
	cbnz	x25, LBB0_2
	b	LBB0_7
LBB0_9:
	ldr	x2, [x19, #8]
	cbz	x2, LBB0_11
; %bb.10:
	ldr	w0, [x21]
	ldr	w1, [x19, #16]
	ldr	w3, [x19]
	bl	_pci_free_consistent
	str	xzr, [x19, #8]
	str	wzr, [x19]
LBB0_11:
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_kfree
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_NES_MGT_QP_COUNT,4,2           ; @NES_MGT_QP_COUNT
	.comm	_PCI_DMA_FROMDEVICE,4,2         ; @PCI_DMA_FROMDEVICE
	.comm	_NES_CQP_WQE_OPCODE_IDX,4,2     ; @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_DESTROY_QP,8,3         ; @NES_CQP_DESTROY_QP
	.comm	_NES_CQP_QP_TYPE_NIC,8,3        ; @NES_CQP_QP_TYPE_NIC
	.comm	_NES_CQP_WQE_ID_IDX,4,2         ; @NES_CQP_WQE_ID_IDX
	.comm	_NES_CQP_DESTROY_CQ,8,3         ; @NES_CQP_DESTROY_CQ
	.comm	_NES_WQE_ALLOC,8,3              ; @NES_WQE_ALLOC
	.comm	_NES_DBG_SHUTDOWN,4,2           ; @NES_DBG_SHUTDOWN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Waiting for CQP, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u, cqp.sq_size=%u\n"

	.comm	_NES_EVENT_TIMEOUT,4,2          ; @NES_EVENT_TIMEOUT
l_.str.1:                               ; @.str.1
	.asciz	"Destroy MGT QP returned, wait_event_timeout ret = %u, cqp_head=%u, cqp.sq_head=%u, cqp.sq_tail=%u\n"

l_.str.2:                               ; @.str.2
	.asciz	"MGT QP%u destroy timeout expired\n"

.subsections_via_symbols
