	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PicoCartLoad                   ## -- Begin function PicoCartLoad
	.p2align	4, 0x90
_PicoCartLoad:                          ## @PicoCartLoad
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$1, %eax
	testq	%rdi, %rdi
	je	LBB0_30
## %bb.1:
	movq	%rdi, %r14
	movl	(%rdi), %r13d
	testl	%r13d, %r13d
	jle	LBB0_30
## %bb.2:
	movq	%rdx, %r15
	movq	%rsi, %r12
	addl	$3, %r13d
	movl	%r13d, %ebx
	andl	$-4, %ebx
	movl	%ebx, %edi
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movl	%ecx, %esi
	callq	_PicoCartAlloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.3:
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %r12
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %esi
	subl	%r13d, %esi
	cmpl	$262144, %esi                   ## imm = 0x40000
	movl	$262144, %eax                   ## imm = 0x40000
	cmovgel	%eax, %esi
	movq	%r12, %rdi
	movq	%r14, %rdx
	callq	_pm_read
	addl	%eax, %r13d
	movslq	%eax, %r15
	addq	%r15, %r12
	imull	$100, %r13d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %edi
	callq	_PicoCartLoadProgressCB
	testl	%r15d, %r15d
	jg	LBB0_4
## %bb.5:
	testl	%r13d, %r13d
	jle	LBB0_11
## %bb.6:
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.7:
	cmpl	$16896, %ebx                    ## imm = 0x4200
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	jl	LBB0_26
## %bb.8:
	andl	$16380, %eax                    ## imm = 0x3FFC
	cmpl	$512, %eax                      ## imm = 0x200
	jne	LBB0_26
## %bb.9:
	movq	_EL_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_elprintf
	addl	$-512, %ebx                     ## imm = 0xFE00
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movq	%rdi, %rsi
	addq	$512, %rsi                      ## imm = 0x200
	movl	%ebx, %edx
	callq	_memmove
	jmp	LBB0_26
LBB0_10:
	movq	_EL_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_elprintf
	movl	$2, %eax
	jmp	LBB0_30
LBB0_11:
	movq	_EL_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_elprintf
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_free
	movl	$3, %eax
	jmp	LBB0_30
LBB0_12:
	cmpl	$131072, %ebx                   ## imm = 0x20000
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	-52(%rbp), %r13d                ## 4-byte Reload
	jne	LBB0_17
## %bb.13:
	movq	_PicoAHW@GOTPCREL(%rip), %r14
	movq	_PAHW_MCD@GOTPCREL(%rip), %r15
	movl	(%r15), %eax
	andl	(%r14), %eax
	jne	LBB0_17
## %bb.14:
	leaq	292(%rcx), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	$4, %edx
	callq	_strncmp
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	testl	%eax, %eax
	je	LBB0_16
## %bb.15:
	addq	$296, %rcx                      ## imm = 0x128
	leaq	L_.str.2(%rip), %rsi
	movq	%rcx, %rdi
	movl	$4, %edx
	callq	_strncmp
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	testl	%eax, %eax
	jne	LBB0_17
LBB0_16:
	movl	(%r15), %eax
	orl	%eax, (%r14)
LBB0_17:
	cmpl	$16896, %ebx                    ## imm = 0x4200
	jl	LBB0_24
## %bb.18:
	andl	$16380, %r13d                   ## imm = 0x3FFC
	cmpl	$512, %r13d                     ## imm = 0x200
	jne	LBB0_24
## %bb.19:
	cmpb	$83, 8832(%rcx)
	movb	640(%rcx), %al
	jne	LBB0_21
## %bb.20:
	cmpb	$69, %al
	je	LBB0_23
LBB0_21:
	cmpb	$83, %al
	jne	LBB0_24
## %bb.22:
	cmpb	$69, 8833(%rcx)
	jne	LBB0_24
LBB0_23:
	movq	_EL_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rcx, %r14
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_elprintf
	movq	%r14, %rdi
	movl	%ebx, %esi
	callq	_DecodeSmd
	addl	$-512, %ebx                     ## imm = 0xFE00
	jmp	LBB0_25
LBB0_24:
	movq	%rcx, %rdi
	movq	%rcx, %rsi
	movl	%ebx, %edx
	callq	_Byteswap
LBB0_25:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
LBB0_26:
	testq	%r12, %r12
	je	LBB0_28
## %bb.27:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r12)
LBB0_28:
	xorl	%eax, %eax
	testq	%r14, %r14
	je	LBB0_30
## %bb.29:
	movl	%ebx, (%r14)
LBB0_30:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EL_STATUS,4,2                  ## @EL_STATUS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"out of memory (wanted %i)"

L_.str.1:                               ## @.str.1
	.asciz	"read failed"

	.comm	_PicoAHW,4,2                    ## @PicoAHW
	.comm	_PAHW_MCD,4,2                   ## @PAHW_MCD
L_.str.2:                               ## @.str.2
	.asciz	"BOOT"

L_.str.3:                               ## @.str.3
	.asciz	"SMD format detected."

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PicoCartLoad                   ; -- Begin function PicoCartLoad
	.p2align	2
_PicoCartLoad:                          ; @PicoCartLoad
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	cbz	x0, LBB0_10
; %bb.1:
	mov	x24, x0
	ldr	w8, [x0]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.2:
	mov	x23, x3
	mov	x19, x2
	mov	x21, x1
	add	w27, w8, #3
	and	w20, w27, #0xfffffffc
	mov	x0, x20
	mov	x1, x3
	bl	_PicoCartAlloc
	cbz	x0, LBB0_12
