	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function multiboot_loadfile
_multiboot_loadfile:                    ## @multiboot_loadfile
	.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
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movq	%rdx, %r15
	movl	%esi, %ebx
	movq	%rdi, %r12
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	cmpl	$-1, %eax
	je	LBB0_3
## %bb.4:
	movl	%eax, %r14d
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movq	%r15, %rbx
	movq	_MULTIBOOT_SEARCH@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %r13
	movl	(%r15), %edx
	movl	%r14d, %edi
	movq	%rax, %rsi
	callq	_read
	cmpl	$8, %eax
	jb	LBB0_10
## %bb.7:
	movslq	%eax, %rdx
	shrq	$3, %rdx
	movq	_MULTIBOOT_HEADER_MAGIC@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$2, %rdx
	movl	$1, %ecx
	cmovaeq	%rdx, %rcx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rax, (%r13,%rdx,8)
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	incq	%rdx
	cmpq	%rdx, %rcx
	jne	LBB0_8
	jmp	LBB0_10
LBB0_1:
	movq	_EFTYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_19
LBB0_3:
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_19
LBB0_5:
	movl	%r14d, %edi
	callq	_close
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_19
LBB0_11:
	movl	%edx, %eax
	movq	(%r13,%rax,8), %rsi
	movq	16(%r13,%rax,8), %rcx
	movslq	8(%r13,%rax,8), %rdx
	movq	%rdx, %rax
	addq	%rsi, %rax
	addq	%rcx, %rax
	jne	LBB0_12
## %bb.13:
	movq	_MULTIBOOT_SUPPORTED_FLAGS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	notl	%eax
	testl	%eax, %edx
	je	LBB0_15
## %bb.14:
	leaq	L_.str.1(%rip), %rdi
	movl	%edx, %esi
	xorl	%eax, %eax
	callq	_printf
	jmp	LBB0_10
LBB0_12:
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_printf
LBB0_10:
	movq	_EFTYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_18:
	movq	%r13, %rdi
	callq	_free
	movl	%r14d, %edi
	callq	_close
LBB0_19:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%rbx, %r15
	movq	%rbx, %rdx
	movl	$1, %ecx
	callq	_elf32_loadfile_raw
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_printf
	jmp	LBB0_18
LBB0_17:
	movq	(%r15), %rax
	movl	(%rax), %edi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_roundup
	movq	(%r15), %rcx
	movl	%eax, (%rcx)
	xorl	%ebx, %ebx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_EFTYPE,4,2                     ## @EFTYPE
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.comm	_errno,4,2                      ## @errno
	.comm	_MULTIBOOT_SEARCH,4,2           ## @MULTIBOOT_SEARCH
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MULTIBOOT_HEADER_MAGIC,8,3     ## @MULTIBOOT_HEADER_MAGIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Multiboot checksum failed, magic: 0x%x flags: 0x%x checksum: 0x%x\n"

	.comm	_MULTIBOOT_SUPPORTED_FLAGS,4,2  ## @MULTIBOOT_SUPPORTED_FLAGS
L_.str.1:                               ## @.str.1
	.asciz	"Unsupported multiboot flags found: 0x%x\n"

L_.str.2:                               ## @.str.2
	.asciz	"elf32_loadfile_raw failed: %d unable to load multiboot kernel\n"

	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.no_dead_strip	_multiboot_loadfile
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function multiboot_loadfile
_multiboot_loadfile:                    ; @multiboot_loadfile
	.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
	cbz	x0, LBB0_7
; %bb.1:
	mov	x21, x2
	mov	x22, x1
	mov	x23, x0
Lloh0:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_open
	cmn	w0, #1
	b.eq	LBB0_8
; %bb.2:
	mov	x19, x0
Lloh3:
	adrp	x24, _MULTIBOOT_SEARCH@GOTPAGE
