	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nes_destroy_qp
_nes_destroy_qp:                        ## @nes_destroy_qp
	.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
	callq	_to_nesqp
	movq	%rax, %rbx
	movq	_sw_qps_destroyed@GOTPCREL(%rip), %rdi
	callq	_atomic_inc
	movl	$1, (%rbx)
	movq	8(%rbx), %rax
	movq	_IB_QPS_INIT@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	cmpq	%rcx, %rax
	jl	LBB0_3
## %bb.1:
	movq	_IB_QPS_RTS@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	jg	LBB0_3
## %bb.2:
	movq	_IB_QPS_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	leaq	40(%rbx), %rdi
	movq	_IB_QP_STATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-48(%rbp), %rsi
	xorl	%ecx, %ecx
	callq	_nes_modify_qp
	movq	8(%rbx), %rax
	movq	(%r15), %rcx
LBB0_3:
	cmpq	%rcx, %rax
	je	LBB0_5
## %bb.4:
	movq	_IB_QPS_RTR@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
LBB0_5:
	movq	80(%rbx), %r15
	testq	%r15, %r15
	je	LBB0_8
## %bb.6:
	movq	_IW_CM_EVENT_CONNECT_REPLY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	subl	(%rcx), %edx
	movl	%eax, -52(%rbp)
	movl	%edx, -56(%rbp)
	movl	20(%r15), %eax
	movl	%eax, -60(%rbp)
	movl	16(%r15), %eax
	movl	%eax, -64(%rbp)
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -80(%rbp)
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movl	76(%rbx), %r13d
	leaq	72(%rbx), %rdi
	callq	_atomic_read
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edi
	movl	%r13d, %edx
	movq	%r15, %rcx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_nes_debug
	movq	%r15, %rdi
	callq	*8(%r15)
	leaq	-80(%rbp), %rsi
	movq	%r15, %rdi
	callq	*(%r15)
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_nes_debug
LBB0_8:
	cmpq	$0, 64(%rbx)
	je	LBB0_16
## %bb.9:
	movq	(%r14), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.10:
	movq	(%rax), %rdi
	testq	%rdi, %rdi
	je	LBB0_13
## %bb.11:
	callq	_to_nesucontext
	movq	%rax, %r14
	movq	16(%rbx), %rdi
	movl	16(%rax), %esi
	callq	_clear_bit
	movq	8(%r14), %rcx
	movq	16(%rbx), %rax
	movq	$0, (%rcx,%rax,8)
	cmpq	%rax, (%r14)
	jbe	LBB0_13
## %bb.12:
	movq	%rax, (%r14)
LBB0_13:
	cmpq	$0, 56(%rbx)
	je	LBB0_21
## %bb.14:
	cmpq	$0, 48(%rbx)
	je	LBB0_21
## %bb.15:
	movq	$0, 48(%rbx)
	movl	44(%rbx), %edi
	callq	_kunmap
	jmp	LBB0_21
