	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_alloc_gtt_mem    ## -- Begin function amdgpu_amdkfd_alloc_gtt_mem
	.p2align	4, 0x90
_amdgpu_amdkfd_alloc_gtt_mem:           ## @amdgpu_amdkfd_alloc_gtt_mem
	.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
	subq	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, %ebx
	movq	%r8, -64(%rbp)                  ## 8-byte Spill
	movq	%rcx, %r15
	movq	%rdx, %r13
	movq	%rsi, %r14
	movq	%rdi, %r12
	movq	$0, -48(%rbp)
	movq	$0, -56(%rbp)
	leaq	-104(%rbp), %rdi
	xorl	%esi, %esi
	movl	$40, %edx
	callq	_memset
	movq	%r14, -104(%rbp)
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)
	movq	_AMDGPU_GEM_DOMAIN_GTT@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movl	%eax, -76(%rbp)
	movq	_AMDGPU_GEM_CREATE_CPU_GTT_USWC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -96(%rbp)
	movq	_ttm_bo_type_kernel@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -80(%rbp)
	movq	$0, -88(%rbp)
	testl	%ebx, %ebx
	je	LBB0_2
## %bb.1:
	movq	_AMDGPU_GEM_CREATE_MQD_GFX9@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -96(%rbp)
LBB0_2:
	leaq	-104(%rbp), %rsi
	leaq	-48(%rbp), %rdx
	movq	%r12, %rdi
	callq	_amdgpu_bo_create
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_15
LBB0_4:
	movq	-48(%rbp), %rdi
	movl	$1, %esi
	callq	_amdgpu_bo_reserve
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_14
LBB0_6:
	movq	-48(%rbp), %rdi
	movl	(%r14), %esi
	callq	_amdgpu_bo_pin
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_13
LBB0_8:
	movq	-48(%rbp), %rdi
	callq	_amdgpu_ttm_alloc_gart
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movl	%eax, %ebx
	movl	(%r12), %edi
	movq	-48(%rbp), %rdx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_12
LBB0_10:
	movq	-48(%rbp), %rdi
	leaq	-56(%rbp), %rsi
	callq	_amdgpu_bo_kmap
	testl	%eax, %eax
	je	LBB0_16
## %bb.11:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_12:
	movq	-48(%rbp), %rdi
	callq	_amdgpu_bo_unpin
LBB0_13:
	movq	-48(%rbp), %rdi
	callq	_amdgpu_bo_unreserve
LBB0_14:
	leaq	-48(%rbp), %rdi
	callq	_amdgpu_bo_unref
