	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gem_cpu_prep           ## -- Begin function etnaviv_gem_cpu_prep
	.p2align	4, 0x90
_etnaviv_gem_cpu_prep:                  ## @etnaviv_gem_cpu_prep
	.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	%rdx, -80(%rbp)                 ## 8-byte Spill
	movl	%esi, %r15d
	movq	%rdi, %rbx
	callq	_to_etnaviv_bo
	movq	%rax, %r13
	movq	_ETNA_PREP_WRITE@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	testl	%r15d, (%rax)
	movq	8(%rbx), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	setne	%r14b
	cmpq	$0, 8(%r13)
	je	LBB0_1
LBB0_2:
	movb	%r14b, %r12b
	movq	_ETNA_PREP_NOSYNC@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_5
## %bb.3:
	movl	(%rbx), %edi
	movl	%r12d, %esi
	callq	_dma_resv_test_signaled_rcu
	testl	%eax, %eax
	jne	LBB0_6
## %bb.4:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_1:
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movq	%r13, %r15
	addq	$16, %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r13, %rdi
	callq	_etnaviv_gem_get_pages
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	%rax, %r13
	movq	%r15, %rdi
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	callq	_mutex_unlock
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, %rdi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
## %bb.9:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_5:
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	callq	_etnaviv_timeout_to_jiffies
	movl	(%rbx), %edi
	movl	%r12d, %esi
	movl	$1, %edx
	movq	%rax, %rcx
	callq	_dma_resv_wait_timeout_rcu
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	subl	(%rcx), %ebx
	testl	%eax, %eax
	cmovnel	%eax, %ebx
	jle	LBB0_8
LBB0_6:
	movq	_ETNA_BO_CACHED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ebx, %ebx
	testl	%eax, (%r13)
	je	LBB0_8
## %bb.7:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	8(%r13), %rax
	movl	(%rax), %r12d
	movl	%r15d, %r14d
	movl	4(%rax), %r15d
	movl	%r14d, %edi
	callq	_etnaviv_op_to_dma_dir
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%r15d, %esi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_dma_sync_sg_for_cpu
	movl	%r14d, 4(%r13)
LBB0_8:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ETNA_PREP_WRITE,4,2            ## @ETNA_PREP_WRITE
	.comm	_ETNA_PREP_NOSYNC,4,2           ## @ETNA_PREP_NOSYNC
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_ETNA_BO_CACHED,4,2             ## @ETNA_BO_CACHED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gem_cpu_prep           ; -- Begin function etnaviv_gem_cpu_prep
	.p2align	2
_etnaviv_gem_cpu_prep:                  ; @etnaviv_gem_cpu_prep
	.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	x22, x2
	mov	x19, x1
	mov	x21, x0
	bl	_to_etnaviv_bo
	mov	x20, x0
	ldr	x26, [x21, #8]
Lloh0:
	adrp	x8, _ETNA_PREP_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ETNA_PREP_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w19
	cset	w23, ne
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_4
LBB0_1:
Lloh3:
	adrp	x8, _ETNA_PREP_NOSYNC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ETNA_PREP_NOSYNC@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w19
	b.eq	LBB0_6
; %bb.2:
	ldr	w0, [x21]
	mov	x1, x23
	bl	_dma_resv_test_signaled_rcu
	cbnz	w0, LBB0_7
; %bb.3:
Lloh6:
	adrp	x8, _EBUSY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_4:
	add	x25, x20, #16
	mov	x0, x25
	bl	_mutex_lock
	mov	x0, x20
	bl	_etnaviv_gem_get_pages
	mov	x24, x0
	mov	x0, x25
	bl	_mutex_unlock
	mov	x0, x24
	bl	_IS_ERR
	cbz	x0, LBB0_1
; %bb.5:
	mov	x0, x24
	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
	b	_PTR_ERR
LBB0_6:
	mov	x0, x22
	bl	_etnaviv_timeout_to_jiffies
	mov	x3, x0
	ldr	w0, [x21]
	mov	x1, x23
	mov	w2, #1
	bl	_dma_resv_wait_timeout_rcu
	mov	x8, x0
Lloh9:
	adrp	x9, _ETIMEDOUT@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ETIMEDOUT@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	cmp	w0, #0
	csneg	w0, w0, w9, ne
	cmp	w8, #1
	b.lt	LBB0_10
LBB0_7:
	ldr	w8, [x20]
Lloh12:
	adrp	x9, _ETNA_BO_CACHED@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ETNA_BO_CACHED@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
	ldr	w21, [x26]
	ldr	x8, [x20, #8]
	ldp	w23, w22, [x8]
	mov	x0, x19
	bl	_etnaviv_op_to_dma_dir
	mov	x3, x0
	mov	x0, x21
	mov	x1, x22
	mov	x2, x23
	bl	_dma_sync_sg_for_cpu
	mov	w0, #0
	str	w19, [x20, #4]
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ETNA_PREP_WRITE,4,2            ; @ETNA_PREP_WRITE
	.comm	_ETNA_PREP_NOSYNC,4,2           ; @ETNA_PREP_NOSYNC
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_ETNA_BO_CACHED,4,2             ; @ETNA_BO_CACHED
.subsections_via_symbols