Lloh4:
	ldr	x24, [x24, _MULTIBOOT_SEARCH@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_malloc
	cbz	x0, LBB0_9
; %bb.3:
	mov	x20, x0
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x20
	bl	_read
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w0, #8
	b.lo	LBB0_15
; %bb.4:
	mov	x8, #0
	sxtw	x9, w0
	lsr	x10, x9, #3
Lloh5:
	adrp	x9, _MULTIBOOT_HEADER_MAGIC@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MULTIBOOT_HEADER_MAGIC@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x10, #1
	csinc	x10, x10, xzr, hi
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x11, [x20, x8, lsl #3]
	cmp	x11, x9
	b.eq	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x8, x8, #1
	cmp	x10, x8
	b.ne	LBB0_5
	b	LBB0_15
LBB0_7:
Lloh8:
	adrp	x8, _EFTYPE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EFTYPE@GOTPAGEOFF]
Lloh10:
	ldr	w22, [x8]
	b	LBB0_17
LBB0_8:
Lloh11:
	adrp	x8, _errno@GOTPAGE
Lloh12:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh13:
	ldr	w22, [x8]
	b	LBB0_17
LBB0_9:
	mov	x0, x19
	bl	_close
Lloh14:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh16:
	ldr	w22, [x8]
	b	LBB0_17
LBB0_10:
	add	x9, x20, w8, uxtw #3
	ldr	x8, [x9]
	ldrsw	x1, [x9, #8]
	ldr	x9, [x9, #16]
	add	x10, x8, x1
	cmn	x10, x9
	b.ne	LBB0_13
; %bb.11:
Lloh17:
	adrp	x8, _MULTIBOOT_SUPPORTED_FLAGS@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MULTIBOOT_SUPPORTED_FLAGS@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	bics	wzr, w1, w8
	b.eq	LBB0_18
; %bb.12:
Lloh20:
	adrp	x0, l_.str.1@PAGE
Lloh21:
	add	x0, x0, l_.str.1@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	b	LBB0_14
LBB0_13:
                                        ; kill: def $w1 killed $w1 killed $x1 def $x1
	stp	x1, x9, [sp]
Lloh22:
	adrp	x0, l_.str@PAGE
Lloh23:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x8
LBB0_14:
	bl	_printf
LBB0_15:
Lloh24:
	adrp	x8, _EFTYPE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EFTYPE@GOTPAGEOFF]
Lloh26:
	ldr	w22, [x8]
LBB0_16:
	mov	x0, x20
	bl	_free
	mov	x0, x19
	bl	_close
LBB0_17:
	mov	x0, x22
	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_18:
	mov	x0, x23
	mov	x1, x22
	mov	x2, x21
	mov	w3, #1
	bl	_elf32_loadfile_raw
	mov	x22, x0
	cbz	w0, LBB0_20
; %bb.19:
Lloh27:
	adrp	x0, l_.str.2@PAGE
Lloh28:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x22
	bl	_printf
	b	LBB0_16
LBB0_20:
	ldr	x8, [x21]
	ldr	w0, [x8]
Lloh29:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh30:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	bl	_roundup
	ldr	x8, [x21]
	str	w0, [x8]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_EFTYPE,4,2                     ; @EFTYPE
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.comm	_errno,4,2                      ; @errno
	.comm	_MULTIBOOT_SEARCH,4,2           ; @MULTIBOOT_SEARCH
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MULTIBOOT_HEADER_MAGIC,8,3     ; @MULTIBOOT_HEADER_MAGIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Multiboot checksum failed, magic: 0x%x flags: 0x%x checksum: 0x%x\n"

	.comm	_MULTIBOOT_SUPPORTED_FLAGS,4,2  ; @MULTIBOOT_SUPPORTED_FLAGS
l_.str.1:                               ; @.str.1
	.asciz	"Unsupported multiboot flags found: 0x%x\n"

l_.str.2:                               ; @.str.2
	.asciz	"elf32_loadfile_raw failed: %d unable to load multiboot kernel\n"

	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.no_dead_strip	_multiboot_loadfile
.subsections_via_symbols
