	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_SW2HW_MPT_wrapper         ## -- Begin function mlx4_SW2HW_MPT_wrapper
	.p2align	4, 0x90
_mlx4_SW2HW_MPT_wrapper:                ## @mlx4_SW2HW_MPT_wrapper
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -80(%rbp)                  ## 8-byte Spill
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movq	%rcx, %r15
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	movl	(%rdx), %ebx
	movq	$0, -96(%rbp)
	movl	(%rcx), %edi
	callq	_mr_get_mtt_addr
	cltd
	idivl	(%r13)
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	callq	_mpt_mask
	movl	%eax, %r12d
	andl	%ebx, %r12d
	movl	%r14d, %ebx
	movq	_RES_MPT_HW@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-96(%rbp), %r8
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	callq	_mr_res_start_move_to
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_17
## %bb.1:
	movl	(%r15), %edi
	callq	_mr_is_region
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:
	movl	(%r15), %edi
	callq	_mr_get_pd
	shrl	$17, %eax
	andl	$127, %eax
	subl	$1, %eax
	jb	LBB0_5
## %bb.4:
	cmpl	%ebx, %eax
	je	LBB0_5
LBB0_2:
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	%r13, %r15
	movl	%r12d, %r13d
LBB0_16:
	movq	_RES_MPT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%r13d, %ecx
	callq	_res_abort_move
LBB0_17:
	movl	%r14d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	(%r15), %edi
	callq	_mr_is_fmr
	testq	%rax, %rax
	movq	%r15, %r14
	movq	%r13, %r15
	movl	%r12d, %r13d
	movq	-88(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_9
## %bb.6:
	movl	(%r14), %edi
	callq	_mr_is_bind_enabled
	testq	%rax, %rax
	je	LBB0_8
LBB0_7:
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_16
LBB0_8:
	movl	(%r14), %edi
	callq	_mr_is_region
	testl	%eax, %eax
	je	LBB0_7
LBB0_9:
	movl	(%r14), %edi
	callq	_mr_phys_mpt
	testl	%eax, %eax
	je	LBB0_10
## %bb.18:
	movq	%r15, %rdi
	movl	%ebx, %esi
	movq	%r12, %rdx
	movq	%r14, %rcx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	movq	-80(%rbp), %r9                  ## 8-byte Reload
	callq	_mlx4_DMA_wrapper
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_16
LBB0_14:
	movq	_RES_MPT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%r13d, %ecx
	callq	_res_end_move
	xorl	%r14d, %r14d
	jmp	LBB0_17
LBB0_10:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	_RES_MTT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-48(%rbp), %r8
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	-52(%rbp), %r12d                ## 4-byte Reload
	movl	%r12d, %edx
	callq	_get_res
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_16
## %bb.11:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_mr_get_mtt_size
	movq	-48(%rbp), %r8
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_check_mtt_range
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_15
## %bb.12:
	movq	-48(%rbp), %rax
	movq	-96(%rbp), %rcx
	movq	%rax, (%rcx)
	movq	%r15, %rdi
	movl	%ebx, %esi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	movq	-80(%rbp), %r9                  ## 8-byte Reload
	callq	_mlx4_DMA_wrapper
	movl	%eax, %r14d
	testl	%eax, %eax
	je	LBB0_13
LBB0_15:
	movq	-48(%rbp), %rax
	movl	(%rax), %edx
	movq	_RES_MTT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_put_res
	jmp	LBB0_16
LBB0_13:
	movq	-48(%rbp), %rdi
	addq	$4, %rdi
	callq	_atomic_inc
	movq	-48(%rbp), %rax
	movl	(%rax), %edx
	movq	_RES_MTT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_put_res
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_RES_MPT_HW,4,2                 ## @RES_MPT_HW
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_RES_MTT,4,2                    ## @RES_MTT
	.comm	_RES_MPT,4,2                    ## @RES_MPT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_SW2HW_MPT_wrapper         ; -- Begin function mlx4_SW2HW_MPT_wrapper
	.p2align	2
_mlx4_SW2HW_MPT_wrapper:                ; @mlx4_SW2HW_MPT_wrapper
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x5
	mov	x23, x4
	mov	x24, x3
	mov	x25, x2
	mov	x19, x1
	mov	x20, x0
	ldr	w21, [x2]
	str	xzr, [sp]
	ldr	w0, [x3]
	bl	_mr_get_mtt_addr
	mov	x26, x0
	ldr	w28, [x20]
	mov	x0, x20
	bl	_mpt_mask
	and	w21, w0, w21
Lloh0:
	adrp	x8, _RES_MPT_HW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RES_MPT_HW@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x4, sp
	mov	x0, x20
	mov	x1, x19
	mov	x2, x21
	bl	_mr_res_start_move_to
	mov	x27, x0
	cbnz	w0, LBB0_8
; %bb.1:
	ldr	w0, [x24]
	bl	_mr_is_region
	cbz	w0, LBB0_6
; %bb.2:
	ldr	w0, [x24]
	bl	_mr_get_pd
	ubfx	w8, w0, #17, #7
	cbz	w8, LBB0_4
; %bb.3:
	sub	w8, w8, #1
	cmp	w8, w19
	b.ne	LBB0_6
LBB0_4:
	ldr	w0, [x24]
	bl	_mr_is_fmr
	cbz	x0, LBB0_10
; %bb.5:
	ldr	w0, [x24]
	bl	_mr_is_bind_enabled
	cbz	x0, LBB0_9
LBB0_6:
Lloh3:
	adrp	x8, _EPERM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_7:
Lloh6:
	adrp	x8, _RES_MPT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _RES_MPT@GOTPAGEOFF]
