	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_cs_ib_fill
_amdgpu_cs_ib_fill:                     ## @amdgpu_cs_ib_fill
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %eax
	testl	%eax, %eax
	jle	LBB0_27
## %bb.1:
	movq	40(%r15), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	movl	$8, %r14d
	movq	_AMDGPU_CHUNK_ID_IB@GOTPCREL(%rip), %rdi
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	xorl	%r13d, %r13d
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_26:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	movslq	%eax, %rcx
	addq	$16, %r14
	cmpq	%rcx, %r12
	jge	LBB0_27
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	24(%r15), %rcx
	cmpl	(%rcx), %r13d
	jge	LBB0_27
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	32(%r15), %rdx
	movq	-8(%rdx,%r14), %rsi
	cmpq	(%rdi), %rsi
	jne	LBB0_26
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	movq	24(%rcx), %r13
	movq	(%rdx,%r14), %rbx
	movq	(%rbx), %rax
	movq	_AMDGPU_HW_IP_GFX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_15
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_amdgpu_mcbp@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_amdgpu_sriov_vf
	testq	%rax, %rax
	je	LBB0_15
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	8(%rbx), %eax
	movq	_AMDGPU_IB_FLAG_PREEMPT@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_11
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_AMDGPU_IB_FLAG_CE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	incl	%eax
	jmp	LBB0_12
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	incl	-48(%rbp)                       ## 4-byte Folded Spill
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	cmpl	$1, %eax
	jg	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$2, -48(%rbp)                   ## 4-byte Folded Reload
	jge	LBB0_14
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	16(%r15), %edi
	movq	(%rbx), %rsi
	movl	24(%rbx), %edx
	movl	20(%rbx), %ecx
	leaq	-112(%rbp), %r8
	callq	_amdgpu_ctx_get_entity
	testl	%eax, %eax
	jne	LBB0_30
## %bb.16:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rcx
	movq	_AMDGPU_IB_FLAG_PREAMBLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_AMDGPU_PREAMBLE_IB_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	24(%r15), %rcx
	orl	%eax, 16(%rcx)
LBB0_18:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%r15), %rcx
	movq	-112(%rbp), %rax
	testq	%rcx, %rcx
	je	LBB0_20
## %bb.19:                              ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%rax, %rcx
	jne	LBB0_14
LBB0_20:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, 8(%r15)
	movq	(%rax), %rax
	movl	(%rax), %edi
	callq	_to_amdgpu_ring
	movq	(%rax), %rax
	cmpq	$0, 8(%rax)
	movq	%r12, -104(%rbp)                ## 8-byte Spill
	movq	%r14, -96(%rbp)                 ## 8-byte Spill
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	%r13, %r14
	je	LBB0_21
## %bb.22:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	12(%rbx), %edx
	jmp	LBB0_23
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edx, %edx
LBB0_23:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	movslq	%r13d, %rax
	leaq	(%rax,%rax,2), %r15
	leaq	(%r14,%r15,4), %r12
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%r12, %rcx
	callq	_amdgpu_ib_get
	testl	%eax, %eax
	jne	LBB0_24
