	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PcMemFinalizeMemoryMap         ## -- Begin function PcMemFinalizeMemoryMap
	.p2align	4, 0x90
_PcMemFinalizeMemoryMap:                ## @PcMemFinalizeMemoryMap
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_STACKLOW@GOTPCREL(%rip), %rbx
	movslq	(%rbx), %rdx
	addq	$-4096, %rdx                    ## imm = 0xF000
	movq	_LoaderFirmwareTemporary@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %r8
	movl	$4096, %esi                     ## imm = 0x1000
	callq	_ReserveMemory
	movslq	(%rbx), %rsi
	movq	_STACKADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	subq	%rsi, %rdx
	movq	_LoaderOsloaderStack@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.1(%rip), %r8
	movq	%r14, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_ReserveMemory
	movq	_FREELDR_BASE@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	_FrLdrImageSize@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdx
	movq	_LoaderLoadedProgram@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.2(%rip), %r8
	movq	%r14, %rdi
	callq	_ReserveMemory
	movslq	(%r13), %rdi
	addq	(%rbx), %rdi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_ALIGN_UP_BY
	movq	%rax, %r8
	movq	_DiskReadBuffer@GOTPCREL(%rip), %rax
	movq	%r8, (%rax)
	movslq	(%rbx), %rcx
	movq	_DiskReadBufferSize@GOTPCREL(%rip), %r15
	movq	%rcx, (%r15)
	movq	_PcMapCount@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movl	(%r13), %eax
	cltd
	idivl	%ecx
	movq	_LoaderFree@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rbx
	leaq	16(%r14), %rdx
	movq	_LoaderFirmwareTemporary@GOTPCREL(%rip), %r13
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	addq	$24, %rdx
	decq	%rdi
	je	LBB0_7
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	-16(%rdx), %esi
	cmpl	%eax, %esi
	jle	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpq	%rbx, -8(%rdx)
	jne	LBB0_6
## %bb.5:
	imull	%ecx, %esi
	movslq	%esi, %rax
	movq	_DiskReadBuffer@GOTPCREL(%rip), %rbx
	movq	%rax, (%rbx)
	imull	(%rdx), %ecx
	movq	_MAX_DISKREADBUFFER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ecx, %edi
	callq	_min
	movq	%rax, %rcx
	movq	%rax, (%r15)
	movq	(%rbx), %r8
	jmp	LBB0_7
LBB0_1:
	movq	_LoaderFirmwareTemporary@GOTPCREL(%rip), %r13
LBB0_7:
	leaq	L_.str.3(%rip), %rdi
	xorl	%ebx, %ebx
	movq	%r8, %rsi
	movq	%rcx, %rdx
	xorl	%eax, %eax
	callq	_TRACE
	xorl	%edi, %edi
	cmpq	$0, (%r15)
	setg	%dil
	callq	_ASSERT
	movq	_DiskReadBuffer@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%r15), %rdx
	movl	(%r13), %ecx
	leaq	L_.str.4(%rip), %r8
	movq	%r14, %rdi
	callq	_ReserveMemory
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_TRACE
	cmpq	$0, (%r12)
	je	LBB0_10
## %bb.8:
	movq	%r12, %r15
	addq	$16, %r14
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	-16(%r14), %ebx
	movl	(%r14), %r12d
	movq	-8(%r14), %rdi
	callq	_MmGetSystemMemoryMapTypeString
	leaq	L_.str.6(%rip), %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_TRACE
	incq	%r13
	movq	(%r15), %rbx
	addq	$24, %r14
	cmpq	%rbx, %r13
	jb	LBB0_9
LBB0_10:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STACKLOW,4,2                   ## @STACKLOW
	.comm	_LoaderFirmwareTemporary,4,2    ## @LoaderFirmwareTemporary
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"BIOS area"

	.comm	_STACKADDR,8,3                  ## @STACKADDR
	.comm	_LoaderOsloaderStack,4,2        ## @LoaderOsloaderStack
L_.str.1:                               ## @.str.1
	.asciz	"FreeLdr stack"

	.comm	_FREELDR_BASE,4,2               ## @FREELDR_BASE
	.comm	_FrLdrImageSize,8,3             ## @FrLdrImageSize
	.comm	_LoaderLoadedProgram,4,2        ## @LoaderLoadedProgram
