	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mps3_pte_insert
_mps3_pte_insert:                       ## @mps3_pte_insert
	.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
	movq	%rsi, %r15
	movl	(%rsi), %eax
	movq	_PVO_HID@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_1
## %bb.2:
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, (%r15)
	movq	_moea64_pteg_mask@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$3, %eax
	xorl	4(%r15), %eax
	jmp	LBB0_3
LBB0_1:
	movl	4(%r15), %eax
LBB0_3:
	andl	$-8, %eax
	movl	%eax, 4(%r15)
	leaq	-56(%rbp), %rsi
	movq	%r15, %rdi
	callq	_moea64_pte_from_pvo
	movl	$0, -48(%rbp)
	xorl	%eax, %eax
	callq	_PTESYNC
	movq	_mps3_table_lock@GOTPCREL(%rip), %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	movq	_mps3_vas_id@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movslq	4(%r15), %rsi
	movl	-56(%rbp), %edx
	movl	-52(%rbp), %ecx
	movq	_LPTE_LOCKED@GOTPCREL(%rip), %r12
	movq	_LPTE_WIRED@GOTPCREL(%rip), %r13
	movl	(%r13), %r8d
	orl	(%r12), %r8d
	leaq	-44(%rbp), %r10
	subq	$8, %rsp
	leaq	-48(%rbp), %rbx
	leaq	-64(%rbp), %rax
	xorl	%r9d, %r9d
	pushq	%r10
	pushq	%rbx
	pushq	%rax
	callq	_lv1_insert_htab_entry
	addq	$32, %rsp
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mtx_unlock
	testl	%ebx, %ebx
	je	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rdi
	movl	%ebx, %esi
	callq	_panic
	movl	$-1, %ebx
	jmp	LBB0_9
LBB0_5:
	movq	-64(%rbp), %rax
	movq	%rax, %rcx
	andq	$-8, %rcx
	movslq	4(%r15), %rdx
	cmpq	%rdx, %rcx
	je	LBB0_7
## %bb.6:
	movq	_PVO_HID@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, (%r15)
