	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gpu_submit             ## -- Begin function etnaviv_gpu_submit
	.p2align	4, 0x90
_etnaviv_gpu_submit:                    ## @etnaviv_gpu_submit
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	56(%rdi), %r13
	cmpl	$0, (%rdi)
	jne	LBB0_4
## %bb.1:
	movl	24(%r13), %edi
	callq	_pm_runtime_get_sync
	testl	%eax, %eax
	js	LBB0_2
## %bb.3:
	movl	$1, (%r15)
LBB0_4:
	xorl	%eax, %eax
	cmpq	$0, 8(%r15)
	setne	%al
	leal	(%rax,%rax), %r12d
	incl	%r12d
	leaq	-60(%rbp), %rdx
	movq	%r13, %rdi
	movl	%r12d, %esi
	callq	_event_alloc
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	xorl	%r14d, %r14d
	jmp	LBB0_17
LBB0_6:
	movq	%r13, %rdi
	callq	_mutex_lock
	movq	%r13, %rdi
	callq	_etnaviv_gpu_fence_alloc
	movq	%rax, %r14
	testq	%rax, %rax
	je	LBB0_7
## %bb.9:
	movq	16(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.11:
	callq	_etnaviv_iommu_context_get
	movq	16(%r13), %rax
	movq	%rax, 48(%r15)
	cmpq	$0, 8(%r15)
	je	LBB0_14
LBB0_13:
	movq	8(%r13), %rax
	movl	-56(%rbp), %ecx
	leaq	(%rcx,%rcx,2), %rcx
	movq	_sync_point_perfmon_sample_pre@GOTPCREL(%rip), %rdx
	movq	%rdx, 8(%rax,%rcx,8)
	leaq	4(%r15), %rdi
	callq	_kref_get
	movq	8(%r13), %rax
	movl	-56(%rbp), %esi
	leaq	(%rsi,%rsi,2), %rcx
	movq	%r15, (%rax,%rcx,8)
	movq	%r13, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_etnaviv_sync_point_queue
LBB0_14:
	movq	8(%r13), %rax
	movl	-60(%rbp), %ecx
	leaq	(%rcx,%rcx,2), %rdx
	movq	%r14, 16(%rax,%rdx,8)
	leaq	16(%r15), %r8
	movq	16(%r15), %rax
	movq	32(%r15), %rdx
	addq	$-8, %rax
	movq	%rax, 24(%r15)
	movl	40(%r15), %esi
	movq	%r13, %rdi
                                        ## kill: def $ecx killed $ecx killed $rcx
	callq	_etnaviv_buffer_queue
	cmpq	$0, 8(%r15)
	je	LBB0_16
## %bb.15:
	movq	8(%r13), %rax
	movl	-52(%rbp), %ecx
	leaq	(%rcx,%rcx,2), %rcx
	movq	_sync_point_perfmon_sample_post@GOTPCREL(%rip), %rdx
	movq	%rdx, 8(%rax,%rcx,8)
	leaq	4(%r15), %rdi
	callq	_kref_get
	movq	8(%r13), %rax
	movl	-52(%rbp), %esi
	leaq	(%rsi,%rsi,2), %rcx
	movq	%r15, (%rax,%rcx,8)
	movq	%r13, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_etnaviv_sync_point_queue
	jmp	LBB0_16
LBB0_2:
	xorl	%r14d, %r14d
	jmp	LBB0_17
LBB0_7:
	movl	%r12d, %r15d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	-60(%rbp,%rbx,4), %esi
	movq	%r13, %rdi
	callq	_event_free
	incq	%rbx
	cmpq	%rbx, %r15
	jne	LBB0_8
LBB0_16:
	movq	%r13, %rdi
	callq	_mutex_unlock
LBB0_17:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_19
## %bb.18:
	movq	%r14, %rax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	32(%r15), %rdi
	callq	_etnaviv_iommu_context_get
	movq	32(%r15), %rax
	movq	%rax, 16(%r13)
	movq	%r13, %rdi
	callq	_etnaviv_gpu_start_fe_idleloop
	cmpq	$0, 8(%r15)
	jne	LBB0_13
	jmp	LBB0_14
LBB0_19:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no free events\n"

	.comm	_sync_point_perfmon_sample_pre,4,2 ## @sync_point_perfmon_sample_pre
	.comm	_sync_point_perfmon_sample_post,4,2 ## @sync_point_perfmon_sample_post
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_etnaviv_gpu_submit             ; -- Begin function etnaviv_gpu_submit
	.p2align	2
_etnaviv_gpu_submit:                    ; @etnaviv_gpu_submit
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	ldr	x19, [x0, #56]
	ldr	w8, [x0]
	cbnz	w8, LBB0_3
; %bb.1:
	ldr	w0, [x19, #24]
	bl	_pm_runtime_get_sync
	tbnz	w0, #31, LBB0_11
; %bb.2:
	mov	w8, #1
	str	w8, [x21]
LBB0_3:
	ldr	x22, [x21, #8]
	cmp	x22, #0
	mov	w8, #3
	csinc	w1, w8, wzr, ne
	add	x2, sp, #12
	mov	x0, x19
	bl	_event_alloc
	cbz	w0, LBB0_5
; %bb.4:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	mov	x20, #0
	b	LBB0_15
LBB0_5:
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x19
	bl	_etnaviv_gpu_fence_alloc
	mov	x20, x0
	cbz	x0, LBB0_12
; %bb.6:
	ldr	x0, [x19, #16]
	cbz	x0, LBB0_17
; %bb.7:
	bl	_etnaviv_iommu_context_get
	ldr	x8, [x19, #16]
	str	x8, [x21, #48]
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_9
LBB0_8:
	ldr	x8, [x19, #8]
	ldr	w9, [sp, #16]
	mov	w22, #24
	madd	x8, x9, x22, x8
Lloh5:
	adrp	x9, _sync_point_perfmon_sample_pre@GOTPAGE
Lloh6:
	ldr	x9, [x9, _sync_point_perfmon_sample_pre@GOTPAGEOFF]
	str	x9, [x8, #8]
	add	x0, x21, #4
	bl	_kref_get
	ldr	x8, [x19, #8]
	ldr	w1, [sp, #16]
	mul	x9, x1, x22
	str	x21, [x8, x9]
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_etnaviv_sync_point_queue
LBB0_9:
	ldr	x8, [x19, #8]
	ldr	w3, [sp, #12]
	mov	w9, #24
	madd	x8, x3, x9, x8
	str	x20, [x8, #16]
	mov	x22, x21
	ldr	x8, [x22, #16]!
	sub	x8, x8, #8
	str	x8, [x22, #8]
	ldr	w1, [x22, #24]
	ldr	x2, [x22, #16]
	mov	x0, x19
                                        ; kill: def $w3 killed $w3 killed $x3
	mov	x4, x22
	bl	_etnaviv_buffer_queue
	ldur	x8, [x22, #-8]
	cbz	x8, LBB0_14
; %bb.10:
	ldr	x8, [x19, #8]
	ldr	w9, [sp, #20]
	mov	w22, #24
	madd	x8, x9, x22, x8
Lloh7:
	adrp	x9, _sync_point_perfmon_sample_post@GOTPAGE
Lloh8:
	ldr	x9, [x9, _sync_point_perfmon_sample_post@GOTPAGEOFF]
	str	x9, [x8, #8]
	add	x0, x21, #4
	bl	_kref_get
	ldr	x8, [x19, #8]
	ldr	w1, [sp, #20]
	mul	x9, x1, x22
	str	x21, [x8, x9]
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_etnaviv_sync_point_queue
	b	LBB0_14
LBB0_11:
	mov	x20, #0
	b	LBB0_15
LBB0_12:
	ldr	w1, [sp, #12]
	mov	x0, x19
	bl	_event_free
	cbz	x22, LBB0_14
; %bb.13:
	ldr	w1, [sp, #16]
	mov	x0, x19
	bl	_event_free
	ldr	w1, [sp, #20]
	mov	x0, x19
	bl	_event_free
LBB0_14:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_15:
	ldr	x8, [sp, #24]
Lloh9:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh10:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_18
; %bb.16:
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
LBB0_17:
	ldr	x0, [x21, #32]
	bl	_etnaviv_iommu_context_get
	ldr	x8, [x21, #32]
	str	x8, [x19, #16]
	mov	x0, x19
	bl	_etnaviv_gpu_start_fe_idleloop
	ldr	x8, [x21, #8]
	cbnz	x8, LBB0_8
	b	LBB0_9
LBB0_18:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no free events\n"

	.comm	_sync_point_perfmon_sample_pre,4,2 ; @sync_point_perfmon_sample_pre
	.comm	_sync_point_perfmon_sample_post,4,2 ; @sync_point_perfmon_sample_post
.subsections_via_symbols
