	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CARTRIDGE_Initialise           ## -- Begin function CARTRIDGE_Initialise
	.p2align	4, 0x90
_CARTRIDGE_Initialise:                  ## @CARTRIDGE_Initialise
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_FALSE@GOTPCREL(%rip), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	(%rax), %eax
	movq	%rdi, -88(%rbp)                 ## 8-byte Spill
	movl	(%rdi), %r12d
	movl	$1, %ecx
	cmpl	$2, %r12d
	jl	LBB0_32
## %bb.1:
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movl	$1, -68(%rbp)                   ## 4-byte Folded Spill
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	movl	$1, %r15d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%r15), %r13d
	movslq	%r15d, %r14
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_11
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_14
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.2(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_16
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_19
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.4(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_23
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.5(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	je	LBB0_24
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_strcmp
	testq	%rax, %rax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	leaq	L_.str.7(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	movq	_CARTRIDGE_LAST_SUPPORTED@GOTPCREL(%rip), %r12
	movq	(%r12), %rsi
	leaq	L_.str.8(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	leaq	L_.str.9(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	movq	(%r12), %rsi
	leaq	L_.str.10(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	leaq	L_.str.11(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	leaq	L_.str.12(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx,%r14,8), %rax
	movl	-68(%rbp), %edx                 ## 4-byte Reload
	movslq	%edx, %rcx
	incl	%edx
	movl	%edx, -68(%rbp)                 ## 4-byte Spill
	movq	%rax, (%rbx,%rcx,8)
	jmp	LBB0_28
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r12d, %r13d
	jge	LBB0_22
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_CARTRIDGE_main@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	movslq	%r13d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rax,8), %rsi
	movl	$8, %edx
	callq	_Util_strlcpy
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_27
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_CARTRIDGE_UNKNOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%rbx)
	movl	$0, -52(%rbp)                   ## 4-byte Folded Spill
	jmp	LBB0_27
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r12d, %r13d
	jge	LBB0_22
## %bb.15:                              ##   in Loop: Header=BB0_2 Depth=1
	movslq	%r13d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rax,8), %rdi
	movq	_CARTRIDGE_main@GOTPCREL(%rip), %rbx
	leaq	8(%rbx), %rsi
	callq	_Util_sscansdec
	movq	8(%rbx), %rax
	testq	%rax, %rax
	sets	%cl
	movq	_CARTRIDGE_LAST_SUPPORTED@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	setg	%al
	orb	%cl, %al
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cmovel	%ecx, %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_21
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r12d, %r13d
	jge	LBB0_22
## %bb.17:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_CARTRIDGE_piggyback@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	movslq	%r13d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rax,8), %rsi
	movl	$8, %edx
	callq	_Util_strlcpy
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_27
## %bb.26:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_CARTRIDGE_UNKNOWN@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%rbx)
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	.p2align	4, 0x90
LBB0_27:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r13d, %r15d
	jmp	LBB0_28
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%r12d, %r13d
	jge	LBB0_22
## %bb.20:                              ##   in Loop: Header=BB0_2 Depth=1
	movslq	%r13d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rax,8), %rdi
	movq	_CARTRIDGE_piggyback@GOTPCREL(%rip), %rbx
	leaq	8(%rbx), %rsi
	callq	_Util_sscansdec
	movq	8(%rbx), %rax
	testq	%rax, %rax
	sets	%cl
	movq	_CARTRIDGE_LAST_SUPPORTED@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rax
	setg	%al
	orb	%cl, %al
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	cmovel	%ecx, %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmovel	%eax, %ecx
	movl	%r13d, %r15d
	testl	%eax, %eax
	je	LBB0_29
	jmp	LBB0_33
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	testl	%eax, %eax
	je	LBB0_29
	jmp	LBB0_33
LBB0_23:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_25
LBB0_24:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_FALSE@GOTPCREL(%rip), %rax
LBB0_25:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	(%rax), %eax
	movq	_CARTRIDGE_autoreboot@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
LBB0_28:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, %eax
	testl	%eax, %eax
	jne	LBB0_33
LBB0_29:                                ##   in Loop: Header=BB0_2 Depth=1
	testl	%ecx, %ecx
	jne	LBB0_34
## %bb.30:                              ##   in Loop: Header=BB0_2 Depth=1
	incl	%r15d
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %r12d
	cmpl	%r12d, %r15d
	jge	LBB0_36
## %bb.31:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	jmp	LBB0_2
LBB0_32:
	movl	%eax, %edx
	jmp	LBB0_37
LBB0_33:
	movslq	%r15d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rax,8), %rsi
	leaq	L_.str.13(%rip), %rdi
	jmp	LBB0_35
LBB0_34:
	movslq	%r15d, %rax
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	-8(%rcx,%rax,8), %rsi
	leaq	L_.str.14(%rip), %rdi
LBB0_35:
	xorl	%eax, %eax
	callq	_Log_print
	jmp	LBB0_44
LBB0_36:
	movl	-68(%rbp), %ecx                 ## 4-byte Reload
	movl	-72(%rbp), %edx                 ## 4-byte Reload
LBB0_37:
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movl	%ecx, (%rax)
	movq	_TRUE@GOTPCREL(%rip), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	testl	%edx, %edx
	jne	LBB0_44
## %bb.38:
	movq	_CARTRIDGE_main@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	cmpb	$0, (%rax)
	jne	LBB0_40
## %bb.39:
	movq	_CARTRIDGE_NONE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%rbx)
LBB0_40:
	movq	_CARTRIDGE_piggyback@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	cmpb	$0, (%rcx)
	jne	LBB0_42
## %bb.41:
	movq	_CARTRIDGE_NONE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, 8(%rax)
LBB0_42:
	movq	%rbx, %rdi
	callq	_InitInsert
	movq	8(%rbx), %rdi
	callq	_CartIsPassthrough
	testq	%rax, %rax
	je	LBB0_44
## %bb.43:
	movq	_CARTRIDGE_piggyback@GOTPCREL(%rip), %rdi
	callq	_InitInsert
LBB0_44:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FALSE,4,2                      ## @FALSE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"-cart"

	.comm	_CARTRIDGE_main,16,3            ## @CARTRIDGE_main
	.comm	_CARTRIDGE_UNKNOWN,8,3          ## @CARTRIDGE_UNKNOWN
	.comm	_TRUE,4,2                       ## @TRUE
L_.str.1:                               ## @.str.1
	.asciz	"-cart-type"

	.comm	_CARTRIDGE_LAST_SUPPORTED,8,3   ## @CARTRIDGE_LAST_SUPPORTED
L_.str.2:                               ## @.str.2
	.asciz	"-cart2"

	.comm	_CARTRIDGE_piggyback,16,3       ## @CARTRIDGE_piggyback
L_.str.3:                               ## @.str.3
	.asciz	"-cart2-type"

L_.str.4:                               ## @.str.4
	.asciz	"-cart-autoreboot"

	.comm	_CARTRIDGE_autoreboot,4,2       ## @CARTRIDGE_autoreboot
L_.str.5:                               ## @.str.5
	.asciz	"-no-cart-autoreboot"

L_.str.6:                               ## @.str.6
	.asciz	"-help"

L_.str.7:                               ## @.str.7
	.asciz	"\t-cart <file>         Install cartridge (raw or CART format)"

L_.str.8:                               ## @.str.8
	.asciz	"\t-cart-type <num>     Set cartridge type (0..%i)"

L_.str.9:                               ## @.str.9
	.asciz	"\t-cart2 <file>        Install piggyback cartridge"

L_.str.10:                              ## @.str.10
	.asciz	"\t-cart2-type <num>    Set piggyback cartridge type (0..%i)"

L_.str.11:                              ## @.str.11
	.asciz	"\t-cart-autoreboot     Reboot when cartridge is inserted/removed"

L_.str.12:                              ## @.str.12
	.asciz	"\t-no-cart-autoreboot  Don't reboot after changing cartridge"

L_.str.13:                              ## @.str.13
	.asciz	"Missing argument for '%s'"

L_.str.14:                              ## @.str.14
	.asciz	"Invalid argument for '%s'"

	.comm	_CARTRIDGE_NONE,8,3             ## @CARTRIDGE_NONE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_CARTRIDGE_Initialise           ; -- Begin function CARTRIDGE_Initialise
	.p2align	2
_CARTRIDGE_Initialise:                  ; @CARTRIDGE_Initialise
	.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
	mov	x19, x0
Lloh0:
	adrp	x27, _FALSE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _FALSE@GOTPAGEOFF]
	ldr	w26, [x27]
	ldr	w28, [x0]
	cmp	w28, #2
	b.lt	LBB0_31
; %bb.1:
	mov	x20, x1
	mov	w8, #1
	stp	w8, w26, [sp, #24]              ; 8-byte Folded Spill
Lloh2:
	adrp	x21, l_.str@PAGE
Lloh3:
	add	x21, x21, l_.str@PAGEOFF
	mov	x24, x26
	str	w26, [sp, #20]                  ; 4-byte Folded Spill
	mov	w23, #1
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	sxtw	x25, w23
	add	x22, x25, #1
	ldr	x0, [x20, w23, sxtw #3]
	mov	x1, x21
	bl	_strcmp
	cbz	x0, LBB0_11
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_13
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_15
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh8:
	adrp	x1, l_.str.3@PAGE
Lloh9:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_20
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh10:
	adrp	x1, l_.str.4@PAGE
Lloh11:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_27
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh12:
	adrp	x1, l_.str.5@PAGE
Lloh13:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_strcmp
	cbz	x0, LBB0_28
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, x25, lsl #3]
Lloh14:
	adrp	x1, l_.str.6@PAGE
Lloh15:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_strcmp
	cbnz	x0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh16:
	adrp	x8, _TRUE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	str	w8, [sp, #20]                   ; 4-byte Folded Spill
Lloh19:
	adrp	x0, l_.str.7@PAGE
Lloh20:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_Log_print
Lloh21:
	adrp	x22, _CARTRIDGE_LAST_SUPPORTED@GOTPAGE
Lloh22:
	ldr	x22, [x22, _CARTRIDGE_LAST_SUPPORTED@GOTPAGEOFF]
	ldr	x8, [x22]
	str	x8, [sp]
Lloh23:
	adrp	x0, l_.str.8@PAGE
Lloh24:
	add	x0, x0, l_.str.8@PAGEOFF
	bl	_Log_print
Lloh25:
	adrp	x0, l_.str.9@PAGE
Lloh26:
	add	x0, x0, l_.str.9@PAGEOFF
	bl	_Log_print
	ldr	x8, [x22]
	str	x8, [sp]
Lloh27:
	adrp	x0, l_.str.10@PAGE
Lloh28:
	add	x0, x0, l_.str.10@PAGEOFF
	bl	_Log_print
Lloh29:
	adrp	x0, l_.str.11@PAGE
Lloh30:
	add	x0, x0, l_.str.11@PAGEOFF
	bl	_Log_print
Lloh31:
	adrp	x0, l_.str.12@PAGE
Lloh32:
	add	x0, x0, l_.str.12@PAGEOFF
	bl	_Log_print
LBB0_10:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x20, x25, lsl #3]
	ldr	w9, [sp, #24]                   ; 4-byte Folded Reload
	str	x8, [x20, w9, sxtw #3]
	add	w8, w9, #1
	str	w8, [sp, #24]                   ; 4-byte Folded Spill
	mov	x8, x26
	cbz	w8, LBB0_24
	b	LBB0_30
LBB0_11:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w22, w28
	b.ge	LBB0_23
; %bb.12:                               ;   in Loop: Header=BB0_2 Depth=1
Lloh33:
	adrp	x23, _CARTRIDGE_main@GOTPAGE
Lloh34:
	ldr	x23, [x23, _CARTRIDGE_main@GOTPAGEOFF]
	ldr	x0, [x23]
	ldr	x1, [x20, x22, lsl #3]
	mov	w2, #8
	bl	_Util_strlcpy
	cbnz	w24, LBB0_19
	b	LBB0_18
LBB0_13:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w22, w28
	b.ge	LBB0_23
; %bb.14:                               ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, w22, sxtw #3]
Lloh35:
	adrp	x23, _CARTRIDGE_main@GOTPAGE
Lloh36:
	ldr	x23, [x23, _CARTRIDGE_main@GOTPAGEOFF]
	add	x1, x23, #8
	bl	_Util_sscansdec
	ldr	x8, [x23, #8]
	cmp	x8, #0
Lloh37:
	adrp	x9, _CARTRIDGE_LAST_SUPPORTED@GOTPAGE
Lloh38:
	ldr	x9, [x9, _CARTRIDGE_LAST_SUPPORTED@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
	ccmp	x8, x9, #0, ge
	cset	w8, gt
Lloh40:
	adrp	x9, _TRUE@GOTPAGE
Lloh41:
	ldr	x9, [x9, _TRUE@GOTPAGEOFF]
Lloh42:
	ldr	w9, [x9]
	cmp	w8, #0
	csel	w24, w24, w9, ne
	b	LBB0_22
LBB0_15:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w22, w28
	b.ge	LBB0_23
; %bb.16:                               ;   in Loop: Header=BB0_2 Depth=1
Lloh43:
	adrp	x23, _CARTRIDGE_piggyback@GOTPAGE
Lloh44:
	ldr	x23, [x23, _CARTRIDGE_piggyback@GOTPAGEOFF]
	ldr	x0, [x23]
	ldr	x1, [x20, w22, sxtw #3]
	mov	w2, #8
	bl	_Util_strlcpy
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	cbnz	w8, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_2 Depth=1
	str	wzr, [sp, #28]                  ; 4-byte Folded Spill
LBB0_18:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh45:
	adrp	x8, _CARTRIDGE_UNKNOWN@GOTPAGE
Lloh46:
	ldr	x8, [x8, _CARTRIDGE_UNKNOWN@GOTPAGEOFF]
Lloh47:
	ldr	x8, [x8]
	str	x8, [x23, #8]
LBB0_19:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x23, x22
	mov	x8, x26
	cbz	w8, LBB0_24
	b	LBB0_30
LBB0_20:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w22, w28
	b.ge	LBB0_23
; %bb.21:                               ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x20, w22, sxtw #3]
Lloh48:
	adrp	x23, _CARTRIDGE_piggyback@GOTPAGE
Lloh49:
	ldr	x23, [x23, _CARTRIDGE_piggyback@GOTPAGEOFF]
	add	x1, x23, #8
	bl	_Util_sscansdec
	ldr	x8, [x23, #8]
	cmp	x8, #0
Lloh50:
	adrp	x9, _CARTRIDGE_LAST_SUPPORTED@GOTPAGE
Lloh51:
	ldr	x9, [x9, _CARTRIDGE_LAST_SUPPORTED@GOTPAGEOFF]
Lloh52:
	ldr	x9, [x9]
	ccmp	x8, x9, #0, ge
	cset	w8, gt
Lloh53:
	adrp	x9, _TRUE@GOTPAGE
Lloh54:
	ldr	x9, [x9, _TRUE@GOTPAGEOFF]
Lloh55:
	ldr	w9, [x9]
	cmp	w8, #0
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	csel	w8, w8, w9, ne
	str	w8, [sp, #28]                   ; 4-byte Folded Spill
LBB0_22:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x8, x26
	csel	w26, w9, w26, ne
	mov	x23, x22
	cbz	w8, LBB0_24
	b	LBB0_30
LBB0_23:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh56:
	adrp	x8, _TRUE@GOTPAGE
Lloh57:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh58:
	ldr	w8, [x8]
	cbnz	w8, LBB0_30
LBB0_24:                                ;   in Loop: Header=BB0_2 Depth=1
	cbnz	w26, LBB0_32
; %bb.25:                               ;   in Loop: Header=BB0_2 Depth=1
	add	w23, w23, #1
	ldr	w28, [x19]
	cmp	w23, w28
	b.ge	LBB0_34
; %bb.26:                               ;   in Loop: Header=BB0_2 Depth=1
	ldr	w26, [x27]
	b	LBB0_2
LBB0_27:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh59:
	adrp	x8, _TRUE@GOTPAGE
Lloh60:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh61:
	ldr	w8, [x8]
	b	LBB0_29
LBB0_28:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x27]
LBB0_29:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh62:
	adrp	x9, _CARTRIDGE_autoreboot@GOTPAGE
Lloh63:
	ldr	x9, [x9, _CARTRIDGE_autoreboot@GOTPAGEOFF]
Lloh64:
	str	w8, [x9]
	mov	x8, x26
	cbz	w8, LBB0_24
LBB0_30:
	ldr	x8, [x20, w23, sxtw #3]
	str	x8, [sp]
Lloh65:
	adrp	x0, l_.str.13@PAGE
Lloh66:
	add	x0, x0, l_.str.13@PAGEOFF
	b	LBB0_33
LBB0_31:
	mov	w8, #1
	str	w8, [x19]
	cbnz	w26, LBB0_41
	b	LBB0_35
LBB0_32:
	add	x8, x20, w23, sxtw #3
	ldur	x8, [x8, #-8]
	str	x8, [sp]
Lloh67:
	adrp	x0, l_.str.14@PAGE
Lloh68:
	add	x0, x0, l_.str.14@PAGEOFF
LBB0_33:
	bl	_Log_print
Lloh69:
	adrp	x8, _FALSE@GOTPAGE
Lloh70:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
	b	LBB0_42
LBB0_34:
	ldp	w26, w8, [sp, #20]              ; 8-byte Folded Reload
	str	w8, [x19]
	cbnz	w26, LBB0_41
LBB0_35:
Lloh71:
	adrp	x19, _CARTRIDGE_main@GOTPAGE
Lloh72:
	ldr	x19, [x19, _CARTRIDGE_main@GOTPAGEOFF]
	ldr	x8, [x19]
	ldrb	w8, [x8]
	cbnz	w8, LBB0_37
; %bb.36:
Lloh73:
	adrp	x8, _CARTRIDGE_NONE@GOTPAGE
Lloh74:
	ldr	x8, [x8, _CARTRIDGE_NONE@GOTPAGEOFF]
Lloh75:
	ldr	x8, [x8]
	str	x8, [x19, #8]
LBB0_37:
Lloh76:
	adrp	x8, _CARTRIDGE_piggyback@GOTPAGE
Lloh77:
	ldr	x8, [x8, _CARTRIDGE_piggyback@GOTPAGEOFF]
	ldr	x9, [x8]
	ldrb	w9, [x9]
	cbnz	w9, LBB0_39
; %bb.38:
Lloh78:
	adrp	x9, _CARTRIDGE_NONE@GOTPAGE
Lloh79:
	ldr	x9, [x9, _CARTRIDGE_NONE@GOTPAGEOFF]
Lloh80:
	ldr	x9, [x9]
	str	x9, [x8, #8]
LBB0_39:
	mov	x0, x19
	bl	_InitInsert
	ldr	x0, [x19, #8]
	bl	_CartIsPassthrough
	cbz	x0, LBB0_41
; %bb.40:
Lloh81:
	adrp	x0, _CARTRIDGE_piggyback@GOTPAGE
Lloh82:
	ldr	x0, [x0, _CARTRIDGE_piggyback@GOTPAGEOFF]
	bl	_InitInsert
LBB0_41:
Lloh83:
	adrp	x8, _TRUE@GOTPAGE
Lloh84:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
LBB0_42:
	ldr	w0, [x8]
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGot	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh59, Lloh60, Lloh61
	.loh AdrpLdrGotStr	Lloh62, Lloh63, Lloh64
	.loh AdrpAdd	Lloh65, Lloh66
	.loh AdrpAdd	Lloh67, Lloh68
	.loh AdrpLdrGot	Lloh69, Lloh70
	.loh AdrpLdrGot	Lloh71, Lloh72
	.loh AdrpLdrGotLdr	Lloh73, Lloh74, Lloh75
	.loh AdrpLdrGot	Lloh76, Lloh77
	.loh AdrpLdrGotLdr	Lloh78, Lloh79, Lloh80
	.loh AdrpLdrGot	Lloh81, Lloh82
	.loh AdrpLdrGot	Lloh83, Lloh84
	.cfi_endproc
                                        ; -- End function
	.comm	_FALSE,4,2                      ; @FALSE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"-cart"

	.comm	_CARTRIDGE_main,16,3            ; @CARTRIDGE_main
	.comm	_CARTRIDGE_UNKNOWN,8,3          ; @CARTRIDGE_UNKNOWN
	.comm	_TRUE,4,2                       ; @TRUE
l_.str.1:                               ; @.str.1
	.asciz	"-cart-type"

	.comm	_CARTRIDGE_LAST_SUPPORTED,8,3   ; @CARTRIDGE_LAST_SUPPORTED
l_.str.2:                               ; @.str.2
	.asciz	"-cart2"

	.comm	_CARTRIDGE_piggyback,16,3       ; @CARTRIDGE_piggyback
l_.str.3:                               ; @.str.3
	.asciz	"-cart2-type"

l_.str.4:                               ; @.str.4
	.asciz	"-cart-autoreboot"

	.comm	_CARTRIDGE_autoreboot,4,2       ; @CARTRIDGE_autoreboot
l_.str.5:                               ; @.str.5
	.asciz	"-no-cart-autoreboot"

l_.str.6:                               ; @.str.6
	.asciz	"-help"

l_.str.7:                               ; @.str.7
	.asciz	"\t-cart <file>         Install cartridge (raw or CART format)"

l_.str.8:                               ; @.str.8
	.asciz	"\t-cart-type <num>     Set cartridge type (0..%i)"

l_.str.9:                               ; @.str.9
	.asciz	"\t-cart2 <file>        Install piggyback cartridge"

l_.str.10:                              ; @.str.10
	.asciz	"\t-cart2-type <num>    Set piggyback cartridge type (0..%i)"

l_.str.11:                              ; @.str.11
	.asciz	"\t-cart-autoreboot     Reboot when cartridge is inserted/removed"

l_.str.12:                              ; @.str.12
	.asciz	"\t-no-cart-autoreboot  Don't reboot after changing cartridge"

l_.str.13:                              ; @.str.13
	.asciz	"Missing argument for '%s'"

l_.str.14:                              ; @.str.14
	.asciz	"Invalid argument for '%s'"

	.comm	_CARTRIDGE_NONE,8,3             ; @CARTRIDGE_NONE
.subsections_via_symbols
