	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_psb_mmu_insert_pages           ## -- Begin function psb_mmu_insert_pages
	.p2align	4, 0x90
_psb_mmu_insert_pages:                  ## @psb_mmu_insert_pages
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r12
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%esi, %esi
	subl	(%rax), %esi
	testl	%r9d, %r9d
	je	LBB0_1
## %bb.2:
	movl	%ecx, %eax
	cltd
	idivl	%r8d
	testl	%edx, %edx
	je	LBB0_3
## %bb.20:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_19
LBB0_1:
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	$1, %r15d
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%ecx, %r8d
	jmp	LBB0_4
LBB0_3:
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, %r15d
LBB0_4:
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%r8d, -72(%rbp)                 ## 4-byte Spill
	movl	%r8d, %r14d
	shll	%cl, %r14d
	movl	%r9d, -76(%rbp)                 ## 4-byte Spill
	movl	%r9d, %ebx
	shll	%cl, %ebx
	movq	8(%r12), %rdi
	callq	_down_read
	testl	%r15d, %r15d
	movl	%r15d, %eax
	movl	$0, %r15d
	jle	LBB0_15
## %bb.5:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movslq	%r14d, %rcx
	movslq	%ebx, %rdx
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	xorl	%edx, %edx
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rbx
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
                                        ##       Child Loop BB0_10 Depth 3
	movl	%edx, -80(%rbp)                 ## 4-byte Spill
	leaq	(%r12,%rcx), %r15
	movq	%r12, -104(%rbp)                ## 8-byte Spill
	movq	%r15, -112(%rbp)                ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_10 Depth 3
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_psb_pd_addr_end
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_psb_mmu_pt_alloc_map_lock
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=2
	movq	%rax, %r14
	movq	-120(%rbp), %r15                ## 8-byte Reload
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_6 Depth=1
                                        ##     Parent Loop BB0_7 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movl	(%r13), %edi
	addq	$8, %r13
	callq	_page_to_pfn
	movl	%eax, %edi
	movl	16(%rbp), %esi
	callq	_psb_mmu_mask_pte
	movq	%r14, %rdi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_psb_mmu_set_pte
	incl	(%r14)
	movslq	(%rbx), %rax
	addq	%rax, %r12
	cmpq	%r15, %r12
	jb	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=2
	movq	%r14, %rdi
	callq	_psb_mmu_pt_unmap_unlock
	movq	%r15, %r12
	movq	-112(%rbp), %rax                ## 8-byte Reload
	cmpq	%rax, %r15
	movq	%rax, %r15
	jne	LBB0_7
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	-104(%rbp), %r12                ## 8-byte Reload
	addq	-88(%rbp), %r12                 ## 8-byte Folded Reload
	movl	-80(%rbp), %edx                 ## 4-byte Reload
	incl	%edx
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, %edx
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	jne	LBB0_6
## %bb.13:
	xorl	%r15d, %r15d
	jmp	LBB0_14
LBB0_8:
	movl	-44(%rbp), %r15d                ## 4-byte Reload
LBB0_14:
	movq	-64(%rbp), %r12                 ## 8-byte Reload
LBB0_15:
	cmpl	$-1, (%r12)
	je	LBB0_17
## %bb.16:
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	-72(%rbp), %ecx                 ## 4-byte Reload
	movl	-76(%rbp), %r8d                 ## 4-byte Reload
	callq	_psb_mmu_flush_ptes
LBB0_17:
	movq	8(%r12), %rdi
	callq	_up_read
	cmpl	$-1, (%r12)
	je	LBB0_19
## %bb.18:
	movq	8(%r12), %rdi
	callq	_psb_mmu_flush
LBB0_19:
	movl	%r15d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_psb_mmu_insert_pages           ; -- Begin function psb_mmu_insert_pages
	.p2align	2
_psb_mmu_insert_pages:                  ; @psb_mmu_insert_pages
	.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	x25, x6
	mov	x23, x5
	mov	x21, x3
	mov	x24, x2
	mov	x26, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
	cbz	w5, LBB0_3
