	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function get_first_free_basemem_page
_get_first_free_basemem_page:           ## @get_first_free_basemem_page
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r15d
	movq	_MEMREGION_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_osGetMemRegionUsed
	movl	%eax, %r14d
	leaq	-36(%rbp), %rdi
	xorl	%r12d, %r12d
	movl	$2, %esi
	xorl	%edx, %edx
	callq	_svcGetSystemInfo
	xorl	%ebx, %ebx
	testl	%r15d, %r15d
	setne	%bl
	movl	%ebx, %r15d
	shll	$27, %r15d
	subl	%r14d, %r15d
	addl	-36(%rbp), %r15d
	xorl	%eax, %eax
	callq	_osGetKernelVersion
	movq	%rax, %r14
	movl	$2, %edi
	movl	$49, %esi
	xorl	%edx, %edx
	callq	_SYSTEM_VERSION
	shll	$12, %ebx
	addl	$4096, %ebx                     ## imm = 0x1000
	cmpq	%rax, %r14
	cmovlel	%r12d, %ebx
	xorl	%eax, %eax
	callq	_osGetKernelVersion
	movq	%rax, %r14
	movl	$2, %edi
	movl	$40, %esi
	xorl	%edx, %edx
	callq	_SYSTEM_VERSION
	xorl	%ecx, %ecx
	cmpq	%rax, %r14
	setle	%cl
	shll	$28, %ecx
	addl	%r15d, %ebx
	leal	(%rcx,%rbx), %eax
	addl	$-402214912, %eax               ## imm = 0xE806B000
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MEMREGION_BASE,4,2             ## @MEMREGION_BASE
	.no_dead_strip	_get_first_free_basemem_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function get_first_free_basemem_page
_get_first_free_basemem_page:           ; @get_first_free_basemem_page
	.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	x19, x0
Lloh0:
	adrp	x8, _MEMREGION_BASE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MEMREGION_BASE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_osGetMemRegionUsed
	mov	x20, x0
	add	x0, sp, #12
	mov	w1, #2
	mov	w2, #0
	bl	_svcGetSystemInfo
	ldr	w22, [sp, #12]
	bl	_osGetKernelVersion
	mov	x21, x0
	mov	w0, #2
	mov	w1, #49
	mov	w2, #0
	bl	_SYSTEM_VERSION
	mov	w8, #8192
	mov	w9, #4096
	cmp	w19, #0
	csel	w8, w9, w8, eq
	mov	w9, #45056
	movk	w9, #4102, lsl #16
	mov	w10, #45056
	movk	w10, #2054, lsl #16
	csel	w23, w10, w9, eq
	cmp	x21, x0
	csel	w21, w8, wzr, gt
	bl	_osGetKernelVersion
	mov	x19, x0
	mov	w0, #2
	mov	w1, #40
	mov	w2, #0
	bl	_SYSTEM_VERSION
	cmp	x19, x0
	mov	w8, #-268435456
	mov	w9, #-536870912
	csel	w8, w9, w8, gt
	sub	w9, w23, w20
	add	w9, w9, w22
	add	w9, w9, w21
	add	w0, w9, w8
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MEMREGION_BASE,4,2             ; @MEMREGION_BASE
	.no_dead_strip	_get_first_free_basemem_page
.subsections_via_symbols
