	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_ib_schedule             ## -- Begin function radeon_ib_schedule
	.p2align	4, 0x90
_radeon_ib_schedule:                    ## @radeon_ib_schedule
	.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
	movq	%rdi, %rbx
	cmpl	$0, 40(%rsi)
	je	LBB0_2
## %bb.1:
	movq	%rsi, %r12
	movq	(%rsi), %r14
	shlq	$2, %r14
	addq	8(%rbx), %r14
	cmpl	$0, (%r14)
	je	LBB0_2
## %bb.3:
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	_RADEON_NUM_RINGS@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	leal	64(,%rax,8), %edx
	movq	%rbx, %rdi
	movq	%r14, %rsi
	callq	_radeon_ring_lock
	testl	%eax, %eax
	je	LBB0_4
## %bb.24:
	movl	%eax, %r13d
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_23
LBB0_2:
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_23:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	cmpl	$0, (%r15)
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jle	LBB0_10
## %bb.5:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	xorl	%r14d, %r14d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	incq	%rbx
	movslq	(%r15), %rax
	cmpq	%rax, %rbx
	jge	LBB0_9
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r12), %rsi
	movq	32(%r12), %rax
	movq	(%rax,%rbx,8), %r13
	movq	%r13, %rdi
	callq	_radeon_fence_need_sync
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	24(%r12), %esi
	movl	(%r13), %edx
	movq	(%r12), %rcx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_radeon_semaphore_sync_rings
	movq	(%r12), %rsi
	movq	%r13, %rdi
	callq	_radeon_fence_note_sync
	movl	$1, %r14d
	jmp	LBB0_8
LBB0_9:
	testl	%r14d, %r14d
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_11
LBB0_10:
	leaq	24(%r12), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%edx, %edx
	callq	_radeon_semaphore_free
LBB0_11:
	movq	16(%r12), %rdx
	testq	%rdx, %rdx
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_13
## %bb.12:
	movq	(%r12), %rsi
	movq	%r15, %rdi
	callq	_radeon_ring_vm_flush
LBB0_13:
	testq	%rbx, %rbx
	je	LBB0_15
## %bb.14:
	movq	(%rbx), %rsi
	movq	%r15, %rdi
	movq	%rbx, %rdx
	callq	_radeon_ring_ib_execute
	leaq	24(%rbx), %rsi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_radeon_semaphore_free
LBB0_15:
	movq	(%r12), %rsi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_radeon_ring_ib_execute
	leaq	8(%r12), %rbx
	movq	(%r12), %rdx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_radeon_fence_emit
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %r13d
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_radeon_ring_unlock_undo
	jmp	LBB0_23
LBB0_17:
	movq	-56(%rbp), %r13                 ## 8-byte Reload
	testq	%r13, %r13
	je	LBB0_19
## %bb.18:
	movq	(%rbx), %rdi
	callq	_radeon_fence_ref
	movq	%rax, 8(%r13)
LBB0_19:
	movq	16(%r12), %rax
	testq	%rax, %rax
	je	LBB0_22
## %bb.20:
	cmpq	$0, (%rax)
	jne	LBB0_22
## %bb.21:
	movq	8(%r12), %rdi
	callq	_radeon_fence_ref
	movq	16(%r12), %rcx
	movq	%rax, (%rcx)
LBB0_22:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_radeon_ring_unlock_commit
	xorl	%r13d, %r13d
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"couldn't schedule ib\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RADEON_NUM_RINGS,4,2           ## @RADEON_NUM_RINGS
L_.str.1:                               ## @.str.1
	.asciz	"scheduling IB failed (%d).\n"

L_.str.2:                               ## @.str.2
	.asciz	"failed to emit fence for new IB (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_radeon_ib_schedule             ; -- Begin function radeon_ib_schedule
	.p2align	2