LBB0_7:
	movl	%eax, 4(%r15)
	movq	_moea64_pte_valid@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	leal	1(%rdi), %eax
	movl	%eax, (%r14)
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_STAT_MOEA64
	movl	-48(%rbp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	(%r12), %ecx
	orl	(%r13), %ecx
	xorl	%edi, %edi
	testl	%eax, %ecx
	sete	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_KASSERT
	movl	(%r14), %edi
	leal	-1(%rdi), %eax
	movl	%eax, (%r14)
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_STAT_MOEA64
	movq	_moea64_pte_overflow@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leal	1(%rdi), %ecx
	movl	%ecx, (%rax)
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_STAT_MOEA64
LBB0_9:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PVO_HID,4,2                    ## @PVO_HID
	.comm	_moea64_pteg_mask,4,2           ## @moea64_pteg_mask
	.comm	_mps3_table_lock,4,2            ## @mps3_table_lock
	.comm	_mps3_vas_id,4,2                ## @mps3_vas_id
	.comm	_LPTE_LOCKED,4,2                ## @LPTE_LOCKED
	.comm	_LPTE_WIRED,4,2                 ## @LPTE_WIRED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mps3_pte_insert: overflow (%d)"

	.comm	_moea64_pte_valid,4,2           ## @moea64_pte_valid
L_.str.1:                               ## @.str.1
	.asciz	"Evicted a wired PTE"

	.comm	_moea64_pte_overflow,4,2        ## @moea64_pte_overflow
	.no_dead_strip	_mps3_pte_insert
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mps3_pte_insert
_mps3_pte_insert:                       ; @mps3_pte_insert
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x1
	ldr	w8, [x1]
Lloh0:
	adrp	x22, _PVO_HID@GOTPAGE
Lloh1:
	ldr	x22, [x22, _PVO_HID@GOTPAGEOFF]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	bic	w8, w8, w9
	str	w8, [x19]
Lloh2:
	adrp	x8, _moea64_pteg_mask@GOTPAGE
Lloh3:
	ldr	x8, [x8, _moea64_pteg_mask@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	eor	w8, w9, w8, lsl #3
	b	LBB0_3
LBB0_2:
	ldr	w8, [x19, #4]
LBB0_3:
	and	w8, w8, #0xfffffff8
	str	w8, [x19, #4]
	add	x1, sp, #24
	mov	x0, x19
	bl	_moea64_pte_from_pvo
	str	wzr, [sp, #16]
	bl	_PTESYNC
Lloh5:
	adrp	x21, _mps3_table_lock@GOTPAGE
Lloh6:
	ldr	x21, [x21, _mps3_table_lock@GOTPAGEOFF]
	mov	x0, x21
	bl	_mtx_lock
Lloh7:
	adrp	x8, _mps3_vas_id@GOTPAGE
Lloh8:
	ldr	x8, [x8, _mps3_vas_id@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	ldrsw	x1, [x19, #4]
	ldp	w2, w3, [sp, #24]
Lloh10:
	adrp	x23, _LPTE_LOCKED@GOTPAGE
Lloh11:
	ldr	x23, [x23, _LPTE_LOCKED@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh12:
	adrp	x24, _LPTE_WIRED@GOTPAGE
Lloh13:
	ldr	x24, [x24, _LPTE_WIRED@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w4, w9, w8
	add	x8, sp, #16
	orr	x8, x8, #0x4
	str	x8, [sp]
	add	x6, sp, #8
	add	x7, sp, #16
	mov	w5, #0
	bl	_lv1_insert_htab_entry
	mov	x20, x0
	mov	x0, x21
	bl	_mtx_unlock
	cbz	w20, LBB0_5
; %bb.4:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x20
	bl	_panic
	mov	w0, #-1
	b	LBB0_10
LBB0_5:
	ldr	x8, [sp, #8]
	and	x9, x8, #0xfffffffffffffff8
	ldrsw	x10, [x19, #4]
	cmp	x9, x10
	b.eq	LBB0_7
; %bb.6:
	ldr	w9, [x22]
	ldr	w10, [x19]
	orr	w9, w10, w9
	str	w9, [x19]
LBB0_7:
	str	w8, [x19, #4]
Lloh16:
	adrp	x19, _moea64_pte_valid@GOTPAGE
Lloh17:
	ldr	x19, [x19, _moea64_pte_valid@GOTPAGEOFF]
	ldr	w0, [x19]
	add	w8, w0, #1
	str	w8, [x19]
	bl	_STAT_MOEA64
	ldr	w8, [sp, #16]
	cbz	w8, LBB0_9
; %bb.8:
	ldr	w9, [x24]
	ldr	w10, [x23]
	orr	w9, w10, w9
	tst	w9, w8
	cset	w0, eq
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KASSERT
	ldr	w0, [x19]
	sub	w8, w0, #1
	str	w8, [x19]
	bl	_STAT_MOEA64
Lloh20:
	adrp	x8, _moea64_pte_overflow@GOTPAGE
Lloh21:
	ldr	x8, [x8, _moea64_pte_overflow@GOTPAGEOFF]
	ldr	w0, [x8]
	add	w9, w0, #1
	str	w9, [x8]
	bl	_STAT_MOEA64
LBB0_9:
	mov	w0, #0
LBB0_10:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_PVO_HID,4,2                    ; @PVO_HID
	.comm	_moea64_pteg_mask,4,2           ; @moea64_pteg_mask
	.comm	_mps3_table_lock,4,2            ; @mps3_table_lock
	.comm	_mps3_vas_id,4,2                ; @mps3_vas_id
	.comm	_LPTE_LOCKED,4,2                ; @LPTE_LOCKED
	.comm	_LPTE_WIRED,4,2                 ; @LPTE_WIRED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mps3_pte_insert: overflow (%d)"

	.comm	_moea64_pte_valid,4,2           ; @moea64_pte_valid
l_.str.1:                               ; @.str.1
	.asciz	"Evicted a wired PTE"

	.comm	_moea64_pte_overflow,4,2        ; @moea64_pte_overflow
	.no_dead_strip	_mps3_pte_insert
.subsections_via_symbols
