	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rv770_copy_dma                 ## -- Begin function rv770_copy_dma
	.p2align	4, 0x90
_rv770_copy_dma:                        ## @rv770_copy_dma
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -80(%rbp)                  ## 8-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %r14d
	movl	%esi, %r13d
	movq	%rdi, %r15
	movq	$0, -48(%rbp)
	movq	8(%rdi), %rax
	movslq	(%rax), %r12
	shlq	$2, %r12
	addq	(%rdi), %r12
	leaq	-48(%rbp), %rsi
	callq	_radeon_semaphore_create
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%eax, %ebx
	callq	_DRM_ERROR
	movl	%ebx, %eax
	jmp	LBB0_13
LBB0_2:
	movq	_RADEON_GPU_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %ebx
	shrl	$2, %ebx
	movl	%ebx, %edi
	movl	$65535, %esi                    ## imm = 0xFFFF
	callq	_DIV_ROUND_UP
	movq	%r15, %rdi
	movl	%eax, %r15d
	leal	(%r15,%r15,4), %edx
	addl	$8, %edx
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, %rsi
	callq	_radeon_ring_lock
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%eax, %ebx
	callq	_DRM_ERROR
	leaq	-48(%rbp), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%edx, %edx
	callq	_radeon_semaphore_free
	movl	%ebx, %eax
	jmp	LBB0_13
LBB0_4:
	movl	%ebx, -68(%rbp)                 ## 4-byte Spill
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %r13
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	(%r15), %rdi
	movl	(%r12), %esi
	callq	_radeon_fence_need_sync
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movq	-48(%rbp), %rsi
	movq	(%r15), %rax
	movl	(%rax), %edx
	movl	(%r12), %ecx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_radeon_semaphore_sync_rings
	movq	(%r15), %rdi
	movq	%r12, %rbx
	movl	(%r12), %esi
	callq	_radeon_fence_note_sync
	jmp	LBB0_7
LBB0_6:
	movq	%r12, %rbx
	leaq	-48(%rbp), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%edx, %edx
	callq	_radeon_semaphore_free
LBB0_7:
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movq	%r13, %rax
	testl	%eax, %eax
	movq	%r14, %r13
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movl	-68(%rbp), %r14d                ## 4-byte Reload
	jle	LBB0_10
## %bb.8:
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	cmpl	$65535, %r14d                   ## imm = 0xFFFF
	movl	$65535, %r12d                   ## imm = 0xFFFF
	cmovll	%r14d, %r12d
	subl	%r12d, %r14d
	movq	_DMA_PACKET_COPY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	movl	%r12d, %ecx
	callq	_DMA_PACKET
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_radeon_ring_write
	movl	%r13d, %esi
	andl	$-4, %esi
	movq	%rbx, %rdi
	callq	_radeon_ring_write
	movl	%r15d, %esi
	andl	$-4, %esi
	movq	%rbx, %rdi
	callq	_radeon_ring_write
	movl	%r13d, %edi
	callq	_upper_32_bits
	movzbl	%al, %esi
	movq	%rbx, %rdi
	callq	_radeon_ring_write
	movl	%r15d, %edi
	callq	_upper_32_bits
	movzbl	%al, %esi
	movq	%rbx, %rdi
	callq	_radeon_ring_write
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leal	(%r15,%r12,4), %r15d
	leal	(%r13,%r12,4), %r13d
	decl	%eax
	jne	LBB0_9
LBB0_10:
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %edx
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	callq	_radeon_fence_emit
	testl	%eax, %eax
	movq	%rbx, %rsi
	je	LBB0_12
## %bb.11:
	movq	%r15, %rdi
	movl	%eax, %ebx
	callq	_radeon_ring_unlock_undo
	movl	%ebx, %eax
	jmp	LBB0_13
LBB0_12:
	movq	%r15, %rdi
	callq	_radeon_ring_unlock_commit
	movq	(%r14), %rdx
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	callq	_radeon_semaphore_free
	xorl	%eax, %eax
LBB0_13:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"radeon: moving bo (%d).\n"

	.comm	_RADEON_GPU_PAGE_SHIFT,4,2      ## @RADEON_GPU_PAGE_SHIFT
	.comm	_DMA_PACKET_COPY,4,2            ## @DMA_PACKET_COPY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rv770_copy_dma                 ; -- Begin function rv770_copy_dma
	.p2align	2