; %bb.1:
	mov	x27, x4
	sdiv	w28, w21, w4
	msub	w8, w28, w4, w21
	cbz	w8, LBB0_4
; %bb.2:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_19
LBB0_3:
	mov	w28, #1
	mov	x27, x21
LBB0_4:
Lloh6:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w22, [x8]
	ldr	x0, [x19, #8]
	bl	_down_read
	cmp	w28, #1
	b.lt	LBB0_14
; %bb.5:
	stp	w21, w23, [sp, #40]             ; 8-byte Folded Spill
	mov	w21, #0
	neg	w8, w20
	stp	w8, w27, [sp, #24]              ; 8-byte Folded Spill
	lsl	w8, w27, w22
	sxtw	x9, w8
	lsl	w8, w23, w22
	sxtw	x8, w8
	str	x8, [sp]                        ; 8-byte Folded Spill
Lloh9:
	adrp	x20, _PAGE_SIZE@GOTPAGE
Lloh10:
	ldr	x20, [x20, _PAGE_SIZE@GOTPAGEOFF]
	str	x24, [sp, #32]                  ; 8-byte Folded Spill
	mov	x23, x24
	str	w28, [sp, #20]                  ; 4-byte Folded Spill
	str	x9, [sp, #8]                    ; 8-byte Folded Spill
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
                                        ;       Child Loop BB0_9 Depth 3
	add	x27, x23, x9
	mov	x28, x23
LBB0_7:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_9 Depth 3
	mov	x0, x28
	mov	x1, x27
	bl	_psb_pd_addr_end
	mov	x22, x0
	mov	x0, x19
	mov	x1, x28
	bl	_psb_mmu_pt_alloc_map_lock
	cbz	x0, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	mov	x24, x0
LBB0_9:                                 ;   Parent Loop BB0_6 Depth=1
                                        ;     Parent Loop BB0_7 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	w0, [x26], #8
	bl	_page_to_pfn
	mov	x1, x25
	bl	_psb_mmu_mask_pte
	mov	x2, x0
	mov	x0, x24
	mov	x1, x28
	bl	_psb_mmu_set_pte
	ldr	w8, [x24]
	add	w8, w8, #1
	str	w8, [x24]
	ldrsw	x8, [x20]
	add	x28, x28, x8
	cmp	x28, x22
	b.lo	LBB0_9
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=2
	mov	x0, x24
	bl	_psb_mmu_pt_unmap_unlock
	mov	x28, x22
	cmp	x22, x27
	b.ne	LBB0_7
; %bb.11:                               ;   in Loop: Header=BB0_6 Depth=1
	ldp	x8, x9, [sp]                    ; 16-byte Folded Reload
	add	x23, x23, x8
	add	w21, w21, #1
	ldr	w28, [sp, #20]                  ; 4-byte Folded Reload
	cmp	w21, w28
	b.ne	LBB0_6
; %bb.12:
	mov	w20, #0
	ldp	w21, w23, [sp, #40]             ; 8-byte Folded Reload
	ldr	x24, [sp, #32]                  ; 8-byte Folded Reload
	ldr	w27, [sp, #28]                  ; 4-byte Folded Reload
	b	LBB0_15
LBB0_13:
	ldp	w21, w23, [sp, #40]             ; 8-byte Folded Reload
	ldr	x24, [sp, #32]                  ; 8-byte Folded Reload
	ldp	w20, w27, [sp, #24]             ; 8-byte Folded Reload
	b	LBB0_15
LBB0_14:
	mov	w20, #0
LBB0_15:
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_17
; %bb.16:
	mov	x0, x19
	mov	x1, x24
	mov	x2, x21
	mov	x3, x27
	mov	x4, x23
	bl	_psb_mmu_flush_ptes
LBB0_17:
	ldr	x0, [x19, #8]
	bl	_up_read
	ldr	w8, [x19]
	cmn	w8, #1
	b.eq	LBB0_19
; %bb.18:
	ldr	x0, [x19, #8]
	bl	_psb_mmu_flush
LBB0_19:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
.subsections_via_symbols
