	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehca_rereg_mr                  ## -- Begin function ehca_rereg_mr
	.p2align	4, 0x90
_ehca_rereg_mr:                         ## @ehca_rereg_mr
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -64(%rbp)                  ## 8-byte Spill
	movl	%r8d, %r13d
	movq	%rcx, %r12
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	16(%rbp), %rax
	movq	(%rax), %rdx
	movq	_MAX_RPAGES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rsi), %rcx
	cmpq	%rax, %rdx
	jg	LBB0_6
## %bb.1:
	cmpq	%rax, %rcx
	jg	LBB0_6
## %bb.2:
	cmpq	%rcx, %rdx
	jg	LBB0_6
## %bb.3:
	leaq	8(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	8(%rbx), %eax
	movq	_EHCA_MR_FLAG_MAXMR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	jne	LBB0_7
## %bb.4:
	subq	$8, %rsp
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%r12, %rcx
	movl	%r13d, %r8d
	movq	-64(%rbp), %r9                  ## 8-byte Reload
	pushq	32(%rbp)
	pushq	24(%rbp)
	pushq	16(%rbp)
	callq	_ehca_rereg_mr_rereg1
	addq	$32, %rsp
	testl	%eax, %eax
	je	LBB0_15
## %bb.5:
	movl	%eax, %r15d
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%edx, %edx
	movl	$1, %ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rax), %eax
	addl	%r15d, %eax
	je	LBB0_9
	jmp	LBB0_14
LBB0_6:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_ehca_dbg
	leaq	8(%rbx), %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	8(%rbx), %eax
	movq	_EHCA_MR_FLAG_MAXMR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_8
LBB0_7:
	notl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 8(%rbx)
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	_ehca_err
	jmp	LBB0_9
LBB0_8:
	xorl	%eax, %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
LBB0_9:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movq	%r12, %r13
	movl	4(%r14), %edi
	movq	%rbx, %rsi
	callq	_hipz_h_free_resource_mr
	movq	%rax, %r12
	movq	_H_SUCCESS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r12
	jne	LBB0_12
## %bb.10:
	movq	32(%rbx), %rax
	movq	%rax, -96(%rbp)
	movups	(%rbx), %xmm0
	movups	16(%rbx), %xmm1
	movaps	%xmm1, -112(%rbp)
	movaps	%xmm0, -128(%rbp)
	movq	%rbx, %rdi
	callq	_ehca_mr_deletenew
	movl	-120(%rbp), %eax
	movl	%eax, 8(%rbx)
	movl	-100(%rbp), %eax
	movl	%eax, 28(%rbx)
	movups	-116(%rbp), %xmm0
	movups	%xmm0, 12(%rbx)
	movq	_EHCA_REG_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%r13, %r12
	movq	%r13, %rcx
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	movl	%r13d, %r8d
	movq	-64(%rbp), %r9                  ## 8-byte Reload
	pushq	%rax
	pushq	32(%rbp)
	pushq	24(%rbp)
	pushq	16(%rbp)
	callq	_ehca_reg_mr
	addq	$32, %rsp
	testl	%eax, %eax
	je	LBB0_15
## %bb.11:
	movl	%eax, %r15d
	leaq	-120(%rbp), %rsi
	movl	$32, %edx
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_memcpy
	movl	$1, %edx
	jmp	LBB0_14
LBB0_12:
	movl	4(%r14), %r8d
	movl	32(%rbx), %r10d
	movl	36(%rbx), %r9d
	subq	$8, %rsp
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	movq	%r12, %rdx
	movq	%rbx, %rcx
	xorl	%eax, %eax
	pushq	%r10
	callq	_ehca_err
	addq	$16, %rsp
	movq	%r12, %rdi
	callq	_ehca2ib_return_code
	testl	%eax, %eax
	je	LBB0_16
## %bb.13:
	movl	$1, %edx
	movl	%eax, %r15d
	movq	%r13, %r12
	movq	-80(%rbp), %r13                 ## 8-byte Reload
