	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_dmem_migrate_vma       ## -- Begin function nouveau_dmem_migrate_vma
	.p2align	4, 0x90
_nouveau_dmem_migrate_vma:              ## @nouveau_dmem_migrate_vma
	.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	%rdx, %rbx
	subq	%rdx, %r12
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shrq	%cl, %r12
	movq	%rsi, %r14
	movq	%rdi, -104(%rbp)                ## 8-byte Spill
	movq	_SG_MAX_SINGLE_ALLOC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	callq	_min
	movq	%rax, %rdi
	movq	%rbx, -112(%rbp)                ## 8-byte Spill
	movq	%rbx, -96(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -88(%rbp)
	movups	%xmm0, -72(%rbp)
	movq	%r14, -56(%rbp)
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movl	$8, %esi
	callq	_kcalloc
	movq	%rax, -80(%rbp)
	testq	%rax, %rax
	je	LBB0_14
## %bb.1:
	movq	%rax, %r13
	movl	(%rbx), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	$8, %esi
	callq	_kcalloc
	movq	%rax, -72(%rbp)
	testq	%rax, %rax
	je	LBB0_13
## %bb.2:
	movq	%rax, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	$4, %esi
	callq	_kmalloc_array
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_12
## %bb.3:
	testq	%r12, %r12
	je	LBB0_10
## %bb.4:
	xorl	%ebx, %ebx
	leaq	-96(%rbp), %r14
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	-88(%rbp), %rax
	movq	%rax, -96(%rbp)
	addq	%r13, %rbx
	cmpq	%r12, %rbx
	jae	LBB0_10
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	_SG_MAX_SINGLE_ALLOC@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	callq	_min
	movq	%rax, %r13
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movzbl	(%rax), %ecx
	movq	%r13, %rax
	shlq	%cl, %rax
	addq	-112(%rbp), %rax                ## 8-byte Folded Reload
	movq	%rax, -88(%rbp)
	movq	%r14, %rdi
	callq	_migrate_vma_setup
	testl	%eax, %eax
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	cmpq	$0, -64(%rbp)
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	movq	%r14, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_nouveau_dmem_migrate_chunk
	jmp	LBB0_9
LBB0_10:
	xorl	%r15d, %r15d
	jmp	LBB0_11
LBB0_6:
	movl	%eax, %r15d
LBB0_11:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	movq	-72(%rbp), %r14
LBB0_12:
	movq	%r14, %rdi
	callq	_kfree
	movq	-80(%rbp), %r13
LBB0_13:
	movq	%r13, %rdi
	callq	_kfree
LBB0_14:
	movl	%r15d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_SG_MAX_SINGLE_ALLOC,4,2        ## @SG_MAX_SINGLE_ALLOC
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_dmem_migrate_vma       ; -- Begin function nouveau_dmem_migrate_vma
	.p2align	2
_nouveau_dmem_migrate_vma:              ; @nouveau_dmem_migrate_vma
	.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, x2
	mov	x22, x1
	mov	x20, x0
Lloh0:
	adrp	x26, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x26, [x26, _PAGE_SHIFT@GOTPAGEOFF]
	sub	x8, x3, x2
	ldr	x9, [x26]
	lsr	x21, x8, x9
Lloh2:
	adrp	x27, _SG_MAX_SINGLE_ALLOC@GOTPAGE
Lloh3:
	ldr	x27, [x27, _SG_MAX_SINGLE_ALLOC@GOTPAGEOFF]
	ldr	w0, [x27]
	mov	x1, x21
	bl	_min
	mov	x23, x0
	str	x19, [sp]
	movi.2d	v0, #0000000000000000
	stur	q0, [sp, #8]
	stur	q0, [sp, #24]
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	str	x22, [sp, #40]
Lloh6:
	ldr	w8, [x8]
	neg	w22, w8
Lloh7:
	adrp	x28, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x28, [x28, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x28]
	mov	w1, #8
	bl	_kcalloc
	str	x0, [sp, #16]
	cbz	x0, LBB0_14
; %bb.1:
	mov	x24, x0
	ldr	w2, [x28]
	mov	x0, x23
	mov	w1, #8
	bl	_kcalloc
	str	x0, [sp, #24]
	cbz	x0, LBB0_13
; %bb.2:
	mov	x25, x0
	ldr	w2, [x28]
	mov	x0, x23
	mov	w1, #4
	bl	_kmalloc_array
	cbz	x0, LBB0_12
; %bb.3:
	mov	x23, x0
	cbz	x21, LBB0_9
; %bb.4:
	mov	x25, #0
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #8]
	str	x8, [sp]
	add	x25, x24, x25
	cmp	x25, x21
	b.hs	LBB0_9
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x27]
	mov	x1, x21
	bl	_min
	mov	x24, x0
	ldr	x8, [x26]
	lsl	x8, x0, x8
	add	x8, x8, x19
	str	x8, [sp, #8]
	mov	x0, sp
	bl	_migrate_vma_setup
	cbnz	w0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #32]
	cbz	x8, LBB0_5
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x1, sp
	mov	x0, x20
	mov	x2, x23
	bl	_nouveau_dmem_migrate_chunk
	b	LBB0_5
LBB0_9:
	mov	w22, #0
	b	LBB0_11
LBB0_10:
	mov	x22, x0
LBB0_11:
	mov	x0, x23
	bl	_kfree
	ldr	x25, [sp, #24]
LBB0_12:
	mov	x0, x25
	bl	_kfree
	ldr	x24, [sp, #16]
LBB0_13:
	mov	x0, x24
	bl	_kfree
LBB0_14:
	mov	x0, x22
	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
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_SG_MAX_SINGLE_ALLOC,4,2        ; @SG_MAX_SINGLE_ALLOC
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
.subsections_via_symbols