_rv770_copy_dma:                        ; @rv770_copy_dma
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x4
	mov	x24, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	str	xzr, [sp, #8]
	ldp	x21, x8, [x0]
	ldrsw	x25, [x8]
	add	x1, sp, #8
	bl	_radeon_semaphore_create
	cbz	w0, LBB0_2
; %bb.1:
	mov	x26, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x26
	bl	_DRM_ERROR
	b	LBB0_12
LBB0_2:
	add	x21, x21, x25, lsl #2
Lloh2:
	adrp	x8, _RADEON_GPU_PAGE_SHIFT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RADEON_GPU_PAGE_SHIFT@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	lsl	w8, w24, w8
	lsr	w24, w8, #2
	mov	x0, x24
	mov	w1, #65535
	bl	_DIV_ROUND_UP
	mov	x25, x0
	add	w8, w0, w0, lsl #2
	add	w2, w8, #8
	mov	x0, x19
	mov	x1, x21
	bl	_radeon_ring_lock
	cbz	w0, LBB0_5
; %bb.3:
	mov	x26, x0
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x26
	bl	_DRM_ERROR
	add	x1, sp, #8
	mov	x0, x19
	mov	x2, #0
LBB0_4:
	bl	_radeon_semaphore_free
	b	LBB0_12
LBB0_5:
	ldr	x0, [x20]
	ldr	w1, [x21]
	bl	_radeon_fence_need_sync
	cbz	x0, LBB0_7
; %bb.6:
	ldr	x1, [sp, #8]
	ldr	x8, [x20]
	ldr	w2, [x8]
	ldr	w3, [x21]
	mov	x0, x19
	bl	_radeon_semaphore_sync_rings
	ldr	x0, [x20]
	ldr	w1, [x21]
	bl	_radeon_fence_note_sync
	cmp	w25, #1
	b.ge	LBB0_8
	b	LBB0_10
LBB0_7:
	add	x1, sp, #8
	mov	x0, x19
	mov	x2, #0
	bl	_radeon_semaphore_free
	cmp	w25, #1
	b.lt	LBB0_10
LBB0_8:
	mov	w27, #65535
Lloh7:
	adrp	x28, _DMA_PACKET_COPY@GOTPAGE
Lloh8:
	ldr	x28, [x28, _DMA_PACKET_COPY@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w24, w27
	csel	w26, w24, w27, lt
	sub	w24, w24, w26
	ldr	w0, [x28]
	mov	w1, #0
	mov	w2, #0
	mov	x3, x26
	bl	_DMA_PACKET
	mov	x1, x0
	mov	x0, x21
	bl	_radeon_ring_write
	and	w1, w22, #0xfffffffc
	mov	x0, x21
	bl	_radeon_ring_write
	and	w1, w23, #0xfffffffc
	mov	x0, x21
	bl	_radeon_ring_write
	mov	x0, x22
	bl	_upper_32_bits
	and	w1, w0, #0xff
	mov	x0, x21
	bl	_radeon_ring_write
	mov	x0, x23
	bl	_upper_32_bits
	and	w1, w0, #0xff
	mov	x0, x21
	bl	_radeon_ring_write
	lsl	w8, w26, #2
	add	w23, w8, w23
	add	w22, w8, w22
	subs	w25, w25, #1
	b.ne	LBB0_9
LBB0_10:
	ldr	w2, [x21]
	mov	x0, x19
	mov	x1, x20
	bl	_radeon_fence_emit
	mov	x26, x0
	cbz	w0, LBB0_13
; %bb.11:
	mov	x0, x19
	mov	x1, x21
	bl	_radeon_ring_unlock_undo
LBB0_12:
	mov	x0, x26
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_13:
	mov	x0, x19
	mov	x1, x21
	bl	_radeon_ring_unlock_commit
	ldr	x2, [x20]
	add	x1, sp, #8
	mov	x0, x19
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"radeon: moving bo (%d).\n"

	.comm	_RADEON_GPU_PAGE_SHIFT,4,2      ; @RADEON_GPU_PAGE_SHIFT
	.comm	_DMA_PACKET_COPY,4,2            ; @DMA_PACKET_COPY
.subsections_via_symbols
