	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ppgtt_handle_guest_write_page_table_bytes
_ppgtt_handle_guest_write_page_table_bytes: ## @ppgtt_handle_guest_write_page_table_bytes
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r13d
	movq	%rdi, %r15
	movq	24(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %r14
	movq	8(%r14), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	decl	%ebx
	andl	%esi, %ebx
	movb	(%r14), %cl
	sarl	%cl, %ebx
	movslq	%ebx, %r12
	leaq	-48(%rbp), %rsi
	movq	%r12, %rdx
	callq	_ppgtt_get_guest_entry
	movq	-48(%rbp), %rax
	movq	_GTT_TYPE_PPGTT_PTE_64K_ENTRY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.1:
	movq	_GTT_64K_PTE_STRIDE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%r12, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_2
## %bb.3:
	movq	%r12, %rax
	xorl	%edx, %edx
	divq	%rcx
	testq	%rdx, %rdx
	je	LBB0_6
LBB0_5:
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rsi
	callq	_gvt_vdbg_mm
	xorl	%ebx, %ebx
	jmp	LBB0_20
LBB0_2:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	testq	%rdx, %rdx
	jne	LBB0_5
LBB0_6:
	cmpl	%r13d, 4(%r14)
	jne	LBB0_8
## %bb.7:
	leaq	-48(%rbp), %rsi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_ppgtt_handle_guest_write_page_table
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_20
	jmp	LBB0_12
LBB0_8:
	movl	20(%r15), %esi
	movq	%r12, %rdi
	callq	_test_bit
	testl	%eax, %eax
	je	LBB0_9
LBB0_11:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ppgtt_set_post_shadow
LBB0_12:
	movq	_enable_out_of_sync@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpl	$0, (%rax)
	je	LBB0_20
## %bb.13:
	incl	8(%r15)
	movq	(%r15), %rax
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movl	(%rax), %edi
	leaq	-48(%rbp), %rsi
	movq	%r12, %rdx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movq	-64(%rbp), %r9                  ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	callq	*(%rax)
LBB0_15:
	movq	%r15, %rdi
	callq	_can_do_out_of_sync
	testq	%rax, %rax
	je	LBB0_20
## %bb.16:
	cmpq	$0, (%r15)
	jne	LBB0_18
## %bb.17:
	movq	%r15, %rdi
	callq	_ppgtt_allocate_oos_page
LBB0_18:
	movq	%r15, %rdi
	callq	_ppgtt_set_guest_page_oos
	testl	%eax, %eax
	jns	LBB0_20
## %bb.19:
	movl	%eax, %ebx
	jmp	LBB0_20
LBB0_9:
	movslq	16(%r15), %r14
	leaq	-72(%rbp), %rbx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_ppgtt_get_shadow_entry
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_ppgtt_handle_guest_entry_removal
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_10
LBB0_20:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movl	(%rax,%r14,4), %esi
	leaq	-72(%rbp), %rbx
	movq	%rbx, %rdi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	callq	*8(%rax)
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_ppgtt_set_shadow_entry
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_GTT_TYPE_PPGTT_PTE_64K_ENTRY,8,3 ## @GTT_TYPE_PPGTT_PTE_64K_ENTRY
	.comm	_GTT_64K_PTE_STRIDE,8,3         ## @GTT_64K_PTE_STRIDE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Ignore write to unused PTE entry, index %lu\n"

	.comm	_enable_out_of_sync,4,2         ## @enable_out_of_sync
	.no_dead_strip	_ppgtt_handle_guest_write_page_table_bytes
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ppgtt_handle_guest_write_page_table_bytes
_ppgtt_handle_guest_write_page_table_bytes: ; @ppgtt_handle_guest_write_page_table_bytes
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x3
	mov	x19, x0
	ldr	x20, [x0, #24]
	ldr	x24, [x20, #8]
	ldr	x23, [x24, #8]
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w8, w8, #1
	and	w8, w8, w1
	ldr	w9, [x24]
	asr	w8, w8, w9
	sxtw	x21, w8
	add	x1, sp, #8
	mov	x2, x21
	bl	_ppgtt_get_guest_entry
	ldr	x8, [sp, #8]
Lloh3:
	adrp	x9, _GTT_TYPE_PPGTT_PTE_64K_ENTRY@GOTPAGE
Lloh4:
	ldr	x9, [x9, _GTT_TYPE_PPGTT_PTE_64K_ENTRY@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
Lloh6:
	adrp	x8, _GTT_64K_PTE_STRIDE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GTT_64K_PTE_STRIDE@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	udiv	x9, x21, x8
	msub	x8, x9, x8, x21
	cbz	x8, LBB0_3
; %bb.2:
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_gvt_vdbg_mm
	b	LBB0_14
LBB0_3:
	ldr	w8, [x24, #4]
	cmp	w8, w22
	b.ne	LBB0_5
; %bb.4:
	add	x1, sp, #8
	mov	x0, x19
	mov	x2, x21
	bl	_ppgtt_handle_guest_write_page_table
	cbnz	w0, LBB0_15
	b	LBB0_7
LBB0_5:
	ldr	w1, [x19, #20]
	mov	x0, x21
	bl	_test_bit
	cbz	w0, LBB0_16
LBB0_6:
	mov	x0, x19
	mov	x1, x21
	bl	_ppgtt_set_post_shadow
LBB0_7:
Lloh11:
	adrp	x8, _enable_out_of_sync@GOTPAGE
Lloh12:
	ldr	x8, [x8, _enable_out_of_sync@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cbz	w8, LBB0_14
; %bb.8:
	ldr	w8, [x19, #8]
	add	w8, w8, #1
	str	w8, [x19, #8]
	ldr	x8, [x19]
	cbz	x8, LBB0_10
; %bb.9:
	ldr	x9, [x23]
	ldr	w0, [x8]
	add	x1, sp, #8
	mov	x2, x21
	mov	w3, #0
	mov	w4, #0
	mov	x5, x20
	blr	x9
LBB0_10:
	mov	x0, x19
	bl	_can_do_out_of_sync
	cbz	x0, LBB0_14
; %bb.11:
	ldr	x8, [x19]
	cbnz	x8, LBB0_13
; %bb.12:
	mov	x0, x19
	bl	_ppgtt_allocate_oos_page
LBB0_13:
	mov	x0, x19
	bl	_ppgtt_set_guest_page_oos
	tbnz	w0, #31, LBB0_15
LBB0_14:
	mov	w0, #0
LBB0_15:
	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
	add	sp, sp, #80
	ret
LBB0_16:
	ldrsw	x22, [x19, #16]
	mov	x1, sp
	mov	x0, x19
	mov	x2, x21
	bl	_ppgtt_get_shadow_entry
	mov	x1, sp
	mov	x0, x19
	mov	x2, x21
	bl	_ppgtt_handle_guest_entry_removal
	cbnz	w0, LBB0_15
; %bb.17:
	ldr	x8, [x23, #8]
	ldr	x9, [x20]
	ldr	w1, [x9, x22, lsl #2]
	mov	x0, sp
	blr	x8
	mov	x1, sp
	mov	x0, x19
	mov	x2, x21
	bl	_ppgtt_set_shadow_entry
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_GTT_TYPE_PPGTT_PTE_64K_ENTRY,8,3 ; @GTT_TYPE_PPGTT_PTE_64K_ENTRY
	.comm	_GTT_64K_PTE_STRIDE,8,3         ; @GTT_64K_PTE_STRIDE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Ignore write to unused PTE entry, index %lu\n"

	.comm	_enable_out_of_sync,4,2         ; @enable_out_of_sync
	.no_dead_strip	_ppgtt_handle_guest_write_page_table_bytes
.subsections_via_symbols
