	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function allocate_mqd
_allocate_mqd:                          ## @allocate_mqd
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	$0, -40(%rbp)
	cmpq	$0, 8(%rdi)
	je	LBB0_4
## %bb.1:
	movq	%rsi, %r15
	movq	(%rsi), %rax
	movq	_KFD_QUEUE_TYPE_COMPUTE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.2:
	movq	_GFP_NOIO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$12, %edi
	callq	_kzalloc
	movq	%rax, -40(%rbp)
	testq	%rax, %rax
	je	LBB0_7
## %bb.3:
	movq	%rax, %r14
	movl	(%rbx), %r12d
	movl	8(%r15), %edi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_ALIGN
	movq	%rax, %rbx
	movl	(%r15), %esi
	movl	$4, %edi
	callq	_ALIGN
	addq	%rax, %rbx
	leaq	8(%r14), %rdx
	movq	%r14, %rcx
	addq	$4, %rcx
	movl	%r12d, %edi
	movq	%rbx, %rsi
	movq	%r14, %r8
	movl	$1, %r9d
	callq	_amdgpu_amdkfd_alloc_gtt_mem
	jmp	LBB0_5
LBB0_4:
	leaq	-40(%rbp), %rdx
	movq	%rbx, %rdi
	movl	$4, %esi
	callq	_kfd_gtt_sa_allocate
LBB0_5:
	movl	%eax, %ecx
	movq	-40(%rbp), %rax
	testl	%ecx, %ecx
	je	LBB0_8
## %bb.6:
	movq	%rax, %rdi
	callq	_kfree
LBB0_7:
	xorl	%eax, %eax
LBB0_8:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KFD_QUEUE_TYPE_COMPUTE,8,3     ## @KFD_QUEUE_TYPE_COMPUTE
	.comm	_GFP_NOIO,4,2                   ## @GFP_NOIO
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.no_dead_strip	_allocate_mqd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function allocate_mqd
_allocate_mqd:                          ; @allocate_mqd
	.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	x19, x0
	str	xzr, [sp, #8]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_4
; %bb.1:
	mov	x21, x1
	ldr	x8, [x1]
Lloh0:
	adrp	x9, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KFD_QUEUE_TYPE_COMPUTE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _GFP_NOIO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_NOIO@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #12
	bl	_kzalloc
	str	x0, [sp, #8]
	cbz	x0, LBB0_7
; %bb.3:
	mov	x20, x0
	ldr	w19, [x19]
	ldr	w0, [x21, #8]
Lloh6:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_ALIGN
	mov	x21, x0
	ldr	w1, [x22]
	mov	w0, #4
	bl	_ALIGN
	add	x1, x0, x21
	add	x2, x20, #8
	add	x3, x20, #4
	mov	x0, x19
	mov	x4, x20
	mov	w5, #1
	bl	_amdgpu_amdkfd_alloc_gtt_mem
	b	LBB0_5
LBB0_4:
	add	x2, sp, #8
	mov	x0, x19
	mov	w1, #4
	bl	_kfd_gtt_sa_allocate
LBB0_5:
	mov	x8, x0
	ldr	x0, [sp, #8]
	cbz	w8, LBB0_7
; %bb.6:
	bl	_kfree
	mov	x0, #0
LBB0_7:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_KFD_QUEUE_TYPE_COMPUTE,8,3     ; @KFD_QUEUE_TYPE_COMPUTE
	.comm	_GFP_NOIO,4,2                   ; @GFP_NOIO
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.no_dead_strip	_allocate_mqd
.subsections_via_symbols
