	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function unreserve_mem_limit
_unreserve_mem_limit:                   ## @unreserve_mem_limit
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -52(%rbp)                 ## 4-byte Spill
	movq	%rdx, %r13
	movq	%rsi, %r12
	movq	%rdi, %r15
	addq	$8, %rdi
	movl	$4, %edx
	callq	_ttm_bo_dma_acc_size
	movq	%rax, %rbx
	movq	_kfd_mem_limit@GOTPCREL(%rip), %r14
	leaq	16(%r14), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_spin_lock
	movq	_AMDGPU_GEM_DOMAIN_GTT@GOTPCREL(%rip), %rax
	cmpq	%r13, (%rax)
	jne	LBB0_2
## %bb.1:
	addq	%r12, %rbx
	movdqu	(%r14), %xmm0
	movq	%rbx, %xmm1
	pshufd	$68, %xmm1, %xmm1               ## xmm1 = xmm1[0,1,0,1]
	psubq	%xmm1, %xmm0
	movdqu	%xmm0, (%r14)
	movq	%xmm0, %rdi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_7
LBB0_2:
	movq	%r14, %rcx
	movq	(%r14), %rdi
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_5
## %bb.3:
	movq	_AMDGPU_GEM_DOMAIN_CPU@GOTPCREL(%rip), %rax
	cmpq	%r13, (%rax)
	jne	LBB0_5
## %bb.4:
	movq	%rbx, %rax
	addq	%r12, %rax
	subq	%rax, %rdi
	movq	%rcx, %r14
	movq	%rdi, (%rcx)
	subq	%rbx, 8(%rcx)
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_7
LBB0_5:
	subq	%rbx, %rdi
	movq	%rcx, %r14
	movq	%rdi, (%rcx)
	subq	%rbx, 8(%rcx)
	movq	_AMDGPU_GEM_DOMAIN_VRAM@GOTPCREL(%rip), %rax
	cmpq	%r13, (%rax)
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_7
## %bb.6:
	movq	(%r15), %rdi
	subq	%r12, %rdi
	movq	%rdi, (%r15)
	shrq	$63, %rdi
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_WARN_ONCE
	movq	(%r14), %rdi
LBB0_7:
	shrq	$63, %rdi
	leaq	L_.str.1(%rip), %rsi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_WARN_ONCE
	movq	8(%r14), %rdi
	shrq	$63, %rdi
	leaq	L_.str.2(%rip), %rsi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_WARN_ONCE
	movq	%rbx, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_kfd_mem_limit,24,3             ## @kfd_mem_limit
	.comm	_AMDGPU_GEM_DOMAIN_GTT,8,3      ## @AMDGPU_GEM_DOMAIN_GTT
	.comm	_AMDGPU_GEM_DOMAIN_CPU,8,3      ## @AMDGPU_GEM_DOMAIN_CPU
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,8,3     ## @AMDGPU_GEM_DOMAIN_VRAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kfd VRAM memory accounting unbalanced"

L_.str.1:                               ## @.str.1
	.asciz	"kfd system memory accounting unbalanced"

L_.str.2:                               ## @.str.2
	.asciz	"kfd TTM memory accounting unbalanced"

	.no_dead_strip	_unreserve_mem_limit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function unreserve_mem_limit
_unreserve_mem_limit:                   ; @unreserve_mem_limit
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x23, x3
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	add	x0, x0, #8
	mov	w2, #4
	bl	_ttm_bo_dma_acc_size
	mov	x22, x0
Lloh0:
	adrp	x24, _kfd_mem_limit@GOTPAGE
Lloh1:
	ldr	x24, [x24, _kfd_mem_limit@GOTPAGEOFF]
	add	x0, x24, #16
	bl	_spin_lock
Lloh2:
	adrp	x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _AMDGPU_GEM_DOMAIN_GTT@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x8, x21
	b.ne	LBB0_2
; %bb.1:
	add	x8, x22, x19
	ldr	q0, [x24]
	dup.2d	v1, x8
	sub.2d	v0, v0, v1
	str	q0, [x24]
	fmov	x8, d0
	b	LBB0_7
LBB0_2:
	ldr	x8, [x24]
	cbnz	w23, LBB0_5
; %bb.3:
Lloh5:
	adrp	x9, _AMDGPU_GEM_DOMAIN_CPU@GOTPAGE
Lloh6:
	ldr	x9, [x9, _AMDGPU_GEM_DOMAIN_CPU@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x9, x21
	b.ne	LBB0_5
; %bb.4:
	add	x9, x22, x19
	sub	x8, x8, x9
	ldr	x9, [x24, #8]
	sub	x9, x9, x22
	stp	x8, x9, [x24]
	b	LBB0_7
LBB0_5:
	sub	x8, x8, x22
	ldr	x9, [x24, #8]
	sub	x9, x9, x22
	stp	x8, x9, [x24]
Lloh8:
	adrp	x9, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGE
Lloh9:
	ldr	x9, [x9, _AMDGPU_GEM_DOMAIN_VRAM@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x9, x21
	b.ne	LBB0_7
; %bb.6:
	ldr	x8, [x20]
	sub	x8, x8, x19
	str	x8, [x20]
	lsr	x0, x8, #63
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_WARN_ONCE
	ldr	x8, [x24]
LBB0_7:
	lsr	x0, x8, #63
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_WARN_ONCE
	ldr	x8, [x24, #8]
	lsr	x0, x8, #63
Lloh15:
	adrp	x1, l_.str.2@PAGE
Lloh16:
	add	x1, x1, l_.str.2@PAGEOFF
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_WARN_ONCE
	add	x0, x24, #16
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_spin_unlock
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_kfd_mem_limit,24,3             ; @kfd_mem_limit
	.comm	_AMDGPU_GEM_DOMAIN_GTT,8,3      ; @AMDGPU_GEM_DOMAIN_GTT
	.comm	_AMDGPU_GEM_DOMAIN_CPU,8,3      ; @AMDGPU_GEM_DOMAIN_CPU
	.comm	_AMDGPU_GEM_DOMAIN_VRAM,8,3     ; @AMDGPU_GEM_DOMAIN_VRAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kfd VRAM memory accounting unbalanced"

l_.str.1:                               ; @.str.1
	.asciz	"kfd system memory accounting unbalanced"

l_.str.2:                               ; @.str.2
	.asciz	"kfd TTM memory accounting unbalanced"

	.no_dead_strip	_unreserve_mem_limit
.subsections_via_symbols
