	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function etnaviv_gem_userptr_get_pages
_etnaviv_gem_userptr_get_pages:         ## @etnaviv_gem_userptr_get_pages
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	8(%rdi), %r12d
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %r12d
	movq	_current@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	movq	(%rax), %rdi
	callq	_might_lock_read
	movq	32(%r14), %rax
	movq	(%rbx), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.1:
	movq	_EPERM@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_11:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r12d, %edi
	movl	$8, %esi
	callq	_kvmalloc_array
	testq	%rax, %rax
	je	LBB0_12
## %bb.4:
	movq	%rax, %r15
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r12d, %esi
	subl	%ebx, %esi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdi
	movslq	%ebx, %rax
	imulq	%rax, %rdi
	movl	$0, %edx
	addq	24(%r14), %rdi
	cmpl	$0, 16(%r14)
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	_FOLL_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	leaq	(%r15,%rax,8), %rcx
	callq	_get_user_pages_fast
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	addl	%r13d, %ebx
	cmpl	%r12d, %ebx
	jl	LBB0_5
## %bb.10:
	movq	%r15, (%r14)
	xorl	%r13d, %r13d
	jmp	LBB0_11
LBB0_12:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_8:
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_release_pages
	movq	%r15, %rdi
	callq	_kvfree
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_current,8,3                    ## @current
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_FOLL_WRITE,4,2                 ## @FOLL_WRITE
	.no_dead_strip	_etnaviv_gem_userptr_get_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function etnaviv_gem_userptr_get_pages
_etnaviv_gem_userptr_get_pages:         ; @etnaviv_gem_userptr_get_pages
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
Lloh0:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
	ldr	w20, [x0, #8]
Lloh2:
	ldr	w21, [x8]
Lloh3:
	adrp	x22, _current@GOTPAGE
Lloh4:
	ldr	x22, [x22, _current@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	x0, [x8]
	bl	_might_lock_read
	ldr	x8, [x19, #32]
	ldr	x9, [x22]
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_4
; %bb.1:
Lloh5:
	adrp	x8, _EPERM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_3:
	mov	x0, x23
	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
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_4:
	asr	w20, w20, w21
Lloh7:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh9:
	ldr	w2, [x8]
	mov	x0, x20
	mov	w1, #8
	bl	_kvmalloc_array
	cbz	x0, LBB0_9
; %bb.5:
	mov	x21, x0
	mov	w22, #0
Lloh10:
	adrp	x24, _PAGE_SIZE@GOTPAGE
Lloh11:
	ldr	x24, [x24, _PAGE_SIZE@GOTPAGEOFF]
Lloh12:
	adrp	x25, _FOLL_WRITE@GOTPAGE
Lloh13:
	ldr	x25, [x25, _FOLL_WRITE@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	w1, w20, w22
	ldr	x8, [x19, #24]
	ldrsw	x9, [x24]
	sxtw	x10, w22
	madd	x0, x9, x10, x8
	add	x3, x21, w22, sxtw #3
	ldr	w8, [x19, #16]
	ldr	w9, [x25]
	cmp	w8, #0
	csel	w2, w9, wzr, eq
	bl	_get_user_pages_fast
	mov	x23, x0
	tbnz	w0, #31, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	w22, w23, w22
	cmp	w22, w20
	b.lt	LBB0_6
; %bb.8:
	mov	w23, #0
	str	x21, [x19]
	b	LBB0_3
LBB0_9:
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_10:
	mov	x0, x21
	mov	x1, x22
	bl	_release_pages
	mov	x0, x21
	bl	_kvfree
	b	LBB0_3
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_current,8,3                    ; @current
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_FOLL_WRITE,4,2                 ; @FOLL_WRITE
	.no_dead_strip	_etnaviv_gem_userptr_get_pages
.subsections_via_symbols
