	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_svmm_bind              ## -- Begin function nouveau_svmm_bind
	.p2align	4, 0x90
_nouveau_svmm_bind:                     ## @nouveau_svmm_bind
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rdi
	movq	%rsi, %rbx
	callq	_nouveau_cli
	movq	_PAGE_MASK@GOTPCREL(%rip), %rcx
	movq	(%rbx), %rsi
	andq	(%rcx), %rsi
	movq	8(%rbx), %rdx
	movq	%rsi, (%rbx)
	andq	(%rcx), %rdx
	movq	%rdx, 8(%rbx)
	cmpq	$0, 56(%rbx)
	jne	LBB0_2
## %bb.1:
	cmpq	$0, 48(%rbx)
	jne	LBB0_2
## %bb.3:
	movq	%rax, %r14
	movl	16(%rbx), %eax
	movq	_NOUVEAU_SVM_BIND_VALID_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	testl	%ecx, %eax
	jne	LBB0_2
## %bb.4:
	cmpq	%rdx, %rsi
	jae	LBB0_2
## %bb.5:
	movq	32(%rbx), %r15
	testq	%r15, %r15
	je	LBB0_2
## %bb.6:
	movq	_NOUVEAU_SVM_BIND_COMMAND_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%eax, %edi
	sarl	%cl, %edi
	movq	_NOUVEAU_SVM_BIND_COMMAND_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %edi
	cmpl	$129, %edi
	jne	LBB0_2
## %bb.7:
	movq	_NOUVEAU_SVM_BIND_TARGET_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	movq	_NOUVEAU_SVM_BIND_TARGET_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	cmpl	$128, %eax
	jne	LBB0_2
## %bb.8:
	cmpq	$0, 40(%rbx)
	jne	LBB0_2
## %bb.9:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shlq	%cl, %r15
	leaq	(%r15,%rsi), %rax
	cmpq	%rsi, %rax
	jbe	LBB0_2
## %bb.10:
	cmpq	%rdx, %rax
	jbe	LBB0_11
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	_current@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_task_mm
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_down_read
	movq	(%rbx), %r13
	addq	%r13, %r15
	cmpq	%r15, %r13
	jae	LBB0_15
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movq	%r15, %rdx
	callq	_find_vma_intersection
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%rax, %r12
	movl	(%rax), %edi
	movq	%r15, %rsi
	callq	_min
	movq	%r13, %rdx
	movq	%rax, %r13
	movl	(%r14), %edi
	movq	%r12, %rsi
	movq	%rax, %rcx
	callq	_nouveau_dmem_migrate_vma
	movq	%r13, %rax
	cmpq	%r15, %r13
	jb	LBB0_13
LBB0_15:
	movq	$0, 24(%rbx)
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	callq	_up_read
	movq	%rbx, %rdi
	callq	_mmput
	xorl	%eax, %eax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_MASK,8,3                  ## @PAGE_MASK
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NOUVEAU_SVM_BIND_VALID_MASK,4,2 ## @NOUVEAU_SVM_BIND_VALID_MASK
	.comm	_NOUVEAU_SVM_BIND_COMMAND_SHIFT,4,2 ## @NOUVEAU_SVM_BIND_COMMAND_SHIFT
	.comm	_NOUVEAU_SVM_BIND_COMMAND_MASK,4,2 ## @NOUVEAU_SVM_BIND_COMMAND_MASK
	.comm	_NOUVEAU_SVM_BIND_PRIORITY_SHIFT,4,2 ## @NOUVEAU_SVM_BIND_PRIORITY_SHIFT
	.comm	_NOUVEAU_SVM_BIND_PRIORITY_MASK,4,2 ## @NOUVEAU_SVM_BIND_PRIORITY_MASK
	.comm	_NOUVEAU_SVM_BIND_TARGET_SHIFT,4,2 ## @NOUVEAU_SVM_BIND_TARGET_SHIFT
	.comm	_NOUVEAU_SVM_BIND_TARGET_MASK,4,2 ## @NOUVEAU_SVM_BIND_TARGET_MASK
	.comm	_PAGE_SHIFT,8,3                 ## @PAGE_SHIFT
	.comm	_current,4,2                    ## @current
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_svmm_bind              ; -- Begin function nouveau_svmm_bind
	.p2align	2
_nouveau_svmm_bind:                     ; @nouveau_svmm_bind
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x0, x2
	mov	x19, x1
	bl	_nouveau_cli
