	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_fence_sync             ## -- Begin function nouveau_fence_sync
	.p2align	4, 0x90
_nouveau_fence_sync:                    ## @nouveau_fence_sync
	.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, -44(%rbp)                 ## 4-byte Spill
	movl	%edx, %r13d
	movq	%rsi, %r12
	movq	8(%rsi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	je	LBB0_1
LBB0_2:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_dma_resv_get_list
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_dma_resv_get_excl
	testq	%rax, %rax
	je	LBB0_12
## %bb.3:
	movq	%rax, %rbx
	testl	%r13d, %r13d
	je	LBB0_6
## %bb.4:
	testq	%r14, %r14
	je	LBB0_6
## %bb.5:
	cmpl	$0, (%r14)
	je	LBB0_6
LBB0_12:
	xorl	%ebx, %ebx
	testl	%r13d, %r13d
	je	LBB0_24
## %bb.13:
	testq	%r14, %r14
	je	LBB0_24
## %bb.14:
	cmpl	$0, (%r14)
	jle	LBB0_24
## %bb.15:
	movl	$1, %r15d
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r14), %rax
	movl	-4(%rax,%r15,4), %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_dma_resv_held
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_rcu_dereference_protected
	movq	%rax, %r13
	movl	(%r12), %esi
	movq	%rax, %rdi
	callq	_nouveau_local_fence
	testq	%rax, %rax
	je	LBB0_21
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%rax, %rbx
	xorl	%eax, %eax
	callq	_rcu_read_lock
	movl	(%rbx), %edi
	callq	_rcu_dereference
	testq	%rax, %rax
	je	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=1
	cmpq	%r12, %rax
	je	LBB0_26
## %bb.19:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	%rbx, %rdi
	movq	%rax, %rsi
	movq	%r12, %rdx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	callq	*(%rax)
	testq	%rax, %rax
	je	LBB0_26
LBB0_20:                                ##   in Loop: Header=BB0_16 Depth=1
	xorl	%eax, %eax
	callq	_rcu_read_unlock
LBB0_21:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	%r13, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_dma_fence_wait
	movl	%eax, %ebx
	jmp	LBB0_22
	.p2align	4, 0x90
LBB0_26:                                ##   in Loop: Header=BB0_16 Depth=1
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_rcu_read_unlock
LBB0_22:                                ##   in Loop: Header=BB0_16 Depth=1
	movslq	(%r14), %rax
	cmpq	%rax, %r15
	jge	LBB0_24
## %bb.23:                              ##   in Loop: Header=BB0_16 Depth=1
	incq	%r15
	testl	%ebx, %ebx
	je	LBB0_16
	jmp	LBB0_24
LBB0_1:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	callq	_dma_resv_reserve_shared
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_24
	jmp	LBB0_2
LBB0_6:
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_nouveau_local_fence
	testq	%rax, %rax
	je	LBB0_11
## %bb.7:
	movq	%rax, %r14
	xorl	%eax, %eax
	callq	_rcu_read_lock
	movl	(%r14), %edi
	callq	_rcu_dereference
	testq	%rax, %rax
	je	LBB0_10
## %bb.8:
	cmpq	%r12, %rax
	je	LBB0_25
## %bb.9:
	movq	%r14, %rdi
	movq	%rax, %rsi
	movq	%r12, %rdx
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	callq	*(%rax)
	testq	%rax, %rax
	je	LBB0_25
LBB0_10:
	xorl	%eax, %eax
	callq	_rcu_read_unlock
LBB0_11:
	movq	%rbx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dma_fence_wait                 ## TAILCALL
LBB0_25:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_rcu_read_unlock
LBB0_24:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_fence_sync             ; -- Begin function nouveau_fence_sync
	.p2align	2
_nouveau_fence_sync:                    ; @nouveau_fence_sync
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x3
	mov	x24, x2
	mov	x20, x1
	ldr	x25, [x1, #8]
	ldr	x21, [x0]
	cbz	w2, LBB0_17
LBB0_1:
	mov	x0, x21
	bl	_dma_resv_get_list
	mov	x22, x0
	mov	x0, x21
	bl	_dma_resv_get_excl
	cbz	x0, LBB0_5
; %bb.2:
	mov	x23, x0
	cbz	w24, LBB0_18
; %bb.3:
	cbz	x22, LBB0_18
; %bb.4:
	ldr	w8, [x22]
	cbz	w8, LBB0_18
LBB0_5:
	mov	w0, #0
	cbz	w24, LBB0_26
; %bb.6:
	cbz	x22, LBB0_26
; %bb.7:
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_25
; %bb.8:
	mov	x26, #0
	b	LBB0_12
LBB0_9:                                 ;   in Loop: Header=BB0_12 Depth=1
	bl	_rcu_read_unlock
LBB0_10:                                ;   in Loop: Header=BB0_12 Depth=1
	mov	x0, x23
	mov	x1, x19
	bl	_dma_fence_wait
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	add	x26, x26, #1
	ldrsw	x8, [x22]
	cmp	x26, x8
	ccmp	w0, #0, #0, lt
	b.ne	LBB0_26
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x22, #8]
	ldr	w23, [x8, x26, lsl #2]
	mov	x0, x21
	bl	_dma_resv_held
	mov	x1, x0
	mov	x0, x23
	bl	_rcu_dereference_protected
	mov	x23, x0
	ldr	w1, [x20]
	bl	_nouveau_local_fence
	cbz	x0, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x24, x0
	bl	_rcu_read_lock
	ldr	w0, [x24]
	bl	_rcu_dereference
	cbz	x0, LBB0_9
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	mov	x1, x0
	cmp	x0, x20
	b.eq	LBB0_16
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [x25]
	mov	x0, x24
	mov	x2, x20
	blr	x8
	cbnz	x0, LBB0_9
LBB0_16:                                ;   in Loop: Header=BB0_12 Depth=1
	bl	_rcu_read_unlock
	mov	w0, #0
	b	LBB0_11
LBB0_17:
	mov	x0, x21
	mov	w1, #1
	bl	_dma_resv_reserve_shared
	cbnz	w0, LBB0_26
	b	LBB0_1
LBB0_18:
	ldr	w1, [x20]
	mov	x0, x23
	bl	_nouveau_local_fence
	cbz	x0, LBB0_23
; %bb.19:
	mov	x21, x0
	bl	_rcu_read_lock
	ldr	w0, [x21]
	bl	_rcu_dereference
	cbz	x0, LBB0_22
; %bb.20:
	mov	x1, x0
	cmp	x0, x20
	b.eq	LBB0_24
; %bb.21:
	ldr	x8, [x25]
	mov	x0, x21
	mov	x2, x20
	blr	x8
	cbz	x0, LBB0_24
LBB0_22:
	bl	_rcu_read_unlock
LBB0_23:
	mov	x0, x23
	mov	x1, x19
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	b	_dma_fence_wait
LBB0_24:
	bl	_rcu_read_unlock
LBB0_25:
	mov	w0, #0
LBB0_26:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
