	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_vmid_grab               ## -- Begin function amdgpu_vmid_grab
	.p2align	4, 0x90
_amdgpu_vmid_grab:                      ## @amdgpu_vmid_grab
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r12
	movq	(%rsi), %rax
	movq	8(%rsi), %rcx
	movl	(%rcx), %r15d
	movq	(%rax), %rax
	movq	$0, -72(%rbp)
	movq	$0, -48(%rbp)
	leaq	(%r15,%r15,2), %rcx
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	leaq	(%rax,%rcx,4), %rdi
	addq	$4, %rdi
	movq	%rdi, -96(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	leaq	-72(%rbp), %rcx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	callq	_amdgpu_vmid_grab_idle
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.1:
	cmpq	$0, -72(%rbp)
	je	LBB0_13
## %bb.2:
	movq	8(%r12), %rax
	cmpq	$0, (%rax,%r15,8)
	je	LBB0_5
## %bb.3:
	leaq	-48(%rbp), %r9
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	_amdgpu_vmid_grab_reserved
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.4:
	movq	-48(%rbp), %rax
	testq	%rax, %rax
	jne	LBB0_10
	jmp	LBB0_13
LBB0_5:
	leaq	-48(%rbp), %r9
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	callq	_amdgpu_vmid_grab_used
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.6:
	movq	-48(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_7
LBB0_9:
	addq	$16, %rdi
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rax,%rcx,4), %rsi
	addq	$8, %rsi
	callq	_list_move_tail
	movq	-48(%rbp), %rax
LBB0_10:
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movl	16(%rdx), %ecx
	movl	%ecx, 12(%rax)
	movl	4(%r12), %ecx
	movl	%ecx, 8(%rax)
	cmpl	$0, (%rdx)
	je	LBB0_12
## %bb.11:
	movq	(%rax), %rdi
	callq	_dma_fence_put
	movq	-48(%rbp), %rax
	movq	$0, (%rax)
	movq	-48(%rbp), %rax
LBB0_12:
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movslq	(%rcx,%rdx,4), %rcx
	negq	%rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rax,%rcx,8), %rax
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%rax, 8(%rdx)
	movl	(%r12), %eax
	movl	%eax, 4(%rdx)
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_trace_amdgpu_vm_grab_id
	xorl	%r13d, %r13d
LBB0_13:
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	(%r14), %r14
	movq	-72(%rbp), %rsi
	movq	%rsi, -48(%rbp)
	movq	(%rbx), %rdi
	addq	$32, %rsi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	xorl	%ecx, %ecx
	callq	_amdgpu_sync_fence
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.8:
	movq	-48(%rbp), %rax
	movq	24(%rax), %rdi
	callq	_dma_fence_put
	movq	%r14, %rdi
	callq	_dma_fence_get
	movq	-48(%rbp), %rdi
	movq	%rax, 24(%rdi)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	$1, (%rax)
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_vmid_grab               ; -- Begin function amdgpu_vmid_grab
	.p2align	2
_amdgpu_vmid_grab:                      ; @amdgpu_vmid_grab
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x4
	mov	x23, x3
	mov	x24, x2
	mov	x21, x1
	mov	x22, x0
	ldp	x8, x9, [x1]
	ldr	w26, [x9]
	ldr	x27, [x8]
	stp	xzr, xzr, [sp]
	mov	w8, #12
	madd	x8, x26, x8, x27
	add	x20, x8, #4
	mov	x0, x20
	bl	_mutex_lock
	add	x3, sp, #8
	mov	x0, x22
	mov	x1, x21
	mov	x2, x24
	bl	_amdgpu_vmid_grab_idle
	mov	x25, x0
	cbnz	w0, LBB0_11
; %bb.1:
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_11
; %bb.2:
	ldr	x8, [x22, #8]
	ldr	x8, [x8, x26, lsl #3]
	cbz	x8, LBB0_5
; %bb.3:
	mov	x5, sp
	mov	x0, x22
	mov	x1, x21
	mov	x2, x24
	mov	x3, x23
	mov	x4, x19
	bl	_amdgpu_vmid_grab_reserved
	mov	x25, x0
	cbnz	w0, LBB0_11
; %bb.4:
	ldr	x8, [sp]
	cbnz	x8, LBB0_8
	b	LBB0_11
LBB0_5:
	mov	x5, sp
	mov	x0, x22
	mov	x1, x21
	mov	x2, x24
	mov	x3, x23
	mov	x4, x19
	bl	_amdgpu_vmid_grab_used
	mov	x25, x0
	cbnz	w0, LBB0_11
; %bb.6:
	ldr	x8, [sp]
	cbz	x8, LBB0_12
LBB0_7:
	add	x0, x8, #16
	mov	w8, #12
	madd	x8, x26, x8, x27
	add	x1, x8, #8
	bl	_list_move_tail
	ldr	x8, [sp]
LBB0_8:
	ldr	w9, [x19, #16]
	str	w9, [x8, #12]
	ldr	w9, [x22, #4]
	str	w9, [x8, #8]
	ldr	w9, [x19]
	cbz	w9, LBB0_10
; %bb.9:
	ldr	x0, [x8]
	bl	_dma_fence_put
	ldr	x8, [sp]
	str	xzr, [x8]
	ldr	x8, [sp]
LBB0_10:
	mov	w9, #12
	mul	x9, x26, x9
	ldrsw	x9, [x27, x9]
	mov	w10, #40
	mneg	x9, x9, x10
	add	x8, x8, x9
	str	x8, [x19, #8]
	ldr	w8, [x22]
	str	w8, [x19, #4]
	mov	x0, x22
	mov	x1, x21
	mov	x2, x19
	bl	_trace_amdgpu_vm_grab_id
	mov	w25, #0
LBB0_11:
	mov	x0, x20
	bl	_mutex_unlock
	mov	x0, x25
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_12:
	ldr	x24, [x24]
	ldr	x8, [sp, #8]
	str	x8, [sp]
	ldr	x0, [x21]
	add	x1, x8, #32
	mov	x2, x23
	mov	w3, #0
	bl	_amdgpu_sync_fence
	mov	x25, x0
	cbnz	w0, LBB0_11
; %bb.13:
	ldr	x8, [sp]
	ldr	x0, [x8, #24]
	bl	_dma_fence_put
	mov	x0, x24
	bl	_dma_fence_get
	ldr	x8, [sp]
	str	x0, [x8, #24]
	mov	w9, #1
	str	w9, [x19]
	b	LBB0_7
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
