	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocrdma_alloc_ucontext          ## -- Begin function ocrdma_alloc_ucontext
	.p2align	4, 0x90
_ocrdma_alloc_ucontext:                 ## @ocrdma_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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	(%rdi), %rbx
	callq	_get_ocrdma_ucontext
	movq	%rax, %r13
	pxor	%xmm0, %xmm0
	movdqa	%xmm0, -80(%rbp)
	movq	$0, -64(%rbp)
	movq	%rbx, %rdi
	callq	_get_ocrdma_dev
	movq	%rax, %r12
	movq	24(%rax), %r14
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$8192, %edi                     ## imm = 0x2000
	callq	_roundup
	testq	%r15, %r15
	je	LBB0_1
## %bb.3:
	movl	%eax, %ebx
	leaq	16(%r13), %rdi
	callq	_INIT_LIST_HEAD
	movq	%r13, %rdi
	addq	$12, %rdi
	callq	_mutex_init
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movl	%ebx, %esi
	movq	%r13, %rdx
	callq	_dma_alloc_coherent
	movl	%eax, 4(%r13)
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movl	%ebx, 8(%r13)
	movl	%ebx, -56(%rbp)
	movl	%eax, %edi
	callq	_virt_to_phys
	movl	%eax, -52(%rbp)
	movq	%r13, %rdi
	movl	%eax, %esi
	movl	%ebx, %edx
	callq	_ocrdma_add_mmap
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.6:
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	_ocrdma_alloc_ucontext_pd
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
## %bb.7:
	movl	16(%r12), %eax
	movl	%eax, -60(%rbp)
	movq	4(%r12), %xmm0                  ## xmm0 = mem[0],zero
	pshufd	$68, %xmm0, %xmm0               ## xmm0 = xmm0[0,1,0,1]
	pinsrd	$3, 12(%r12), %xmm0
	movdqu	%xmm0, -76(%rbp)
	movl	(%r12), %esi
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	movl	$4, %edx
	callq	_memcpy
	leaq	-80(%rbp), %rsi
	movq	%r15, %rdi
	movl	$32, %edx
	callq	_ib_copy_to_udata
	testl	%eax, %eax
	je	LBB0_11
## %bb.8:
	movl	%eax, %r15d
	movq	%r13, %rdi
	callq	_ocrdma_dealloc_ucontext_pd
	movl	%r15d, %ebx
LBB0_9:
	movl	(%r13), %esi
	movl	8(%r13), %edx
	movq	%r13, %rdi
	callq	_ocrdma_del_mmap
LBB0_10:
	movl	8(%r13), %esi
	movl	(%r13), %ecx
	movl	4(%r13), %edx
	movq	%r14, %rdi
	callq	_dma_free_coherent
	jmp	LBB0_11
LBB0_1:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ocrdma_alloc_ucontext          ; -- Begin function ocrdma_alloc_ucontext
	.p2align	2
_ocrdma_alloc_ucontext:                 ; @ocrdma_alloc_ucontext
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x1
	ldr	x20, [x0]
	bl	_get_ocrdma_ucontext
	mov	x19, x0
	stp	xzr, xzr, [sp]
	str	xzr, [sp, #16]
	mov	x0, x20
	bl	_get_ocrdma_dev
	mov	x22, x0
	ldr	x20, [x0, #24]
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #8192
	bl	_roundup
	cbz	x21, LBB0_8
; %bb.1:
	mov	x23, x0
	add	x0, x19, #16
	bl	_INIT_LIST_HEAD
	add	x0, x19, #12
	bl	_mutex_init
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_dma_alloc_coherent
	str	w0, [x19, #4]
	cbz	w0, LBB0_9
; %bb.2:
	str	w23, [x19, #8]
	str	w23, [sp, #24]
	bl	_virt_to_phys
	mov	x1, x0
	str	w0, [sp, #28]
	mov	x0, x19
	mov	x2, x23
	bl	_ocrdma_add_mmap
	mov	x23, x0
	cbnz	w0, LBB0_7
; %bb.3:
	mov	x0, x22
	mov	x1, x19
	mov	x2, x21
	bl	_ocrdma_alloc_ucontext_pd
	mov	x23, x0
	cbnz	w0, LBB0_6
; %bb.4:
	ldr	w8, [x22, #16]
	str	w8, [sp, #20]
	add	x8, x22, #12
	ldur	d0, [x22, #4]
	mov.s	v0[2], v0[0]
	ld1.s	{ v0 }[3], [x8]
	stur	q0, [sp, #4]
	ldr	w1, [x22]
	mov	w2, #4
	bl	_memcpy
	mov	x1, sp
	mov	x0, x21
	mov	w2, #32
	bl	_ib_copy_to_udata
	mov	x23, x0
	cbz	w0, LBB0_11
; %bb.5:
	mov	x0, x19
	bl	_ocrdma_dealloc_ucontext_pd
LBB0_6:
	ldr	w1, [x19]
	ldr	w2, [x19, #8]
	mov	x0, x19
	bl	_ocrdma_del_mmap
LBB0_7:
	ldp	w2, w1, [x19, #4]
	ldr	w3, [x19]
	mov	x0, x20
	bl	_dma_free_coherent
	b	LBB0_11
LBB0_8:
Lloh6:
	adrp	x8, _EFAULT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_11:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
.subsections_via_symbols
