	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gfx_v9_0_mec_init
_gfx_v9_0_mec_init:                     ## @gfx_v9_0_mec_init
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	36(%rdi), %edi
	movq	_AMDGPU_MAX_COMPUTE_QUEUES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bitmap_zero
	movq	%rbx, %rdi
	callq	_amdgpu_gfx_compute_queue_acquire
	movq	_GFX9_MEC_HPD_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	imulq	(%rbx), %rsi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	_AMDGPU_GEM_DOMAIN_VRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	24(%rbx), %r8
	leaq	32(%rbx), %r9
	leaq	-72(%rbp), %rax
	movq	%rax, (%rsp)
	movq	%rbx, %rdi
	callq	_amdgpu_bo_create_reserved
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r14d
	movl	48(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_warn
	movq	%rbx, %rdi
	callq	_gfx_v9_0_mec_fini
	jmp	LBB0_5
LBB0_2:
	movq	-72(%rbp), %rdi
	movq	24(%rbx), %rax
	movl	(%rax), %edx
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	_memset
	movq	24(%rbx), %rdi
	callq	_amdgpu_bo_kunmap
	movq	24(%rbx), %rdi
	callq	_amdgpu_bo_unreserve
	movq	40(%rbx), %rax
	movq	(%rax), %r15
	movq	(%r15), %rdi
	callq	_le32_to_cpu
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	8(%r15), %rdi
	callq	_le32_to_cpu
                                        ## kill: def $eax killed $eax def $rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	8(%r15), %rsi
	movl	(%r12), %edx
	movq	_AMDGPU_GEM_DOMAIN_GTT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	8(%rbx), %r12
	leaq	16(%rbx), %r9
	leaq	-64(%rbp), %rax
	movq	%rax, (%rsp)
	movq	%rbx, %rdi
	movq	%r12, %r8
	callq	_amdgpu_bo_create_reserved
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r13d
	movl	48(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_warn
	movq	%rbx, %rdi
	callq	_gfx_v9_0_mec_fini
	movl	%r13d, %r14d
	jmp	LBB0_5
LBB0_4:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovnsl	%eax, %edx
	sarl	$2, %edx
	movslq	-44(%rbp), %rax                 ## 4-byte Folded Reload
	addq	%rax, %r15
	movq	-64(%rbp), %rdi
	movq	%r15, %rsi
	callq	_memcpy
	movq	(%r12), %rdi
	callq	_amdgpu_bo_kunmap
	movq	(%r12), %rdi
	callq	_amdgpu_bo_unreserve
LBB0_5:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AMDGPU_MAX_COMPUTE_QUEUES,4,2  ## @AMDGPU_MAX_COMPUTE_QUEUES
	.comm	_GFX9_MEC_HPD_SIZE,8,3          ## @GFX9_MEC_HPD_SIZE
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ## @AMDGPU_GEM_DOMAIN_VRAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"(%d) create HDP EOP bo failed\n"

	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ## @AMDGPU_GEM_DOMAIN_GTT
L_.str.1:                               ## @.str.1
	.asciz	"(%d) create mec firmware bo failed\n"

	.no_dead_strip	_gfx_v9_0_mec_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gfx_v9_0_mec_init
_gfx_v9_0_mec_init:                     ; @gfx_v9_0_mec_init
	.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	x19, x0
	ldr	w0, [x0, #36]
Lloh0:
	adrp	x8, _AMDGPU_MAX_COMPUTE_QUEUES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AMDGPU_MAX_COMPUTE_QUEUES@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_bitmap_zero
	mov	x0, x19
	bl	_amdgpu_gfx_compute_queue_acquire
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _GFX9_MEC_HPD_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _GFX9_MEC_HPD_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	mul	x1, x9, x8
Lloh6:
	adrp	x21, _PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x21, [x21, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w2, [x21]
Lloh8:
	adrp	x8, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGEOFF]
Lloh10:
	ldr	w3, [x8]
	add	x4, x19, #24
	add	x5, x19, #32
	add	x6, sp, #8
	mov	x0, x19
	bl	_amdgpu_bo_create_reserved
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19, #48]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	ldr	x0, [sp, #8]
	ldr	x8, [x19, #24]
	ldr	w2, [x8]
	mov	w1, #0
	bl	_memset
	ldr	x0, [x19, #24]
	bl	_amdgpu_bo_kunmap
	ldr	x0, [x19, #24]
	bl	_amdgpu_bo_unreserve
	ldr	x8, [x19, #40]
	ldr	x24, [x8]
	ldr	x0, [x24]
	bl	_le32_to_cpu
	mov	x22, x0
	ldr	x0, [x24, #8]
	bl	_le32_to_cpu
	mov	x23, x0
	ldr	x1, [x24, #8]
	ldr	w2, [x21]
Lloh13:
	adrp	x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGEOFF]
Lloh15:
	ldr	w3, [x8]
	add	x21, x19, #8
	add	x5, x19, #16
	mov	x6, sp
	mov	x0, x19
	mov	x4, x21
	bl	_amdgpu_bo_create_reserved
	mov	x20, x0
	cbz	w0, LBB0_6
; %bb.3:
	ldr	w0, [x19, #48]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_4:
	mov	x2, x20
	bl	_dev_warn
	mov	x0, x19
	bl	_gfx_v9_0_mec_fini
LBB0_5:
	mov	x0, x20
	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_6:
	add	w8, w23, #3
	cmp	w23, #0
	csel	w8, w8, w23, lt
	asr	w2, w8, #2
	add	x1, x24, w22, sxtw
	ldr	x0, [sp]
	bl	_memcpy
	ldr	x0, [x21]
	bl	_amdgpu_bo_kunmap
	ldr	x0, [x21]
	bl	_amdgpu_bo_unreserve
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_AMDGPU_MAX_COMPUTE_QUEUES,4,2  ; @AMDGPU_MAX_COMPUTE_QUEUES
	.comm	_GFX9_MEC_HPD_SIZE,8,3          ; @GFX9_MEC_HPD_SIZE
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,4,2     ; @AMDGPU_GEM_DOMAIN_VRAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"(%d) create HDP EOP bo failed\n"

	.comm	_AMDGPU_GEM_DOMAIN_GTT,4,2      ; @AMDGPU_GEM_DOMAIN_GTT
l_.str.1:                               ; @.str.1
	.asciz	"(%d) create mec firmware bo failed\n"

	.no_dead_strip	_gfx_v9_0_mec_init
.subsections_via_symbols
