	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_vgpu_fence
_alloc_vgpu_fence:                      ## @alloc_vgpu_fence
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	8(%rdi), %rax
	movq	(%rax), %r15
	leaq	4(%r15), %r14
	movq	%r14, %rdi
	callq	_intel_runtime_pm_get
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r12, %rdi
	callq	_vgpu_fence_sz
	testl	%eax, %eax
	jle	LBB0_4
## %bb.1:
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_i915_reserve_fence
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	jne	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r12), %rax
	movq	%rbx, (%rax,%r13,8)
	incq	%r13
	movq	%r12, %rdi
	callq	_vgpu_fence_sz
	cltq
	cmpq	%rax, %r13
	jl	LBB0_2
LBB0_4:
	movq	%r12, %rdi
	callq	__clear_vgpu_fence
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	%r14, %rdi
	callq	_intel_runtime_pm_put_unchecked
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_5:
	leaq	L_.str(%rip), %rdi
	callq	_gvt_vgpu_err
	movq	%r12, %rdi
	callq	_vgpu_fence_sz
	testl	%eax, %eax
	jle	LBB0_10
## %bb.6:
	xorl	%ebx, %ebx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_7 Depth=1
	incq	%rbx
	movq	%r12, %rdi
	callq	_vgpu_fence_sz
	cltq
	cmpq	%rax, %rbx
	jge	LBB0_10
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rax
	movq	(%rax,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	callq	_i915_unreserve_fence
	movq	(%r12), %rax
	movq	$0, (%rax,%rbx,8)
	jmp	LBB0_9
LBB0_10:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	%r14, %rdi
	callq	_intel_runtime_pm_put_unchecked
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to alloc fences\n"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.no_dead_strip	_alloc_vgpu_fence
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_vgpu_fence
_alloc_vgpu_fence:                      ; @alloc_vgpu_fence
	.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	x21, x0
	ldr	x8, [x0, #8]
	ldr	x20, [x8]
	add	x19, x20, #4
	mov	x0, x19
	bl	_intel_runtime_pm_get
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x21
	bl	_vgpu_fence_sz
	cmp	w0, #1
	b.lt	LBB0_4
; %bb.1:
	mov	x23, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_i915_reserve_fence
	mov	x22, x0
	bl	_IS_ERR
	cbnz	x0, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x21]
	str	x22, [x8, x23, lsl #3]
	add	x23, x23, #1
	mov	x0, x21
	bl	_vgpu_fence_sz
	cmp	x23, w0, sxtw
	b.lt	LBB0_2
LBB0_4:
	mov	x0, x21
	bl	__clear_vgpu_fence
	mov	x0, x20
	bl	_mutex_unlock
	mov	x0, x19
	bl	_intel_runtime_pm_put_unchecked
	mov	w0, #0
	b	LBB0_11
LBB0_5:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gvt_vgpu_err
	mov	x0, x21
	bl	_vgpu_fence_sz
	cmp	w0, #1
	b.lt	LBB0_10
; %bb.6:
	mov	x22, #0
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x22, x22, #1
	mov	x0, x21
	bl	_vgpu_fence_sz
	cmp	x22, w0, sxtw
	b.ge	LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21]
	ldr	x0, [x8, x22, lsl #3]
	cbz	x0, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	bl	_i915_unreserve_fence
	ldr	x8, [x21]
	str	xzr, [x8, x22, lsl #3]
	b	LBB0_7
LBB0_10:
	mov	x0, x20
	bl	_mutex_unlock
	mov	x0, x19
	bl	_intel_runtime_pm_put_unchecked
Lloh2:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	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
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to alloc fences\n"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.no_dead_strip	_alloc_vgpu_fence
.subsections_via_symbols
