	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function create_queue_nocpsch
_create_queue_nocpsch:                  ## @create_queue_nocpsch
	.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	%rdx, %r15
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	%rsi, %rdi
	callq	_print_queue
	movq	%r14, %rdi
	callq	_dqm_lock
	movq	(%r14), %rsi
	movq	_max_num_of_queues_per_device@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rsi
	jge	LBB0_1
## %bb.2:
	movq	%r15, %rdi
	callq	_list_empty
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	callq	_allocate_vmid
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_35
LBB0_4:
	movl	20(%r15), %eax
	movl	%eax, 32(%r13)
	xorl	%eax, %eax
	cmpl	$0, 16(%r15)
	setne	%al
	movl	%eax, (%r13)
	movl	12(%r15), %eax
	movl	%eax, 28(%r13)
	movl	8(%r15), %eax
	movl	%eax, 24(%r13)
	movq	32(%r14), %rbx
	movq	8(%r13), %rdi
	callq	_get_mqd_type_from_queue_type
	movq	(%rbx,%rax,8), %r12
	movq	8(%r13), %rax
	movq	_KFD_QUEUE_TYPE_COMPUTE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.5:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_allocate_hqd
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_33
## %bb.6:
	movslq	56(%r13), %rsi
	movl	52(%r13), %edx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_debug
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_35
LBB0_7:
	movq	_KFD_QUEUE_TYPE_SDMA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_9
## %bb.8:
	movq	_KFD_QUEUE_TYPE_SDMA_XGMI@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
LBB0_9:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_allocate_sdma_queue
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_33
## %bb.10:
	movq	%r14, %rdi
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	*24(%r14)
LBB0_11:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_allocate_doorbell
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_28
## %bb.12:
	movq	%r14, %rdi
	callq	_dqm_unlock
	movl	24(%r12), %edi
	movq	%r13, %rsi
	callq	*32(%r12)
	movl	%eax, 40(%r13)
	movq	%r14, %rdi
	callq	_dqm_lock
	movl	40(%r13), %edx
	testl	%edx, %edx
	je	LBB0_13
## %bb.14:
	leaq	44(%r13), %rsi
	leaq	72(%r13), %rcx
	movq	%r12, %rdi
	movq	%r13, %r8
	callq	*16(%r12)
	cmpq	$0, 16(%r13)
	je	LBB0_19
## %bb.15:
	movq	64(%r13), %rax
	movq	(%rax), %rax
	movq	_current@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	leaq	L_.str.2(%rip), %rsi
	callq	_WARN
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:
	movq	_EFAULT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_13:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_27
LBB0_17:
	movl	56(%r13), %edx
	movl	44(%r13), %esi
	movl	52(%r13), %ecx
	movq	(%rbx), %rax
	movq	(%rax), %r9
	movq	%r12, %rdi
	movq	%r13, %r8
	callq	*(%r12)
	movl	%eax, %ebx
LBB0_18:
	testl	%ebx, %ebx
	je	LBB0_19
## %bb.26:
	movl	40(%r13), %edx
	movl	44(%r13), %esi
	movq	%r12, %rdi
	callq	*8(%r12)
LBB0_27:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_deallocate_doorbell
LBB0_28:
	movq	8(%r13), %rax
	movq	_KFD_QUEUE_TYPE_COMPUTE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_30
## %bb.29:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_deallocate_hqd
	jmp	LBB0_33
LBB0_30:
	movq	_KFD_QUEUE_TYPE_SDMA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_32
## %bb.31:
	movq	_KFD_QUEUE_TYPE_SDMA_XGMI@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_33
LBB0_32:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_deallocate_sdma_queue
LBB0_33:
	movq	%r15, %rdi
	callq	_list_empty
	testq	%rax, %rax
	je	LBB0_35
## %bb.34:
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%r13, %rdx
	callq	_deallocate_vmid
LBB0_35:
	movq	%r14, %rdi
	callq	_dqm_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	leaq	48(%r13), %rdi
	movq	%r15, %rsi
	callq	_list_add
	incl	4(%r15)
	cmpq	$0, 16(%r13)
	je	LBB0_21
## %bb.20:
	incl	16(%r14)
LBB0_21:
	movq	8(%r13), %rax
	movq	_KFD_QUEUE_TYPE_SDMA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_23
