	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_alloc_mr                ## -- Begin function pvrdma_alloc_mr
	.p2align	4, 0x90
_pvrdma_alloc_mr:                       ## @pvrdma_alloc_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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	(%rdi), %edi
	callq	_to_vdev
	movq	%rax, %r13
	movq	_IB_MR_TYPE_MEM_REG@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_PVRDMA_MAX_FAST_REG_PAGES@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jl	LBB0_2
## %bb.4:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movl	$48, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r15
	leal	(,%r12,4), %edi
	movl	(%rbx), %esi
	callq	_kzalloc
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	leaq	16(%r15), %rbx
	movq	%r13, %rdi
	xorl	%r13d, %r13d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rsi
	movl	%r12d, %edx
	xorl	%ecx, %ecx
	callq	_pvrdma_page_dir_init
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_warn
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_12:
	movq	8(%r15), %rdi
	callq	_kfree
	jmp	LBB0_13
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%edi, %edi
	subl	(%rax), %edi
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_13:
	movq	%r15, %rdi
	callq	_kfree
	movl	%r13d, %edi
	callq	_ERR_PTR
LBB0_14:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	leaq	-96(%rbp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$24, %edx
	callq	_memset
	movq	_PVRDMA_CMD_CREATE_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -76(%rbp)
	movq	%r14, %rdi
	callq	_to_vpd
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movq	$0, -88(%rbp)
	movq	_PVRDMA_MR_FLAG_FRMR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -92(%rbp)
	movl	%r12d, -96(%rbp)
	movq	_PVRDMA_CMD_CREATE_MR_RESP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-64(%rbp), %rdx
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_pvrdma_cmd_post
	testl	%eax, %eax
	js	LBB0_11
## %bb.15:
	movl	%r12d, (%r15)
	movl	-56(%rbp), %eax
	movl	%eax, 44(%r15)
	movl	-60(%rbp), %ecx
	movq	%r15, %rax
	addq	$20, %rax
	movl	%ecx, 24(%r15)
	movl	-64(%rbp), %ecx
	movl	%ecx, 20(%r15)
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 40(%r15)
	movq	$0, 32(%r15)
	jmp	LBB0_14
LBB0_11:
	movl	%eax, %r13d
	movq	(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_warn
	movq	%rbx, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	callq	_pvrdma_page_dir_cleanup
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_IB_MR_TYPE_MEM_REG,4,2         ## @IB_MR_TYPE_MEM_REG
	.comm	_PVRDMA_MAX_FAST_REG_PAGES,4,2  ## @PVRDMA_MAX_FAST_REG_PAGES
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to allocate page dir for mr\n"

	.comm	_PVRDMA_CMD_CREATE_MR,4,2       ## @PVRDMA_CMD_CREATE_MR
	.comm	_PVRDMA_MR_FLAG_FRMR,4,2        ## @PVRDMA_MR_FLAG_FRMR
	.comm	_PVRDMA_CMD_CREATE_MR_RESP,4,2  ## @PVRDMA_CMD_CREATE_MR_RESP
L_.str.1:                               ## @.str.1
	.asciz	"could not create FR mem region, error: %d\n"

	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_alloc_mr                ; -- Begin function pvrdma_alloc_mr
	.p2align	2
_pvrdma_alloc_mr:                       ; @pvrdma_alloc_mr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x21, x2
	mov	x19, x1
	mov	x22, x0
	ldr	w0, [x0]
	bl	_to_vdev
Lloh0:
	adrp	x8, _IB_MR_TYPE_MEM_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IB_MR_TYPE_MEM_REG@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _PVRDMA_MAX_FAST_REG_PAGES@GOTPAGE
Lloh4:
	ldr	x9, [x9, _PVRDMA_MAX_FAST_REG_PAGES@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w19
	ccmp	w9, w21, #8, eq
	b.ge	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_8
LBB0_2:
	mov	x20, x0
Lloh8:
	adrp	x23, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x23, [x23, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	w0, #48
	bl	_kzalloc
	cbz	x0, LBB0_7
; %bb.3:
	mov	x19, x0
	lsl	w0, w21, #2
	ldr	w1, [x23]
	bl	_kzalloc
	str	x0, [x19, #8]
	cbz	x0, LBB0_9
; %bb.4:
	add	x23, x19, #16
	mov	x0, x20
	mov	x1, x23
	mov	x2, x21
	mov	w3, #0
	bl	_pvrdma_page_dir_init
	cbz	w0, LBB0_12
; %bb.5:
	ldr	x0, [x20]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
Lloh12:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_6:
	ldr	x0, [x19, #8]
	bl	_kfree
	b	LBB0_10
LBB0_7:
Lloh15:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
	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
	add	sp, sp, #112
	b	_ERR_PTR
LBB0_9:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	mov	x0, x19
	bl	_kfree
	mov	x0, x22
	bl	_ERR_PTR
	mov	x19, x0
LBB0_11:
	mov	x0, x19
	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
	add	sp, sp, #112
	ret
LBB0_12:
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #24
	bl	_memset
Lloh20:
	adrp	x8, _PVRDMA_CMD_CREATE_MR@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_MR@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	str	w8, [sp, #44]
	mov	x0, x22
	bl	_to_vpd
	ldr	w8, [x0]
	str	w8, [sp, #40]
	str	xzr, [sp, #32]
Lloh23:
	adrp	x8, _PVRDMA_MR_FLAG_FRMR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PVRDMA_MR_FLAG_FRMR@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	stp	w21, w8, [sp, #24]
Lloh26:
	adrp	x8, _PVRDMA_CMD_CREATE_MR_RESP@GOTPAGE
Lloh27:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_MR_RESP@GOTPAGEOFF]
Lloh28:
	ldr	w3, [x8]
	add	x1, sp, #24
	add	x2, sp, #8
	mov	x0, x20
	bl	_pvrdma_cmd_post
	tbnz	w0, #31, LBB0_14
; %bb.13:
	str	w21, [x19]
	ldr	w8, [sp, #16]
	ldr	d0, [sp, #8]
	str	d0, [x19, #20]!
Lloh29:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh30:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #20]
	stur	xzr, [x19, #12]
	b	LBB0_11
LBB0_14:
	mov	x22, x0
	ldr	x0, [x20]
	str	x22, [sp]
Lloh32:
	adrp	x1, l_.str.1@PAGE
Lloh33:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_warn
	mov	x0, x20
	mov	x1, x23
	bl	_pvrdma_page_dir_cleanup
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_IB_MR_TYPE_MEM_REG,4,2         ; @IB_MR_TYPE_MEM_REG
	.comm	_PVRDMA_MAX_FAST_REG_PAGES,4,2  ; @PVRDMA_MAX_FAST_REG_PAGES
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to allocate page dir for mr\n"

	.comm	_PVRDMA_CMD_CREATE_MR,4,2       ; @PVRDMA_CMD_CREATE_MR
	.comm	_PVRDMA_MR_FLAG_FRMR,4,2        ; @PVRDMA_MR_FLAG_FRMR
	.comm	_PVRDMA_CMD_CREATE_MR_RESP,4,2  ; @PVRDMA_CMD_CREATE_MR_RESP
l_.str.1:                               ; @.str.1
	.asciz	"could not create FR mem region, error: %d\n"

	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
.subsections_via_symbols