L_.str.2:                               ## @.str.2
	.asciz	"FreeLdr image"

	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_DiskReadBuffer,8,3             ## @DiskReadBuffer
	.comm	_DiskReadBufferSize,8,3         ## @DiskReadBufferSize
	.comm	_PcMapCount,8,3                 ## @PcMapCount
	.comm	_LoaderFree,8,3                 ## @LoaderFree
	.comm	_MAX_DISKREADBUFFER_SIZE,4,2    ## @MAX_DISKREADBUFFER_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"DiskReadBuffer=0x%p, DiskReadBufferSize=0x%lx\n"

L_.str.4:                               ## @.str.4
	.asciz	"Disk read buffer"

L_.str.5:                               ## @.str.5
	.asciz	"Dumping resulting memory map:\n"

L_.str.6:                               ## @.str.6
	.asciz	"BasePage=0x%lx, PageCount=0x%lx, Type=%s\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PcMemFinalizeMemoryMap         ; -- Begin function PcMemFinalizeMemoryMap
	.p2align	2
_PcMemFinalizeMemoryMap:                ; @PcMemFinalizeMemoryMap
	.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, x0
Lloh0:
	adrp	x21, _STACKLOW@GOTPAGE
Lloh1:
	ldr	x21, [x21, _STACKLOW@GOTPAGEOFF]
	ldrsw	x8, [x21]
	sub	x2, x8, #1, lsl #12             ; =4096
Lloh2:
	adrp	x20, _LoaderFirmwareTemporary@GOTPAGE
Lloh3:
	ldr	x20, [x20, _LoaderFirmwareTemporary@GOTPAGEOFF]
	ldr	w3, [x20]
Lloh4:
	adrp	x4, l_.str@PAGE
Lloh5:
	add	x4, x4, l_.str@PAGEOFF
	mov	w1, #4096
	bl	_ReserveMemory
Lloh6:
	adrp	x8, _STACKADDR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _STACKADDR@GOTPAGEOFF]
	ldrsw	x1, [x21]
Lloh8:
	ldr	x8, [x8]
	sub	x2, x8, x1
Lloh9:
	adrp	x8, _LoaderOsloaderStack@GOTPAGE
Lloh10:
	ldr	x8, [x8, _LoaderOsloaderStack@GOTPAGEOFF]
Lloh11:
	ldr	w3, [x8]
Lloh12:
	adrp	x4, l_.str.1@PAGE
Lloh13:
	add	x4, x4, l_.str.1@PAGEOFF
	mov	x0, x19
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_ReserveMemory
Lloh14:
	adrp	x24, _FREELDR_BASE@GOTPAGE
Lloh15:
	ldr	x24, [x24, _FREELDR_BASE@GOTPAGEOFF]
	ldr	w1, [x24]
Lloh16:
	adrp	x21, _FrLdrImageSize@GOTPAGE
Lloh17:
	ldr	x21, [x21, _FrLdrImageSize@GOTPAGEOFF]
	ldr	x2, [x21]
Lloh18:
	adrp	x8, _LoaderLoadedProgram@GOTPAGE
Lloh19:
	ldr	x8, [x8, _LoaderLoadedProgram@GOTPAGEOFF]
Lloh20:
	ldr	w3, [x8]
Lloh21:
	adrp	x4, l_.str.2@PAGE
Lloh22:
	add	x4, x4, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_ReserveMemory
	ldrsw	x8, [x24]
	ldr	x9, [x21]
	add	x0, x9, x8
Lloh23:
	adrp	x21, _PAGE_SIZE@GOTPAGE
Lloh24:
	ldr	x21, [x21, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x21]
	bl	_ALIGN_UP_BY
	mov	x8, x0
Lloh25:
	adrp	x22, _DiskReadBuffer@GOTPAGE
Lloh26:
	ldr	x22, [x22, _DiskReadBuffer@GOTPAGEOFF]
	str	x0, [x22]
	ldrsw	x0, [x21]
Lloh27:
	adrp	x23, _DiskReadBufferSize@GOTPAGE
Lloh28:
	ldr	x23, [x23, _DiskReadBufferSize@GOTPAGEOFF]
	str	x0, [x23]
Lloh29:
	adrp	x21, _PcMapCount@GOTPAGE
