	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_copy_buffer             ## -- Begin function amdgpu_copy_buffer
	.p2align	4, 0x90
_amdgpu_copy_buffer:                    ## @amdgpu_copy_buffer
	.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	%rcx, %r12
	movq	8(%rdi), %r13
	cmpl	$0, 16(%rbp)
	je	LBB0_3
## %bb.1:
	cmpl	$0, (%rdi)
	je	LBB0_2
LBB0_3:
	movl	%esi, -60(%rbp)                 ## 4-byte Spill
	movl	%edx, -64(%rbp)                 ## 4-byte Spill
	movq	%r8, -96(%rbp)                  ## 8-byte Spill
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	movq	%r9, -72(%rbp)                  ## 8-byte Spill
	movq	8(%r13), %rax
	movq	8(%rax), %rsi
	movq	%r12, %rdi
	movq	%rsi, %r14
	callq	_DIV_ROUND_UP
	movl	%eax, %r15d
	movq	8(%r13), %rax
	movl	(%rax), %eax
	imull	%r15d, %eax
	movl	%eax, %ebx
	negl	%ebx
	andl	$7, %ebx
	addl	%eax, %ebx
	leal	(,%rbx,4), %esi
	leaq	-48(%rbp), %rdx
	movq	%r13, %rdi
	callq	_amdgpu_job_alloc_with_ib
	testl	%eax, %eax
	jne	LBB0_18
## %bb.4:
	movq	%r14, -104(%rbp)                ## 8-byte Spill
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	cmpl	$0, 24(%rbp)
	je	LBB0_6
## %bb.5:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	16(%rax), %edi
	callq	_amdgpu_gmc_pd_addr
	movq	-48(%rbp), %rcx
	movl	%eax, 20(%rcx)
	movl	$1, (%rcx)
LBB0_6:
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	testq	%rdx, %rdx
	je	LBB0_11
## %bb.7:
	movq	-48(%rbp), %rsi
	addq	$16, %rsi
	movq	_AMDGPU_FENCE_OWNER_UNDEFINED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%r8d, %r8d
	callq	_amdgpu_sync_resv
	testl	%eax, %eax
	je	LBB0_11
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %ebx
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_9
LBB0_2:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	movl	%ebx, %eax
	jmp	LBB0_18
LBB0_11:
	testl	%r15d, %r15d
	movl	-64(%rbp), %r13d                ## 4-byte Reload
	movl	-60(%rbp), %r14d                ## 4-byte Reload
	je	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	callq	_min
	movq	%rax, %rbx
	movq	-48(%rbp), %rax
	movq	8(%rax), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %edx
	movl	%r13d, %ecx
	movq	%rbx, %r8
	callq	_amdgpu_emit_copy_buffer
	addl	%ebx, %r14d
	addl	%ebx, %r13d
	subq	%rbx, %r12
	decl	%r15d
	jne	LBB0_12
LBB0_13:
	movq	-48(%rbp), %rax
	movq	8(%rax), %rsi
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_amdgpu_ring_pad_ib
	movq	-48(%rbp), %rax
	movq	8(%rax), %rax
	xorl	%edi, %edi
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	cmpl	%ecx, (%rax)
	seta	%dil
	callq	_WARN_ON
	movq	-48(%rbp), %rdi
	cmpl	$0, 16(%rbp)
	je	LBB0_15
## %bb.14:
	movq	%rbx, %rsi
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	callq	_amdgpu_job_submit_direct
	jmp	LBB0_16
LBB0_15:
	movq	_AMDGPU_FENCE_OWNER_UNDEFINED@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	callq	_amdgpu_job_submit
