	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvidia_insert_memory
_nvidia_insert_memory:                  ## @nvidia_insert_memory
	.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
	movl	%edx, %ebx
	movl	%esi, %r15d
	movq	%rdi, %r12
	movl	24(%rdi), %edi
	movl	%edx, %esi
	callq	_agp_generic_type_to_mask_type
	testl	%eax, %eax
	jne	LBB0_2
## %bb.1:
	cmpl	%ebx, (%r12)
	jne	LBB0_2
## %bb.4:
	movl	4(%r12), %ecx
	xorl	%ebx, %ebx
	testl	%ecx, %ecx
	je	LBB0_18
## %bb.5:
	leal	(%rcx,%r15), %ebx
	movq	_nvidia_private@GOTPCREL(%rip), %rsi
	movl	(%rsi), %edi
	movq	_agp_memory_reserved@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r8
	cltd
	idivl	(%r8)
	subl	%eax, %edi
	cmpl	%edi, %ebx
	jle	LBB0_6
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movslq	%r15d, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	testl	%ecx, %ecx
	jle	LBB0_11
## %bb.7:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movq	_agp_bridge@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movq	8(%r13), %rdi
	movq	%rsi, %r14
	addq	8(%rsi), %rdi
	addq	%rbx, %rdi
	callq	_readl
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_PGE_EMPTY
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=1
	incq	%rbx
	movl	4(%r12), %ecx
	leal	(%rcx,%r15), %eax
	cltq
	cmpq	%rax, %rbx
	movq	%r14, %rsi
	jl	LBB0_9
LBB0_11:
	cmpl	$0, 8(%r12)
	jne	LBB0_13
## %bb.12:
	xorl	%eax, %eax
	movq	%rsi, %rbx
	callq	_global_cache_flush
	movq	%rbx, %rsi
	movl	$1, 8(%r12)
	movl	4(%r12), %ecx
LBB0_13:
	testl	%ecx, %ecx
	jle	LBB0_17
## %bb.14:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	_agp_bridge@GOTPCREL(%rip), %r14
	movq	(%r14), %rbx
	movq	(%rbx), %rax
	movq	8(%rax), %r15
	movq	16(%r12), %rax
	movl	(%rax,%r13,4), %edi
	callq	_page_to_phys
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	*%r15
	movq	(%r14), %rcx
	movq	8(%rcx), %rsi
	movq	_nvidia_private@GOTPCREL(%rip), %rcx
	addq	8(%rcx), %rsi
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addq	%r13, %rcx
	addq	%rcx, %rsi
	movl	%eax, %edi
	callq	_writel
	incq	%r13
	movslq	4(%r12), %rax
	cmpq	%rax, %r13
	jl	LBB0_15
## %bb.16:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	addl	%r13d, %r15d
	movq	_nvidia_private@GOTPCREL(%rip), %rsi
LBB0_17:
	xorl	%ebx, %ebx
	movq	_agp_bridge@GOTPCREL(%rip), %r14
	movq	(%r14), %rax
	movq	8(%rsi), %rcx
	movslq	%r15d, %rdx
	addq	8(%rax), %rdx
	leaq	(%rcx,%rdx), %rdi
	decq	%rdi
	callq	_readl
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	%r12, %rdi
	callq	*(%rax)
	jmp	LBB0_18
LBB0_10:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_nvidia_private,16,3            ## @nvidia_private
	.comm	_agp_memory_reserved,4,2        ## @agp_memory_reserved
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_agp_bridge,8,3                 ## @agp_bridge
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_nvidia_insert_memory
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvidia_insert_memory
_nvidia_insert_memory:                  ; @nvidia_insert_memory
	.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	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	w0, [x0, #24]
	mov	x1, x2
	bl	_agp_generic_type_to_mask_type
	cbnz	w0, LBB0_4
; %bb.1:
	ldr	w8, [x19]
	cmp	w8, w21
	b.ne	LBB0_4
; %bb.2:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_18
; %bb.3:
	add	w9, w8, w20
Lloh0:
	adrp	x22, _nvidia_private@GOTPAGE
Lloh1:
	ldr	x22, [x22, _nvidia_private@GOTPAGEOFF]
	ldr	w10, [x22]
Lloh2:
	adrp	x11, _agp_memory_reserved@GOTPAGE
Lloh3:
	ldr	x11, [x11, _agp_memory_reserved@GOTPAGEOFF]
Lloh4:
	ldr	w11, [x11]
Lloh5:
	adrp	x12, _PAGE_SIZE@GOTPAGE
Lloh6:
	ldr	x12, [x12, _PAGE_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w12, [x12]
	sdiv	w11, w11, w12
	sub	w10, w10, w11
	cmp	w9, w10
	b.le	LBB0_7
LBB0_4:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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_7:
Lloh10:
	adrp	x23, _agp_bridge@GOTPAGE
Lloh11:
	ldr	x23, [x23, _agp_bridge@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_11
; %bb.8:
	sxtw	x24, w20
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x21, [x23]
	ldr	x8, [x21, #8]
	ldr	x9, [x22, #8]
	add	x8, x8, x9
	add	x0, x24, x8
	bl	_readl
	mov	x1, x0
	mov	x0, x21
	bl	_PGE_EMPTY
	cbz	w0, LBB0_19
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x24, x24, #1
	ldr	w8, [x19, #4]
	add	w9, w8, w20
	cmp	x24, w9, sxtw
	b.lt	LBB0_9
LBB0_11:
	ldr	w9, [x19, #8]
	cbnz	w9, LBB0_13
; %bb.12:
	bl	_global_cache_flush
	mov	w8, #1
	str	w8, [x19, #8]
	ldr	w8, [x19, #4]
LBB0_13:
	cmp	w8, #1
	b.lt	LBB0_17
; %bb.14:
	mov	x24, #0
	mov	x8, x20
	sxtw	x25, w8
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x21, [x23]
	ldr	x8, [x21]
	ldr	x26, [x8, #8]
	ldr	x8, [x19, #16]
	ldr	w0, [x8, x24, lsl #2]
	bl	_page_to_phys
	mov	x1, x0
	mov	x0, x21
	mov	w2, #0
	blr	x26
	ldr	x8, [x23]
	ldr	x8, [x8, #8]
	ldr	x9, [x22, #8]
	add	x8, x8, x9
	add	x9, x25, x24
	add	x1, x9, x8
	bl	_writel
	add	x24, x24, #1
	ldrsw	x8, [x19, #4]
	cmp	x24, x8
	b.lt	LBB0_15
; %bb.16:
	add	w20, w20, w24
LBB0_17:
	ldr	x8, [x23]
	ldr	x8, [x8, #8]
	ldr	x9, [x22, #8]
	add	x8, x8, w20, sxtw
	add	x8, x8, x9
	sub	x0, x8, #1
	bl	_readl
	ldr	x8, [x23]
	ldr	x8, [x8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
LBB0_18:
	mov	w0, #0
	b	LBB0_6
LBB0_19:
Lloh12:
	adrp	x8, _EBUSY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_nvidia_private,16,3            ; @nvidia_private
	.comm	_agp_memory_reserved,4,2        ; @agp_memory_reserved
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_agp_bridge,8,3                 ; @agp_bridge
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_nvidia_insert_memory
.subsections_via_symbols