Lloh8:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x19
	mov	x3, x21
	bl	_res_abort_move
LBB0_8:
	mov	x0, x27
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_9:
	ldr	w0, [x24]
	bl	_mr_is_region
	cbz	w0, LBB0_6
LBB0_10:
	ldr	w0, [x24]
	bl	_mr_phys_mpt
	cbz	w0, LBB0_13
; %bb.11:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x25
	mov	x3, x24
	mov	x4, x23
	mov	x5, x22
	bl	_mlx4_DMA_wrapper
	mov	x27, x0
	cbnz	w0, LBB0_7
LBB0_12:
Lloh9:
	adrp	x8, _RES_MPT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _RES_MPT@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x19
	mov	x3, x21
	bl	_res_end_move
	mov	w27, #0
	b	LBB0_8
LBB0_13:
Lloh12:
	adrp	x8, _RES_MTT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RES_MTT@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x8]
	sdiv	w26, w26, w28
	add	x4, sp, #8
	mov	x0, x20
	mov	x1, x19
	mov	x2, x26
	bl	_get_res
	mov	x27, x0
	cbnz	w0, LBB0_7
; %bb.14:
Lloh15:
	adrp	x28, _RES_MTT@GOTPAGE
Lloh16:
	ldr	x28, [x28, _RES_MTT@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_mr_get_mtt_size
	mov	x3, x0
	ldr	x4, [sp, #8]
	mov	x0, x20
	mov	x1, x19
	mov	x2, x26
	bl	_check_mtt_range
	mov	x27, x0
	cbnz	w0, LBB0_16
; %bb.15:
	ldp	x9, x8, [sp]
	str	x8, [x9]
	mov	x0, x20
	mov	x1, x19
	mov	x2, x25
	mov	x3, x24
	mov	x4, x23
	mov	x5, x22
	bl	_mlx4_DMA_wrapper
	mov	x27, x0
	cbz	w0, LBB0_17
LBB0_16:
	ldr	x8, [sp, #8]
	ldr	w2, [x8]
	ldr	w3, [x28]
	mov	x0, x20
	mov	x1, x19
	bl	_put_res
	b	LBB0_7
LBB0_17:
	ldr	x8, [sp, #8]
	add	x0, x8, #4
	bl	_atomic_inc
	ldr	x8, [sp, #8]
	ldr	w2, [x8]
	ldr	w3, [x28]
	mov	x0, x20
	mov	x1, x19
	bl	_put_res
	b	LBB0_12
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_RES_MPT_HW,4,2                 ; @RES_MPT_HW
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_RES_MTT,4,2                    ; @RES_MTT
	.comm	_RES_MPT,4,2                    ; @RES_MPT
.subsections_via_symbols
