	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_arch_prepare_memory_region ## -- Begin function kvm_arch_prepare_memory_region
	.p2align	4, 0x90
_kvm_arch_prepare_memory_region:        ## @kvm_arch_prepare_memory_region
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	8(%rsi), %rax
	movq	_KVM_MEMORY_SLOTS@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	jge	LBB0_1
## %bb.2:
	movq	_MAP_PRIVATE@GOTPCREL(%rip), %rax
	testl	%ecx, %ecx
	jne	LBB0_8
	jmp	LBB0_4
LBB0_1:
	movq	_MAP_SHARED@GOTPCREL(%rip), %rax
	testl	%ecx, %ecx
	jne	LBB0_8
LBB0_4:
	movl	(%rbx), %r14d
	testl	%r14d, %r14d
	je	LBB0_8
## %bb.5:
	leaq	16(%rbp), %rcx
	cmpl	$0, 24(%rcx)
	jne	LBB0_8
## %bb.6:
	movq	_MAP_ANONYMOUS@GOTPCREL(%rip), %rcx
	movl	(%rax), %r15d
	orl	(%rcx), %r15d
	movq	_current@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	(%rax), %rdi
	callq	_down_write
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	imull	(%rax), %r14d
	movq	_PROT_READ@GOTPCREL(%rip), %rax
	movq	_PROT_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	xorl	%edi, %edi
	xorl	%esi, %esi
	movl	%r14d, %edx
	movl	%r15d, %r8d
	xorl	%r9d, %r9d
	callq	_do_mmap
	movq	%rax, %r14
	movq	(%r12), %rax
	movq	(%rax), %rdi
	callq	_up_write
	movq	%r14, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_7
## %bb.9:
	movq	%r14, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_7:
	movq	%r14, 16(%rbx)
LBB0_8:
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAP_PRIVATE,4,2                ## @MAP_PRIVATE
	.comm	_MAP_ANONYMOUS,4,2              ## @MAP_ANONYMOUS
	.comm	_KVM_MEMORY_SLOTS,8,3           ## @KVM_MEMORY_SLOTS
	.comm	_MAP_SHARED,4,2                 ## @MAP_SHARED
	.comm	_current,8,3                    ## @current
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_PROT_READ,4,2                  ## @PROT_READ
	.comm	_PROT_WRITE,4,2                 ## @PROT_WRITE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kvm_arch_prepare_memory_region ; -- Begin function kvm_arch_prepare_memory_region
	.p2align	2
_kvm_arch_prepare_memory_region:        ; @kvm_arch_prepare_memory_region
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	ldr	x8, [x1, #8]
Lloh0:
	adrp	x9, _KVM_MEMORY_SLOTS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KVM_MEMORY_SLOTS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _MAP_PRIVATE@GOTPAGE
Lloh4:
	ldr	x10, [x10, _MAP_PRIVATE@GOTPAGEOFF]
Lloh5:
	adrp	x11, _MAP_SHARED@GOTPAGE
Lloh6:
	ldr	x11, [x11, _MAP_SHARED@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x10, x11, lt
	cbnz	w4, LBB0_3
; %bb.1:
	mov	x19, x1
	ldr	w21, [x1]
	cbz	w21, LBB0_3
; %bb.2:
	ldr	w9, [x2, #24]
	cbz	w9, LBB0_4
LBB0_3:
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_4:
Lloh7:
	adrp	x9, _MAP_ANONYMOUS@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MAP_ANONYMOUS@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	ldr	w8, [x8]
	orr	w20, w8, w9
Lloh10:
	adrp	x22, _current@GOTPAGE
Lloh11:
	ldr	x22, [x22, _current@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	x0, [x8]
	bl	_down_write
Lloh12:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _PROT_READ@GOTPAGE
Lloh16:
	ldr	x9, [x9, _PROT_READ@GOTPAGEOFF]
	mul	w2, w8, w21
Lloh17:
	ldr	w8, [x9]
Lloh18:
	adrp	x9, _PROT_WRITE@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PROT_WRITE@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	x0, #0
	mov	w1, #0
	mov	x4, x20
	mov	w5, #0
	bl	_do_mmap
	mov	x20, x0
	ldr	x8, [x22]
	ldr	x0, [x8]
	bl	_up_write
	mov	x0, x20
	bl	_IS_ERR
	cbz	x0, LBB0_6
; %bb.5:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_PTR_ERR
LBB0_6:
	str	x20, [x19, #16]
	b	LBB0_3
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_MAP_PRIVATE,4,2                ; @MAP_PRIVATE
	.comm	_MAP_ANONYMOUS,4,2              ; @MAP_ANONYMOUS
	.comm	_KVM_MEMORY_SLOTS,8,3           ; @KVM_MEMORY_SLOTS
	.comm	_MAP_SHARED,4,2                 ; @MAP_SHARED
	.comm	_current,8,3                    ; @current
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_PROT_READ,4,2                  ; @PROT_READ
	.comm	_PROT_WRITE,4,2                 ; @PROT_WRITE
.subsections_via_symbols