LBB0_14:
	movq	16(%rbp), %rax
	movl	8(%rax), %r11d
	subq	$8, %rsp
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdi
	movq	%r12, %r10
	movq	%rdx, %r12
	movl	%r15d, %edx
	movq	%r14, %rcx
	movq	%rbx, %r8
	movq	-56(%rbp), %r9                  ## 8-byte Reload
	xorl	%eax, %eax
	pushq	%r12
	pushq	-48(%rbp)                       ## 8-byte Folded Reload
	movq	32(%rbp), %rbx
	pushq	(%rbx)
	movq	24(%rbp), %rbx
	pushq	(%rbx)
	pushq	%r11
	pushq	16(%rbp)
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	pushq	%r13
	pushq	%r10
	callq	_ehca_err
	addq	$80, %rsp
	jmp	LBB0_16
LBB0_15:
	xorl	%r15d, %r15d
LBB0_16:
	movl	%r15d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_RPAGES,8,3                 ## @MAX_RPAGES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Rereg3 case, pginfo->num_hwpages=%llx e_mr->num_hwpages=%x"

	.comm	_EHCA_MR_FLAG_MAXMR,4,2         ## @EHCA_MR_FLAG_MAXMR
L_.str.1:                               ## @.str.1
	.asciz	"Rereg MR for max-MR! e_mr=%p"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_H_SUCCESS,8,3                  ## @H_SUCCESS
L_.str.2:                               ## @.str.2
	.asciz	"hipz_free_mr failed, h_ret=%lli e_mr=%p hca_hndl=%llx mr_hndl=%llx mr->lkey=%x"

	.comm	_EHCA_REG_MR,4,2                ## @EHCA_REG_MR
L_.str.3:                               ## @.str.3
	.asciz	"ret=%i shca=%p e_mr=%p iova_start=%p size=%llx acl=%x e_pd=%p pginfo=%p num_kpages=%llx lkey=%x rkey=%x rereg_1_hcall=%x rereg_3_hcall=%x"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehca_rereg_mr                  ; -- Begin function ehca_rereg_mr
	.p2align	2
