	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_test_ring_sync          ## -- Begin function radeon_test_ring_sync
	.p2align	4, 0x90
_radeon_test_ring_sync:                 ## @radeon_test_ring_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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r12
	movq	%rdi, %r15
	movq	$0, -56(%rbp)
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	leaq	-40(%rbp), %rsi
	callq	_radeon_semaphore_create
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
LBB0_10:
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_20
LBB0_2:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$64, %edx
	callq	_radeon_ring_lock
	movl	(%r12), %esi
	testl	%eax, %eax
	je	LBB0_4
LBB0_3:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_20
LBB0_4:
	movq	-40(%rbp), %rdx
	movq	%r15, %rdi
	callq	_radeon_semaphore_emit_wait
	movq	%r15, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_radeon_ring_unlock_commit
	leaq	-56(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_radeon_test_create_and_emit_fence
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_5
LBB0_20:
	leaq	-40(%rbp), %rsi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_radeon_semaphore_free
	cmpq	$0, -56(%rbp)
	je	LBB0_22
## %bb.21:
	leaq	-56(%rbp), %rdi
	callq	_radeon_fence_unref
LBB0_22:
	cmpq	$0, -48(%rbp)
	je	LBB0_24
## %bb.23:
	leaq	-48(%rbp), %rdi
	callq	_radeon_fence_unref
LBB0_24:
	testl	%ebx, %ebx
	je	LBB0_26
## %bb.25:
	leaq	L_.str.6(%rip), %rdi
	movl	%ebx, %esi
	callq	_pr_warn
LBB0_26:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$64, %edx
	callq	_radeon_ring_lock
	movl	(%r12), %esi
	testl	%eax, %eax
	jne	LBB0_3
## %bb.6:
	movq	-40(%rbp), %rdx
	movq	%r15, %rdi
	callq	_radeon_semaphore_emit_wait
	movq	%r15, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_radeon_ring_unlock_commit
	leaq	-48(%rbp), %rdx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_radeon_test_create_and_emit_fence
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_20
## %bb.7:
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_msleep
	movq	-56(%rbp), %rdi
	callq	_radeon_fence_signaled
	testq	%rax, %rax
	je	LBB0_11
## %bb.8:
	leaq	L_.str.2(%rip), %rdi
LBB0_9:
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_11:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$64, %edx
	callq	_radeon_ring_lock
	testl	%eax, %eax
	je	LBB0_13
LBB0_12:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_20
LBB0_13:
	movl	(%r14), %esi
	movq	-40(%rbp), %rdx
	movq	%r15, %rdi
	callq	_radeon_semaphore_emit_signal
	movq	%r15, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_radeon_ring_unlock_commit
	movq	-56(%rbp), %rdi
	xorl	%esi, %esi
	callq	_radeon_fence_wait
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %ebx
	leaq	L_.str.4(%rip), %rdi
	jmp	LBB0_10
LBB0_15:
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_msleep
	movq	-48(%rbp), %rdi
	callq	_radeon_fence_signaled
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:
	leaq	L_.str.5(%rip), %rdi
	jmp	LBB0_9
LBB0_17:
	movq	%r15, %rdi
	movq	%r14, %rsi
	movl	$64, %edx
	callq	_radeon_ring_lock
	testl	%eax, %eax
	jne	LBB0_12
## %bb.18:
	movl	(%r14), %esi
	movq	-40(%rbp), %rdx
	movq	%r15, %rdi
	callq	_radeon_semaphore_emit_signal
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	movq	%r14, %rsi
	xorl	%edx, %edx
	callq	_radeon_ring_unlock_commit
	movq	-48(%rbp), %rdi
	xorl	%esi, %esi
	callq	_radeon_fence_wait
	testl	%eax, %eax
	je	LBB0_20
## %bb.19:
	movl	%eax, %r14d
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movl	%r14d, %ebx
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to create semaphore\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to lock ring A %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Fence 1 signaled without waiting for semaphore.\n"

L_.str.3:                               ## @.str.3
	.asciz	"Failed to lock ring B %p\n"

L_.str.4:                               ## @.str.4
	.asciz	"Failed to wait for sync fence 1\n"

L_.str.5:                               ## @.str.5
	.asciz	"Fence 2 signaled without waiting for semaphore.\n"

L_.str.6:                               ## @.str.6
	.asciz	"Error while testing ring sync (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_test_ring_sync          ; -- Begin function radeon_test_ring_sync
	.p2align	2
_radeon_test_ring_sync:                 ; @radeon_test_ring_sync
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x20, x2
	mov	x22, x1
	mov	x19, x0
	stp	xzr, xzr, [sp, #16]
	str	xzr, [sp, #8]
	add	x1, sp, #8
	bl	_radeon_semaphore_create
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	mov	x0, x19
	mov	x1, x22
	mov	w2, #64
	bl	_radeon_ring_lock
	ldr	w1, [x22]
	cbz	w0, LBB0_12
LBB0_3:
	mov	x21, x0
	str	x1, [sp]
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_4:
	bl	_DRM_ERROR
LBB0_5:
	add	x1, sp, #8
	mov	x0, x19
	mov	x2, #0
	bl	_radeon_semaphore_free
	ldr	x8, [sp, #24]
	cbz	x8, LBB0_7
; %bb.6:
	add	x0, sp, #24
	bl	_radeon_fence_unref
LBB0_7:
	ldr	x8, [sp, #16]
	cbz	x8, LBB0_9
; %bb.8:
	add	x0, sp, #16
	bl	_radeon_fence_unref
LBB0_9:
	cbz	w21, LBB0_11
; %bb.10:
Lloh4:
	adrp	x0, l_.str.6@PAGE
Lloh5:
	add	x0, x0, l_.str.6@PAGEOFF
	mov	x1, x21
	bl	_pr_warn
LBB0_11:
	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
	add	sp, sp, #80
	ret
LBB0_12:
	ldr	x2, [sp, #8]
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_radeon_semaphore_emit_wait
	mov	x0, x19
	mov	x1, x22
	mov	w2, #0
	bl	_radeon_ring_unlock_commit
	add	x2, sp, #24
	mov	x0, x19
	mov	x1, x22
	bl	_radeon_test_create_and_emit_fence
	mov	x21, x0
	cbnz	w0, LBB0_5
; %bb.13:
	mov	x0, x19
	mov	x1, x22
	mov	w2, #64
	bl	_radeon_ring_lock
	ldr	w1, [x22]
	cbnz	w0, LBB0_3
; %bb.14:
	ldr	x2, [sp, #8]
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_radeon_semaphore_emit_wait
	mov	x0, x19
	mov	x1, x22
	mov	w2, #0
	bl	_radeon_ring_unlock_commit
	add	x2, sp, #16
	mov	x0, x19
	mov	x1, x22
	bl	_radeon_test_create_and_emit_fence
	mov	x21, x0
	cbnz	w0, LBB0_5
; %bb.15:
	mov	w0, #1000
	bl	_msleep
	ldr	x0, [sp, #24]
	bl	_radeon_fence_signaled
	cbz	x0, LBB0_18
; %bb.16:
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_17:
	bl	_DRM_ERROR
	mov	w21, #0
	b	LBB0_5
LBB0_18:
	mov	x0, x19
	mov	x1, x20
	mov	w2, #64
	bl	_radeon_ring_lock
	cbz	w0, LBB0_20
LBB0_19:
	mov	x21, x0
	str	x20, [sp]
Lloh8:
	adrp	x0, l_.str.3@PAGE
Lloh9:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_4
LBB0_20:
	ldr	w1, [x20]
	ldr	x2, [sp, #8]
	mov	x0, x19
	bl	_radeon_semaphore_emit_signal
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_radeon_ring_unlock_commit
	ldr	x0, [sp, #24]
	mov	w1, #0
	bl	_radeon_fence_wait
	cbz	w0, LBB0_23
; %bb.21:
	mov	x21, x0
LBB0_22:
Lloh10:
	adrp	x0, l_.str.4@PAGE
Lloh11:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_4
LBB0_23:
	mov	w0, #1000
	bl	_msleep
	ldr	x0, [sp, #16]
	bl	_radeon_fence_signaled
	cbz	x0, LBB0_25
; %bb.24:
Lloh12:
	adrp	x0, l_.str.5@PAGE
Lloh13:
	add	x0, x0, l_.str.5@PAGEOFF
	b	LBB0_17
LBB0_25:
	mov	x0, x19
	mov	x1, x20
	mov	w2, #64
	bl	_radeon_ring_lock
	cbnz	w0, LBB0_19
; %bb.26:
	ldr	w1, [x20]
	ldr	x2, [sp, #8]
	mov	x0, x19
	bl	_radeon_semaphore_emit_signal
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_radeon_ring_unlock_commit
	ldr	x0, [sp, #16]
	mov	w1, #0
	bl	_radeon_fence_wait
	mov	x21, x0
	cbnz	w0, LBB0_22
	b	LBB0_5
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to create semaphore\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to lock ring A %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Fence 1 signaled without waiting for semaphore.\n"

l_.str.3:                               ; @.str.3
	.asciz	"Failed to lock ring B %p\n"

l_.str.4:                               ; @.str.4
	.asciz	"Failed to wait for sync fence 1\n"

l_.str.5:                               ; @.str.5
	.asciz	"Fence 2 signaled without waiting for semaphore.\n"

l_.str.6:                               ; @.str.6
	.asciz	"Error while testing ring sync (%d)\n"

.subsections_via_symbols
