	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kfd_ioctl_import_dmabuf
_kfd_ioctl_import_dmabuf:               ## @kfd_ioctl_import_dmabuf
	.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, %r12
	movq	%rsi, %r14
	movl	(%rdx), %edi
	callq	_kfd_device_by_id
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	movl	12(%r12), %edi
	callq	_dma_buf_get
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_3
## %bb.10:
	movq	%rbx, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_9
LBB0_3:
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_kfd_bind_process_to_device
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	%r13, %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_8
LBB0_5:
	movl	(%r15), %edi
	movl	8(%r12), %edx
	movl	(%r13), %ecx
	movq	$0, (%rsp)
	leaq	-48(%rbp), %r8
	leaq	-52(%rbp), %r9
	movq	%rbx, %rsi
	callq	_amdgpu_amdkfd_gpuvm_import_dmabuf
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_6
LBB0_8:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_9:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	-48(%rbp), %rsi
	movq	%r13, %rdi
	callq	_kfd_process_device_create_obj_handle
	testl	%eax, %eax
	js	LBB0_7
## %bb.11:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	(%r12), %edi
	movl	%ebx, %esi
	callq	_MAKE_HANDLE
	movl	%eax, 4(%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_9
LBB0_7:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movl	(%r15), %edi
	movq	-48(%rbp), %rsi
	callq	_amdgpu_amdkfd_gpuvm_free_memory_of_gpu
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EFAULT,4,2                     ## @EFAULT
	.no_dead_strip	_kfd_ioctl_import_dmabuf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kfd_ioctl_import_dmabuf
_kfd_ioctl_import_dmabuf:               ; @kfd_ioctl_import_dmabuf
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x2
	mov	x19, x1
	ldr	w0, [x2]
	bl	_kfd_device_by_id
	cbz	x0, LBB0_3
; %bb.1:
	mov	x21, x0
	ldr	w0, [x20, #12]
	bl	_dma_buf_get
	mov	x22, x0
	bl	_IS_ERR
	cbz	x0, LBB0_4
; %bb.2:
	mov	x0, x22
	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
	add	sp, sp, #80
	b	_PTR_ERR
LBB0_3:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_8
LBB0_4:
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x21
	mov	x1, x19
	bl	_kfd_bind_process_to_device
	mov	x23, x0
	bl	_IS_ERR
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, x23
	bl	_PTR_ERR
	mov	x22, x0
	b	LBB0_7
LBB0_6:
	ldr	w0, [x21]
	ldr	w2, [x20, #8]
	ldr	w3, [x23]
	mov	x4, sp
	add	x5, sp, #12
	mov	x1, x22
	mov	x6, #0
	bl	_amdgpu_amdkfd_gpuvm_import_dmabuf
	mov	x22, x0
	cbz	w0, LBB0_9
LBB0_7:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_8:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_9:
	ldr	x1, [sp]
	mov	x0, x23
	bl	_kfd_process_device_create_obj_handle
	tbnz	w0, #31, LBB0_11
; %bb.10:
	mov	x22, x0
	mov	x0, x19
	bl	_mutex_unlock
	ldr	w0, [x20]
	mov	x1, x22
	bl	_MAKE_HANDLE
	mov	w22, #0
	str	w0, [x20, #4]
	b	LBB0_8
LBB0_11:
Lloh3:
	adrp	x8, _EFAULT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
	ldr	w0, [x21]
	ldr	x1, [sp]
	bl	_amdgpu_amdkfd_gpuvm_free_memory_of_gpu
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EFAULT,4,2                     ; @EFAULT
	.no_dead_strip	_kfd_ioctl_import_dmabuf
.subsections_via_symbols
