	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lima_ioctl_gem_submit
_lima_ioctl_gem_submit:                 ## @lima_ioctl_gem_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	%rdx, %rbx
	movq	%rsi, %r13
	callq	_to_lima_dev
	movslq	32(%r13), %rcx
	movq	_lima_pipe_num@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	jge	LBB0_2
## %bb.1:
	movl	(%r13), %edi
	testl	%edi, %edi
	je	LBB0_2
## %bb.4:
	movq	_LIMA_SUBMIT_FLAG_EXPLICIT_FENCE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	notl	%edx
	testl	%edx, 4(%r13)
	jne	LBB0_2
## %bb.5:
	movq	(%rax), %r15
	leaq	(%rcx,%rcx,2), %r12
	movq	8(%r13), %rax
	cmpq	(%r15,%r12,8), %rax
	jne	LBB0_2
## %bb.6:
	movq	(%rbx), %rbx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$9, %esi
	callq	_kvcalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rax, %r14
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movslq	(%r13), %rbx
	shlq	$3, %rbx
	movl	44(%r13), %edi
	callq	_u64_to_user_ptr
	movq	%r14, %rdi
	movl	%eax, %esi
	movq	%rbx, %rdx
	callq	_copy_from_user
	testq	%rax, %rax
	je	LBB0_11
## %bb.9:
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_10:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_20:
	movq	%r14, %rdi
	callq	_kvfree
	jmp	LBB0_21
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_21:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_11:
	movl	16(%r15,%r12,8), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmem_cache_zalloc
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movq	%rax, %rbx
	addq	$8, %rbx
	movq	%rbx, (%rax)
	movl	40(%r13), %edi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	callq	_u64_to_user_ptr
	movq	8(%r13), %rdx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_copy_from_user
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_17:
	movl	(%rax), %ebx
	testl	%ebx, %ebx
	je	LBB0_22
## %bb.18:
	negl	%ebx
	jmp	LBB0_19
LBB0_12:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_15:
	leaq	(%r15,%r12,8), %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	*8(%r15,%r12,8)
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_16
LBB0_19:
	leaq	(%r15,%r12,8), %rax
	addq	$16, %rax
	movl	(%rax), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_kmem_cache_free
	jmp	LBB0_20
LBB0_22:
	xorl	%ebx, %ebx
	jmp	LBB0_20
LBB0_16:
	movl	36(%r13), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_lima_ctx_get
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_lima_pipe_num,4,2              ## @lima_pipe_num
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_LIMA_SUBMIT_FLAG_EXPLICIT_FENCE,4,2 ## @LIMA_SUBMIT_FLAG_EXPLICIT_FENCE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_ENOENT,4,2                     ## @ENOENT
	.no_dead_strip	_lima_ioctl_gem_submit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lima_ioctl_gem_submit
_lima_ioctl_gem_submit:                 ; @lima_ioctl_gem_submit
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x20, x1
	bl	_to_lima_dev
	ldrsw	x25, [x20, #32]
Lloh0:
	adrp	x9, _lima_pipe_num@GOTPAGE
Lloh1:
	ldr	x9, [x9, _lima_pipe_num@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w25, w9
	b.ge	LBB0_9
; %bb.1:
	mov	x8, x0
	ldr	w0, [x20]
	cbz	w0, LBB0_9
; %bb.2:
	ldr	w9, [x20, #4]
Lloh3:
	adrp	x10, _LIMA_SUBMIT_FLAG_EXPLICIT_FENCE@GOTPAGE
Lloh4:
	ldr	x10, [x10, _LIMA_SUBMIT_FLAG_EXPLICIT_FENCE@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	bics	wzr, w9, w10
	b.ne	LBB0_9
; %bb.3:
	ldr	x26, [x8]
	mov	w8, #24
	madd	x22, x25, x8, x26
	ldr	x8, [x20, #8]
	ldr	x9, [x22]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.4:
	ldr	x21, [x19]
Lloh6:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh7:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	w1, #9
	bl	_kvcalloc
	cbz	x0, LBB0_12
; %bb.5:
	mov	x19, x0
	ldrsw	x8, [x20]
	lsl	x23, x8, #3
	ldr	w0, [x20, #44]
	bl	_u64_to_user_ptr
	mov	x1, x0
	mov	x0, x19
	mov	x2, x23
	bl	_copy_from_user
	cbz	x0, LBB0_13
; %bb.6:
Lloh8:
	adrp	x8, _EFAULT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_8:
	mov	x0, x19
	bl	_kvfree
	b	LBB0_11
LBB0_9:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_11:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
Lloh12:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_10
LBB0_13:
	mov	w8, #24
	madd	x27, x25, x8, x26
	ldr	w0, [x27, #16]!
	ldr	w1, [x24]
	bl	_kmem_cache_zalloc
	cbz	x0, LBB0_17
; %bb.14:
	mov	x23, x0
	add	x24, x0, #8
	str	x24, [x0]
	ldr	w0, [x20, #40]
	bl	_u64_to_user_ptr
	mov	x1, x0
	ldr	x2, [x20, #8]
	mov	x0, x24
	bl	_copy_from_user
	cbz	x0, LBB0_18
; %bb.15:
Lloh14:
	adrp	x8, _EFAULT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	cbz	w8, LBB0_21
LBB0_16:
	neg	w22, w8
	b	LBB0_19
LBB0_17:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_7
LBB0_18:
	mov	w8, #24
	madd	x8, x25, x8, x26
	ldr	x8, [x8, #8]
	mov	x0, x22
	mov	x1, x23
	blr	x8
	mov	x22, x0
	cbz	w0, LBB0_20
LBB0_19:
	ldr	w0, [x27]
	mov	x1, x23
	bl	_kmem_cache_free
	b	LBB0_8
LBB0_20:
	ldr	w1, [x20, #36]
	mov	x0, x21
	bl	_lima_ctx_get
Lloh19:
	adrp	x8, _ENOENT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	cbnz	w8, LBB0_16
LBB0_21:
	mov	w22, #0
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_lima_pipe_num,4,2              ; @lima_pipe_num
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_LIMA_SUBMIT_FLAG_EXPLICIT_FENCE,4,2 ; @LIMA_SUBMIT_FLAG_EXPLICIT_FENCE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_ENOENT,4,2                     ; @ENOENT
	.no_dead_strip	_lima_ioctl_gem_submit
.subsections_via_symbols