## %bb.25:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
	movl	16(%rdx), %eax
	movl	%eax, 8(%r14,%r15,4)
	movl	12(%rdx), %eax
	leal	3(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$2, %ecx
	movl	%ecx, (%r12)
	movl	8(%rdx), %eax
	movl	%eax, 4(%r14,%r15,4)
	incl	%r13d
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movl	(%r15), %eax
	movq	-104(%rbp), %r12                ## 8-byte Reload
	movq	_AMDGPU_CHUNK_ID_IB@GOTPCREL(%rip), %rdi
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_26
LBB0_27:
	movq	8(%r15), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	callq	_to_amdgpu_ring
	movq	24(%r15), %rcx
	cmpq	$0, 8(%rcx)
	je	LBB0_29
## %bb.28:
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	je	LBB0_29
LBB0_14:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_31
LBB0_29:
	movl	16(%r15), %edi
	movq	8(%r15), %rsi
	callq	_amdgpu_ctx_wait_prev_fence
LBB0_30:
	movl	%eax, %ebx
LBB0_31:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rdi
	callq	_DRM_ERROR
	jmp	LBB0_31
	.cfi_endproc
                                        ## -- End function
	.comm	_AMDGPU_CHUNK_ID_IB,8,3         ## @AMDGPU_CHUNK_ID_IB
	.comm	_AMDGPU_HW_IP_GFX,8,3           ## @AMDGPU_HW_IP_GFX
	.comm	_amdgpu_mcbp,8,3                ## @amdgpu_mcbp
	.comm	_AMDGPU_IB_FLAG_PREEMPT,4,2     ## @AMDGPU_IB_FLAG_PREEMPT
	.comm	_AMDGPU_IB_FLAG_CE,4,2          ## @AMDGPU_IB_FLAG_CE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AMDGPU_IB_FLAG_PREAMBLE,4,2    ## @AMDGPU_IB_FLAG_PREAMBLE
	.comm	_AMDGPU_PREAMBLE_IB_PRESENT,4,2 ## @AMDGPU_PREAMBLE_IB_PRESENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to get ib !\n"

	.no_dead_strip	_amdgpu_cs_ib_fill
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_cs_ib_fill
_amdgpu_cs_ib_fill:                     ; @amdgpu_cs_ib_fill
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
	ldr	w8, [x1]
	cmp	w8, #1
	b.lt	LBB0_25
; %bb.1:
	mov	x24, #0
	mov	x25, #0
	mov	w21, #0
	mov	w27, #0
	str	wzr, [sp, #4]                   ; 4-byte Folded Spill
	ldr	x9, [x19, #40]
	ldr	x9, [x9]
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
Lloh0:
	adrp	x13, _AMDGPU_CHUNK_ID_IB@GOTPAGE
Lloh1:
	ldr	x13, [x13, _AMDGPU_CHUNK_ID_IB@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x25, x25, #1
	add	x24, x24, #16
	cmp	x25, w8, sxtw
	b.ge	LBB0_25
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19, #24]
	ldr	w10, [x9]
	cmp	w27, w10
	b.ge	LBB0_25
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x10, [x19, #32]
	add	x10, x10, x24
	ldr	x11, [x10]
	ldr	x12, [x13]
	cmp	x11, x12
	b.ne	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x26, [x9, #24]
	ldr	x28, [x10, #8]
	ldr	x8, [x28]
Lloh2:
	adrp	x9, _AMDGPU_HW_IP_GFX@GOTPAGE
Lloh3:
	ldr	x9, [x9, _AMDGPU_HW_IP_GFX@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh5:
	adrp	x8, _amdgpu_mcbp@GOTPAGE
Lloh6:
	ldr	x8, [x8, _amdgpu_mcbp@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	cbnz	x8, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_amdgpu_sriov_vf
	cbz	x0, LBB0_15
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x28, #8]
Lloh8:
	adrp	x9, _AMDGPU_IB_FLAG_PREEMPT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _AMDGPU_IB_FLAG_PREEMPT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh11:
	adrp	x9, _AMDGPU_IB_FLAG_CE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _AMDGPU_IB_FLAG_CE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
	mov	x8, x21
	add	w8, w21, #1
	b	LBB0_13
LBB0_11:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	add	w8, w8, #1
	str	w8, [sp, #4]                    ; 4-byte Folded Spill
LBB0_12:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x8, x21
LBB0_13:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	w8, #1
	b.gt	LBB0_27
; %bb.14:                               ;   in Loop: Header=BB0_3 Depth=1
	mov	x21, x8
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	cmp	w8, #2
	b.ge	LBB0_27
LBB0_15:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x19, #16]
	ldr	x1, [x28]
	ldp	w3, w2, [x28, #20]
	add	x4, sp, #24
	bl	_amdgpu_ctx_get_entity
	cbnz	w0, LBB0_29
; %bb.16:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x28, #8]
Lloh14:
	adrp	x9, _AMDGPU_IB_FLAG_PREAMBLE@GOTPAGE
Lloh15:
	ldr	x9, [x9, _AMDGPU_IB_FLAG_PREAMBLE@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_3 Depth=1
Lloh17:
	adrp	x8, _AMDGPU_PREAMBLE_IB_PRESENT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AMDGPU_PREAMBLE_IB_PRESENT@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	ldr	x9, [x19, #24]
	ldr	w10, [x9, #16]
	orr	w8, w10, w8
	str	w8, [x9, #16]
LBB0_18:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x9, [x19, #8]
	ldr	x8, [sp, #24]
	cbz	x9, LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_3 Depth=1
	cmp	x9, x8
	b.ne	LBB0_27
LBB0_20:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w0, [x8]
	bl	_to_amdgpu_ring
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_22
; %bb.21:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	w2, [x28, #12]
	b	LBB0_23
LBB0_22:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w2, #0
LBB0_23:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w20, #12
	smaddl	x23, w27, w20, x26
	ldp	x1, x0, [sp, #8]                ; 16-byte Folded Reload
	mov	x3, x23
	bl	_amdgpu_ib_get
	cbnz	w0, LBB0_31
; %bb.24:                               ;   in Loop: Header=BB0_3 Depth=1
	sxtw	x8, w27
	ldp	w10, w9, [x28, #12]
	madd	x8, x8, x20, x26
	ldr	w11, [x28, #8]
	add	w12, w10, #3
	cmp	w10, #0
	csel	w10, w12, w10, lt
	asr	w10, w10, #2
	str	w10, [x23]
	stp	w11, w9, [x8, #4]
	add	w27, w27, #1
	ldr	w8, [x19]
Lloh20:
	adrp	x13, _AMDGPU_CHUNK_ID_IB@GOTPAGE
Lloh21:
	ldr	x13, [x13, _AMDGPU_CHUNK_ID_IB@GOTPAGEOFF]
	b	LBB0_2
LBB0_25:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	ldr	w0, [x8]
	bl	_to_amdgpu_ring
	ldr	x8, [x19, #24]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_28
; %bb.26:
	ldr	x8, [x0]
	ldr	x8, [x8]
	cbz	x8, LBB0_28
LBB0_27:
Lloh22:
	adrp	x8, _EINVAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_30
LBB0_28:
	ldr	w0, [x19, #16]
	ldr	x1, [x19, #8]
	bl	_amdgpu_ctx_wait_prev_fence
LBB0_29:
	mov	x22, x0
LBB0_30:
	mov	x0, x22
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_31:
	mov	x22, x0
Lloh25:
	adrp	x0, l_.str@PAGE
Lloh26:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
	b	LBB0_30
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_AMDGPU_CHUNK_ID_IB,8,3         ; @AMDGPU_CHUNK_ID_IB
	.comm	_AMDGPU_HW_IP_GFX,8,3           ; @AMDGPU_HW_IP_GFX
	.comm	_amdgpu_mcbp,8,3                ; @amdgpu_mcbp
	.comm	_AMDGPU_IB_FLAG_PREEMPT,4,2     ; @AMDGPU_IB_FLAG_PREEMPT
	.comm	_AMDGPU_IB_FLAG_CE,4,2          ; @AMDGPU_IB_FLAG_CE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AMDGPU_IB_FLAG_PREAMBLE,4,2    ; @AMDGPU_IB_FLAG_PREAMBLE
	.comm	_AMDGPU_PREAMBLE_IB_PRESENT,4,2 ; @AMDGPU_PREAMBLE_IB_PRESENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to get ib !\n"

	.no_dead_strip	_amdgpu_cs_ib_fill
.subsections_via_symbols