Lloh30:
	ldr	x21, [x21, _PcMapCount@GOTPAGEOFF]
	ldr	x9, [x21]
	cbz	x9, LBB0_6
; %bb.1:
	ldr	w12, [x24]
Lloh31:
	adrp	x10, _LoaderFree@GOTPAGE
Lloh32:
	ldr	x10, [x10, _LoaderFree@GOTPAGEOFF]
Lloh33:
	ldr	x11, [x10]
	add	x10, x19, #16
	sdiv	w12, w12, w0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x10, x10, #24
	subs	x9, x9, #1
	b.eq	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldur	w13, [x10, #-16]
	cmp	w13, w12
	b.le	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldur	x14, [x10, #-8]
	cmp	x14, x11
	b.ne	LBB0_2
; %bb.5:
	mul	w8, w13, w0
	sxtw	x8, w8
	str	x8, [x22]
	ldr	w8, [x10]
	mul	w0, w8, w0
Lloh34:
	adrp	x8, _MAX_DISKREADBUFFER_SIZE@GOTPAGE
Lloh35:
	ldr	x8, [x8, _MAX_DISKREADBUFFER_SIZE@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
	bl	_min
	str	x0, [x23]
	ldr	x8, [x22]
LBB0_6:
	stp	x8, x0, [sp]
Lloh37:
	adrp	x0, l_.str.3@PAGE
Lloh38:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_TRACE
	ldr	x8, [x23]
	cmp	x8, #0
	cset	w0, gt
	bl	_ASSERT
	ldr	w1, [x22]
	ldr	x2, [x23]
	ldr	w3, [x20]
Lloh39:
	adrp	x4, l_.str.4@PAGE
Lloh40:
	add	x4, x4, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_ReserveMemory
Lloh41:
	adrp	x0, l_.str.5@PAGE
Lloh42:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_TRACE
	ldr	x8, [x21]
	cbz	x8, LBB0_9
; %bb.7:
	mov	x20, #0
	add	x22, x19, #16
Lloh43:
	adrp	x19, l_.str.6@PAGE
Lloh44:
	add	x19, x19, l_.str.6@PAGEOFF
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldur	x0, [x22, #-8]
	ldur	w23, [x22, #-16]
	ldr	w24, [x22], #24
	bl	_MmGetSystemMemoryMapTypeString
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x24, x0, [sp, #8]
	str	x23, [sp]
	mov	x0, x19
	bl	_TRACE
	add	x20, x20, #1
	ldr	x0, [x21]
	cmp	x20, x0
	b.lo	LBB0_8
	b	LBB0_10
LBB0_9:
	mov	x0, #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	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpAdd	Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.comm	_STACKLOW,4,2                   ; @STACKLOW
	.comm	_LoaderFirmwareTemporary,4,2    ; @LoaderFirmwareTemporary
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"BIOS area"

	.comm	_STACKADDR,8,3                  ; @STACKADDR
	.comm	_LoaderOsloaderStack,4,2        ; @LoaderOsloaderStack
l_.str.1:                               ; @.str.1
	.asciz	"FreeLdr stack"

	.comm	_FREELDR_BASE,4,2               ; @FREELDR_BASE
	.comm	_FrLdrImageSize,8,3             ; @FrLdrImageSize
	.comm	_LoaderLoadedProgram,4,2        ; @LoaderLoadedProgram
l_.str.2:                               ; @.str.2
	.asciz	"FreeLdr image"

	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_DiskReadBuffer,8,3             ; @DiskReadBuffer
	.comm	_DiskReadBufferSize,8,3         ; @DiskReadBufferSize
	.comm	_PcMapCount,8,3                 ; @PcMapCount
	.comm	_LoaderFree,8,3                 ; @LoaderFree
	.comm	_MAX_DISKREADBUFFER_SIZE,4,2    ; @MAX_DISKREADBUFFER_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"DiskReadBuffer=0x%p, DiskReadBufferSize=0x%lx\n"

l_.str.4:                               ; @.str.4
	.asciz	"Disk read buffer"

l_.str.5:                               ; @.str.5
	.asciz	"Dumping resulting memory map:\n"

l_.str.6:                               ; @.str.6
	.asciz	"BasePage=0x%lx, PageCount=0x%lx, Type=%s\n"

.subsections_via_symbols
