	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nouveau_dmem_migrate_chunk
_nouveau_dmem_migrate_chunk:            ## @nouveau_dmem_migrate_chunk
	.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	%rsi, %r13
	movq	%rdi, %r15
	movq	(%rsi), %r12
	cmpq	8(%rsi), %r12
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	jae	LBB0_1
## %bb.2:
	xorl	%r14d, %r14d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	24(%r13), %rax
	movl	(%rax,%r14), %esi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rdx
	movq	%r15, %rdi
	callq	_nouveau_dmem_migrate_copy_one
	movq	16(%r13), %rcx
	movq	%rax, (%rcx,%r14,2)
	cmpq	$1, %rax
	sbbq	$-1, %rbx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	addq	(%rax), %r12
	addq	$4, %r14
	cmpq	8(%r13), %r12
	jb	LBB0_3
	jmp	LBB0_4
LBB0_1:
	xorl	%ebx, %ebx
LBB0_4:
	movq	8(%r15), %rax
	movl	(%rax), %edi
	leaq	-56(%rbp), %r12
	xorl	%esi, %esi
	movq	%r12, %rdx
	callq	_nouveau_fence_new
	movq	%r13, %rdi
	callq	_migrate_vma_pages
	movq	%r12, %rdi
	callq	_nouveau_dmem_fence_done
	testq	%rbx, %rbx
	je	LBB0_7
## %bb.5:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r14
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	movl	(%rax), %edi
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	-4(%rax,%rbx,4), %esi
	decq	%rbx
	movq	(%r14), %rdx
	movl	(%r12), %ecx
	callq	_dma_unmap_page
	testq	%rbx, %rbx
	jne	LBB0_6
LBB0_7:
	movq	%r13, %rdi
	callq	_migrate_vma_finalize
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
	.no_dead_strip	_nouveau_dmem_migrate_chunk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nouveau_dmem_migrate_chunk
_nouveau_dmem_migrate_chunk:            ; @nouveau_dmem_migrate_chunk
	.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	x21, x2
	mov	x19, x1
	mov	x20, x0
	ldp	x24, x8, [x1]
Lloh0:
	adrp	x22, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PAGE_SIZE@GOTPAGEOFF]
	cmp	x24, x8
	b.hs	LBB0_3
; %bb.1:
	mov	x25, #0
	mov	x26, #0
	mov	x23, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #24]
	ldr	w1, [x8, x26]
	add	x2, x21, x23, lsl #2
	mov	x0, x20
	bl	_nouveau_dmem_migrate_copy_one
	ldr	x8, [x19, #16]
	str	x0, [x8, x25]
	cmp	x0, #0
	cinc	x23, x23, ne
	ldr	x8, [x22]
	ldr	x9, [x19, #8]
	add	x26, x26, #4
	add	x25, x25, #8
	add	x24, x8, x24
	cmp	x24, x9
	b.lo	LBB0_2
	b	LBB0_4
LBB0_3:
	mov	x23, #0
LBB0_4:
	ldr	x8, [x20, #8]
	ldr	w0, [x8]
	add	x2, sp, #8
	mov	w1, #0
	bl	_nouveau_fence_new
	mov	x0, x19
	bl	_migrate_vma_pages
	add	x0, sp, #8
	bl	_nouveau_dmem_fence_done
	cbz	x23, LBB0_7
; %bb.5:
	sub	x21, x21, #4
Lloh2:
	adrp	x24, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh3:
	ldr	x24, [x24, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	x25, x23, #1
	ldr	x8, [x20]
	ldr	w0, [x8]
	ldr	w1, [x21, x23, lsl #2]
	ldr	x2, [x22]
	ldr	w3, [x24]
	bl	_dma_unmap_page
	mov	x23, x25
	cbnz	x25, LBB0_6
LBB0_7:
	mov	x0, x19
	bl	_migrate_vma_finalize
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
	.no_dead_strip	_nouveau_dmem_migrate_chunk
.subsections_via_symbols
