	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_gem_prime_mmap          ## -- Begin function amdgpu_gem_prime_mmap
	.p2align	4, 0x90
_amdgpu_gem_prime_mmap:                 ## @amdgpu_gem_prime_mmap
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r14
	callq	_gem_to_amdgpu_bo
	movq	%rax, %rbx
	movl	8(%rax), %edi
	callq	_amdgpu_ttm_adev
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_amdgpu_bo_size
	cmpq	$0, 16(%r12)
	je	LBB0_1
## %bb.3:
	testq	%r15, %r15
	je	LBB0_1
## %bb.4:
	movl	(%r12), %ecx
	subl	4(%r12), %ecx
	cmpl	%ecx, %eax
	jae	LBB0_6
## %bb.5:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
LBB0_6:
	movl	4(%rbx), %edi
	callq	_amdgpu_ttm_tt_get_usermm
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:
	movq	_AMDGPU_GEM_CREATE_NO_CPU_ACCESS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_9
LBB0_8:
	movq	_EPERM@GOTPCREL(%rip), %rcx
LBB0_2:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_11:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	%rbx, %rdi
	callq	_amdgpu_bo_mmap_offset
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	addl	%eax, 8(%r12)
	movq	16(%r12), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_drm_vma_node_allow
	testl	%eax, %eax
	jne	LBB0_11
## %bb.10:
	movq	16(%r12), %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	callq	_ttm_bo_mmap
	movl	%eax, %ebx
	movq	16(%r12), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_drm_vma_node_revoke
	movl	%ebx, %eax
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AMDGPU_GEM_CREATE_NO_CPU_ACCESS,4,2 ## @AMDGPU_GEM_CREATE_NO_CPU_ACCESS
	.comm	_EPERM,4,2                      ## @EPERM
	.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	_amdgpu_gem_prime_mmap          ; -- Begin function amdgpu_gem_prime_mmap
	.p2align	2
_amdgpu_gem_prime_mmap:                 ; @amdgpu_gem_prime_mmap
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x20, x1
	mov	x19, x0
	bl	_gem_to_amdgpu_bo
	mov	x22, x0
	ldr	w0, [x0, #8]
	bl	_amdgpu_ttm_adev
	mov	x21, x0
	mov	x0, x22
	bl	_amdgpu_bo_size
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_4
; %bb.1:
	cbz	x21, LBB0_4
; %bb.2:
	ldp	w8, w9, [x20]
	sub	w8, w8, w9
	cmp	w0, w8
	b.hs	LBB0_5
; %bb.3:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_8
LBB0_4:
Lloh2:
	adrp	x8, _ENODEV@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
	ldr	w0, [x22, #4]
	bl	_amdgpu_ttm_tt_get_usermm
	cbnz	x0, LBB0_7
; %bb.6:
	ldr	w8, [x22]
Lloh4:
	adrp	x9, _AMDGPU_GEM_CREATE_NO_CPU_ACCESS@GOTPAGE
Lloh5:
	ldr	x9, [x9, _AMDGPU_GEM_CREATE_NO_CPU_ACCESS@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
LBB0_7:
Lloh7:
	adrp	x8, _EPERM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_10:
	mov	x0, x22
	bl	_amdgpu_bo_mmap_offset
Lloh9:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	asr	w8, w0, w8
	ldr	w9, [x20, #8]
	add	w8, w9, w8
	str	w8, [x20, #8]
	ldr	x8, [x20, #16]
	ldr	w1, [x8]
	mov	x0, x19
	bl	_drm_vma_node_allow
	cbnz	w0, LBB0_9
; %bb.11:
	ldr	x0, [x20, #16]
	mov	x1, x20
	mov	x2, x21
	bl	_ttm_bo_mmap
	mov	x21, x0
	ldr	x8, [x20, #16]
	ldr	w1, [x8]
	mov	x0, x19
	bl	_drm_vma_node_revoke
	mov	x0, x21
	b	LBB0_9
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AMDGPU_GEM_CREATE_NO_CPU_ACCESS,4,2 ; @AMDGPU_GEM_CREATE_NO_CPU_ACCESS
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
.subsections_via_symbols
