	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vm_setup_memory                ## -- Begin function vm_setup_memory
	.p2align	4, 0x90
_vm_setup_memory:                       ## @vm_setup_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	_VM_MMAP_ALL@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	%edx, (%rax)
	sete	%dil
	callq	_assert
	movq	(%r15), %rcx
	cmpq	%rbx, %rcx
	jae	LBB0_1
## %bb.2:
	movq	%rbx, %rax
	subq	%rcx, %rax
	movq	_GB@GOTPCREL(%rip), %rdx
	movslq	(%rdx), %rdx
	leaq	(%rax,%rdx,4), %r14
	movq	%rcx, %rbx
	jmp	LBB0_3
LBB0_1:
	xorl	%eax, %eax
	movq	%rbx, %r14
LBB0_3:
	movq	%rbx, 8(%r15)
	movq	%rax, 16(%r15)
	movq	_VM_SYSMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movq	%r14, %rdx
	xorl	%ecx, %ecx
	callq	_vm_alloc_memseg
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_4
LBB0_10:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_VM_MMAP_GUARD_SIZE@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	leaq	(%r14,%rax,2), %rsi
	movq	_PROT_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_MAP_GUARD@GOTPCREL(%rip), %rax
	movq	_MAP_ALIGNED_SUPER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	$-1, %ebx
	xorl	%edi, %edi
	movl	$-1, %r8d
	xorl	%r9d, %r9d
	callq	_mmap
	movq	%rax, %r14
	movq	_MAP_FAILED@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r14
	je	LBB0_10
## %bb.5:
	addq	(%r12), %r14
	movq	16(%r15), %rdx
	testq	%rdx, %rdx
	je	LBB0_7
## %bb.6:
	movq	_GB@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	shll	$2, %esi
	movq	%r15, %rdi
	movq	%r14, %rcx
	callq	_setup_memory_segment
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
LBB0_7:
	movq	8(%r15), %rdx
	testq	%rdx, %rdx
	je	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	xorl	%esi, %esi
	movq	%r14, %rcx
	callq	_setup_memory_segment
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_10
LBB0_9:
	movq	%r14, 24(%r15)
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_VM_MMAP_ALL,4,2                ## @VM_MMAP_ALL
	.comm	_GB,4,2                         ## @GB
	.comm	_VM_SYSMEM,4,2                  ## @VM_SYSMEM
	.comm	_VM_MMAP_GUARD_SIZE,8,3         ## @VM_MMAP_GUARD_SIZE
	.comm	_PROT_NONE,4,2                  ## @PROT_NONE
	.comm	_MAP_GUARD,4,2                  ## @MAP_GUARD
	.comm	_MAP_ALIGNED_SUPER,4,2          ## @MAP_ALIGNED_SUPER
	.comm	_MAP_FAILED,8,3                 ## @MAP_FAILED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vm_setup_memory                ; -- Begin function vm_setup_memory
	.p2align	2
_vm_setup_memory:                       ; @vm_setup_memory
	.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
	mov	x21, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _VM_MMAP_ALL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VM_MMAP_ALL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w2
	cset	w0, eq
	bl	_assert
	ldr	x9, [x19]
	cmp	x9, x21
	b.hs	LBB0_2
; %bb.1:
	sub	x8, x21, x9
Lloh3:
	adrp	x10, _GB@GOTPAGE
Lloh4:
	ldr	x10, [x10, _GB@GOTPAGEOFF]
Lloh5:
	ldrsw	x10, [x10]
	add	x20, x8, x10, lsl #2
	mov	x21, x9
	b	LBB0_3
LBB0_2:
	mov	x8, #0
	mov	x20, x21
LBB0_3:
	stp	x21, x8, [x19, #8]
Lloh6:
	adrp	x8, _VM_SYSMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VM_SYSMEM@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	mov	x3, #0
	bl	_vm_alloc_memseg
	mov	x21, x0
	cbz	w0, LBB0_5
LBB0_4:
	mov	x0, x21
	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_5:
Lloh9:
	adrp	x22, _VM_MMAP_GUARD_SIZE@GOTPAGE
Lloh10:
	ldr	x22, [x22, _VM_MMAP_GUARD_SIZE@GOTPAGEOFF]
	ldr	x8, [x22]
	add	x1, x20, x8, lsl #1
Lloh11:
	adrp	x8, _PROT_NONE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _PROT_NONE@GOTPAGEOFF]
Lloh13:
	adrp	x9, _MAP_GUARD@GOTPAGE
Lloh14:
	ldr	x9, [x9, _MAP_GUARD@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
Lloh16:
	ldr	w8, [x9]
Lloh17:
	adrp	x9, _MAP_ALIGNED_SUPER@GOTPAGE
Lloh18:
	ldr	x9, [x9, _MAP_ALIGNED_SUPER@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	w21, #-1
	mov	x0, #0
	mov	w4, #-1
	mov	w5, #0
	bl	_mmap
Lloh20:
	adrp	x8, _MAP_FAILED@GOTPAGE
Lloh21:
	ldr	x8, [x8, _MAP_FAILED@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	cmp	x0, x8
	b.eq	LBB0_4
; %bb.6:
	ldr	x8, [x22]
	add	x20, x0, x8
	ldr	x2, [x19, #16]
	cbz	x2, LBB0_8
; %bb.7:
Lloh23:
	adrp	x8, _GB@GOTPAGE
Lloh24:
	ldr	x8, [x8, _GB@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	lsl	w1, w8, #2
	mov	x0, x19
	mov	x3, x20
	bl	_setup_memory_segment
	mov	x21, x0
	cbnz	w0, LBB0_4
LBB0_8:
	ldr	x2, [x19, #8]
	cbz	x2, LBB0_10
; %bb.9:
	mov	x0, x19
	mov	w1, #0
	mov	x3, x20
	bl	_setup_memory_segment
	mov	x21, x0
	cbnz	w0, LBB0_4
LBB0_10:
	mov	w21, #0
	str	x20, [x19, #24]
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh15
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_VM_MMAP_ALL,4,2                ; @VM_MMAP_ALL
	.comm	_GB,4,2                         ; @GB
	.comm	_VM_SYSMEM,4,2                  ; @VM_SYSMEM
	.comm	_VM_MMAP_GUARD_SIZE,8,3         ; @VM_MMAP_GUARD_SIZE
	.comm	_PROT_NONE,4,2                  ; @PROT_NONE
	.comm	_MAP_GUARD,4,2                  ; @MAP_GUARD
	.comm	_MAP_ALIGNED_SUPER,4,2          ; @MAP_ALIGNED_SUPER
	.comm	_MAP_FAILED,8,3                 ; @MAP_FAILED
.subsections_via_symbols