Lloh0:
	adrp	x8, _PAGE_MASK@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_MASK@GOTPAGEOFF]
	ldr	x9, [x8]
	ldp	x10, x11, [x19]
	and	x9, x10, x9
	str	x9, [x19]
	ldr	x8, [x8]
	and	x8, x11, x8
	str	x8, [x19, #8]
	ldr	x10, [x19, #56]
	cbnz	x10, LBB0_10
; %bb.1:
	ldr	x10, [x19, #48]
	cbnz	x10, LBB0_10
; %bb.2:
	ldr	w11, [x19, #16]
Lloh2:
	adrp	x10, _NOUVEAU_SVM_BIND_VALID_MASK@GOTPAGE
Lloh3:
	ldr	x10, [x10, _NOUVEAU_SVM_BIND_VALID_MASK@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x10]
	bics	wzr, w11, w10
	b.ne	LBB0_10
; %bb.3:
	cmp	x9, x8
	b.hs	LBB0_10
; %bb.4:
	ldr	x10, [x19, #32]
	cbz	x10, LBB0_10
; %bb.5:
Lloh5:
	adrp	x12, _NOUVEAU_SVM_BIND_COMMAND_SHIFT@GOTPAGE
Lloh6:
	ldr	x12, [x12, _NOUVEAU_SVM_BIND_COMMAND_SHIFT@GOTPAGEOFF]
Lloh7:
	ldr	w12, [x12]
	asr	w12, w11, w12
Lloh8:
	adrp	x13, _NOUVEAU_SVM_BIND_COMMAND_MASK@GOTPAGE
Lloh9:
	ldr	x13, [x13, _NOUVEAU_SVM_BIND_COMMAND_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w13, [x13]
	and	w12, w12, w13
	cmp	w12, #129
	b.ne	LBB0_10
; %bb.6:
Lloh11:
	adrp	x12, _NOUVEAU_SVM_BIND_TARGET_SHIFT@GOTPAGE
Lloh12:
	ldr	x12, [x12, _NOUVEAU_SVM_BIND_TARGET_SHIFT@GOTPAGEOFF]
Lloh13:
	ldr	w12, [x12]
	asr	w11, w11, w12
Lloh14:
	adrp	x12, _NOUVEAU_SVM_BIND_TARGET_MASK@GOTPAGE
Lloh15:
	ldr	x12, [x12, _NOUVEAU_SVM_BIND_TARGET_MASK@GOTPAGEOFF]
Lloh16:
	ldr	w12, [x12]
	and	w11, w11, w12
	cmp	w11, #128
	b.ne	LBB0_10
; %bb.7:
	ldr	x11, [x19, #40]
	cbnz	x11, LBB0_10
; %bb.8:
Lloh17:
	adrp	x11, _PAGE_SHIFT@GOTPAGE
Lloh18:
	ldr	x11, [x11, _PAGE_SHIFT@GOTPAGEOFF]
Lloh19:
	ldr	x11, [x11]
	lsl	x22, x10, x11
	add	x10, x22, x9
	cmp	x10, x9
	b.ls	LBB0_10
; %bb.9:
	cmp	x10, x8
	b.ls	LBB0_12
LBB0_10:
Lloh20:
	adrp	x8, _EINVAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	x20, x0
Lloh23:
	adrp	x8, _current@GOTPAGE
Lloh24:
	ldr	x8, [x8, _current@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	bl	_get_task_mm
	mov	x21, x0
	bl	_down_read
	ldr	x23, [x19]
	add	x22, x23, x22
	cmp	x23, x22
	b.hs	LBB0_15
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	mov	x1, x23
	mov	x2, x22
	bl	_find_vma_intersection
	cbz	x0, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	mov	x24, x0
	ldr	w0, [x0]
	mov	x1, x22
	bl	_min
	mov	x25, x0
	ldr	w0, [x20]
	mov	x1, x24
	mov	x2, x23
	mov	x3, x25
	bl	_nouveau_dmem_migrate_vma
	mov	x23, x25
	cmp	x25, x22
	b.lo	LBB0_13
LBB0_15:
	str	xzr, [x19, #24]
	mov	x0, x21
	bl	_up_read
	mov	x0, x21
	bl	_mmput
	mov	w0, #0
	b	LBB0_11
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_MASK,8,3                  ; @PAGE_MASK
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NOUVEAU_SVM_BIND_VALID_MASK,4,2 ; @NOUVEAU_SVM_BIND_VALID_MASK
	.comm	_NOUVEAU_SVM_BIND_COMMAND_SHIFT,4,2 ; @NOUVEAU_SVM_BIND_COMMAND_SHIFT
	.comm	_NOUVEAU_SVM_BIND_COMMAND_MASK,4,2 ; @NOUVEAU_SVM_BIND_COMMAND_MASK
	.comm	_NOUVEAU_SVM_BIND_PRIORITY_SHIFT,4,2 ; @NOUVEAU_SVM_BIND_PRIORITY_SHIFT
	.comm	_NOUVEAU_SVM_BIND_PRIORITY_MASK,4,2 ; @NOUVEAU_SVM_BIND_PRIORITY_MASK
	.comm	_NOUVEAU_SVM_BIND_TARGET_SHIFT,4,2 ; @NOUVEAU_SVM_BIND_TARGET_SHIFT
	.comm	_NOUVEAU_SVM_BIND_TARGET_MASK,4,2 ; @NOUVEAU_SVM_BIND_TARGET_MASK
	.comm	_PAGE_SHIFT,8,3                 ; @PAGE_SHIFT
	.comm	_current,4,2                    ; @current
.subsections_via_symbols