## %bb.22:
	incl	12(%r14)
	jmp	LBB0_25
LBB0_23:
	movq	_KFD_QUEUE_TYPE_SDMA_XGMI@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_25
## %bb.24:
	incl	8(%r14)
LBB0_25:
	movq	(%r14), %rsi
	incq	%rsi
	movq	%rsi, (%r14)
	leaq	L_.str.3(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_pr_debug
	jmp	LBB0_35
	.cfi_endproc
                                        ## -- End function
	.comm	_max_num_of_queues_per_device,8,3 ## @max_num_of_queues_per_device
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't create new usermode queue because %d queues were already created\n"

	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_KFD_QUEUE_TYPE_COMPUTE,8,3     ## @KFD_QUEUE_TYPE_COMPUTE
L_.str.1:                               ## @.str.1
	.asciz	"Loading mqd to hqd on pipe %d, queue %d\n"

	.comm	_KFD_QUEUE_TYPE_SDMA,8,3        ## @KFD_QUEUE_TYPE_SDMA
	.comm	_KFD_QUEUE_TYPE_SDMA_XGMI,8,3   ## @KFD_QUEUE_TYPE_SDMA_XGMI
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_current,8,3                    ## @current
L_.str.2:                               ## @.str.2
	.asciz	"should only run in user thread"

	.comm	_EFAULT,4,2                     ## @EFAULT
L_.str.3:                               ## @.str.3
	.asciz	"Total of %d queues are accountable so far\n"

	.no_dead_strip	_create_queue_nocpsch
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function create_queue_nocpsch
_create_queue_nocpsch:                  ; @create_queue_nocpsch
	.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	x21, x2
	mov	x20, x1
	mov	x19, x0
	mov	x0, x1
	bl	_print_queue
	mov	x0, x19
	bl	_dqm_lock
	ldr	x1, [x19]
Lloh0:
	adrp	x8, _max_num_of_queues_per_device@GOTPAGE
Lloh1:
	ldr	x8, [x8, _max_num_of_queues_per_device@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x1, x8
	b.ge	LBB0_6
; %bb.1:
	mov	x0, x21
	bl	_list_empty
	cbz	x0, LBB0_3
; %bb.2:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_allocate_vmid
	mov	x23, x0
	cbnz	w0, LBB0_27
LBB0_3:
	ldp	w9, w8, [x21, #16]
	str	w8, [x20, #32]
	cmp	w9, #0
	cset	w8, ne
	str	w8, [x20]
	ldr	d0, [x21, #8]
	str	d0, [x20, #24]
	ldr	x22, [x19, #32]
	ldr	x0, [x20, #8]
	bl	_get_mqd_type_from_queue_type
	ldr	x22, [x22, x0, lsl #3]
	ldr	x8, [x20, #8]
Lloh3:
	adrp	x24, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGE
Lloh4:
	ldr	x24, [x24, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGEOFF]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.4:
	mov	x0, x19
	mov	x1, x20
	bl	_allocate_hqd
	mov	x23, x0
	cbnz	w0, LBB0_25
; %bb.5:
	ldp	w8, w1, [x20, #52]
                                        ; kill: def $w1 killed $w1 def $x1
	sxtw	x1, w1
	str	x8, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_debug
	b	LBB0_10
LBB0_6:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
Lloh9:
	adrp	x8, _EPERM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_27
LBB0_7:
Lloh12:
	adrp	x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGE
Lloh13:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
Lloh15:
	adrp	x10, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGE
Lloh16:
	ldr	x10, [x10, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGEOFF]
Lloh17:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_10
; %bb.8:
	mov	x0, x19
	mov	x1, x20
	bl	_allocate_sdma_queue
	mov	x23, x0
	cbnz	w0, LBB0_25
; %bb.9:
	ldr	x8, [x19, #24]
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	blr	x8
LBB0_10:
	mov	x0, x21
	mov	x1, x20
	bl	_allocate_doorbell
	mov	x23, x0
	cbnz	w0, LBB0_20
; %bb.11:
	mov	x0, x19
	bl	_dqm_unlock
	ldr	x8, [x22, #32]
	ldr	w0, [x22, #24]
	mov	x1, x20
	blr	x8
	str	w0, [x20, #40]
	mov	x0, x19
	bl	_dqm_lock
	ldr	w2, [x20, #40]
	cbz	w2, LBB0_15
; %bb.12:
	ldr	x8, [x22, #16]
	add	x1, x20, #44
	add	x3, x20, #72
	mov	x0, x22
	mov	x4, x20
	blr	x8
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_28
; %bb.13:
	ldr	x8, [x20, #64]
	ldr	x8, [x8]
Lloh18:
	adrp	x23, _current@GOTPAGE
Lloh19:
	ldr	x23, [x23, _current@GOTPAGEOFF]
	ldr	x9, [x23]
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_WARN
	cbz	x0, LBB0_16
; %bb.14:
Lloh22:
	adrp	x8, _EFAULT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_17
LBB0_15:
Lloh25:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_19
LBB0_16:
	ldr	x8, [x22]
	ldr	w1, [x20, #44]
	ldp	w3, w2, [x20, #52]
	ldr	x9, [x23]
	ldr	x5, [x9]
	mov	x0, x22
	mov	x4, x20
	blr	x8
	mov	x23, x0
LBB0_17:
	cbz	w23, LBB0_28
; %bb.18:
	ldr	x8, [x22, #8]
	ldp	w2, w1, [x20, #40]
	mov	x0, x22
	blr	x8
LBB0_19:
	mov	x0, x21
	mov	x1, x20
	bl	_deallocate_doorbell
LBB0_20:
	ldr	x8, [x20, #8]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_22
; %bb.21:
	mov	x0, x19
	mov	x1, x20
	bl	_deallocate_hqd
	b	LBB0_25
LBB0_22:
Lloh28:
	adrp	x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGE
Lloh29:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_24
; %bb.23:
Lloh31:
	adrp	x9, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGE
Lloh32:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_25
LBB0_24:
	mov	x0, x19
	mov	x1, x20
	bl	_deallocate_sdma_queue
LBB0_25:
	mov	x0, x21
	bl	_list_empty
	cbz	x0, LBB0_27
; %bb.26:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	bl	_deallocate_vmid
LBB0_27:
	mov	x0, x19
	bl	_dqm_unlock
	mov	x0, x23
	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_28:
	add	x0, x20, #48
	mov	x1, x21
	bl	_list_add
	ldr	w8, [x21, #4]
	add	w8, w8, #1
	str	w8, [x21, #4]
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_30
; %bb.29:
	ldr	w8, [x19, #16]
	add	w8, w8, #1
	str	w8, [x19, #16]
LBB0_30:
	ldr	x8, [x20, #8]
Lloh34:
	adrp	x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGE
Lloh35:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_SDMA@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_32
; %bb.31:
	ldr	w8, [x19, #12]
	add	w8, w8, #1
	str	w8, [x19, #12]
	b	LBB0_34
LBB0_32:
Lloh37:
	adrp	x9, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGE
Lloh38:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_SDMA_XGMI@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_34
; %bb.33:
	ldr	w8, [x19, #8]
	add	w8, w8, #1
	str	w8, [x19, #8]
LBB0_34:
	ldr	x8, [x19]
	add	x1, x8, #1
	str	x1, [x19]
Lloh40:
	adrp	x0, l_.str.3@PAGE
Lloh41:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_debug
	mov	w23, #0
	b	LBB0_27
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_max_num_of_queues_per_device,8,3 ; @max_num_of_queues_per_device
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't create new usermode queue because %d queues were already created\n"

	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_KFD_QUEUE_TYPE_COMPUTE,8,3     ; @KFD_QUEUE_TYPE_COMPUTE
l_.str.1:                               ; @.str.1
	.asciz	"Loading mqd to hqd on pipe %d, queue %d\n"

	.comm	_KFD_QUEUE_TYPE_SDMA,8,3        ; @KFD_QUEUE_TYPE_SDMA
	.comm	_KFD_QUEUE_TYPE_SDMA_XGMI,8,3   ; @KFD_QUEUE_TYPE_SDMA_XGMI
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_current,8,3                    ; @current
l_.str.2:                               ; @.str.2
	.asciz	"should only run in user thread"

	.comm	_EFAULT,4,2                     ; @EFAULT
l_.str.3:                               ; @.str.3
	.asciz	"Total of %d queues are accountable so far\n"

	.no_dead_strip	_create_queue_nocpsch
.subsections_via_symbols
