	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_slot_autodetect                ## -- Begin function slot_autodetect
	.p2align	4, 0x90
_slot_autodetect:                       ## @slot_autodetect
	.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
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	testq	%rdx, %rdx
	je	LBB0_15
## %bb.1:
	movq	%rdx, %r14
	movl	%esi, %r12d
	movl	%edi, %ebx
	movq	%rsp, %r13
	movq	_MAXPATHLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r15
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	testl	%r12d, %r12d
	je	LBB0_2
## %bb.7:
	movq	_rominfo@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	testl	%ebx, %ebx
	jle	LBB0_9
## %bb.8:
	decl	%ebx
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_sprintf
	jmp	LBB0_10
LBB0_2:
	movq	_DEFAULT_PATH@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_rom_filename@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testl	%ebx, %ebx
	jle	LBB0_4
## %bb.3:
	decl	%ebx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_sprintf
	jmp	LBB0_5
LBB0_9:
	leaq	L_.str.4(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_sprintf
LBB0_10:
	movq	_CARD_WORKAREA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_SysArea@GOTPCREL(%rip), %rdi
	xorl	%esi, %esi
	callq	_memset
	leaq	L_.str.5(%rip), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_CARD_Init
	decl	%r12d
	movl	%r12d, %edi
	callq	_CardMount
	testq	%rax, %rax
	je	LBB0_14
## %bb.11:
	leaq	-56(%rbp), %rdx
	movl	%r12d, %edi
	movq	%r15, %rsi
	callq	_CARD_Open
	movq	_CARD_ERROR_READY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.12:
	movl	-56(%rbp), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	callq	_CARD_GetStatus
	movl	-64(%rbp), %eax
	movl	%eax, -68(%rbp)
	leaq	-68(%rbp), %rdi
	callq	_localtime
	movl	$1900, %ecx                     ## imm = 0x76C
	addq	16(%rax), %rcx
	movq	%rcx, 24(%r14)
	movups	(%rax), %xmm0
	movups	%xmm0, 4(%r14)
	leaq	-56(%rbp), %rdi
	callq	_CARD_Close
	movl	$1, (%r14)
LBB0_13:
	movl	%r12d, %edi
	callq	_CARD_Unmount
	jmp	LBB0_14
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_sprintf
LBB0_5:
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_14
## %bb.6:
	movq	%rax, %rbx
	leaq	-56(%rbp), %r12
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_stat
	movq	%r12, %rdi
	callq	_localtime
	movl	$1900, %ecx                     ## imm = 0x76C
	addq	16(%rax), %rcx
	movq	%rcx, 24(%r14)
	movups	(%rax), %xmm0
	movups	%xmm0, 4(%r14)
	movq	%rbx, %rdi
	callq	_fclose
	movl	$1, (%r14)
LBB0_14:
	movq	%r13, %rsp
LBB0_15:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_17
## %bb.16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAXPATHLEN,4,2                 ## @MAXPATHLEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/saves/%s.gp%d"

	.comm	_DEFAULT_PATH,8,3               ## @DEFAULT_PATH
	.comm	_rom_filename,8,3               ## @rom_filename
L_.str.1:                               ## @.str.1
	.asciz	"%s/saves/%s.srm"

L_.str.2:                               ## @.str.2
	.asciz	"rb"

L_.str.3:                               ## @.str.3
	.asciz	"MD-%04X.gp%d"

	.comm	_rominfo,4,2                    ## @rominfo
L_.str.4:                               ## @.str.4
	.asciz	"MD-%04X.srm"

	.comm	_SysArea,32,3                   ## @SysArea
	.comm	_CARD_WORKAREA,4,2              ## @CARD_WORKAREA
L_.str.5:                               ## @.str.5
	.asciz	"GENP"

L_.str.6:                               ## @.str.6
	.asciz	"00"

	.comm	_CARD_ERROR_READY,8,3           ## @CARD_ERROR_READY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_slot_autodetect                ; -- Begin function slot_autodetect
	.p2align	2
_slot_autodetect:                       ; @slot_autodetect
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	sub	sp, sp, #32
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
	cbz	x2, LBB0_15
; %bb.1:
	mov	x19, x2
	mov	x21, x1
	mov	x22, x0
	mov	x23, sp
Lloh3:
	adrp	x8, _MAXPATHLEN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAXPATHLEN@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x1fffffff0
	sub	x20, x9, x8
	mov	sp, x20
	mov	x0, x2
	mov	w1, #0
	mov	w2, #32
	bl	_memset
	cbz	w21, LBB0_4
; %bb.2:
Lloh8:
	adrp	x8, _rominfo@GOTPAGE
Lloh9:
	ldr	x8, [x8, _rominfo@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	subs	w9, w22, #1
	b.lt	LBB0_6
; %bb.3:
	stp	x8, x9, [sp, #-16]!
Lloh11:
	adrp	x1, l_.str.3@PAGE
Lloh12:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_7
LBB0_4:
Lloh13:
	adrp	x8, _DEFAULT_PATH@GOTPAGE
Lloh14:
	ldr	x8, [x8, _DEFAULT_PATH@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
Lloh16:
	adrp	x9, _rom_filename@GOTPAGE
Lloh17:
	ldr	x9, [x9, _rom_filename@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	subs	w10, w22, #1
	b.lt	LBB0_11
; %bb.5:
	stp	x8, x9, [sp, #-32]!
	str	x10, [sp, #16]
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #32
	b	LBB0_12
LBB0_6:
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	str	x8, [sp, #-16]!
Lloh21:
	adrp	x1, l_.str.4@PAGE
Lloh22:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_7:
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #16
Lloh23:
	adrp	x8, _CARD_WORKAREA@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CARD_WORKAREA@GOTPAGEOFF]
Lloh25:
	ldr	w2, [x8]
Lloh26:
	adrp	x0, _SysArea@GOTPAGE
Lloh27:
	ldr	x0, [x0, _SysArea@GOTPAGEOFF]
	mov	w1, #0
	bl	_memset
Lloh28:
	adrp	x0, l_.str.5@PAGE
Lloh29:
	add	x0, x0, l_.str.5@PAGEOFF
Lloh30:
	adrp	x1, l_.str.6@PAGE
Lloh31:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_CARD_Init
	sub	w21, w21, #1
	mov	x0, x21
	bl	_CardMount
	cbz	x0, LBB0_14
; %bb.8:
	sub	x2, x29, #64
	mov	x0, x21
	mov	x1, x20
	bl	_CARD_Open
Lloh32:
	adrp	x8, _CARD_ERROR_READY@GOTPAGE
Lloh33:
	ldr	x8, [x8, _CARD_ERROR_READY@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.9:
	ldur	w1, [x29, #-64]
	sub	x2, x29, #72
	mov	x0, x21
	bl	_CARD_GetStatus
	ldur	w8, [x29, #-72]
	stur	w8, [x29, #-76]
	sub	x0, x29, #76
	bl	_localtime
	ldr	x8, [x0, #16]
	add	x8, x8, #1900
	str	x8, [x19, #24]
	ldr	q0, [x0]
	stur	q0, [x19, #4]
	sub	x0, x29, #64
	bl	_CARD_Close
	mov	w8, #1
	str	w8, [x19]
LBB0_10:
	mov	x0, x21
	bl	_CARD_Unmount
	b	LBB0_14
LBB0_11:
	stp	x8, x9, [sp, #-16]!
Lloh35:
	adrp	x1, l_.str.1@PAGE
Lloh36:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_sprintf
	add	sp, sp, #16
LBB0_12:
Lloh37:
	adrp	x1, l_.str.2@PAGE
Lloh38:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_fopen
	cbz	x0, LBB0_14
; %bb.13:
	mov	x21, x0
	sub	x1, x29, #64
	mov	x0, x20
	bl	_stat
	sub	x0, x29, #64
	bl	_localtime
	ldr	x8, [x0, #16]
	add	x8, x8, #1900
	str	x8, [x19, #24]
	ldr	q0, [x0]
	stur	q0, [x19, #4]
	mov	x0, x21
	bl	_fclose
	mov	w8, #1
	str	w8, [x19]
LBB0_14:
	mov	sp, x23
LBB0_15:
	ldur	x8, [x29, #-56]
Lloh39:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh40:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh41:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_17
; %bb.16:
	sub	sp, x29, #48
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_17:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_MAXPATHLEN,4,2                 ; @MAXPATHLEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/saves/%s.gp%d"

	.comm	_DEFAULT_PATH,8,3               ; @DEFAULT_PATH
	.comm	_rom_filename,8,3               ; @rom_filename
l_.str.1:                               ; @.str.1
	.asciz	"%s/saves/%s.srm"

l_.str.2:                               ; @.str.2
	.asciz	"rb"

l_.str.3:                               ; @.str.3
	.asciz	"MD-%04X.gp%d"

	.comm	_rominfo,4,2                    ; @rominfo
l_.str.4:                               ; @.str.4
	.asciz	"MD-%04X.srm"

	.comm	_SysArea,32,3                   ; @SysArea
	.comm	_CARD_WORKAREA,4,2              ; @CARD_WORKAREA
l_.str.5:                               ; @.str.5
	.asciz	"GENP"

l_.str.6:                               ; @.str.6
	.asciz	"00"

	.comm	_CARD_ERROR_READY,8,3           ; @CARD_ERROR_READY
.subsections_via_symbols
