	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_alloc_ucontext          ## -- Begin function pvrdma_alloc_ucontext
	.p2align	4, 0x90
_pvrdma_alloc_ucontext:                 ## @pvrdma_alloc_ucontext
	.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
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
	callq	_to_vdev
	movq	%rax, %r12
	movq	%rbx, %rdi
	callq	_to_vucontext
	movq	$0, -60(%rbp)
	movl	$0, -40(%rbp)
	cmpl	$0, 24(%r12)
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movq	%r12, 16(%rax)
	movq	%r12, %rdi
	movq	%rax, %rsi
	callq	_pvrdma_uar_alloc
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_1:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_4:
	movq	(%r12), %rax
	movq	_PVRDMA_PPN64_VERSION@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpq	(%rcx), %rax
	setl	%dl
	movl	(%r14), %eax
	movl	%eax, -60(%rbp,%rdx,4)
	movq	_PVRDMA_CMD_CREATE_UC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	_PVRDMA_CMD_CREATE_UC_RESP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-64(%rbp), %rsi
	leaq	-40(%rbp), %rdx
	movq	%r12, %rdi
	callq	_pvrdma_cmd_post
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movl	-40(%rbp), %eax
	movl	%eax, 8(%r14)
	movq	8(%r12), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movl	$4, %edx
	callq	_ib_copy_to_udata
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_pvrdma_uar_free
	addq	$4, %r14
	movq	%r14, %rdi
	callq	_pvrdma_dealloc_ucontext
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_9:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	%eax, %ebx
	movq	16(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_warn
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_pvrdma_uar_free
	jmp	LBB0_10
LBB0_7:
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PVRDMA_PPN64_VERSION,8,3       ## @PVRDMA_PPN64_VERSION
	.comm	_PVRDMA_CMD_CREATE_UC,4,2       ## @PVRDMA_CMD_CREATE_UC
	.comm	_PVRDMA_CMD_CREATE_UC_RESP,4,2  ## @PVRDMA_CMD_CREATE_UC_RESP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not create ucontext, error: %d\n"

	.comm	_EFAULT,4,2                     ## @EFAULT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvrdma_alloc_ucontext          ; -- Begin function pvrdma_alloc_ucontext
	.p2align	2
_pvrdma_alloc_ucontext:                 ; @pvrdma_alloc_ucontext
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x0
	ldr	x0, [x0]
	bl	_to_vdev
	mov	x19, x0
	mov	x0, x20
	bl	_to_vucontext
	stur	xzr, [sp, #20]
	str	wzr, [sp, #8]
	ldr	w8, [x19, #24]
	cbz	w8, LBB0_3
; %bb.1:
	mov	x20, x0
	str	x19, [x0, #16]
	mov	x0, x19
	mov	x1, x20
	bl	_pvrdma_uar_alloc
	cbz	w0, LBB0_4
; %bb.2:
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_7
LBB0_3:
Lloh2:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:
Lloh4:
	adrp	x8, _PVRDMA_PPN64_VERSION@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PVRDMA_PPN64_VERSION@GOTPAGEOFF]
	ldr	x9, [x19]
Lloh6:
	ldr	x8, [x8]
	ldr	w10, [x20]
	mov	w11, #4
	mov	w12, #8
	cmp	x9, x8
	csel	x8, x12, x11, lt
	add	x9, sp, #16
	str	w10, [x9, x8]
Lloh7:
	adrp	x8, _PVRDMA_CMD_CREATE_UC@GOTPAGE
Lloh8:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_UC@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	str	w8, [sp, #16]
Lloh10:
	adrp	x8, _PVRDMA_CMD_CREATE_UC_RESP@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PVRDMA_CMD_CREATE_UC_RESP@GOTPAGEOFF]
Lloh12:
	ldr	w3, [x8]
	add	x1, sp, #16
	add	x2, sp, #8
	mov	x0, x19
	bl	_pvrdma_cmd_post
	tbnz	w0, #31, LBB0_9
; %bb.5:
	ldr	w8, [sp, #8]
	str	w8, [x20, #8]
	ldr	x8, [x19, #8]
	ldr	w8, [x8]
	str	w8, [sp]
	mov	x1, sp
	mov	x0, x21
	mov	w2, #4
	bl	_ib_copy_to_udata
	cbz	w0, LBB0_10
; %bb.6:
	mov	x0, x19
	mov	x1, x20
	bl	_pvrdma_uar_free
	add	x0, x20, #4
	bl	_pvrdma_dealloc_ucontext
Lloh13:
	adrp	x8, _EFAULT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_8:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_9:
	mov	x22, x0
	ldr	x0, [x19, #16]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	bl	_dev_warn
	mov	x0, x19
	mov	x1, x20
	bl	_pvrdma_uar_free
	b	LBB0_8
LBB0_10:
	mov	w22, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PVRDMA_PPN64_VERSION,8,3       ; @PVRDMA_PPN64_VERSION
	.comm	_PVRDMA_CMD_CREATE_UC,4,2       ; @PVRDMA_CMD_CREATE_UC
	.comm	_PVRDMA_CMD_CREATE_UC_RESP,4,2  ; @PVRDMA_CMD_CREATE_UC_RESP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not create ucontext, error: %d\n"

	.comm	_EFAULT,4,2                     ; @EFAULT
.subsections_via_symbols
