	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvkm_vmm_map_locked
_nvkm_vmm_map_locked:                   ## @nvkm_vmm_map_locked
	.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	%r8, %rbx
	movl	%ecx, %r12d
	movq	%rdx, %r13
	movq	%rsi, %r14
	movq	%rdi, %r15
	movl	16(%r8), %edi
	callq	_nvkm_memory_size
	movslq	(%rbx), %rcx
	addq	(%r14), %rcx
	xorl	%edi, %edi
	cmpq	%rcx, %rax
	setl	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movl	16(%rbx), %edi
	callq	_nvkm_memory_size
	movl	(%rbx), %ecx
	movl	(%r14), %r8d
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	xorl	%r15d, %r15d
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_VMM_DEBUG
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_26:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	8(%r14), %rax
	movq	16(%r14), %rcx
	movq	_NVKM_VMA_PAGE_NONE@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmpq	%rdx, %rax
	jne	LBB0_7
## %bb.3:
	cmpq	%rax, %rcx
	jne	LBB0_7
## %bb.4:
	movl	%r12d, %ecx
	movq	%r15, %r12
	movl	16(%r15), %r15d
	movl	$0, 16(%r12)
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, %r8
	callq	_nvkm_vmm_map_choose
	movl	%r15d, 16(%r12)
	testl	%eax, %eax
	je	LBB0_9
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_VMM_DEBUG
	movq	%r12, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movq	%rbx, %r8
	callq	_nvkm_vmm_map_choose
	jmp	LBB0_6
LBB0_7:
	cmpq	%rdx, %rcx
	movq	8(%r15), %rdx
	cmovneq	%rcx, %rax
	shlq	$3, %rax
	addq	(%rdx), %rax
	movq	%rax, 24(%rbx)
	movq	%r15, %rdi
	movq	%r14, %rsi
	movq	%r13, %rdx
	movl	%r12d, %ecx
	movq	%rbx, %r8
	callq	_nvkm_vmm_map_valid
	movq	%r15, %r12
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	%eax, %r15d
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_VMM_DEBUG
	jmp	LBB0_26
LBB0_9:
	movl	(%rbx), %edx
	movl	%edx, 4(%rbx)
	movq	40(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_15
## %bb.10:
	testl	%edx, %edx
	je	LBB0_14
## %bb.11:
	movq	_NVKM_RAM_MM_SHIFT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rax), %esi
	shll	%cl, %esi
	subl	%esi, %edx
	jl	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	%edx, 4(%rbx)
	movq	8(%rax), %rax
	movq	%rax, 40(%rbx)
	jne	LBB0_12
LBB0_14:
	movq	24(%rbx), %rsi
	movq	(%rsi), %rax
	movq	(%rax), %rax
	addq	$8, %rax
	jmp	LBB0_21
