	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_add_gws_to_process ## -- Begin function amdgpu_amdkfd_add_gws_to_process
	.p2align	4, 0x90
_amdgpu_amdkfd_add_gws_to_process:      ## @amdgpu_amdkfd_add_gws_to_process
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, -48(%rbp)
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	movq	%rsi, %r12
	testq	%rsi, %rsi
	je	LBB0_2
## %bb.4:
	movq	%rdx, %r15
	movq	%rdi, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %rdi
	callq	_mutex_init
	movq	%r12, %rdi
	callq	_amdgpu_bo_ref
	movq	(%r15), %rcx
	movl	%eax, 20(%rcx)
	movq	_AMDGPU_GEM_DOMAIN_GWS@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	movl	%eax, 16(%rcx)
	movq	%r14, 8(%rcx)
	movq	(%r15), %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_add_kgd_mem_to_kfd_bo_list
	movq	(%r15), %rdi
	addq	$4, %rdi
	callq	_amdgpu_sync_create
	movq	(%r15), %rax
	movq	8(%rax), %rdi
	callq	_mutex_lock
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_amdgpu_bo_reserve
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_pr_err
	jmp	LBB0_8
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_9:
	movl	(%r13), %esi
	movq	%r12, %rdi
	movl	$1, %edx
	callq	_amdgpu_amdkfd_bo_validate
	testl	%eax, %eax
	je	LBB0_12
## %bb.10:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_err
	jmp	LBB0_11
LBB0_12:
	movl	(%r12), %edi
	movl	$1, %esi
	callq	_dma_resv_reserve_shared
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_13
LBB0_11:
	movq	%r12, %rdi
	callq	_amdgpu_bo_unreserve
LBB0_8:
	movq	(%r15), %rax
	movq	8(%rax), %rdi
	callq	_mutex_unlock
	movq	(%r15), %rdi
	addq	$4, %rdi
	callq	_amdgpu_sync_free
	movq	(%r15), %rdi
	movq	%r14, %rsi
	callq	_remove_kgd_mem_from_kfd_bo_list
	leaq	-48(%rbp), %rdi
	callq	_amdgpu_bo_unref
	movq	(%r15), %rdi
	callq	_mutex_destroy
	movq	(%r15), %rdi
	callq	_kfree
	movq	$0, (%r15)
LBB0_14:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	8(%r14), %rsi
	movq	%r12, %rdi
	movl	$1, %edx
	callq	_amdgpu_bo_fence
	movq	%r12, %rdi
	callq	_amdgpu_bo_unreserve
	movq	(%r15), %rax
	movq	8(%rax), %rdi
	callq	_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_AMDGPU_GEM_DOMAIN_GWS,4,2      ## @AMDGPU_GEM_DOMAIN_GWS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Reserve gws bo failed %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"GWS BO validate failed %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_add_gws_to_process ; -- Begin function amdgpu_amdkfd_add_gws_to_process
	.p2align	2
_amdgpu_amdkfd_add_gws_to_process:      ; @amdgpu_amdkfd_add_gws_to_process
	.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
	str	x1, [sp, #8]
	cbz	x0, LBB0_5
; %bb.1:
	mov	x21, x1
	cbz	x1, LBB0_5
; %bb.2:
	mov	x19, x2
	mov	x20, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	str	x0, [x19]
	cbz	x0, LBB0_6
; %bb.3:
	bl	_mutex_init
	mov	x0, x21
	bl	_amdgpu_bo_ref
Lloh3:
	adrp	x23, _AMDGPU_GEM_DOMAIN_GWS@GOTPAGE
Lloh4:
	ldr	x23, [x23, _AMDGPU_GEM_DOMAIN_GWS@GOTPAGEOFF]
	ldr	x8, [x19]
	ldr	w9, [x23]
	stp	w9, w0, [x8, #16]
	str	x20, [x8, #8]
	ldr	x0, [x19]
	mov	x1, x20
	mov	w2, #0
	bl	_add_kgd_mem_to_kfd_bo_list
	ldr	x8, [x19]
	add	x0, x8, #4
	bl	_amdgpu_sync_create
	ldr	x8, [x19]
	ldr	x0, [x8, #8]
	bl	_mutex_lock
	mov	x0, x21
	mov	w1, #0
	bl	_amdgpu_bo_reserve
	mov	x22, x0
	bl	_unlikely
	cbz	x0, LBB0_8
; %bb.4:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x22
	bl	_pr_err
	b	LBB0_12
LBB0_5:
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_13
LBB0_8:
	ldr	w1, [x23]
	mov	x0, x21
	mov	w2, #1
	bl	_amdgpu_amdkfd_bo_validate
	cbz	w0, LBB0_10
; %bb.9:
	mov	x22, x0
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x22
	bl	_pr_err
	b	LBB0_11
LBB0_10:
	ldr	w0, [x21]
	mov	w1, #1
	bl	_dma_resv_reserve_shared
	mov	x22, x0
	cbz	w0, LBB0_14
LBB0_11:
	mov	x0, x21
	bl	_amdgpu_bo_unreserve
LBB0_12:
	ldr	x8, [x19]
	ldr	x0, [x8, #8]
	bl	_mutex_unlock
	ldr	x8, [x19]
	add	x0, x8, #4
	bl	_amdgpu_sync_free
	ldr	x0, [x19]
	mov	x1, x20
	bl	_remove_kgd_mem_from_kfd_bo_list
	add	x0, sp, #8
	bl	_amdgpu_bo_unref
	ldr	x0, [x19]
	bl	_mutex_destroy
	ldr	x0, [x19]
	bl	_kfree
	str	xzr, [x19]
LBB0_13:
	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_14:
	ldr	x1, [x20, #8]
	mov	x0, x21
	mov	w2, #1
	bl	_amdgpu_bo_fence
	mov	x0, x21
	bl	_amdgpu_bo_unreserve
	ldr	x8, [x19]
	ldr	x0, [x8, #8]
	bl	_mutex_unlock
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_AMDGPU_GEM_DOMAIN_GWS,4,2      ; @AMDGPU_GEM_DOMAIN_GWS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Reserve gws bo failed %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"GWS BO validate failed %d\n"

.subsections_via_symbols