LBB0_16:
	movq	24(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_18
## %bb.17:
	movq	%rbx, %rdi
	callq	_nes_clean_cq
LBB0_18:
	movq	32(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_21
## %bb.19:
	cmpq	24(%rbx), %rsi
	je	LBB0_21
## %bb.20:
	movq	%rbx, %rdi
	callq	_nes_clean_cq
LBB0_21:
	addq	$40, %rbx
	movq	%rbx, %rdi
	callq	_nes_rem_ref
	xorl	%eax, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_sw_qps_destroyed,4,2           ## @sw_qps_destroyed
	.comm	_IB_QPS_INIT,8,3                ## @IB_QPS_INIT
	.comm	_IB_QPS_RTS,8,3                 ## @IB_QPS_RTS
	.comm	_IB_QPS_ERR,4,2                 ## @IB_QPS_ERR
	.comm	_IB_QP_STATE,4,2                ## @IB_QP_STATE
	.comm	_IB_QPS_RTR,8,3                 ## @IB_QPS_RTR
	.comm	_IW_CM_EVENT_CONNECT_REPLY,4,2  ## @IW_CM_EVENT_CONNECT_REPLY
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_NES_DBG_QP,4,2                 ## @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Generating a CM Timeout Event for QP%u. cm_id = %p, refcount = %u. \n"

L_.str.1:                               ## @.str.1
	.asciz	"OFA CM event_handler returned, ret=%d\n"

	.no_dead_strip	_nes_destroy_qp
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nes_destroy_qp
_nes_destroy_qp:                        ; @nes_destroy_qp
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	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
	mov	x20, x0
	bl	_to_nesqp
	mov	x19, x0
Lloh0:
	adrp	x0, _sw_qps_destroyed@GOTPAGE
Lloh1:
	ldr	x0, [x0, _sw_qps_destroyed@GOTPAGEOFF]
	bl	_atomic_inc
	mov	w8, #1
	str	w8, [x19]
	ldr	x8, [x19, #8]
Lloh2:
	adrp	x21, _IB_QPS_INIT@GOTPAGE
Lloh3:
	ldr	x21, [x21, _IB_QPS_INIT@GOTPAGEOFF]
	ldr	x9, [x21]
Lloh4:
	adrp	x10, _IB_QPS_RTS@GOTPAGE
Lloh5:
	ldr	x10, [x10, _IB_QPS_RTS@GOTPAGEOFF]
Lloh6:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #0, ge
	b.gt	LBB0_2
; %bb.1:
Lloh7:
	adrp	x8, _IB_QPS_ERR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _IB_QPS_ERR@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	add	x0, x19, #40
Lloh10:
	adrp	x8, _IB_QP_STATE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _IB_QP_STATE@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	add	x1, sp, #56
	mov	x3, #0
	bl	_nes_modify_qp
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
LBB0_2:
Lloh13:
	adrp	x10, _IB_QPS_RTR@GOTPAGE
Lloh14:
	ldr	x10, [x10, _IB_QPS_RTR@GOTPAGEOFF]
Lloh15:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_6
; %bb.3:
	ldr	x21, [x19, #80]
	cbz	x21, LBB0_6
; %bb.4:
Lloh16:
	adrp	x8, _IW_CM_EVENT_CONNECT_REPLY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _IW_CM_EVENT_CONNECT_REPLY@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _ETIMEDOUT@GOTPAGE
Lloh20:
	ldr	x9, [x9, _ETIMEDOUT@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	neg	w9, w9
	stp	w9, w8, [sp, #48]
	ldr	d0, [x21, #16]
	str	d0, [sp, #40]
	stp	xzr, xzr, [sp, #24]
Lloh22:
	adrp	x24, _NES_DBG_QP@GOTPAGE
Lloh23:
	ldr	x24, [x24, _NES_DBG_QP@GOTPAGEOFF]
	ldr	w22, [x24]
	ldr	w23, [x19, #76]
	add	x0, x19, #72
	bl	_atomic_read
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x21, x0, [sp]
Lloh24:
	adrp	x1, l_.str@PAGE
Lloh25:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	mov	x2, x23
	bl	_nes_debug
	ldr	x8, [x21, #8]
	mov	x0, x21
	blr	x8
	ldr	x8, [x21]
	add	x1, sp, #24
	mov	x0, x21
	blr	x8
	cbz	w0, LBB0_6
; %bb.5:
	mov	x2, x0
	ldr	w0, [x24]
Lloh26:
	adrp	x1, l_.str.1@PAGE
Lloh27:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_nes_debug
LBB0_6:
	ldr	x8, [x19, #64]
	cbz	x8, LBB0_14
; %bb.7:
	ldr	x8, [x20]
	cbz	x8, LBB0_11
; %bb.8:
	ldr	x0, [x8]
	cbz	x0, LBB0_11
; %bb.9:
	bl	_to_nesucontext
	mov	x20, x0
	ldr	x0, [x19, #16]
	ldr	w1, [x20, #16]
	bl	_clear_bit
	ldr	x9, [x20, #8]
	ldr	x8, [x19, #16]
	str	xzr, [x9, x8, lsl #3]
	ldr	x9, [x20]
	cmp	x9, x8
	b.ls	LBB0_11
; %bb.10:
	str	x8, [x20]
LBB0_11:
	ldr	x8, [x19, #56]
	cbz	x8, LBB0_19
; %bb.12:
	ldr	x8, [x19, #48]
	cbz	x8, LBB0_19
; %bb.13:
	str	xzr, [x19, #48]
	ldr	w0, [x19, #44]
	bl	_kunmap
	b	LBB0_19
LBB0_14:
	ldr	x1, [x19, #24]
	cbz	x1, LBB0_16
; %bb.15:
	mov	x0, x19
	bl	_nes_clean_cq
LBB0_16:
	ldr	x1, [x19, #32]
	cbz	x1, LBB0_19
; %bb.17:
	ldr	x8, [x19, #24]
	cmp	x1, x8
	b.eq	LBB0_19
; %bb.18:
	mov	x0, x19
	bl	_nes_clean_cq
LBB0_19:
	add	x0, x19, #40
	bl	_nes_rem_ref
	mov	w0, #0
	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
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_sw_qps_destroyed,4,2           ; @sw_qps_destroyed
	.comm	_IB_QPS_INIT,8,3                ; @IB_QPS_INIT
	.comm	_IB_QPS_RTS,8,3                 ; @IB_QPS_RTS
	.comm	_IB_QPS_ERR,4,2                 ; @IB_QPS_ERR
	.comm	_IB_QP_STATE,4,2                ; @IB_QP_STATE
	.comm	_IB_QPS_RTR,8,3                 ; @IB_QPS_RTR
	.comm	_IW_CM_EVENT_CONNECT_REPLY,4,2  ; @IW_CM_EVENT_CONNECT_REPLY
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_NES_DBG_QP,4,2                 ; @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Generating a CM Timeout Event for QP%u. cm_id = %p, refcount = %u. \n"

l_.str.1:                               ; @.str.1
	.asciz	"OFA CM event_handler returned, ret=%d\n"

	.no_dead_strip	_nes_destroy_qp
.subsections_via_symbols
