	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_reg_user_mr             ## -- Begin function pvrdma_reg_user_mr
	.p2align	4, 0x90
_pvrdma_reg_user_mr:                    ## @pvrdma_reg_user_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, %r14
	movl	%r8d, -52(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r12
	movq	%rdx, %r15
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r13
	movl	(%rdi), %edi
	callq	_to_vdev
	movq	%rax, %rbx
	testq	%r15, %r15
	je	LBB0_17
## %bb.1:
	movq	8(%rbx), %rax
	cmpq	%r15, (%rax)
	jge	LBB0_2
LBB0_17:
	movq	(%rbx), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_warn
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movl	%ebx, %edi
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_PTR                        ## TAILCALL
LBB0_2:
	movq	%r14, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	xorl	%r8d, %r8d
	callq	_ib_umem_get
	movq	%rax, %r14
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_3
## %bb.18:
	movq	(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_warn
	movq	%r14, %rdi
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_ERR_CAST                       ## TAILCALL
LBB0_3:
	movq	%r14, %rdi
	callq	_ib_umem_num_pages
	movl	%eax, %edx
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movq	_PVRDMA_PAGE_DIR_MAX_PAGES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jg	LBB0_5
## %bb.6:
	movl	%edx, -48(%rbp)                 ## 4-byte Spill
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$48, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rax, %r14
	movq	%r12, 32(%rax)
	movq	%r15, 24(%rax)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, 40(%r14)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	xorl	%ecx, %ecx
	callq	_pvrdma_page_dir_init
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	movq	%r14, %r12
	je	LBB0_10
## %bb.9:
	movq	(%rbx), %rdi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_warn
	jmp	LBB0_14
LBB0_5:
	movq	(%rbx), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_dev_warn
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_15
LBB0_10:
	movq	40(%r12), %rsi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_pvrdma_page_dir_insert_umem
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	testl	%eax, %eax
	je	LBB0_11
LBB0_13:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_pvrdma_page_dir_cleanup
LBB0_14:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_15:
	movq	%r14, %rdi
	callq	_ib_umem_release
	movq	%r12, %rdi
	callq	_kfree
	movl	%ebx, %edi
	callq	_ERR_PTR
LBB0_16:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%r12, %r14
	leaq	-128(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	_PVRDMA_CMD_CREATE_MR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, -104(%rbp)
	movq	%r15, -112(%rbp)
	movq	%r13, %rdi
	callq	_to_vpd
	movl	(%rax), %eax
	movl	%eax, -116(%rbp)
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -128(%rbp)
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -124(%rbp)
	movl	(%r14), %eax
	movl	%eax, -120(%rbp)
	movq	_PVRDMA_CMD_CREATE_MR_RESP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-88(%rbp), %rdx
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_pvrdma_cmd_post
	testl	%eax, %eax
	js	LBB0_12
## %bb.19:
	movl	-80(%rbp), %eax
	movl	%eax, 16(%r14)
	movl	-84(%rbp), %ecx
	movq	%r14, %rax
	addq	$4, %rax
	movl	%ecx, 8(%r14)
	movl	-88(%rbp), %ecx
	movl	%ecx, 4(%r14)
	jmp	LBB0_16
LBB0_12:
	movq	(%rbx), %rdi
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_warn
	movq	%r14, %r12
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid mem region length\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"could not get umem for mem region\n"

	.comm	_PVRDMA_PAGE_DIR_MAX_PAGES,4,2  ## @PVRDMA_PAGE_DIR_MAX_PAGES
L_.str.2:                               ## @.str.2
	.asciz	"overflow %d pages in mem region\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.3:                               ## @.str.3
	.asciz	"could not allocate page directory\n"

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

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_reg_user_mr             ; -- Begin function pvrdma_reg_user_mr
	.p2align	2
_pvrdma_reg_user_mr:                    ; @pvrdma_reg_user_mr
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x19, x5
	mov	x22, x4
	mov	x27, x3
	mov	x24, x2
	mov	x25, x1
	mov	x23, x0
	ldr	w0, [x0]
	bl	_to_vdev
	mov	x21, x0
	cbz	x24, LBB0_2
; %bb.1:
	ldr	x8, [x21, #8]
	ldr	x8, [x8]
	cmp	x8, x24
	b.ge	LBB0_3
LBB0_2:
	ldr	x0, [x21]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_ERR_PTR
LBB0_3:
	mov	x0, x19
	mov	x1, x25
	mov	x2, x24
	mov	x3, x22
	mov	w4, #0
	bl	_ib_umem_get
	mov	x19, x0
	bl	_IS_ERR
	cbz	x0, LBB0_5
; %bb.4:
	ldr	x0, [x21]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_warn
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_ERR_CAST
LBB0_5:
	mov	x0, x19
	bl	_ib_umem_num_pages
	mov	x26, x0
	tbnz	w0, #31, LBB0_10
; %bb.6:
Lloh7:
	adrp	x8, _PVRDMA_PAGE_DIR_MAX_PAGES@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PVRDMA_PAGE_DIR_MAX_PAGES@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmp	w26, w8
	b.gt	LBB0_10
; %bb.7:
Lloh10:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	w0, #48
	bl	_kzalloc
	mov	x20, x0
	cbz	x0, LBB0_11
; %bb.8:
	stp	x24, x27, [x20, #24]
	str	x19, [x20, #40]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x26
	mov	w3, #0
	bl	_pvrdma_page_dir_init
	cbz	w0, LBB0_15
; %bb.9:
	mov	x27, x0
	ldr	x0, [x21]
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_warn
	b	LBB0_13
LBB0_10:
	ldr	x0, [x21]
	str	x26, [sp]
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_warn
	mov	x20, #0
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh19:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w27, w8
LBB0_13:
	mov	x0, x19
	bl	_ib_umem_release
	mov	x0, x20
	bl	_kfree
	mov	x0, x27
	bl	_ERR_PTR
	mov	x20, x0
LBB0_14:
	mov	x0, x20
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_15:
	ldr	x1, [x20, #40]
	mov	x0, x20
	mov	w2, #0
	bl	_pvrdma_page_dir_insert_umem
	mov	x27, x0
	cbz	w0, LBB0_17
LBB0_16:
	mov	x0, x21
	mov	x1, x20
	bl	_pvrdma_page_dir_cleanup
	b	LBB0_13
LBB0_17:
	add	x0, sp, #24
	mov	w1, #0
	mov	w2, #40
	bl	_memset
Lloh21:
	adrp	x8, _PVRDMA_CMD_CREATE_MR@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_MR@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	stp	x24, x25, [sp, #40]
	mov	x0, x23
	bl	_to_vpd
	ldr	w8, [x0]
	str	w8, [sp, #36]
	stp	w22, w26, [sp, #24]
	ldr	w8, [x20]
	str	w8, [sp, #32]
Lloh24:
	adrp	x8, _PVRDMA_CMD_CREATE_MR_RESP@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_MR_RESP@GOTPAGEOFF]
Lloh26:
	ldr	w3, [x8]
	add	x1, sp, #24
	add	x2, sp, #8
	mov	x0, x21
	bl	_pvrdma_cmd_post
	tbnz	w0, #31, LBB0_19
; %bb.18:
	ldr	w8, [sp, #16]
	ldr	d0, [sp, #8]
	str	d0, [x20, #4]!
	str	w8, [x20, #12]
	b	LBB0_14
LBB0_19:
	mov	x27, x0
	ldr	x0, [x21]
	str	x27, [sp]
Lloh27:
	adrp	x1, l_.str.4@PAGE
Lloh28:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_warn
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid mem region length\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"could not get umem for mem region\n"

	.comm	_PVRDMA_PAGE_DIR_MAX_PAGES,4,2  ; @PVRDMA_PAGE_DIR_MAX_PAGES
l_.str.2:                               ; @.str.2
	.asciz	"overflow %d pages in mem region\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.3:                               ; @.str.3
	.asciz	"could not allocate page directory\n"

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

.subsections_via_symbols