LBB0_15:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	-48(%rbp), %rdi
	movq	%rdi, (%r13)
	callq	_amdgpu_bo_gpu_offset
	movl	%eax, (%r15)
	movq	-56(%rbp), %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	-48(%rbp), %rdi
	callq	_amdgpu_bo_unreserve
	xorl	%ebx, %ebx
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ## @AMDGPU_GEM_DOMAIN_GTT
	.comm	_AMDGPU_GEM_CREATE_CPU_GTT_USWC,4,2 ## @AMDGPU_GEM_CREATE_CPU_GTT_USWC
	.comm	_ttm_bo_type_kernel,4,2         ## @ttm_bo_type_kernel
	.comm	_AMDGPU_GEM_CREATE_MQD_GFX9,4,2 ## @AMDGPU_GEM_CREATE_MQD_GFX9
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to allocate BO for amdkfd (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"(%d) failed to reserve bo for amdkfd\n"

L_.str.2:                               ## @.str.2
	.asciz	"(%d) failed to pin bo for amdkfd\n"

L_.str.3:                               ## @.str.3
	.asciz	"%p bind failed\n"

L_.str.4:                               ## @.str.4
	.asciz	"(%d) failed to map bo to kernel for amdkfd\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_amdkfd_alloc_gtt_mem    ; -- Begin function amdgpu_amdkfd_alloc_gtt_mem
	.p2align	2
_amdgpu_amdkfd_alloc_gtt_mem:           ; @amdgpu_amdkfd_alloc_gtt_mem
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x23, x5
	mov	x19, x4
	mov	x20, x3
	mov	x22, x2
	mov	x24, x1
	mov	x21, x0
	str	xzr, [sp, #56]
	str	xzr, [sp, #8]
	add	x0, sp, #16
	mov	w1, #0
	mov	w2, #40
	bl	_memset
	str	x24, [sp, #16]
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x24, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGE
Lloh4:
	ldr	x24, [x24, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGEOFF]
	str	w8, [sp, #48]
	ldr	w9, [x24]
Lloh5:
	adrp	x8, _AMDGPU_GEM_CREATE_CPU_GTT_USWC@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AMDGPU_GEM_CREATE_CPU_GTT_USWC@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [sp, #24]
Lloh8:
	adrp	x10, _ttm_bo_type_kernel@GOTPAGE
Lloh9:
	ldr	x10, [x10, _ttm_bo_type_kernel@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	stp	w10, w9, [sp, #40]
	str	xzr, [sp, #32]
	cbz	w23, LBB0_2
; %bb.1:
Lloh11:
	adrp	x9, _AMDGPU_GEM_CREATE_MQD_GFX9@GOTPAGE
Lloh12:
	ldr	x9, [x9, _AMDGPU_GEM_CREATE_MQD_GFX9@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #24]
LBB0_2:
	add	x1, sp, #16
	add	x2, sp, #56
	mov	x0, x21
	bl	_amdgpu_bo_create
	cbz	w0, LBB0_4
; %bb.3:
	mov	x23, x0
	ldr	w0, [x21]
	str	x23, [sp]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_15
LBB0_4:
	ldr	x0, [sp, #56]
	mov	w1, #1
	bl	_amdgpu_bo_reserve
	cbz	w0, LBB0_6
; %bb.5:
	mov	x23, x0
	ldr	w0, [x21]
	str	x23, [sp]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	b	LBB0_14
LBB0_6:
	ldr	x0, [sp, #56]
	ldr	w1, [x24]
	bl	_amdgpu_bo_pin
	cbz	w0, LBB0_8
; %bb.7:
	mov	x23, x0
	ldr	w0, [x21]
	str	x23, [sp]
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	b	LBB0_13
LBB0_8:
	ldr	x0, [sp, #56]
	bl	_amdgpu_ttm_alloc_gart
	cbz	w0, LBB0_10
; %bb.9:
	mov	x23, x0
	ldr	w0, [x21]
	ldr	x8, [sp, #56]
	str	x8, [sp]
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	b	LBB0_12
LBB0_10:
	ldr	x0, [sp, #56]
	add	x1, sp, #8
	bl	_amdgpu_bo_kmap
	mov	x23, x0
	cbz	w0, LBB0_16
; %bb.11:
	ldr	w0, [x21]
	str	x23, [sp]
Lloh22:
	adrp	x1, l_.str.4@PAGE
Lloh23:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
LBB0_12:
	ldr	x0, [sp, #56]
	bl	_amdgpu_bo_unpin
LBB0_13:
	ldr	x0, [sp, #56]
	bl	_amdgpu_bo_unreserve
LBB0_14:
	add	x0, sp, #56
	bl	_amdgpu_bo_unref
LBB0_15:
	mov	x0, x23
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_16:
	ldr	x0, [sp, #56]
	str	x0, [x22]
	bl	_amdgpu_bo_gpu_offset
	str	w0, [x20]
	ldr	x8, [sp, #8]
	str	x8, [x19]
	ldr	x0, [sp, #56]
	bl	_amdgpu_bo_unreserve
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ; @AMDGPU_GEM_DOMAIN_GTT
	.comm	_AMDGPU_GEM_CREATE_CPU_GTT_USWC,4,2 ; @AMDGPU_GEM_CREATE_CPU_GTT_USWC
	.comm	_ttm_bo_type_kernel,4,2         ; @ttm_bo_type_kernel
	.comm	_AMDGPU_GEM_CREATE_MQD_GFX9,4,2 ; @AMDGPU_GEM_CREATE_MQD_GFX9
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to allocate BO for amdkfd (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"(%d) failed to reserve bo for amdkfd\n"

l_.str.2:                               ; @.str.2
	.asciz	"(%d) failed to pin bo for amdkfd\n"

l_.str.3:                               ; @.str.3
	.asciz	"%p bind failed\n"

l_.str.4:                               ; @.str.4
	.asciz	"(%d) failed to map bo to kernel for amdkfd\n"

.subsections_via_symbols