_ehca_rereg_mr:                         ; @ehca_rereg_mr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #272
	.cfi_def_cfa_offset 272
	stp	x28, x27, [sp, #176]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #192]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #208]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #224]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #240]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #256]            ; 16-byte Folded Spill
	add	x29, sp, #256
	.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	x26, x7
	mov	x25, x6
	mov	x24, x5
	mov	x23, x4
	stp	x3, x2, [sp, #112]              ; 16-byte Folded Spill
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x29, #16]
Lloh0:
	adrp	x8, _MAX_RPAGES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_RPAGES@GOTPAGEOFF]
	ldr	x2, [x6]
Lloh2:
	ldr	x8, [x8]
	ldr	x3, [x1]
	cmp	x2, x8
	ccmp	x3, x8, #0, le
	ccmp	x2, x3, #0, le
	b.le	LBB0_2
; %bb.1:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ehca_dbg
	mov	x27, x20
	ldr	w8, [x27, #8]!
Lloh5:
	adrp	x9, _EHCA_MR_FLAG_MAXMR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _EHCA_MR_FLAG_MAXMR@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_3
	b	LBB0_4
LBB0_2:
	mov	x27, x20
	ldr	w8, [x27, #8]!
Lloh8:
	adrp	x9, _EHCA_MR_FLAG_MAXMR@GOTPAGE
Lloh9:
	ldr	x9, [x9, _EHCA_MR_FLAG_MAXMR@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
LBB0_3:
	bic	w8, w8, w9
	str	w8, [x20, #8]
	str	x20, [sp]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
LBB0_4:
	mov	w22, #0
LBB0_5:
	ldr	w0, [x19, #4]
	mov	x1, x20
	bl	_hipz_h_free_resource_mr
Lloh13:
	adrp	x8, _H_SUCCESS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _H_SUCCESS@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_8
; %bb.6:
	ldp	q0, q1, [x20]
	stp	q0, q1, [sp, #128]
	ldr	x8, [x20, #32]
	str	x8, [sp, #160]
	mov	x0, x20
	bl	_ehca_mr_deletenew
	ldr	w8, [sp, #136]
	str	w8, [x20, #8]
	ldr	w8, [sp, #156]
	str	w8, [x20, #28]
	ldur	q0, [sp, #140]
	stur	q0, [x20, #12]
Lloh16:
	adrp	x8, _EHCA_REG_MR@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EHCA_REG_MR@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	str	x21, [sp]
	mov	x0, x19
	mov	x1, x20
	ldp	x3, x2, [sp, #112]              ; 16-byte Folded Reload
	mov	x4, x23
	mov	x5, x24
	mov	x6, x25
	mov	x7, x26
	bl	_ehca_reg_mr
	mov	x28, x0
	cbz	w0, LBB0_11
; %bb.7:
	add	x8, sp, #128
	orr	x1, x8, #0x8
	mov	x0, x27
	mov	w2, #32
	bl	_memcpy
	b	LBB0_9
LBB0_8:
	mov	x28, x0
	ldr	w8, [x19, #4]
	ldp	w10, w9, [x20, #32]
	stp	x9, x10, [sp, #24]
	stp	x20, x8, [sp, #8]
	str	x0, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ehca_err
	mov	x0, x28
	bl	_ehca2ib_return_code
	mov	x28, x0
	cbz	w0, LBB0_11
LBB0_9:
	mov	w8, #1
LBB0_10:
	ldr	x9, [x26]
	ldr	x10, [x21]
	ldr	w11, [x25, #8]
	stp	x22, x8, [sp, #88]
	stp	x9, x10, [sp, #72]
	stp	x25, x11, [sp, #56]
	stp	x23, x24, [sp, #40]
	ldr	x8, [sp, #112]                  ; 8-byte Folded Reload
	str	x8, [sp, #32]
	ldr	x8, [sp, #120]                  ; 8-byte Folded Reload
	stp	x20, x8, [sp, #16]
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	stp	x28, x19, [sp]
	mov	x0, x19
	bl	_ehca_err
LBB0_11:
	mov	x0, x28
	ldp	x29, x30, [sp, #256]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #240]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #224]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #208]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #192]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #176]            ; 16-byte Folded Reload
	add	sp, sp, #272
	ret
LBB0_12:
	str	x21, [sp]
	mov	x0, x19
	mov	x1, x20
	ldp	x3, x2, [sp, #112]              ; 16-byte Folded Reload
	mov	x4, x23
	mov	x5, x24
	mov	x6, x25
	mov	x7, x26
	bl	_ehca_rereg_mr_rereg1
	mov	x28, x0
	cbz	w0, LBB0_11
; %bb.13:
Lloh23:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	mov	w22, #1
	cmn	w28, w8
	b.eq	LBB0_5
; %bb.14:
	mov	w8, #0
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_RPAGES,8,3                 ; @MAX_RPAGES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Rereg3 case, pginfo->num_hwpages=%llx e_mr->num_hwpages=%x"

	.comm	_EHCA_MR_FLAG_MAXMR,4,2         ; @EHCA_MR_FLAG_MAXMR
l_.str.1:                               ; @.str.1
	.asciz	"Rereg MR for max-MR! e_mr=%p"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_H_SUCCESS,8,3                  ; @H_SUCCESS
l_.str.2:                               ; @.str.2
	.asciz	"hipz_free_mr failed, h_ret=%lli e_mr=%p hca_hndl=%llx mr_hndl=%llx mr->lkey=%x"

	.comm	_EHCA_REG_MR,4,2                ; @EHCA_REG_MR
l_.str.3:                               ; @.str.3
	.asciz	"ret=%i shca=%p e_mr=%p iova_start=%p size=%llx acl=%x e_pd=%p pginfo=%p num_kpages=%llx lkey=%x rkey=%x rereg_1_hcall=%x rereg_3_hcall=%x"

.subsections_via_symbols