; %bb.3:
	mov	x22, x0
	stp	x19, x21, [sp, #16]             ; 16-byte Folded Spill
	mov	w28, #0
	mov	w8, #8832
	add	x8, x0, x8
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	mov	w19, #262144
	mov	w21, #100
	mov	x25, x0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	sub	w8, w20, w28
	cmp	w8, #64, lsl #12                ; =262144
	csel	w1, w8, w19, lt
	mov	x0, x25
	mov	x2, x24
	bl	_pm_read
	mov	x26, x0
	add	w28, w0, w28
	add	x25, x25, w0, sxtw
	mul	w8, w28, w21
	sdiv	w0, w8, w20
	bl	_PicoCartLoadProgressCB
	cmp	w26, #0
	b.gt	LBB0_4
; %bb.5:
	cmp	w28, #0
	b.le	LBB0_13
; %bb.6:
	cbz	w23, LBB0_14
; %bb.7:
	mov	w8, #16896
	cmp	w20, w8
	ldr	x21, [sp, #24]                  ; 8-byte Folded Reload
	b.lt	LBB0_31
; %bb.8:
	and	w8, w27, #0x3ffc
	cmp	w8, #512
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
	b.ne	LBB0_27
; %bb.9:
Lloh0:
	adrp	x8, _EL_STATUS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EL_STATUS@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x1, l_.str.3@PAGE
Lloh4:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_elprintf
	sub	w20, w20, #512
	add	x1, x22, #512
	mov	x0, x22
	mov	x2, x20
	bl	_memmove
	cbnz	x21, LBB0_28
	b	LBB0_29
LBB0_10:
	mov	w0, #1
LBB0_11:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_12:
Lloh5:
	adrp	x8, _EL_STATUS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EL_STATUS@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	str	x20, [sp]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_elprintf
	mov	w0, #2
	b	LBB0_11
LBB0_13:
Lloh10:
	adrp	x8, _EL_STATUS@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EL_STATUS@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_elprintf
	mov	x0, x22
	bl	_free
	mov	w0, #3
	b	LBB0_11
LBB0_14:
	cmp	w20, #32, lsl #12               ; =131072
	ldr	x21, [sp, #24]                  ; 8-byte Folded Reload
	b.ne	LBB0_19
; %bb.15:
Lloh15:
	adrp	x23, _PicoAHW@GOTPAGE
Lloh16:
	ldr	x23, [x23, _PicoAHW@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh17:
	adrp	x19, _PAHW_MCD@GOTPAGE
Lloh18:
	ldr	x19, [x19, _PAHW_MCD@GOTPAGEOFF]
	ldr	w9, [x19]
	and	w8, w9, w8
	cbnz	w8, LBB0_19
; %bb.16:
	add	x0, x22, #292
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w2, #4
	bl	_strncmp
	cbz	w0, LBB0_18
; %bb.17:
	add	x0, x22, #296
Lloh21:
	adrp	x1, l_.str.2@PAGE
Lloh22:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w2, #4
	bl	_strncmp
	cbnz	w0, LBB0_19
LBB0_18:
	ldr	w8, [x19]
	ldr	w9, [x23]
	orr	w8, w9, w8
	str	w8, [x23]
LBB0_19:
	mov	w8, #16896
	cmp	w20, w8
	b.lt	LBB0_26
; %bb.20:
	and	w8, w27, #0x3ffc
	cmp	w8, #512
	b.ne	LBB0_26
; %bb.21:
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldrb	w9, [x8]
	ldrb	w8, [x22, #640]
	cmp	w9, #83
	b.ne	LBB0_23
; %bb.22:
	cmp	w8, #69
	b.eq	LBB0_25
LBB0_23:
	cmp	w8, #83
	b.ne	LBB0_26
; %bb.24:
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldrb	w8, [x8, #1]
	cmp	w8, #69
	b.ne	LBB0_26
LBB0_25:
Lloh23:
	adrp	x8, _EL_STATUS@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EL_STATUS@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_elprintf
	mov	x0, x22
	mov	x1, x20
	bl	_DecodeSmd
	sub	w20, w20, #512
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
	cbnz	x21, LBB0_28
	b	LBB0_29
LBB0_26:
	mov	x0, x22
	mov	x1, x22
	mov	x2, x20
	bl	_Byteswap
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
LBB0_27:
	cbz	x21, LBB0_29
LBB0_28:
	str	x22, [x21]
LBB0_29:
	mov	w0, #0
	cbz	x19, LBB0_11
; %bb.30:
	str	w20, [x19]
	b	LBB0_11
LBB0_31:
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
	cbnz	x21, LBB0_28
	b	LBB0_29
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_EL_STATUS,4,2                  ; @EL_STATUS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"out of memory (wanted %i)"

l_.str.1:                               ; @.str.1
	.asciz	"read failed"

	.comm	_PicoAHW,4,2                    ; @PicoAHW
	.comm	_PAHW_MCD,4,2                   ; @PAHW_MCD
l_.str.2:                               ; @.str.2
	.asciz	"BOOT"

l_.str.3:                               ; @.str.3
	.asciz	"SMD format detected."

.subsections_via_symbols