LBB0_16:
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_17
LBB0_9:
	movq	-48(%rbp), %rdi
	callq	_amdgpu_job_free
	leaq	L_.str.2(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movl	%ebx, %eax
	jmp	LBB0_18
LBB0_17:
	xorl	%eax, %eax
LBB0_18:
	addq	$72, %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	"Trying to move memory with ring turned off.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AMDGPU_FENCE_OWNER_UNDEFINED,4,2 ## @AMDGPU_FENCE_OWNER_UNDEFINED
L_.str.1:                               ## @.str.1
	.asciz	"sync failed (%d).\n"

L_.str.2:                               ## @.str.2
	.asciz	"Error scheduling IBs (%d)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_copy_buffer             ; -- Begin function amdgpu_copy_buffer
	.p2align	2
_amdgpu_copy_buffer:                    ; @amdgpu_copy_buffer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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, x7
	mov	x23, x3
	mov	x24, x2
	mov	x25, x1
	mov	x22, x0
	ldr	x20, [x0, #8]
	cbz	w6, LBB0_2
; %bb.1:
	ldr	w8, [x22]
	cbz	w8, LBB0_8
LBB0_2:
	stp	x5, x4, [sp, #24]               ; 16-byte Folded Spill
	str	w6, [sp, #20]                   ; 4-byte Folded Spill
	ldr	x8, [x20, #8]
	ldr	x26, [x8, #8]
	mov	x0, x23
	mov	x1, x26
	bl	_DIV_ROUND_UP
	mov	x27, x0
	ldr	x8, [x20, #8]
	ldr	w8, [x8]
	mneg	w9, w8, w0
	and	w9, w9, #0x7
	madd	w28, w8, w0, w9
	lsl	w1, w28, #2
	add	x2, sp, #40
	mov	x0, x20
	bl	_amdgpu_job_alloc_with_ib
	mov	x21, x0
	cbnz	w0, LBB0_14
; %bb.3:
	str	w28, [sp, #16]                  ; 4-byte Folded Spill
	cbz	w19, LBB0_5
; %bb.4:
	ldr	w0, [x20, #16]
	bl	_amdgpu_gmc_pd_addr
	ldr	x8, [sp, #40]
	str	w0, [x8, #20]
	mov	w9, #1
	str	w9, [x8]
LBB0_5:
	ldr	x2, [sp, #32]                   ; 8-byte Folded Reload
	cbz	x2, LBB0_9
; %bb.6:
	ldr	x8, [sp, #40]
	add	x1, x8, #16
Lloh0:
	adrp	x8, _AMDGPU_FENCE_OWNER_UNDEFINED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AMDGPU_FENCE_OWNER_UNDEFINED@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x0, x20
	mov	w4, #0
	bl	_amdgpu_sync_resv
	cbz	w0, LBB0_9
; %bb.7:
	mov	x21, x0
	str	x21, [sp]
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_13
LBB0_8:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_14
LBB0_9:
	cbz	w27, LBB0_11
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x23
	mov	x1, x26
	bl	_min
	mov	x19, x0
	ldr	x8, [sp, #40]
	ldr	x1, [x8, #8]
	mov	x0, x20
	mov	x2, x25
	mov	x3, x24
	mov	x4, x19
	bl	_amdgpu_emit_copy_buffer
	add	w25, w25, w19
	add	w24, w24, w19
	sub	x23, x23, x19
	subs	w27, w27, #1
	b.ne	LBB0_10
LBB0_11:
	ldr	x8, [sp, #40]
	ldr	x1, [x8, #8]
	mov	x0, x22
	bl	_amdgpu_ring_pad_ib
	ldr	x8, [sp, #40]
	ldr	x8, [x8, #8]
	ldr	w8, [x8]
	ldr	w9, [sp, #16]                   ; 4-byte Folded Reload
	cmp	w8, w9
	cset	w0, hi
	bl	_WARN_ON
	ldr	x0, [sp, #40]
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	cbz	w8, LBB0_15
; %bb.12:
	mov	x1, x22
	ldr	x2, [sp, #24]                   ; 8-byte Folded Reload
	bl	_amdgpu_job_submit_direct
	mov	x21, x0
	cbz	w0, LBB0_14
LBB0_13:
	ldr	x0, [sp, #40]
	bl	_amdgpu_job_free
	str	x21, [sp]
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_ERROR
LBB0_14:
	mov	x0, x21
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_15:
Lloh12:
	adrp	x8, _AMDGPU_FENCE_OWNER_UNDEFINED@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AMDGPU_FENCE_OWNER_UNDEFINED@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x1, x20
	ldr	x3, [sp, #24]                   ; 8-byte Folded Reload
	bl	_amdgpu_job_submit
	mov	x21, x0
	cbnz	w0, LBB0_13
	b	LBB0_14
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Trying to move memory with ring turned off.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AMDGPU_FENCE_OWNER_UNDEFINED,4,2 ; @AMDGPU_FENCE_OWNER_UNDEFINED
l_.str.1:                               ; @.str.1
	.asciz	"sync failed (%d).\n"

l_.str.2:                               ; @.str.2
	.asciz	"Error scheduling IBs (%d)\n"

.subsections_via_symbols
