	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function uninorth_insert_memory
_uninorth_insert_memory:                ## @uninorth_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
	pushq	%rax
	.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, %r14d
	movq	%rdi, %r15
	movq	_agp_bridge@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	16(%rax), %rdi
	callq	_A_SIZE_32
	cmpl	%ebx, (%r15)
	jne	LBB0_1
## %bb.3:
	movl	(%rax), %r13d
	movq	(%r12), %rdi
	movq	8(%rdi), %rax
	movl	%ebx, %esi
	callq	*(%rax)
	testl	%eax, %eax
	jne	LBB0_1
## %bb.4:
	movl	4(%r15), %eax
	leal	(%rax,%r14), %ecx
	cmpl	%r13d, %ecx
	jle	LBB0_5
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	testl	%eax, %eax
	jle	LBB0_7
## %bb.6:
	movq	(%r12), %rax
	movq	(%rax), %rax
	movslq	%r14d, %rsi
	movslq	%ecx, %rcx
	movq	%rsi, %rdx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rax,%rdx,8)
	jne	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=1
	incq	%rdx
	cmpq	%rcx, %rdx
	jl	LBB0_9
## %bb.11:
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	leaq	(,%rsi,8), %r13
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rax
	movl	(%rax,%r14,4), %edi
	callq	_page_to_phys
                                        ## kill: def $eax killed $eax def $rax
	andl	$-4096, %eax                    ## imm = 0xF000
	leal	1(%rax), %edi
	callq	_cpu_to_le32
	movq	(%r12), %rcx
	movq	(%rcx), %rcx
	addq	%r13, %rcx
	movq	%rax, (%rcx,%r14,8)
	movq	8(%r15), %rax
	movl	(%rax,%r14,4), %edi
	callq	_page_to_phys
	movl	%eax, %edi
	callq	___va
	movq	%rax, %rbx
	movq	8(%r15), %rax
	movl	(%rax,%r14,4), %edi
	callq	_page_to_phys
	movl	%eax, %edi
	callq	___va
	leaq	4096(%rax), %rsi
	movq	%rbx, %rdi
	callq	_flush_dcache_range
	incq	%r14
	movslq	4(%r15), %rax
	cmpq	%rax, %r14
	jl	LBB0_12
## %bb.13:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_7:
	movslq	%r14d, %rdi
LBB0_14:
	movq	(%r12), %rax
	shlq	$3, %rdi
	addq	(%rax), %rdi
	callq	_in_le32
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_mb
	movq	%r15, %rdi
	callq	_uninorth_tlbflush
	jmp	LBB0_15
LBB0_10:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_2
	.cfi_endproc
                                        ## -- End function
	.comm	_agp_bridge,8,3                 ## @agp_bridge
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_uninorth_insert_memory
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function uninorth_insert_memory
_uninorth_insert_memory:                ; @uninorth_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
Lloh0:
	adrp	x22, _agp_bridge@GOTPAGE
Lloh1:
	ldr	x22, [x22, _agp_bridge@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	x0, [x8, #16]
	bl	_A_SIZE_32
	ldr	w8, [x19]
	cmp	w8, w21
	b.ne	LBB0_3
; %bb.1:
	ldr	w23, [x0]
	ldr	x0, [x22]
	ldr	x8, [x0, #8]
	ldr	x8, [x8]
	mov	x1, x21
	blr	x8
	cbnz	w0, LBB0_3
; %bb.2:
	ldr	w8, [x19, #4]
	add	w9, w8, w20
	cmp	w9, w23
	b.le	LBB0_6
LBB0_3:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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_6:
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.7:
	ldr	x8, [x22]
	ldr	x8, [x8]
	sxtw	x21, w20
	sxtw	x9, w9
	mov	x10, x21
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x8, x10, lsl #3]
	cbnz	x11, LBB0_14
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	add	x10, x10, #1
	cmp	x10, x9
	b.lt	LBB0_8
; %bb.10:
	mov	x23, #0
	lsl	x24, x21, #3
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #8]
	lsl	x25, x23, #2
	ldr	w0, [x8, x25]
	bl	_page_to_phys
	and	w8, w0, #0xfffff000
	orr	w0, w8, #0x1
	bl	_cpu_to_le32
	ldr	x8, [x22]
	ldr	x8, [x8]
	add	x8, x8, x24
	str	x0, [x8, x23, lsl #3]
	ldr	x8, [x19, #8]
	ldr	w0, [x8, x25]
	bl	_page_to_phys
	bl	___va
	mov	x20, x0
	ldr	x8, [x19, #8]
	ldr	w0, [x8, x25]
	bl	_page_to_phys
	bl	___va
	add	x1, x0, #1, lsl #12             ; =4096
	mov	x0, x20
	bl	_flush_dcache_range
	add	x23, x23, #1
	ldrsw	x8, [x19, #4]
	cmp	x23, x8
	b.lt	LBB0_11
	b	LBB0_13
LBB0_12:
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	sxtw	x21, w20
LBB0_13:
	ldr	x8, [x22]
	ldr	x8, [x8]
	add	x0, x8, x21, lsl #3
	bl	_in_le32
	bl	_mb
	mov	x0, x19
	bl	_uninorth_tlbflush
	mov	w0, #0
	b	LBB0_5
LBB0_14:
Lloh4:
	adrp	x8, _EBUSY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_agp_bridge,8,3                 ; @agp_bridge
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_uninorth_insert_memory
.subsections_via_symbols
