	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vc4_mmap                       ## -- Begin function vc4_mmap
	.p2align	4, 0x90
_vc4_mmap:                              ## @vc4_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	callq	_drm_gem_mmap
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
## %bb.1:
	movq	32(%r14), %rdi
	callq	_to_vc4_bo
	cmpq	$0, 24(%rax)
	je	LBB0_5
## %bb.2:
	movq	_VM_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r14)
	je	LBB0_5
## %bb.3:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	jmp	LBB0_4
LBB0_5:
	movq	(%rax), %rcx
	movq	_VC4_MADV_WILLNEED@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_6
## %bb.7:
	movq	_VM_PFNMAP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, (%r14)
	movq	8(%r14), %r15
	movq	24(%r14), %r8
	movq	$0, 8(%r14)
	movq	16(%rax), %rcx
	movl	(%rcx), %edi
	movl	8(%rax), %ecx
	movl	12(%rax), %edx
	subq	16(%r14), %r8
	movq	%r14, %rsi
	callq	_dma_mmap_wc
	movq	%r15, 8(%r14)
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_drm_gem_vm_close
	jmp	LBB0_10
LBB0_6:
	movq	_VC4_MADV_DONTNEED@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rcx
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.3(%rip), %rsi
	cmoveq	%rax, %rsi
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_VM_WRITE,4,2                   ## @VM_WRITE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mmaping of shader BOs for writing not allowed.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_VC4_MADV_WILLNEED,8,3          ## @VC4_MADV_WILLNEED
L_.str.1:                               ## @.str.1
	.asciz	"mmaping of %s BO not allowed\n"

	.comm	_VC4_MADV_DONTNEED,8,3          ## @VC4_MADV_DONTNEED
L_.str.2:                               ## @.str.2
	.asciz	"purgeable"

L_.str.3:                               ## @.str.3
	.asciz	"purged"

	.comm	_VM_PFNMAP,4,2                  ## @VM_PFNMAP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vc4_mmap                       ; -- Begin function vc4_mmap
	.p2align	2
_vc4_mmap:                              ; @vc4_mmap
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x19, x1
	bl	_drm_gem_mmap
	mov	x20, x0
	cbnz	w0, LBB0_9
; %bb.1:
	ldr	x0, [x19, #32]
	bl	_to_vc4_bo
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _VM_WRITE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _VM_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_8
LBB0_4:
	ldr	x8, [x0]
Lloh5:
	adrp	x9, _VC4_MADV_WILLNEED@GOTPAGE
Lloh6:
	ldr	x9, [x9, _VC4_MADV_WILLNEED@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.5:
Lloh8:
	adrp	x8, _VM_PFNMAP@GOTPAGE
Lloh9:
	ldr	x8, [x8, _VM_PFNMAP@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	w9, [x19]
	bic	w8, w9, w8
	str	w8, [x19]
	ldp	x21, x9, [x19, #8]
	str	xzr, [x19, #8]
	ldr	x8, [x0, #16]
	ldr	w8, [x8]
	ldp	w3, w2, [x0, #8]
	ldr	x10, [x19, #24]
	sub	x4, x10, x9
	mov	x0, x8
	mov	x1, x19
	bl	_dma_mmap_wc
	mov	x20, x0
	str	x21, [x19, #8]
	cbz	w0, LBB0_9
; %bb.6:
	mov	x0, x19
	bl	_drm_gem_vm_close
	b	LBB0_9
LBB0_7:
Lloh11:
	adrp	x9, _VC4_MADV_DONTNEED@GOTPAGE
Lloh12:
	ldr	x9, [x9, _VC4_MADV_DONTNEED@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
Lloh14:
	adrp	x10, l_.str.3@PAGE
Lloh15:
	add	x10, x10, l_.str.3@PAGEOFF
Lloh16:
	adrp	x11, l_.str.2@PAGE
Lloh17:
	add	x11, x11, l_.str.2@PAGEOFF
	cmp	x8, x9
	csel	x8, x11, x10, eq
	str	x8, [sp]
Lloh18:
	adrp	x0, l_.str.1@PAGE
Lloh19:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_8:
	bl	_DRM_DEBUG
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_9:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_VM_WRITE,4,2                   ; @VM_WRITE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mmaping of shader BOs for writing not allowed.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_VC4_MADV_WILLNEED,8,3          ; @VC4_MADV_WILLNEED
l_.str.1:                               ; @.str.1
	.asciz	"mmaping of %s BO not allowed\n"

	.comm	_VC4_MADV_DONTNEED,8,3          ; @VC4_MADV_DONTNEED
l_.str.2:                               ; @.str.2
	.asciz	"purgeable"

l_.str.3:                               ; @.str.3
	.asciz	"purged"

	.comm	_VM_PFNMAP,4,2                  ; @VM_PFNMAP
.subsections_via_symbols