_radeon_ib_schedule:                    ; @radeon_ib_schedule
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x0
	ldr	w8, [x1, #40]
	cbz	w8, LBB0_4
; %bb.1:
	mov	x21, x1
	ldr	x8, [x19, #8]
	ldr	x9, [x1]
	add	x20, x8, x9, lsl #2
	ldr	w8, [x20]
	cbz	w8, LBB0_4
; %bb.2:
	mov	x22, x2
Lloh0:
	adrp	x24, _RADEON_NUM_RINGS@GOTPAGE
Lloh1:
	ldr	x24, [x24, _RADEON_NUM_RINGS@GOTPAGEOFF]
	ldr	w8, [x24]
	lsl	w8, w8, #3
	add	w2, w8, #64
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_ring_lock
	cbz	w0, LBB0_6
; %bb.3:
	mov	x23, x0
	ldr	w0, [x19]
	str	x23, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_5
LBB0_4:
	ldr	w0, [x19]
Lloh4:
	adrp	x1, l_.str@PAGE
Lloh5:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_5:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_6:
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.7:
	mov	x25, #0
	mov	w26, #0
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	x25, x25, #1
	ldrsw	x8, [x24]
	cmp	x25, x8
	b.ge	LBB0_11
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x21, #32]
	ldr	x23, [x8, x25, lsl #3]
	ldr	x1, [x21]
	mov	x0, x23
	bl	_radeon_fence_need_sync
	cbz	x0, LBB0_8
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w1, [x21, #24]
	ldr	w2, [x23]
	ldr	x3, [x21]
	mov	x0, x19
	bl	_radeon_semaphore_sync_rings
	ldr	x1, [x21]
	mov	x0, x23
	bl	_radeon_fence_note_sync
	mov	w26, #1
	b	LBB0_8
LBB0_11:
	cbnz	w26, LBB0_13
LBB0_12:
	add	x1, x21, #24
	mov	x0, x19
	mov	x2, #0
	bl	_radeon_semaphore_free
LBB0_13:
	ldr	x2, [x21, #16]
	cbz	x2, LBB0_15
; %bb.14:
	ldr	x1, [x21]
	mov	x0, x19
	bl	_radeon_ring_vm_flush
LBB0_15:
	cbz	x22, LBB0_17
; %bb.16:
	mov	x23, x22
	ldr	x1, [x23], #24
	mov	x0, x19
	mov	x2, x22
	bl	_radeon_ring_ib_execute
	mov	x0, x19
	mov	x1, x23
	mov	x2, #0
	bl	_radeon_semaphore_free
LBB0_17:
	ldr	x1, [x21]
	mov	x0, x19
	mov	x2, x21
	bl	_radeon_ring_ib_execute
	mov	x24, x21
	ldr	x2, [x24], #8
	mov	x0, x19
	mov	x1, x24
	bl	_radeon_fence_emit
	cbz	w0, LBB0_19
; %bb.18:
	mov	x23, x0
	ldr	w0, [x19]
	str	x23, [sp]
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_ring_unlock_undo
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	b	LBB0_5
LBB0_19:
	cbz	x22, LBB0_21
; %bb.20:
	ldr	x0, [x24]
	bl	_radeon_fence_ref
	str	x0, [x22, #8]
LBB0_21:
	ldr	x8, [x21, #16]
	cbz	x8, LBB0_24
; %bb.22:
	ldr	x8, [x8]
	cbnz	x8, LBB0_24
; %bb.23:
	ldr	x0, [x21, #8]
	bl	_radeon_fence_ref
	ldr	x8, [x21, #16]
	str	x0, [x8]
LBB0_24:
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_ring_unlock_commit
	mov	w23, #0
	b	LBB0_5
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"couldn't schedule ib\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RADEON_NUM_RINGS,4,2           ; @RADEON_NUM_RINGS
l_.str.1:                               ; @.str.1
	.asciz	"scheduling IB failed (%d).\n"

l_.str.2:                               ; @.str.2
	.asciz	"failed to emit fence for new IB (%d)\n"

.subsections_via_symbols
