	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rvt_clear_mr_refs
_rvt_clear_mr_refs:                     ## @rvt_clear_mr_refs
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r12
	movl	52(%rdi), %edi
	callq	_ib_to_rvt
	movq	%rax, %r14
	movq	_RVT_R_REWIND_SGE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	48(%r12), %rsi
	callq	_test_and_clear_bit
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	44(%r12), %rdi
	callq	_rvt_put_ss
LBB0_2:
	leaq	40(%r12), %rdi
	callq	_rvt_put_ss
	testl	%r15d, %r15d
	je	LBB0_8
## %bb.3:
	movq	(%r12), %rsi
	cmpq	8(%r12), %rsi
	je	LBB0_6
## %bb.4:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	callq	_rvt_get_swqe_ptr
	movq	%r12, %rdi
	movq	%rax, %rsi
	callq	_rvt_put_qp_swqe
	movq	(%r12), %rax
	incq	%rax
	cmpq	16(%r12), %rax
	cmovgeq	%rbx, %rax
	movq	%rax, (%r12)
	xorl	%eax, %eax
	callq	_smp_wmb
	movq	(%r12), %rsi
	cmpq	8(%r12), %rsi
	jne	LBB0_5
LBB0_6:
	movq	32(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.7:
	callq	_rvt_put_mr
	movq	$0, 32(%r12)
LBB0_8:
	cmpq	$0, 24(%r12)
	je	LBB0_14
## %bb.9:
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=1
	incq	%rbx
	testq	%r15, %r15
	je	LBB0_14
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_rvt_max_atomic
	movl	%eax, %eax
	cmpq	%rax, %rbx
	jae	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	24(%r12), %r15
	movq	(%r15,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	callq	_rvt_put_mr
	movq	$0, (%r15,%rbx,8)
	movq	24(%r12), %r15
	jmp	LBB0_13
LBB0_14:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RVT_R_REWIND_SGE,4,2           ## @RVT_R_REWIND_SGE
	.no_dead_strip	_rvt_clear_mr_refs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rvt_clear_mr_refs
_rvt_clear_mr_refs:                     ; @rvt_clear_mr_refs
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x1
	mov	x19, x0
	ldr	w0, [x0, #52]
	bl	_ib_to_rvt
	mov	x20, x0
Lloh0:
	adrp	x8, _RVT_R_REWIND_SGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RVT_R_REWIND_SGE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	add	x1, x19, #48
	bl	_test_and_clear_bit
	cbz	x0, LBB0_2
; %bb.1:
	add	x0, x19, #44
	bl	_rvt_put_ss
LBB0_2:
	add	x0, x19, #40
	bl	_rvt_put_ss
	cbz	w21, LBB0_7
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldp	x1, x8, [x19]
	cmp	x1, x8
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x19
	bl	_rvt_get_swqe_ptr
	mov	x1, x0
	mov	x0, x19
	bl	_rvt_put_qp_swqe
	ldr	x8, [x19]
	add	x9, x8, #1
	ldr	x10, [x19, #16]
	cmp	x9, x10
	csinc	x8, xzr, x8, ge
	str	x8, [x19]
	bl	_smp_wmb
	b	LBB0_3
LBB0_5:
	ldr	x0, [x19, #32]
	cbz	x0, LBB0_7
; %bb.6:
	bl	_rvt_put_mr
	str	xzr, [x19, #32]
LBB0_7:
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_13
; %bb.8:
	mov	x21, #0
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x21, x21, #1
	cbz	x22, LBB0_13
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_rvt_max_atomic
	cmp	x21, w0, uxtw
	b.hs	LBB0_13
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	x22, [x19, #24]
	ldr	x0, [x22, x21, lsl #3]
	cbz	x0, LBB0_9
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	bl	_rvt_put_mr
	str	xzr, [x22, x21, lsl #3]
	ldr	x22, [x19, #24]
	b	LBB0_9
LBB0_13:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_RVT_R_REWIND_SGE,4,2           ; @RVT_R_REWIND_SGE
	.no_dead_strip	_rvt_clear_mr_refs
.subsections_via_symbols
