	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kfd_process_device_init_cwsr_dgpu
_kfd_process_device_init_cwsr_dgpu:     ## @kfd_process_device_init_cwsr_dgpu
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	32(%rdi), %r14
	xorl	%eax, %eax
	cmpl	$0, 8(%r14)
	je	LBB0_5
## %bb.1:
	movq	%rdi, %rbx
	cmpq	$0, (%rdi)
	je	LBB0_2
LBB0_5:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_2:
	movq	24(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_5
## %bb.3:
	movq	_ALLOC_MEM_FLAGS_GTT@GOTPCREL(%rip), %rax
	movq	_ALLOC_MEM_FLAGS_NO_SUBSTITUTE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	_ALLOC_MEM_FLAGS_EXECUTABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movq	_KFD_CWSR_TBA_TMA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-24(%rbp), %r8
	movq	%rbx, %rdi
	callq	_kfd_process_alloc_gpuvm
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movq	-24(%rbp), %rdi
	movq	%rdi, (%rbx)
	movq	24(%rbx), %rax
	movq	%rax, 16(%rbx)
	movl	(%r14), %edx
	movl	4(%r14), %esi
	callq	_memcpy
	movq	(%rbx), %rcx
	movq	16(%rbx), %rsi
	movq	_KFD_CWSR_TMA_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	addq	%rsi, %rdx
	movq	%rdx, 8(%rbx)
	leaq	L_.str(%rip), %rdi
	callq	_pr_debug
	xorl	%eax, %eax
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_ALLOC_MEM_FLAGS_GTT,4,2        ## @ALLOC_MEM_FLAGS_GTT
	.comm	_ALLOC_MEM_FLAGS_NO_SUBSTITUTE,4,2 ## @ALLOC_MEM_FLAGS_NO_SUBSTITUTE
	.comm	_ALLOC_MEM_FLAGS_EXECUTABLE,4,2 ## @ALLOC_MEM_FLAGS_EXECUTABLE
	.comm	_KFD_CWSR_TBA_TMA_SIZE,4,2      ## @KFD_CWSR_TBA_TMA_SIZE
	.comm	_KFD_CWSR_TMA_OFFSET,8,3        ## @KFD_CWSR_TMA_OFFSET
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"set tba :0x%llx, tma:0x%llx, cwsr_kaddr:%p for pqm.\n"

	.no_dead_strip	_kfd_process_device_init_cwsr_dgpu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kfd_process_device_init_cwsr_dgpu
_kfd_process_device_init_cwsr_dgpu:     ; @kfd_process_device_init_cwsr_dgpu
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x20, [x0, #32]
	ldr	w8, [x20, #8]
	cbz	w8, LBB0_2
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0]
	cbz	x8, LBB0_4
LBB0_2:
	mov	w0, #0
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_4:
	ldr	x1, [x19, #24]
	cbz	x1, LBB0_2
; %bb.5:
Lloh0:
	adrp	x8, _ALLOC_MEM_FLAGS_GTT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ALLOC_MEM_FLAGS_GTT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _ALLOC_MEM_FLAGS_NO_SUBSTITUTE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _ALLOC_MEM_FLAGS_NO_SUBSTITUTE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _ALLOC_MEM_FLAGS_EXECUTABLE@GOTPAGE
Lloh7:
	ldr	x10, [x10, _ALLOC_MEM_FLAGS_EXECUTABLE@GOTPAGEOFF]
	orr	w8, w9, w8
Lloh8:
	ldr	w9, [x10]
	orr	w3, w8, w9
Lloh9:
	adrp	x8, _KFD_CWSR_TBA_TMA_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KFD_CWSR_TBA_TMA_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	add	x4, sp, #8
	mov	x0, x19
	bl	_kfd_process_alloc_gpuvm
	cbnz	w0, LBB0_3
; %bb.6:
	ldr	x0, [sp, #8]
	str	x0, [x19]
	ldr	x8, [x19, #24]
	str	x8, [x19, #16]
	ldp	w2, w1, [x20]
	bl	_memcpy
	ldr	x1, [x19, #16]
Lloh12:
	adrp	x8, _KFD_CWSR_TMA_OFFSET@GOTPAGE
Lloh13:
	ldr	x8, [x8, _KFD_CWSR_TMA_OFFSET@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	add	x2, x8, x1
	str	x2, [x19, #8]
	ldr	x3, [x19]
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_debug
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ALLOC_MEM_FLAGS_GTT,4,2        ; @ALLOC_MEM_FLAGS_GTT
	.comm	_ALLOC_MEM_FLAGS_NO_SUBSTITUTE,4,2 ; @ALLOC_MEM_FLAGS_NO_SUBSTITUTE
	.comm	_ALLOC_MEM_FLAGS_EXECUTABLE,4,2 ; @ALLOC_MEM_FLAGS_EXECUTABLE
	.comm	_KFD_CWSR_TBA_TMA_SIZE,4,2      ; @KFD_CWSR_TBA_TMA_SIZE
	.comm	_KFD_CWSR_TMA_OFFSET,8,3        ; @KFD_CWSR_TMA_OFFSET
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"set tba :0x%llx, tma:0x%llx, cwsr_kaddr:%p for pqm.\n"

	.no_dead_strip	_kfd_process_device_init_cwsr_dgpu
.subsections_via_symbols
