	.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, %r14
	cmpl	$0, 28(%rsi)
	je	LBB0_2
## %bb.1:
	movq	%rsi, %rbx
	movq	(%rsi), %r12
	shlq	$2, %r12
	addq	8(%r14), %r12
	cmpl	$0, (%r12)
	je	LBB0_2
## %bb.3:
	movq	%rdx, %r13
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	_RADEON_NUM_SYNCS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	64(,%rax,8), %edx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_radeon_ring_lock
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r15d
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_21
LBB0_2:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_21:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	16(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_7
## %bb.6:
	movq	(%rbx), %rdx
	movq	%r14, %rdi
	callq	_radeon_vm_grab_id
	leaq	24(%rbx), %rdi
	movq	%rax, %rsi
	callq	_radeon_sync_fence
LBB0_7:
	leaq	24(%rbx), %rsi
	movq	(%rbx), %rdx
	movq	%r14, %rdi
	callq	_radeon_sync_rings
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:
	movl	%eax, %r15d
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_9
LBB0_10:
	movq	16(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_12
## %bb.11:
	movq	(%rbx), %rdx
	movl	24(%rbx), %ecx
	movq	%r14, %rdi
	callq	_radeon_vm_flush
LBB0_12:
	testq	%r13, %r13
	je	LBB0_14
## %bb.13:
	movq	(%r13), %rsi
	movq	%r14, %rdi
	movq	%r13, %rdx
	callq	_radeon_ring_ib_execute
	leaq	24(%r13), %rsi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_radeon_sync_free
LBB0_14:
	movq	(%rbx), %rsi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_radeon_ring_ib_execute
	leaq	8(%rbx), %rsi
	movq	(%rbx), %rdx
	movq	%r14, %rdi
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	callq	_radeon_fence_emit
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	movl	%eax, %r15d
	movl	(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
LBB0_9:
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_radeon_ring_unlock_undo
	jmp	LBB0_21
LBB0_16:
	testq	%r13, %r13
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_18
## %bb.17:
	movl	(%r15), %edi
	callq	_radeon_fence_ref
	movl	%eax, 8(%r13)
LBB0_18:
	movq	16(%rbx), %rsi
	testq	%rsi, %rsi
	je	LBB0_20
## %bb.19:
	movl	(%r15), %edx
	movq	%r14, %rdi
	callq	_radeon_vm_fence
LBB0_20:
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_radeon_ring_unlock_commit
	xorl	%r15d, %r15d
	jmp	LBB0_21
	.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_SYNCS,4,2           ## @RADEON_NUM_SYNCS
L_.str.1:                               ## @.str.1
	.asciz	"scheduling IB failed (%d).\n"

L_.str.2:                               ## @.str.2
	.asciz	"failed to sync rings (%d)\n"

L_.str.3:                               ## @.str.3
	.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, #28]
	cbz	w8, LBB0_4
; %bb.1:
	mov	x22, x1
	ldr	x8, [x19, #8]
	ldr	x9, [x1]
	add	x20, x8, x9, lsl #2
	ldr	w8, [x20]
	cbz	w8, LBB0_4
; %bb.2:
	mov	x21, x3
	mov	x23, x2
Lloh0:
	adrp	x8, _RADEON_NUM_SYNCS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RADEON_NUM_SYNCS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	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	x24, x0
	ldr	w0, [x19]
	str	x24, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_5
LBB0_4:
	ldr	w0, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_5:
	mov	x0, x24
	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	x1, [x22, #16]
	cbz	x1, LBB0_8
; %bb.7:
	mov	x24, x22
	ldr	x2, [x24], #24
	mov	x0, x19
	bl	_radeon_vm_grab_id
	mov	x1, x0
	mov	x0, x24
	bl	_radeon_sync_fence
LBB0_8:
	mov	x1, x22
	ldr	x2, [x1], #24
	mov	x0, x19
	bl	_radeon_sync_rings
	cbz	w0, LBB0_10
; %bb.9:
	mov	x24, x0
	ldr	w0, [x19]
	str	x24, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_ring_unlock_undo
                                        ; kill: def $w24 killed $w24 killed $x24 def $x24
	b	LBB0_5
LBB0_10:
	ldr	x1, [x22, #16]
	cbz	x1, LBB0_12
; %bb.11:
	ldr	x2, [x22]
	ldr	w3, [x22, #24]
	mov	x0, x19
	bl	_radeon_vm_flush
LBB0_12:
	cbz	x23, LBB0_14
; %bb.13:
	mov	x24, x23
	ldr	x1, [x24], #24
	mov	x0, x19
	mov	x2, x23
	bl	_radeon_ring_ib_execute
	mov	x0, x19
	mov	x1, x24
	mov	x2, #0
	bl	_radeon_sync_free
LBB0_14:
	ldr	x1, [x22]
	mov	x0, x19
	mov	x2, x22
	bl	_radeon_ring_ib_execute
	mov	x24, x22
	ldr	x2, [x24], #8
	mov	x0, x19
	mov	x1, x24
	bl	_radeon_fence_emit
	cbz	w0, LBB0_16
; %bb.15:
	mov	x25, x0
	ldr	w0, [x19]
	str	x25, [sp]
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_ring_unlock_undo
	mov	x24, x25
	b	LBB0_5
LBB0_16:
	cbz	x23, LBB0_18
; %bb.17:
	ldr	w0, [x24]
	bl	_radeon_fence_ref
	str	w0, [x23, #8]
LBB0_18:
	ldr	x1, [x22, #16]
	cbz	x1, LBB0_20
; %bb.19:
	ldr	w2, [x24]
	mov	x0, x19
	bl	_radeon_vm_fence
LBB0_20:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_radeon_ring_unlock_commit
	mov	w24, #0
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.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_SYNCS,4,2           ; @RADEON_NUM_SYNCS
l_.str.1:                               ; @.str.1
	.asciz	"scheduling IB failed (%d).\n"

l_.str.2:                               ; @.str.2
	.asciz	"failed to sync rings (%d)\n"

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

.subsections_via_symbols