LBB0_15:
	movq	32(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_20
## %bb.16:
	testl	%edx, %edx
	je	LBB0_19
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	%rax, %rdi
	callq	_sg_dma_len
	movl	4(%rbx), %ecx
	subl	%eax, %ecx
	jl	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	movl	%ecx, 4(%rbx)
	movq	32(%rbx), %rdi
	callq	_sg_next
	movq	%rax, 32(%rbx)
	cmpl	$0, 4(%rbx)
	jne	LBB0_17
LBB0_19:
	movq	24(%rbx), %rsi
	movq	(%rsi), %rax
	movq	(%rax), %rax
	addq	$4, %rax
	jmp	LBB0_21
LBB0_20:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%edx, %eax
	sarl	%cl, %eax
	addl	%eax, 8(%rbx)
	movq	_PAGE_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movl	%edx, 4(%rbx)
	movq	24(%rbx), %rsi
	movq	(%rsi), %rax
	movq	(%rax), %rax
LBB0_21:
	movl	(%rax), %r9d
	movq	(%r14), %rcx
	movq	16(%r14), %rax
	movl	36(%r14), %edx
	movq	_NVKM_VMA_PAGE_NONE@GOTPCREL(%rip), %rdi
	cmpq	(%rdi), %rax
	jne	LBB0_24
## %bb.22:
	movq	%r12, %rdi
	movq	%rbx, %r8
	callq	_nvkm_vmm_ptes_get_map
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_26
## %bb.23:
	movq	24(%rbx), %rax
	movq	8(%r12), %rcx
	subq	(%rcx), %rax
	sarq	$3, %rax
	movq	%rax, 16(%r14)
	jmp	LBB0_25
LBB0_24:
	movq	%r12, %rdi
	movq	%rbx, %r8
	callq	_nvkm_vmm_ptes_map
LBB0_25:
	leaq	32(%r14), %r15
	movl	32(%r14), %edi
	movq	(%r12), %rax
	movl	(%rax), %esi
	leaq	28(%r14), %rdx
	callq	_nvkm_memory_tags_put
	movq	%r15, %rdi
	callq	_nvkm_memory_unref
	movl	16(%rbx), %edi
	callq	_nvkm_memory_ref
	movl	%eax, 32(%r14)
	movl	$1, 24(%r14)
	movl	12(%rbx), %eax
	movl	%eax, 28(%r14)
	xorl	%r15d, %r15d
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"overrun %016llx %016llx %016llx"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NVKM_VMA_PAGE_NONE,8,3         ## @NVKM_VMA_PAGE_NONE
L_.str.1:                               ## @.str.1
	.asciz	"invalid at any page size"

L_.str.2:                               ## @.str.2
	.asciz	"invalid %d\n"

	.comm	_NVKM_RAM_MM_SHIFT,4,2          ## @NVKM_RAM_MM_SHIFT
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_PAGE_MASK,4,2                  ## @PAGE_MASK
	.no_dead_strip	_nvkm_vmm_map_locked
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvkm_vmm_map_locked
_nvkm_vmm_map_locked:                   ; @nvkm_vmm_map_locked
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x4
	mov	x22, x3
	mov	x23, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w0, [x4, #16]
	bl	_nvkm_memory_size
	ldrsw	x8, [x19]
	ldr	x9, [x20]
	add	x8, x9, x8
	cmp	x0, x8
	cset	w0, lt
	bl	_unlikely
	cbz	x0, LBB0_4
; %bb.1:
	ldr	w0, [x19, #16]
	bl	_nvkm_memory_size
	ldr	x8, [x20]
	ldr	w9, [x19]
	stp	x9, x8, [sp, #8]
	str	x0, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_VMM_DEBUG
LBB0_2:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_3:
	mov	x0, x22
	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
	add	sp, sp, #112
	ret
LBB0_4:
Lloh5:
	adrp	x24, _NVKM_VMA_PAGE_NONE@GOTPAGE
Lloh6:
	ldr	x24, [x24, _NVKM_VMA_PAGE_NONE@GOTPAGEOFF]
	ldr	x9, [x24]
	ldp	x8, x10, [x20, #8]
	cmp	x8, x9
	ccmp	x10, x8, #0, eq
	b.eq	LBB0_7
; %bb.5:
	ldr	x11, [x21, #8]
	ldr	x11, [x11]
	cmp	x10, x9
	csel	x8, x8, x10, eq
	add	x8, x11, x8, lsl #3
	str	x8, [x19, #24]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	mov	x3, x22
	mov	x4, x19
	bl	_nvkm_vmm_map_valid
	cbz	w0, LBB0_9
; %bb.6:
	mov	x22, x0
	str	x22, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_VMM_DEBUG
	b	LBB0_3
LBB0_7:
	ldr	w25, [x21, #16]
	str	wzr, [x21, #16]
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	mov	x3, x22
	mov	x4, x19
	bl	_nvkm_vmm_map_choose
	str	w25, [x21, #16]
	cbz	w0, LBB0_9
; %bb.8:
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_VMM_DEBUG
	mov	x0, x21
	mov	x1, x20
	mov	x2, x23
	mov	x3, x22
	mov	x4, x19
	bl	_nvkm_vmm_map_choose
	b	LBB0_2
LBB0_9:
	ldr	w8, [x19]
	str	w8, [x19, #4]
	ldr	x9, [x19, #40]
	cbz	x9, LBB0_15
; %bb.10:
	cbz	w8, LBB0_14
; %bb.11:
Lloh11:
	adrp	x10, _NVKM_RAM_MM_SHIFT@GOTPAGE
Lloh12:
	ldr	x10, [x10, _NVKM_RAM_MM_SHIFT@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x9]
	lsl	w11, w11, w10
	subs	w8, w8, w11
	b.lt	LBB0_14
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	str	w8, [x19, #4]
	ldr	x9, [x9, #8]
	str	x9, [x19, #40]
	b.ne	LBB0_12
LBB0_14:
	ldr	x1, [x19, #24]
	ldr	x8, [x1]
	ldr	x8, [x8]
	add	x8, x8, #8
	b	LBB0_21
LBB0_15:
	ldr	x0, [x19, #32]
	cbz	x0, LBB0_20
; %bb.16:
	cbz	w8, LBB0_19
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	bl	_sg_dma_len
	ldr	w8, [x19, #4]
	subs	w8, w8, w0
	b.lt	LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	str	w8, [x19, #4]
	ldr	x0, [x19, #32]
	bl	_sg_next
	str	x0, [x19, #32]
	ldr	w8, [x19, #4]
	cbnz	w8, LBB0_17
LBB0_19:
	ldr	x1, [x19, #24]
	ldr	x8, [x1]
	ldr	x8, [x8]
	add	x8, x8, #4
	b	LBB0_21
LBB0_20:
Lloh14:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	asr	w9, w8, w9
	ldr	w10, [x19, #8]
	add	w9, w10, w9
Lloh17:
	adrp	x10, _PAGE_MASK@GOTPAGE
Lloh18:
	ldr	x10, [x10, _PAGE_MASK@GOTPAGEOFF]
Lloh19:
	ldr	w10, [x10]
	and	w8, w10, w8
	stp	w8, w9, [x19, #4]
	ldr	x1, [x19, #24]
	ldr	x8, [x1]
	ldr	x8, [x8]
LBB0_21:
	ldr	w5, [x8]
	ldr	x8, [x20, #16]
	ldr	x9, [x24]
	ldr	w2, [x20, #36]
	ldr	x3, [x20]
	mov	x0, x21
	mov	x4, x19
	cmp	x8, x9
	b.ne	LBB0_24
; %bb.22:
	bl	_nvkm_vmm_ptes_get_map
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.23:
	ldr	x8, [x19, #24]
	ldr	x9, [x21, #8]
	ldr	x9, [x9]
	sub	x8, x8, x9
	asr	x8, x8, #3
	str	x8, [x20, #16]
	b	LBB0_25
LBB0_24:
	bl	_nvkm_vmm_ptes_map
LBB0_25:
	ldr	w0, [x20, #32]!
	ldr	x8, [x21]
	ldr	w1, [x8]
	sub	x2, x20, #4
	bl	_nvkm_memory_tags_put
	mov	x0, x20
	bl	_nvkm_memory_unref
	ldr	w0, [x19, #16]
	bl	_nvkm_memory_ref
	mov	w22, #0
	str	w0, [x20]
	mov	w8, #1
	ldr	w9, [x19, #12]
	stp	w8, w9, [x20, #-8]
	b	LBB0_3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"overrun %016llx %016llx %016llx"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NVKM_VMA_PAGE_NONE,8,3         ; @NVKM_VMA_PAGE_NONE
l_.str.1:                               ; @.str.1
	.asciz	"invalid at any page size"

l_.str.2:                               ; @.str.2
	.asciz	"invalid %d\n"

	.comm	_NVKM_RAM_MM_SHIFT,4,2          ; @NVKM_RAM_MM_SHIFT
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_PAGE_MASK,4,2                  ; @PAGE_MASK
	.no_dead_strip	_nvkm_vmm_map_locked
.subsections_via_symbols
