	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kfd_process_alloc_gpuvm
_kfd_process_alloc_gpuvm:               ## @kfd_process_alloc_gpuvm
	.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	%r8, %r14
	movq	%rdi, %r12
	movq	8(%rdi), %r13
	movq	$0, -48(%rbp)
	movl	(%r13), %edi
	movl	(%r12), %eax
	movl	%ecx, (%rsp)
	leaq	-48(%rbp), %r8
	movl	%eax, %ecx
	xorl	%r9d, %r9d
	callq	_amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.1:
	movl	(%r13), %edi
	movq	-48(%rbp), %rsi
	movl	(%r12), %edx
	callq	_amdgpu_amdkfd_gpuvm_map_memory_to_gpu
	movl	(%r13), %edi
	movq	-48(%rbp), %rsi
	testl	%eax, %eax
	je	LBB0_2
## %bb.10:
	movl	%eax, %ebx
	callq	_amdgpu_amdkfd_gpuvm_free_memory_of_gpu
LBB0_11:
	movq	$0, (%r14)
LBB0_12:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movl	$1, %edx
	callq	_amdgpu_amdkfd_gpuvm_sync_memory
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rdi
	callq	_pr_debug
LBB0_9:
	movq	-48(%rbp), %rdi
	movq	%r12, %rsi
	callq	_kfd_process_free_gpuvm
	movl	%r15d, %ebx
	jmp	LBB0_12
LBB0_4:
	movq	-48(%rbp), %rsi
	movq	%r12, %rdi
	callq	_kfd_process_device_create_obj_handle
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_9
## %bb.5:
	testq	%r14, %r14
	je	LBB0_6
## %bb.7:
	movl	(%r13), %edi
	movq	-48(%rbp), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdx
	xorl	%ecx, %ecx
	callq	_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	testl	%eax, %eax
	je	LBB0_12
## %bb.8:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_debug
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_kfd_process_device_remove_obj_handle
	movl	%r14d, %r15d
	jmp	LBB0_9
LBB0_6:
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Sync memory failed, wait interrupted by user signal\n"

L_.str.1:                               ## @.str.1
	.asciz	"Map GTT BO to kernel failed\n"

	.no_dead_strip	_kfd_process_alloc_gpuvm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kfd_process_alloc_gpuvm
_kfd_process_alloc_gpuvm:               ; @kfd_process_alloc_gpuvm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x4
	mov	x6, x3
	mov	x19, x0
	ldr	x22, [x0, #8]
	str	xzr, [sp, #8]
	ldr	w0, [x22]
	ldr	w3, [x19]
	add	x4, sp, #8
	mov	x5, #0
	bl	_amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu
	mov	x21, x0
	cbnz	w0, LBB0_3
; %bb.1:
	ldr	w0, [x22]
	ldr	x1, [sp, #8]
	ldr	w2, [x19]
	bl	_amdgpu_amdkfd_gpuvm_map_memory_to_gpu
	mov	x21, x0
	ldr	w0, [x22]
	ldr	x1, [sp, #8]
	cbz	w21, LBB0_5
; %bb.2:
	bl	_amdgpu_amdkfd_gpuvm_free_memory_of_gpu
LBB0_3:
	str	xzr, [x20]
LBB0_4:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
LBB0_5:
	mov	w2, #1
	bl	_amdgpu_amdkfd_gpuvm_sync_memory
	cbz	w0, LBB0_8
; %bb.6:
	mov	x21, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_debug
LBB0_7:
	ldr	x0, [sp, #8]
	mov	x1, x19
	bl	_kfd_process_free_gpuvm
	b	LBB0_4
LBB0_8:
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_kfd_process_device_create_obj_handle
	mov	x21, x0
	tbnz	w0, #31, LBB0_7
; %bb.9:
	cbz	x20, LBB0_12
; %bb.10:
	ldr	w0, [x22]
	ldr	x1, [sp, #8]
	mov	x2, x20
	mov	x3, #0
	bl	_amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel
	cbz	w0, LBB0_12
; %bb.11:
	mov	x20, x0
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_debug
	mov	x0, x19
	mov	x1, x21
	bl	_kfd_process_device_remove_obj_handle
	mov	x21, x20
	b	LBB0_7
LBB0_12:
	mov	w21, #0
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Sync memory failed, wait interrupted by user signal\n"

l_.str.1:                               ; @.str.1
	.asciz	"Map GTT BO to kernel failed\n"

	.no_dead_strip	_kfd_process_alloc_gpuvm
.subsections_via_symbols
