	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function unmap_queues_cpsch
_unmap_queues_cpsch:                    ## @unmap_queues_cpsch
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 48(%rdi)
	je	LBB0_2
## %bb.1:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_10
LBB0_2:
	movq	%rdi, %rbx
	cmpl	$0, (%rdi)
	je	LBB0_9
## %bb.3:
	movl	%edx, %r15d
	movl	%esi, %r12d
	movq	8(%rbx), %rsi
	movq	40(%rbx), %rdx
	leaq	L_.str(%rip), %rdi
	callq	_pr_debug
	cmpq	$0, 8(%rbx)
	jg	LBB0_5
## %bb.4:
	cmpq	$0, 40(%rbx)
	je	LBB0_6
LBB0_5:
	movq	%rbx, %rdi
	callq	_unmap_sdma_queues
LBB0_6:
	leaq	16(%rbx), %r14
	movq	_KFD_QUEUE_TYPE_COMPUTE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%r12d, %edx
	movl	%r15d, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_pm_send_unmap_queue
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:
	movq	_KFD_FENCE_INIT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	24(%rbx), %rcx
	movl	%eax, (%rcx)
	movl	32(%rbx), %esi
	movq	_KFD_FENCE_COMPLETED@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movq	%r14, %rdi
	callq	_pm_send_query_status
	movq	24(%rbx), %rdi
	movl	(%r15), %esi
	movq	_queue_preemption_timeout_ms@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_amdkfd_fence_wait_timeout
	testl	%eax, %eax
	jne	LBB0_10
## %bb.8:
	movq	%r14, %rdi
	callq	_pm_release_ib
	movl	$0, (%rbx)
LBB0_9:
	xorl	%eax, %eax
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Before destroying queues, sdma queue count is : %u, xgmi sdma queue count is : %u\n"

	.comm	_KFD_QUEUE_TYPE_COMPUTE,4,2     ## @KFD_QUEUE_TYPE_COMPUTE
	.comm	_KFD_FENCE_INIT,4,2             ## @KFD_FENCE_INIT
	.comm	_KFD_FENCE_COMPLETED,4,2        ## @KFD_FENCE_COMPLETED
	.comm	_queue_preemption_timeout_ms,4,2 ## @queue_preemption_timeout_ms
	.no_dead_strip	_unmap_queues_cpsch
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function unmap_queues_cpsch
_unmap_queues_cpsch:                    ; @unmap_queues_cpsch
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	ldr	x8, [x0, #48]
	cbz	x8, LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _EIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_2:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_3:
	mov	x19, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_10
; %bb.4:
	mov	x21, x2
	mov	x22, x1
	ldr	x1, [x19, #8]
	ldr	x2, [x19, #40]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_debug
	ldr	x8, [x19, #8]
	cmp	x8, #0
	b.gt	LBB0_6
; %bb.5:
	ldr	x8, [x19, #40]
	cbz	x8, LBB0_7
LBB0_6:
	mov	x0, x19
	bl	_unmap_sdma_queues
LBB0_7:
	add	x20, x19, #16
Lloh5:
	adrp	x8, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x22
	mov	x3, x21
	mov	w4, #0
	mov	w5, #0
	bl	_pm_send_unmap_queue
	cbnz	w0, LBB0_2
; %bb.8:
Lloh8:
	adrp	x8, _KFD_FENCE_INIT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _KFD_FENCE_INIT@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	x9, [x19, #24]
	str	w8, [x9]
	ldr	w1, [x19, #32]
Lloh11:
	adrp	x21, _KFD_FENCE_COMPLETED@GOTPAGE
Lloh12:
	ldr	x21, [x21, _KFD_FENCE_COMPLETED@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x20
	bl	_pm_send_query_status
	ldr	x0, [x19, #24]
	ldr	w1, [x21]
Lloh13:
	adrp	x8, _queue_preemption_timeout_ms@GOTPAGE
Lloh14:
	ldr	x8, [x8, _queue_preemption_timeout_ms@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	bl	_amdkfd_fence_wait_timeout
	cbnz	w0, LBB0_2
; %bb.9:
	mov	x0, x20
	bl	_pm_release_ib
	mov	w0, #0
	str	wzr, [x19]
	b	LBB0_2
LBB0_10:
	mov	w0, #0
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Before destroying queues, sdma queue count is : %u, xgmi sdma queue count is : %u\n"

	.comm	_KFD_QUEUE_TYPE_COMPUTE,4,2     ; @KFD_QUEUE_TYPE_COMPUTE
	.comm	_KFD_FENCE_INIT,4,2             ; @KFD_FENCE_INIT
	.comm	_KFD_FENCE_COMPLETED,4,2        ; @KFD_FENCE_COMPLETED
	.comm	_queue_preemption_timeout_ms,4,2 ; @queue_preemption_timeout_ms
	.no_dead_strip	_unmap_queues_cpsch
.subsections_via_symbols
