	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdma_v4_0_ring_test_ib
_sdma_v4_0_ring_test_ib:                ## @sdma_v4_0_ring_test_ib
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	(%rdi), %r12
	movq	$0, -72(%rbp)
	leaq	-44(%rbp), %rsi
	movq	%r12, %rdi
	callq	_amdgpu_device_wb_get
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_13
## %bb.1:
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	movq	8(%r12), %r13
	movl	-44(%rbp), %r14d
	movl	$-889266515, %edi               ## imm = 0xCAFEDEAD
	callq	_cpu_to_le32
	movq	(%r12), %rcx
	movl	-44(%rbp), %edx
	movl	%eax, (%rcx,%rdx,4)
	leaq	-64(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$16, %edx
	callq	_memset
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$256, %edx                      ## imm = 0x100
	movq	%rbx, %rcx
	callq	_amdgpu_ib_get
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_12
## %bb.2:
	shll	$2, %r14d
	addq	%r14, %r13
	movq	_SDMA_OP_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_SDMA_PKT_HEADER_OP
	movl	%eax, %ebx
	movq	_SDMA_SUBOP_WRITE_LINEAR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_SDMA_PKT_HEADER_SUB_OP
	orl	%ebx, %eax
	movq	-64(%rbp), %rcx
	movl	%eax, (%rcx)
	movq	%r13, %rdi
	callq	_lower_32_bits
	movq	-64(%rbp), %rcx
	movl	%eax, 4(%rcx)
	movq	%r13, %rdi
	callq	_upper_32_bits
	movq	-64(%rbp), %rcx
	movl	%eax, 8(%rcx)
	xorl	%edi, %edi
	callq	_SDMA_PKT_WRITE_UNTILED_DW_3_COUNT
	movq	-64(%rbp), %rcx
	movl	%eax, 12(%rcx)
	movl	$-559038737, 16(%rcx)           ## imm = 0xDEADBEEF
	movq	_SDMA_OP_NOP@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_SDMA_PKT_NOP_HEADER_OP
	movq	-64(%rbp), %rcx
	movl	%eax, 20(%rcx)
	movl	(%rbx), %edi
	callq	_SDMA_PKT_NOP_HEADER_OP
	movq	-64(%rbp), %rcx
	movl	%eax, 24(%rcx)
	movl	(%rbx), %edi
	callq	_SDMA_PKT_NOP_HEADER_OP
	movq	-64(%rbp), %rcx
	movl	%eax, 28(%rcx)
	movl	$8, -56(%rbp)
	leaq	-64(%rbp), %rdx
	leaq	-72(%rbp), %r8
	movq	%r15, %rdi
	movl	$1, %esi
	xorl	%ecx, %ecx
	callq	_amdgpu_ib_schedule
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_11
## %bb.3:
	movq	-72(%rbp), %rdi
	xorl	%esi, %esi
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	callq	_dma_fence_wait_timeout
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	js	LBB0_6
## %bb.7:
	movq	(%r12), %rax
	movl	-44(%rbp), %ecx
	movl	(%rax,%rcx,4), %edi
	callq	_le32_to_cpu
	cmpl	$-559038737, %eax               ## imm = 0xDEADBEEF
	jne	LBB0_9
## %bb.8:
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_4:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_6:
	movq	%rax, %rbx
	jmp	LBB0_11
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_10:
	xorl	%ebx, %ebx
	subq	(%rax), %rbx
LBB0_11:
	leaq	-64(%rbp), %rsi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_amdgpu_ib_free
	movq	-72(%rbp), %rdi
	callq	_dma_fence_put
LBB0_12:
	movl	-44(%rbp), %esi
	movq	%r12, %rdi
	callq	_amdgpu_device_wb_free
LBB0_13:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SDMA_OP_WRITE,4,2              ## @SDMA_OP_WRITE
	.comm	_SDMA_SUBOP_WRITE_LINEAR,4,2    ## @SDMA_SUBOP_WRITE_LINEAR
	.comm	_SDMA_OP_NOP,4,2                ## @SDMA_OP_NOP
	.comm	_ETIMEDOUT,8,3                  ## @ETIMEDOUT
	.comm	_EINVAL,8,3                     ## @EINVAL
	.no_dead_strip	_sdma_v4_0_ring_test_ib
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdma_v4_0_ring_test_ib
_sdma_v4_0_ring_test_ib:                ; @sdma_v4_0_ring_test_ib
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x20, x1
	mov	x21, x0
	ldr	x19, [x0]
	str	xzr, [sp, #8]
	add	x1, sp, #4
	mov	x0, x19
	bl	_amdgpu_device_wb_get
	mov	x22, x0
	cbnz	x0, LBB0_12
; %bb.1:
	ldr	x23, [x19, #8]
	ldr	w25, [sp, #4]
	mov	w0, #57005
	movk	w0, #51966, lsl #16
	bl	_cpu_to_le32
	ldr	x8, [x19]
	ldr	w9, [sp, #4]
	str	w0, [x8, x9, lsl #2]
	add	x0, sp, #16
	mov	w1, #0
	mov	w2, #16
	bl	_memset
	add	x3, sp, #16
	mov	x0, x19
	mov	x1, #0
	mov	w2, #256
	bl	_amdgpu_ib_get
	mov	x22, x0
	cbnz	x0, LBB0_11
; %bb.2:
	mov	w24, #48879
	movk	w24, #57005, lsl #16
	lsl	w8, w25, #2
	add	x22, x23, x8
Lloh0:
	adrp	x8, _SDMA_OP_WRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SDMA_OP_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_SDMA_PKT_HEADER_OP
	mov	x23, x0
Lloh3:
	adrp	x8, _SDMA_SUBOP_WRITE_LINEAR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SDMA_SUBOP_WRITE_LINEAR@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
	bl	_SDMA_PKT_HEADER_SUB_OP
	orr	w8, w0, w23
	ldr	x9, [sp, #16]
	str	w8, [x9]
	mov	x0, x22
	bl	_lower_32_bits
	ldr	x8, [sp, #16]
	str	w0, [x8, #4]
	mov	x0, x22
	bl	_upper_32_bits
	ldr	x8, [sp, #16]
	str	w0, [x8, #8]
	mov	w0, #0
	bl	_SDMA_PKT_WRITE_UNTILED_DW_3_COUNT
	ldr	x8, [sp, #16]
	stp	w0, w24, [x8, #12]
Lloh6:
	adrp	x22, _SDMA_OP_NOP@GOTPAGE
Lloh7:
	ldr	x22, [x22, _SDMA_OP_NOP@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_SDMA_PKT_NOP_HEADER_OP
	ldr	x8, [sp, #16]
	str	w0, [x8, #20]
	ldr	w0, [x22]
	bl	_SDMA_PKT_NOP_HEADER_OP
	ldr	x8, [sp, #16]
	str	w0, [x8, #24]
	ldr	w0, [x22]
	bl	_SDMA_PKT_NOP_HEADER_OP
	ldr	x8, [sp, #16]
	str	w0, [x8, #28]
	mov	w8, #8
	str	w8, [sp, #24]
	add	x2, sp, #16
	add	x4, sp, #8
	mov	x0, x21
	mov	w1, #1
	mov	x3, #0
	bl	_amdgpu_ib_schedule
	mov	x22, x0
	cbnz	x0, LBB0_10
; %bb.3:
	ldr	x0, [sp, #8]
	mov	w1, #0
	mov	x2, x20
	bl	_dma_fence_wait_timeout
	cbz	x0, LBB0_7
; %bb.4:
	mov	x22, x0
	tbnz	x0, #63, LBB0_10
; %bb.5:
	ldr	x8, [x19]
	ldr	w9, [sp, #4]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le32_to_cpu
	cmp	w0, w24
	b.ne	LBB0_8
; %bb.6:
	mov	x22, #0
	b	LBB0_10
LBB0_7:
Lloh8:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	x8, [x8]
	neg	x22, x8
LBB0_10:
	add	x1, sp, #16
	mov	x0, x19
	mov	x2, #0
	bl	_amdgpu_ib_free
	ldr	x0, [sp, #8]
	bl	_dma_fence_put
LBB0_11:
	ldr	w1, [sp, #4]
	mov	x0, x19
	bl	_amdgpu_device_wb_free
LBB0_12:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_SDMA_OP_WRITE,4,2              ; @SDMA_OP_WRITE
	.comm	_SDMA_SUBOP_WRITE_LINEAR,4,2    ; @SDMA_SUBOP_WRITE_LINEAR
	.comm	_SDMA_OP_NOP,4,2                ; @SDMA_OP_NOP
	.comm	_ETIMEDOUT,8,3                  ; @ETIMEDOUT
	.comm	_EINVAL,8,3                     ; @EINVAL
	.no_dead_strip	_sdma_v4_0_ring_test_ib
.subsections_via_symbols
